feat(theme): 完善顶部导航栏与底部菜单浅色暖色系适配及多端Tab生命周期同步

这个提交包含在:
wikiboss
2026-09-16 20:27:07 +08:00
父节点 9641dfba47
当前提交 1a56ba2682
共有 8 个文件被更改,包括 370 次插入 和 14 次删除

查看文件

@@ -153,9 +153,10 @@
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { ACTIVITIES_LIST } from '@/common/mock.js';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey } from '@/common/theme.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
const activities = ref(ACTIVITIES_LIST);
const currentTab = ref('ALL');
@@ -164,6 +165,7 @@ const currentThemeKey = ref(getCurrentThemeKey());
const onThemeChanged = (key) => {
currentThemeKey.value = key;
applyThemeToNativeUI(key);
};
onMounted(() => {
@@ -171,6 +173,11 @@ onMounted(() => {
uni.$on('theme-change', onThemeChanged);
});
onShow(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
});
onUnmounted(() => {
uni.$off('theme-change', onThemeChanged);
});

查看文件

@@ -143,9 +143,10 @@
<script setup>
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { GAMES_LIST, BANNERS, EXPERTS_LIST } from '@/common/mock.js';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey } from '@/common/theme.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
const games = ref(GAMES_LIST);
const banners = ref(BANNERS);
@@ -156,13 +157,20 @@ const currentThemeKey = ref(getCurrentThemeKey());
const onThemeChanged = (key) => {
currentThemeKey.value = key;
applyThemeToNativeUI(key);
};
onMounted(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
uni.$on('theme-change', onThemeChanged);
});
onShow(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
});
onUnmounted(() => {
uni.$off('theme-change', onThemeChanged);
});

查看文件

@@ -1,5 +1,5 @@
<template>
<view class="order-list-container">
<view class="order-list-container" :class="{ 'theme-warm': currentThemeKey === 'warm' }">
<!-- 顶部状态分类 Tab -->
<view class="tab-header">
<view
@@ -76,9 +76,32 @@
</template>
<script setup>
import { ref, computed } from 'vue';
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { ORDERS_LIST } from '@/common/mock.js';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, applyThemeToNativeUI } from '@/common/theme.js';
const currentThemeKey = ref(getCurrentThemeKey());
const onThemeChanged = (key) => {
currentThemeKey.value = key;
applyThemeToNativeUI(key);
};
onMounted(() => {
currentThemeKey.value = getCurrentThemeKey();
uni.$on('theme-change', onThemeChanged);
});
onShow(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
});
onUnmounted(() => {
uni.$off('theme-change', onThemeChanged);
});
const tabs = [
{ key: 'ALL', name: '全部' },
@@ -435,4 +458,89 @@ const rateExpert = (id) => {
}
}
}
.order-list-container.theme-warm {
background-color: #FDFBF7;
.tab-header {
background-color: #FFFFFF;
border-color: #F0ECE4;
box-shadow: 0 4rpx 16rpx rgba(28, 25, 23, 0.04);
.tab-item {
.tab-text {
color: #78716C;
}
&.active {
background: rgba(234, 88, 12, 0.1);
.tab-text {
color: #EA580C;
}
.tab-indicator {
background: #EA580C;
box-shadow: 0 0 10rpx rgba(234, 88, 12, 0.4);
}
}
}
}
.orders-wrap .order-card {
background-color: #FFFFFF;
border-color: #F0ECE4;
box-shadow: 0 6rpx 20rpx rgba(28, 25, 23, 0.05);
.order-head {
border-bottom-color: #F5F2EC;
.order-sn {
color: #78716C;
}
}
.expert-block {
.expert-meta {
.name-row .expert-name {
color: #1C1917;
}
.service-name {
color: #57534E;
}
.order-time {
color: #78716C;
}
}
.amount-box .quantity-text {
color: #78716C;
}
}
.order-actions {
border-top-color: #F5F2EC;
.action-btn {
&.cancel-btn {
color: #78716C;
border-color: #E7E5E4;
}
&.primary-btn {
background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
}
&.chat-btn {
background: rgba(234, 88, 12, 0.1);
color: #EA580C;
border-color: rgba(234, 88, 12, 0.25);
}
}
}
}
.empty-state {
.empty-text {
color: #78716C;
}
.empty-btn {
background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
box-shadow: 0 4rpx 16rpx rgba(234, 88, 12, 0.35);
}
}
}
</style>

查看文件

@@ -121,9 +121,10 @@
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { USER_PROFILE } from '@/common/mock.js';
import { ICONS } from '@/common/icons.js';
import { getCurrentThemeKey, setTheme, THEME_KEYS } from '@/common/theme.js';
import { getCurrentThemeKey, setTheme, THEME_KEYS, applyThemeToNativeUI } from '@/common/theme.js';
const user = ref(USER_PROFILE);
const currentRole = ref('PLAYER');
@@ -131,13 +132,20 @@ const currentThemeKey = ref(getCurrentThemeKey());
const onThemeChanged = (key) => {
currentThemeKey.value = key;
applyThemeToNativeUI(key);
};
onMounted(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
uni.$on('theme-change', onThemeChanged);
});
onShow(() => {
currentThemeKey.value = getCurrentThemeKey();
applyThemeToNativeUI(currentThemeKey.value);
});
onUnmounted(() => {
uni.$off('theme-change', onThemeChanged);
});