style(theme): 统一应用主题样式并更新组件样式变量

- 在多个页面组件中添加动态主题样式绑定
- 将硬编码的颜色值替换为CSS变量和主题配置
- 引入主题样式计算逻辑到各个页面
- 更新优惠券、地址、订单等页面的主题适配
- 替换线性渐变背景为动态主题颜色
- 移除uni_modules组件中的$set方法调用以优化性能
- 更新README中主题色管理状态为已完成
This commit is contained in:
pikachu1995@126.com
2026-10-09 16:02:11 +08:00
parent 74d186ff36
commit a32f6d2313
58 changed files with 519 additions and 301 deletions

View File

@@ -1,5 +1,5 @@
<template>
<view class="add-address">
<view :style="themeStyle" class="add-address">
<up-form
:model="form"
ref="uForm"
@@ -92,8 +92,10 @@ import { addAddress as addAddressApi, editAddress, getAddressDetail } from '@/ap
import MCity from '@/components/m-city/m-city.vue'
import uniMap from '@/components/uniMap'
import permision from '@/js_sdk/wa-permission/permission.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const { proxy } = getCurrentInstance()!
const lightColor = computed(() => store.getters.lightColor)

View File

@@ -1,5 +1,5 @@
<template>
<view class="wap">
<view :style="themeStyle" class="wap">
<u-navbar
title="预存款列表"
:fixed="true"
@@ -53,9 +53,13 @@
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { ref, onMounted, computed } from 'vue'
import { getWalletLog, getUserWallet } from '@/api/members'
import { unitPrice } from '@/utils/filters.js'
import { unitPrice } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const walletNum = ref(0)
const swiperCurrent = ref(0)

View File

@@ -1,5 +1,5 @@
<template>
<view class="page">
<view :style="themeStyle" class="page">
<u-navbar
title="余额"
:auto-back="false"
@@ -39,10 +39,14 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { getUserWallet } from '@/api/members'
import { isLogin, navigateToLogin, unitPrice } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const walletNum = ref(0)

View File

@@ -1,5 +1,5 @@
<template>
<view class="page">
<view :style="themeStyle" class="page">
<view class="form-card">
<view class="title">充值金额</view>
<view class="amount-row">
@@ -20,8 +20,12 @@
</template>
<script setup lang="ts">
import { ref, watch } from 'vue'
import { ref, watch, computed } from 'vue'
import { recharge } from '@/api/members'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const price = ref('')
const flag = ref(true)

View File

@@ -1,5 +1,5 @@
<template>
<view class="wap">
<view :style="themeStyle" class="wap">
<u-navbar
title="提现记录"
:fixed="true"
@@ -26,10 +26,14 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import { getWithdrawApplyPage, getWithdrawApplyWechatTransferInfo } from '@/api/members'
import { unitPrice } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const loaded = ref(false)
const params = ref({

View File

@@ -1,5 +1,5 @@
<template>
<view class="page">
<view :style="themeStyle" class="page">
<view class="form-card">
<view class="field-label">提现类型</view>
<view class="readonly-value">{{ typeLabel }}</view>
@@ -62,6 +62,10 @@
import { ref, computed, getCurrentInstance, onMounted } from 'vue'
import { getUserWallet, withdrawalApply, withdrawalSettingVO } from '@/api/members'
import { unitPrice } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const { proxy } = getCurrentInstance()!

View File

@@ -1,5 +1,5 @@
<template>
<view class="log-list">
<view :style="themeStyle" class="log-list">
<view
class="log-way"
v-if="withdrawLogList.length != 0"
@@ -53,14 +53,16 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { cashLog, getDistributionOrders } from '@/api/distribution'
import { unitPrice } from '@/utils/filters.js'
import { assertActiveDistributor } from '@/utils/distributionStatus'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const withdrawLogList = ref<any[]>([])
const achievementList = ref<any[]>([])

View File

@@ -1,5 +1,5 @@
<template>
<view class="wrapper">
<view :style="themeStyle" class="wrapper">
<u-navbar
class="my-title"
title-size="32"
@@ -197,7 +197,7 @@
</template>
<script setup lang="ts">
import { ref, nextTick, getCurrentInstance } from 'vue'
import { ref, nextTick, getCurrentInstance, computed } from 'vue'
import {
onLoad,
onHide,
@@ -215,6 +215,10 @@ import storage from '@/utils/storage.js'
import { beautifyTime, unitPrice } from '@/utils/filters.js'
import config from '@/config/config.js'
import { textReplaceEmoji, emojistwo } from '@/utils/emojis.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
// rpx和px的比率
let l: number

View File

@@ -1,5 +1,5 @@
<template>
<view class="myTracks">
<view :style="themeStyle" class="myTracks">
<u-navbar
title="我的足迹"
:fixed="true"
@@ -62,8 +62,10 @@ import { useStore } from '@/store'
import { unitPrice } from '@/utils/filters.js'
import { myTrackList, deleteHistoryListId } from '@/api/members.js'
import { getStoreBaseInfo } from '@/api/store.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const lightColor = computed(() => store.getters.lightColor)
const isEdit = ref(false)

View File

@@ -1,5 +1,5 @@
<template>
<view class="content">
<view :style="themeStyle" class="content">
<view class="portrait-box">
<image src="/static/pointTrade/point_bg_1.png" mode=""></image>
<image class="point-img" src="/static/pointTrade/tradehall.png" />
@@ -36,12 +36,14 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onLoad, onReachBottom } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { getPointsData, getMemberPointSum } from '@/api/members.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const loadStatus = ref('more')
const pointList = ref<any[]>([])

View File

@@ -1,5 +1,5 @@
<template>
<view class="feedBack">
<view class="feedBack" :style="themeStyle">
<view class="feedBack-box">
<view class="box-title">猜你想问</view>
<view
@@ -54,11 +54,15 @@
</template>
<script setup lang="ts">
import { ref, reactive, getCurrentInstance } from 'vue'
import { ref, reactive, computed, getCurrentInstance } from 'vue'
import { feedBack as submitFeedBackApi } from '@/api/members.js'
import { handleUploadAfterRead } from '@/utils/uploadHelper.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const { proxy } = getCurrentInstance()!
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const feedbackForm = reactive({
type: 'FUNCTION',

View File

@@ -1,5 +1,5 @@
<template>
<view class="person-msg">
<view :style="themeStyle" class="person-msg">
<view class="head" @click="changeFace">
<image :src="form.face || '/static/missing-face.png'" mode="aspectFill"></image>
<view>点击修改头像</view>
@@ -87,6 +87,7 @@ import { saveUserInfo } from '@/api/members.js'
import { upload } from '@/api/common.js'
import storage from '@/utils/storage.js'
import MCity from '@/components/m-city/m-city.vue'
import { getThemeStyle } from '@/utils/theme'
function parseBirthdayTimestamp(str?: string) {
if (!str) return Date.now()
@@ -103,6 +104,7 @@ function formatBirthday(timestamp: number) {
}
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const lightColor = computed(() => store.getters.lightColor)
const userInfo = storage.getUserInfo() || {}

View File

@@ -1,5 +1,5 @@
<template>
<view class="box">
<view :style="themeStyle" class="box">
<view class="box-tips">
<h2 class="h2">绑定手机号码</h2>
<view class="verification"></view>
@@ -44,15 +44,17 @@
</template>
<script setup lang="ts">
import { ref, reactive, watch, getCurrentInstance } from 'vue'
import { ref, reactive, watch, getCurrentInstance, computed } from 'vue'
import { onLoad, onReady } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { sendMobile, bindMobile } from '@/api/login'
import { getUserInfo } from '@/api/members.js'
import storage from '@/utils/storage.js'
import MyVerification from '@/components/verification/verification.vue'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const { proxy } = getCurrentInstance()!
const phoneVerified = ref(false)

View File

@@ -1,5 +1,5 @@
<template>
<view class="box">
<view :style="themeStyle" class="box">
<view class="box-tips">
<h2 class="h2">{{ verificationTitle.title }}</h2>
<view class="verification">{{ verificationTitle.desc }}</view>
@@ -30,9 +30,13 @@
</template>
<script setup lang="ts">
import { ref, reactive } from 'vue'
import { ref, reactive, computed } from 'vue'
import { modifyPass } from '@/api/login'
import { md5 } from '@/utils/md5.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const verificationTitle = {
title: '修改密码',

View File

@@ -1,5 +1,5 @@
<template>
<view class="box">
<view :style="themeStyle" class="box">
<view class="box-tips">
<h2 class="h2">{{ verificationTitle[phoneVerified ? 1 : 0].title }}</h2>
<view class="verification">{{ verificationTitle[step].desc }}</view>
@@ -55,15 +55,17 @@
</template>
<script setup lang="ts">
import { ref, reactive, watch, getCurrentInstance } from 'vue'
import { ref, reactive, watch, getCurrentInstance, computed } from 'vue'
import { onReady } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { isLogin } from '@/utils/filters.js'
import { sendMobile, resetByMobile, resetPassword } from '@/api/login'
import { md5 } from '@/utils/md5.js'
import MyVerification from '@/components/verification/verification.vue'
import MyVerification from '@/components/verification/verification.vue'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const { proxy } = getCurrentInstance()!
const phoneVerified = ref(false)

View File

@@ -1,5 +1,5 @@
<template>
<view class="set-up">
<view :style="themeStyle" class="set-up">
<view class="person" @click="checkUserInfo()">
<u-image
width="140rpx"
@@ -39,10 +39,14 @@
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { ref, computed } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import config from '@/config/config'
import { isLogin, tipsToLogin, quiteLoginOut, logoff } from '@/utils/filters.js'
import { isLogin, tipsToLogin, quiteLoginOut, logoff } from '@/utils/filters.js'
import { useStore } from '@/store'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const userImage = config.defaultUserPhoto
const userInfo = ref<Record<string, any>>({})

View File

@@ -1,5 +1,5 @@
<template>
<view class="sign-in">
<view :style="themeStyle" class="sign-in">
<view class="date-card">
<div class="box">
<div class="circle-box">
@@ -65,9 +65,11 @@
import { ref, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useStore } from '@/store'
import { sign, signTime } from '@/api/point.js'
import { sign, signTime } from '@/api/point.js'
import { getThemeStyle } from '@/utils/theme'
const store = useStore()
const store = useStore()
const themeStyle = computed(() => getThemeStyle(store.state.theme))
const aiderLightColor = computed(() => store.getters.aiderLightColor)
const signAnimating = ref(false)
@@ -226,7 +228,7 @@ page {
height: 200rpx;
border-radius: 50%;
background: $aider-light-color;
box-shadow: 0 4rpx 24rpx 0 rgba($color: $aider-light-color, $alpha: 1);
box-shadow: 0 4rpx 24rpx 0 $aider-light-color;
display: flex;
justify-content: center; //这个是X轴居中
align-items: center; //这个是 Y轴居中