feat(theme): 实现主题切换系统并优化经销商相关页面

- 新增主题切换系统,支持智能主题和手动选择
- 更新经销商首页、团队、订单、提现等页面样式
- 添加主题相关的Hook和样式工具函数
- 优化部分组件样式以适配新主题
This commit is contained in:
2025-08-19 00:08:26 +08:00
parent 8efeb9a5bd
commit 9d9762ef17
23 changed files with 739 additions and 264 deletions

View File

@@ -10,7 +10,7 @@ import {
Divider,
ConfigProvider
} from '@nutui/nutui-react-taro';
import {ArrowLeft, Del, Shopping} from '@nutui/icons-react-taro';
import {ArrowLeft, Del} from '@nutui/icons-react-taro';
import {View} from '@tarojs/components';
import {CartItem, useCart} from "@/hooks/useCart";
import './cart.scss';
@@ -48,11 +48,11 @@ function Cart() {
useShareAppMessage(() => {
return {
title: '购物车 - 网宿小店',
success: function (res) {
console.log('分享成功', res);
success: function () {
console.log('分享成功');
},
fail: function (res) {
console.log('分享失败', res);
fail: function () {
console.log('分享失败');
}
};
});
@@ -203,15 +203,25 @@ function Cart() {
>
<span className="text-lg">({cartCount})</span>
</NavBar>
<Empty
description="购物车空空如也"
actions={[{ text: '去逛逛' }]}
{/* 垂直居中的空状态容器 */}
<View
className="flex items-center justify-center"
style={{
marginTop: `${statusBarHeight + 50}px`,
height: `calc(100vh - ${statusBarHeight + 150}px)`,
paddingTop: `${statusBarHeight + 50}px`,
backgroundColor: 'transparent'
}}
onClick={() => Taro.switchTab({ url: '/pages/index/index' })}
/>
>
<Empty
description="购物车空空如也"
actions={[{ text: '去逛逛' }]}
style={{
backgroundColor: 'transparent'
}}
onClick={() => Taro.switchTab({ url: '/pages/index/index' })}
/>
</View>
</>
)
}
@@ -251,33 +261,8 @@ function Cart() {
</NavBar>
{/* 购物车内容 */}
<View
className="pt-24"
style={{ backgroundColor: cartItems.length === 0 ? 'transparent' : undefined }}
>
{cartItems.length === 0 ? (
// 空购物车
<View
className="cart-empty-container flex flex-col items-center justify-center h-96"
style={{ backgroundColor: 'transparent' }}
>
<Empty
image={<Shopping size={80}/>}
description="购物车空空如也"
style={{ backgroundColor: 'transparent' }}
>
<Button
type="primary"
size="small"
onClick={() => Taro.switchTab({url: '/pages/index/index'})}
>
</Button>
</Empty>
</View>
) : (
<>
{/* 商品列表 */}
<View className="pt-24">
{/* 商品列表 */}
<View className="bg-white">
{cartItems.map((item: CartItem, index: number) => (
<View key={item.goodsId}>
@@ -361,10 +346,8 @@ function Cart() {
</View>
</View>
{/* 底部安全区域占位 */}
<View className="h-20"></View>
</>
)}
{/* 底部安全区域占位 */}
<View className="h-20"></View>
</View>
</>
);

View File

@@ -27,12 +27,13 @@ const UserCell = () => {
backgroundImage: 'linear-gradient(to right bottom, #e53e3e, #c53030)',
}}
title={
<View style={{display: 'inline-flex', alignItems: 'center'}} onClick={() => navTo('/admin/index', true)}>
<View style={{display: 'inline-flex', alignItems: 'center'}}>
<Setting className={'text-white '} size={16}/>
<Text style={{fontSize: '16px'}} className={'pl-3 text-white font-medium'}></Text>
</View>
}
extra={<ArrowRight color="#ffffff" size={18}/>}
onClick={() => navTo('/admin/index', true)}
/>
</View>
</>
@@ -52,7 +53,7 @@ const UserCell = () => {
backgroundImage: 'linear-gradient(to right bottom, #54a799, #177b73)',
}}
title={
<View style={{display: 'inline-flex', alignItems: 'center'}} onClick={() => navTo('/dealer/index', true)}>
<View style={{display: 'inline-flex', alignItems: 'center'}}>
<Reward className={'text-orange-100 '} size={16}/>
<Text style={{fontSize: '16px'}}
className={'pl-3 text-orange-100 font-medium'}></Text>
@@ -60,6 +61,7 @@ const UserCell = () => {
</View>
}
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => navTo('/dealer/index', true)}
/>
</View>
</>

View File

@@ -122,6 +122,13 @@ const UserCell = () => {
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => navTo('/user/profile/profile', true)}
/>
<Cell
className="nutui-cell-clickable"
title="切换主题"
align="center"
extra={<ArrowRight color="#cccccc" size={18}/>}
onClick={() => navTo('/user/theme/index', true)}
/>
<Cell
className="nutui-cell-clickable"
title="退出登录"