wip: 临时提交

This commit is contained in:
ray committed 2025-05-31 07:42:27 +08:00
1 parent d1a90a8313
commit 82fae9ed4b
22 files changed
+308 -546

No files matched your search

+31
View File
@@ -25,3 +25,34 @@ pnpm run dev:h5
``` ```
访问 [http://localhost:4096](http://localhost:4096) 访问 [http://localhost:4096](http://localhost:4096)
## 组件结构
项目组件分为以下几类:
- **基础组件**:`src/components` 下的通用组件
- **业务组件**:`src/components/business` 下的业务相关组件
- `WechatProfile.vue`: 微信小程序环境下的头像、昵称和性别选择组件
使用业务组件:
```vue
<template>
<WechatProfile v-model="profileData" @change="onProfileChange" />
</template>
<script lang="ts" setup>
import { ref } from "vue";
import { WechatProfile } from "@/components/business";
const profileData = ref({
avatar: "",
nickname: "",
gender: 1,
});
const onProfileChange = (data) => {
console.log("个人资料变更:", data);
};
</script>
```
+8 -4
View File
@@ -19,18 +19,22 @@ declare module 'vue' {
QiunDataCharts: typeof import('./src/components/qiun-data-charts/qiun-data-charts.vue')['default'] QiunDataCharts: typeof import('./src/components/qiun-data-charts/qiun-data-charts.vue')['default']
QiunError: typeof import('./src/components/qiun-error/qiun-error.vue')['default'] QiunError: typeof import('./src/components/qiun-error/qiun-error.vue')['default']
QiunLoading: typeof import('./src/components/qiun-loading/qiun-loading.vue')['default'] QiunLoading: typeof import('./src/components/qiun-loading/qiun-loading.vue')['default']
TodoItem: typeof import('./src/components/todo/TodoItem.vue')['default'] TodoItem: (typeof import("./src/components/todo/TodoItem.vue"))["default"]
TodoList: typeof import('./src/components/todo/TodoList.vue')['default'] TodoList: (typeof import("./src/components/todo/TodoList.vue"))["default"]
WdButton: typeof import('wot-design-uni/components/wd-button/wd-button.vue')['default'] WdButton: typeof import('wot-design-uni/components/wd-button/wd-button.vue')['default']
WdCard: typeof import('wot-design-uni/components/wd-card/wd-card.vue')['default'] WdCard: typeof import('wot-design-uni/components/wd-card/wd-card.vue')['default']
WdCell: typeof import('wot-design-uni/components/wd-cell/wd-cell.vue')['default'] WdCell: typeof import('wot-design-uni/components/wd-cell/wd-cell.vue')['default']
WdCellGroup: typeof import('wot-design-uni/components/wd-cell-group/wd-cell-group.vue')['default'] WdCellGroup: typeof import('wot-design-uni/components/wd-cell-group/wd-cell-group.vue')['default']
WdCollapse: (typeof import("wot-design-uni/components/wd-collapse/wd-collapse.vue"))["default"]
WdCollapseItem: (typeof import("wot-design-uni/components/wd-collapse-item/wd-collapse-item.vue"))["default"]
WdConfigProvider: typeof import('wot-design-uni/components/wd-config-provider/wd-config-provider.vue')['default'] WdConfigProvider: typeof import('wot-design-uni/components/wd-config-provider/wd-config-provider.vue')['default']
WdDivider: typeof import('wot-design-uni/components/wd-divider/wd-divider.vue')['default'] WdDivider: (typeof import("wot-design-uni/components/wd-divider/wd-divider.vue"))["default"]
WdForm: typeof import('wot-design-uni/components/wd-form/wd-form.vue')['default'] WdForm: typeof import('wot-design-uni/components/wd-form/wd-form.vue')['default']
WdGrid: typeof import('wot-design-uni/components/wd-grid/wd-grid.vue')['default'] WdGrid: typeof import('wot-design-uni/components/wd-grid/wd-grid.vue')['default']
WdGridItem: typeof import('wot-design-uni/components/wd-grid-item/wd-grid-item.vue')['default'] WdGridItem: typeof import('wot-design-uni/components/wd-grid-item/wd-grid-item.vue')['default']
WdIcon: typeof import('wot-design-uni/components/wd-icon/wd-icon.vue')['default'] WdIcon: typeof import('wot-design-uni/components/wd-icon/wd-icon.vue')['default']
WdImg: typeof import('wot-design-uni/components/wd-img/wd-img.vue')['default']
WdImgCropper: typeof import('wot-design-uni/components/wd-img-cropper/wd-img-cropper.vue')['default']
WdInput: typeof import('wot-design-uni/components/wd-input/wd-input.vue')['default'] WdInput: typeof import('wot-design-uni/components/wd-input/wd-input.vue')['default']
WdMessageBox: typeof import('wot-design-uni/components/wd-message-box/wd-message-box.vue')['default'] WdMessageBox: typeof import('wot-design-uni/components/wd-message-box/wd-message-box.vue')['default']
WdNavbar: typeof import('wot-design-uni/components/wd-navbar/wd-navbar.vue')['default'] WdNavbar: typeof import('wot-design-uni/components/wd-navbar/wd-navbar.vue')['default']
@@ -45,6 +49,6 @@ declare module 'vue' {
WdTabbarItem: typeof import('wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue')['default'] WdTabbarItem: typeof import('wot-design-uni/components/wd-tabbar-item/wd-tabbar-item.vue')['default']
WdTag: typeof import('wot-design-uni/components/wd-tag/wd-tag.vue')['default'] WdTag: typeof import('wot-design-uni/components/wd-tag/wd-tag.vue')['default']
WdToast: typeof import('wot-design-uni/components/wd-toast/wd-toast.vue')['default'] WdToast: typeof import('wot-design-uni/components/wd-toast/wd-toast.vue')['default']
WechatProfile: typeof import('./src/components/WechatProfile.vue')['default'] WechatProfile: typeof import('./src/components/business/WechatProfile.vue')['default']
} }
} }
+4 -1
View File
@@ -14,8 +14,11 @@ export default defineUniPages({
}, },
], ],
globalStyle: { globalStyle: {
navigationStyle: "custom",
navigationBarTextStyle: "black", navigationBarTextStyle: "black",
navigationBarTitleText: "vue-uniapp-template", navigationBarTitleText: "youlai-mall-app",
navigationBarBackgroundColor: "#F8F8F8",
backgroundColor: "#F8F8F8",
}, },
tabBar: { tabBar: {
+1 -5
View File
@@ -2,7 +2,6 @@
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app"; import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { useTheme } from "@/composables/useTheme"; import { useTheme } from "@/composables/useTheme";
// 使用主题 composable
const { initTheme } = useTheme(); const { initTheme } = useTheme();
onLaunch(() => { onLaunch(() => {
@@ -20,7 +19,4 @@ onHide(() => {
}); });
</script> </script>
<style lang="scss"> <style lang="scss"></style>
/* 导入暗黑模式修复样式 */
@import "./styles/dark-mode-fix';";
</style>
@@ -40,13 +40,28 @@
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import FileAPI, { type FileInfo } from "@/api/file"; import FileAPI, { type FileInfo } from "@/api/file";
/**
* 微信小程序头像昵称组件
*
* @description 用于微信小程序环境下的头像、昵称和性别选择
* @component WechatProfile
* @example
* <WechatProfile v-model="profileData" @change="onProfileChange" />
*/
defineOptions({
name: "WechatProfile",
});
// Props // Props
interface ProfileData {
avatar?: string;
nickname?: string;
gender?: number;
}
interface Props { interface Props {
modelValue?: { modelValue?: ProfileData;
avatar?: string;
nickname?: string;
gender?: number;
};
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
@@ -59,8 +74,8 @@ const props = withDefaults(defineProps<Props>(), {
// Emits // Emits
const emit = defineEmits<{ const emit = defineEmits<{
"update:modelValue": [value: { avatar?: string; nickname?: string; gender?: number }]; "update:modelValue": [value: ProfileData];
change: [value: { avatar?: string; nickname?: string; gender?: number }]; change: [value: ProfileData];
}>(); }>();
// 响应式数据 // 响应式数据
@@ -134,7 +149,7 @@ watch(gender, () => {
margin-bottom: 20rpx; margin-bottom: 20rpx;
font-size: 32rpx; font-size: 32rpx;
font-weight: 600; font-weight: 600;
color: #333; color: var(--wot-color-text);
} }
.avatar-section { .avatar-section {
@@ -171,14 +186,14 @@ watch(gender, () => {
justify-content: center; justify-content: center;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: #f8f9fa; background: var(--wot-color-bg-light);
border: 2rpx dashed #ddd; border: 2rpx dashed var(--wot-color-border);
border-radius: 50%; border-radius: 50%;
.placeholder-text { .placeholder-text {
margin-top: 10rpx; margin-top: 10rpx;
font-size: 24rpx; font-size: 24rpx;
color: #999; color: var(--wot-color-text-secondary);
} }
} }
} }
@@ -192,8 +207,8 @@ watch(gender, () => {
height: 80rpx; height: 80rpx;
padding: 0 20rpx; padding: 0 20rpx;
font-size: 28rpx; font-size: 28rpx;
background: #f8f9fa; background: var(--wot-color-bg-light);
border: 1rpx solid #e9ecef; border: 1rpx solid var(--wot-color-border);
border-radius: 12rpx; border-radius: 12rpx;
} }
} }
+11
View File
@@ -0,0 +1,11 @@
/**
* 业务组件导出索引
*/
import WechatProfile from "./WechatProfile.vue";
export { WechatProfile };
// 用于批量注册组件
export default {
WechatProfile,
};
-122
View File
@@ -1,122 +0,0 @@
<template>
<view :class="['todo-item', { completed: todo.completed }]" @tap="toggleCompleted">
<view class="status-icon">
<wd-icon v-if="todo.completed" name="check" color="#67C23A" size="20" />
<view v-else class="uncompleted-circle"></view>
</view>
<view class="todo-content">
<view class="todo-title">{{ todo.title }}</view>
<view v-if="todo.description" class="todo-description">
{{ todo.description }}
</view>
<view v-if="todo.deadline" class="todo-deadline">
<wd-icon name="time" size="14" color="#999999" style="margin-right: 4rpx" />
{{ formatDate(todo.deadline) }}
</view>
</view>
<view class="todo-actions">
<wd-icon
name="delete-filling"
color="#F56C6C"
size="18"
@tap.stop="$emit('delete', todo.id)"
/>
</view>
</view>
</template>
<script lang="ts" setup>
import { defineProps, defineEmits } from "vue";
import { Todo } from "@/types/todo";
const props = defineProps({
todo: {
type: Object as () => Todo,
required: true,
},
});
const emit = defineEmits(["update", "delete"]);
// 切换完成状态
const toggleCompleted = () => {
emit("update", {
...props.todo,
completed: !props.todo.completed,
});
};
// 格式化日期
const formatDate = (date: string) => {
const d = new Date(date);
const year = d.getFullYear();
const month = String(d.getMonth() + 1).padStart(2, "0");
const day = String(d.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
};
</script>
<style lang="scss" scoped>
.todo-item {
display: flex;
align-items: flex-start;
padding: 24rpx;
margin-bottom: 16rpx;
background-color: #fff;
border-radius: 12rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
&.completed {
opacity: 0.7;
.todo-title {
color: #909399;
text-decoration: line-through;
}
}
.status-icon {
display: flex;
align-items: center;
justify-content: center;
width: 40rpx;
height: 40rpx;
margin-right: 20rpx;
.uncompleted-circle {
width: 36rpx;
height: 36rpx;
border: 2rpx solid #dcdfe6;
border-radius: 50%;
}
}
.todo-content {
flex: 1;
.todo-title {
margin-bottom: 8rpx;
font-size: 30rpx;
font-weight: 500;
color: #303133;
}
.todo-description {
margin-bottom: 8rpx;
font-size: 26rpx;
color: #606266;
}
.todo-deadline {
display: flex;
align-items: center;
font-size: 24rpx;
color: #909399;
}
}
.todo-actions {
padding: 6rpx;
}
}
</style>
-43
View File
@@ -1,43 +0,0 @@
<template>
<view class="todo-list">
<wd-empty v-if="todos.length === 0" description="暂无待办事项" />
<TodoItem
v-for="todo in todos"
:key="todo.id"
:todo="todo"
@update="handleUpdate"
@delete="handleDelete"
/>
</view>
</template>
<script lang="ts" setup>
import { defineProps, defineEmits } from "vue";
import { Todo } from "@/types/todo";
import TodoItem from "@/components/todo/TodoItem.vue";
defineProps({
todos: {
type: Array as () => Todo[],
default: () => [],
},
});
const emit = defineEmits(["update", "delete"]);
// 处理更新待办事项
const handleUpdate = (todo: Todo) => {
emit("update", todo);
};
// 处理删除待办事项
const handleDelete = (id: string) => {
emit("delete", id);
};
</script>
<style lang="scss" scoped>
.todo-list {
padding: 20rpx 0;
}
</style>
+16 -12
View File
@@ -3,18 +3,22 @@ import type { ConfigProviderThemeVars } from "wot-design-uni";
/* 默认的主题色列表 */ /* 默认的主题色列表 */
export const colorColumns = [ export const colorColumns = [
{ value: "#165DFF", label: "蓝色" }, { value: "#165DFF", label: "海洋蓝" },
{ value: "#0FC6C2", label: "青绿色" }, { value: "#1677FF", label: "天空蓝" },
{ value: "#722ED1", label: "紫色" }, { value: "#0081FF", label: "梦幻蓝" },
{ value: "#F5222D", label: "红色" }, { value: "#4080FF", label: "皇家蓝" },
{ value: "#FA8C16", label: "橙色" }, { value: "#4D74FF", label: "靛蓝" },
{ value: "#FADB14", label: "黄色" }, { value: "#0FC6C2", label: "碧波绿" },
{ value: "#52C41A", label: "绿色" }, { value: "#722ED1", label: "魔幻紫" },
{ value: "#EB2F96", label: "粉色" }, { value: "#F5222D", label: "热情红" },
{ value: "#13C2C2", label: "青色" }, { value: "#FA8C16", label: "活力橙" },
{ value: "#1890FF", label: "天蓝色" }, { value: "#FADB14", label: "阳光黄" },
{ value: "#CD5C5C", label: "经典红" }, { value: "#52C41A", label: "生机绿" },
{ value: "#228B22", label: "自然绿" }, { value: "#EB2F96", label: "浪漫粉" },
{ value: "#13C2C2", label: "清新青" },
{ value: "#36CFC9", label: "湖水蓝" },
{ value: "#CD5C5C", label: "复古红" },
{ value: "#228B22", label: "森林绿" },
]; ];
/* 存储键名 */ /* 存储键名 */
+60 -8
View File
@@ -1,7 +1,57 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useTheme } from "@/composables/useTheme"; import { useTheme } from "@/composables/useTheme";
import { onLoad } from "@dcloudio/uni-app";
const { theme, themeVars } = useTheme(); const { theme, themeVars } = useTheme();
// 页面标题
const pageTitle = ref("");
// 是否显示返回按钮
const showBackButton = ref(false);
// 是否显示导航栏
const showNavbar = ref(true);
// 获取当前页面路由信息
const getCurrentPageRoute = () => {
const pages = getCurrentPages();
if (pages.length > 0) {
const currentPage = pages[pages.length - 1];
return currentPage.route || "";
}
return "";
};
// 处理返回按钮点击
const handleBack = () => {
uni.navigateBack({
fail: () => {
uni.switchTab({ url: "/pages/index/index" });
},
});
};
// 页面加载时处理导航栏配置
onLoad(() => {
const route = getCurrentPageRoute();
// 获取当前页面实例
const pages = getCurrentPages();
if (pages.length > 0) {
const currentPage = pages[pages.length - 1];
// 尝试获取页面的navigationBarTitleText
const navigationBarTitleText = currentPage.$page?.style?.navigationBarTitleText || "";
pageTitle.value = navigationBarTitleText;
// 如果是首页或tabbar页面,不显示返回按钮
showBackButton.value = pages.length > 1;
// 某些页面可能不需要显示导航栏
if (route.includes("/index/index") || route.includes("/login")) {
showNavbar.value = false;
}
}
});
</script> </script>
<script lang="ts"> <script lang="ts">
@@ -21,18 +71,20 @@ export default {
custom-style="background-color: #f5f5f5;min-height: 100vh" custom-style="background-color: #f5f5f5;min-height: 100vh"
:class="{ 'wot-theme-dark': theme === 'dark' }" :class="{ 'wot-theme-dark': theme === 'dark' }"
> >
<!-- 顶部导航栏 -->
<wd-navbar :title="pageTitle" :border="false" @click-left="handleBack">
<template #left>
<wd-icon name="arrow-left" size="20" />
</template>
</wd-navbar>
<!-- 内容区域 -->
<slot /> <slot />
<wd-notify /> <wd-notify />
<wd-toast /> <wd-toast />
<wd-message-box /> <wd-message-box />
<privacy-popup />
</wd-config-provider> </wd-config-provider>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped></style>
/* 暗黑模式样式 */
.wot-theme-dark {
color: #f5f5f5 !important;
background-color: #1a1a1a !important;
}
</style>
+2 -26
View File
@@ -23,7 +23,7 @@ interface TabbarItem {
// 根据 pages.json 配置的 tabbar 项目 // 根据 pages.json 配置的 tabbar 项目
const tabbarItems = ref<TabbarItem[]>([ const tabbarItems = ref<TabbarItem[]>([
{ name: "index", value: null, active: true, title: "首页", icon: "home" }, { name: "index", value: null, active: true, title: "首页123", icon: "home" },
{ name: "mine", value: null, active: false, title: "我的", icon: "user" }, { name: "mine", value: null, active: false, title: "我的", icon: "user" },
]); ]);
@@ -161,14 +161,6 @@ export default {
custom-style="min-height: 100vh" custom-style="min-height: 100vh"
:class="{ 'wot-theme-dark': theme === 'dark' }" :class="{ 'wot-theme-dark': theme === 'dark' }"
> >
<wd-navbar
:title="activeTabbar.title"
safe-area-inset-top
placeholder
fixed
:bordered="false"
/>
<slot /> <slot />
<wd-tabbar <wd-tabbar
:model-value="activeTabbar.name" :model-value="activeTabbar.name"
@@ -193,20 +185,4 @@ export default {
</wd-config-provider> </wd-config-provider>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped></style>
/* 暗黑模式样式 */
.wot-theme-dark {
color: #f5f5f5;
background-color: #1a1a1a;
:deep(.wd-navbar) {
color: #f5f5f5;
background-color: #2a2a2a;
}
:deep(.wd-tabbar) {
background-color: #2a2a2a;
border-top-color: #404040;
}
}
</style>
+9 -1
View File
@@ -2,14 +2,22 @@ import { createSSRApp } from "vue";
import App from "./App.vue"; import App from "./App.vue";
import "uno.css"; import "uno.css";
import "@/styles/theme.scss"; import "@/styles/index.scss";
import { setupStore } from "@/store"; import { setupStore } from "@/store";
// 可选:导入业务组件
// import BusinessComponents from '@/components/business';
export function createApp() { export function createApp() {
const app = createSSRApp(App); const app = createSSRApp(App);
setupStore(app); setupStore(app);
// 可选:全局注册业务组件
// Object.entries(BusinessComponents).forEach(([name, component]) => {
// app.component(name, component);
// });
return { return {
app, app,
}; };
+4 -1
View File
@@ -74,8 +74,11 @@
} }
], ],
"globalStyle": { "globalStyle": {
"navigationStyle": "custom",
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "vue-uniapp-template" "navigationBarTitleText": "youlai-mall-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}, },
"tabBar": { "tabBar": {
"custom": true, "custom": true,
+9 -23
View File
@@ -1,6 +1,5 @@
<template> <template>
<view style="width: 100%; height: var(--status-bar-height)" /> <view class="app-container">
<view class="home">
<wd-swiper <wd-swiper
v-model:current="current" v-model:current="current"
:list="swiperList" :list="swiperList"
@@ -21,7 +20,7 @@
<view class="p-2"> <view class="p-2">
<image class="w-72rpx h-72rpx rounded-8rpx" :src="item.icon" /> <image class="w-72rpx h-72rpx rounded-8rpx" :src="item.icon" />
</view> </view>
<view class="text">{{ item.title }}</view> <view class="text-sm text-center">{{ item.title }}</view>
</wd-grid-item> </wd-grid-item>
</wd-grid> </wd-grid>
@@ -40,9 +39,9 @@
<!-- 数据统计 --> <!-- 数据统计 -->
<wd-grid :column="2" :gutter="2"> <wd-grid :column="2" :gutter="2">
<wd-grid-item use-slot custom-class="custom-item"> <wd-grid-item use-slot custom-class="h-80px">
<view class="flex justify-start pl-5"> <view class="flex justify-start pl-5">
<view class="flex-center"> <view class="flex items-center">
<image class="w-80rpx h-80rpx rounded-8rpx" src="/static/icons/visitor.png" /> <image class="w-80rpx h-80rpx rounded-8rpx" src="/static/icons/visitor.png" />
<view class="ml-5 text-left"> <view class="ml-5 text-left">
<view class="font-bold">访客数</view> <view class="font-bold">访客数</view>
@@ -51,9 +50,9 @@
</view> </view>
</view> </view>
</wd-grid-item> </wd-grid-item>
<wd-grid-item use-slot custom-class="custom-item"> <wd-grid-item use-slot custom-class="h-80px">
<view class="flex justify-start pl-5"> <view class="flex justify-start pl-5">
<view class="flex-center"> <view class="flex items-center">
<image class="w-80rpx h-80rpx rounded-8rpx" src="/static/icons/browser.png" /> <image class="w-80rpx h-80rpx rounded-8rpx" src="/static/icons/browser.png" />
<view class="ml-5 text-left"> <view class="ml-5 text-left">
<view class="font-bold">浏览量</view> <view class="font-bold">浏览量</view>
@@ -66,7 +65,7 @@
<wd-card> <wd-card>
<template #title> <template #title>
<view class="flex-between"> <view class="flex justify-between items-center">
<view>访问趋势</view> <view>访问趋势</view>
<view> <view>
<wd-radio-group <wd-radio-group
@@ -82,7 +81,7 @@
</view> </view>
</template> </template>
<view class="charts-box"> <view class="w-full h-300px mb-40rpx">
<qiun-data-charts type="area" :chartData="chartData" :opts="chartOpts" /> <qiun-data-charts type="area" :chartData="chartData" :opts="chartOpts" />
</view> </view>
</wd-card> </wd-card>
@@ -267,18 +266,5 @@ onShow(() => {
</script> </script>
<style setup lang="scss"> <style setup lang="scss">
.home { /* 已全部使用UnoCSS替代,不需要额外的样式 */
padding: 10rpx 10rpx;
:deep(.custom-item) {
height: 80px !important;
}
:deep(.wd-card) {
margin: 10rpx 0 !important;
}
}
.charts-box {
width: 100%;
height: 300px;
}
</style> </style>
+5 -6
View File
@@ -1,12 +1,10 @@
<template> <template>
<view class="login-container"> <view class="app-container">
<!-- 背景图 --> <!-- 背景图 -->
<image src="/static/images/login-bg.svg" mode="aspectFill" class="login-bg" /> <image src="/static/images/login-bg.svg" mode="aspectFill" class="login-bg" />
<!-- Logo和标题区域 --> <!-- Logo和标题区域 -->
<view class="header"> <view class="header"> <view class="header"></view>
</view>
<view class="login-card"> <view class="login-card">
<view class="form-wrap"> <view class="form-wrap">
@@ -310,12 +308,13 @@ const navigateToPrivacy = () => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.login-container { .app-container {
position: relative; position: relative;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
height: 100vh; height: 100%;
min-height: 100vh;
overflow: hidden; overflow: hidden;
background-color: var(--wot-color-bg-container); background-color: var(--wot-color-bg-container);
} }
+12 -40
View File
@@ -1,5 +1,5 @@
<template> <template>
<view class="mine-container"> <view class="app-container">
<!-- 用户信息卡片 --> <!-- 用户信息卡片 -->
<view class="user-profile"> <view class="user-profile">
<view class="blur-bg"></view> <view class="blur-bg"></view>
@@ -143,8 +143,15 @@
</view> </view>
</view> </view>
<view v-if="isLogin" class="logout-btn-container"> <!-- 退出登录按钮 -->
<wd-button custom-class="logout-btn-unocss" @click="handleLogout">退出登录</wd-button> <view v-if="isLogin" class="logout-btn-wrap">
<wd-button
class="w-full h-80rpx rounded-40rpx font-bold text-32rpx"
plain
@click="handleLogout"
>
退出登录
</wd-button>
</view> </view>
<wd-toast /> <wd-toast />
@@ -243,13 +250,6 @@ onShow(() => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* stylelint-disable declaration-property-value-no-unknown */
.mine-container {
min-height: 100vh;
padding-bottom: 100rpx;
background-color: var(--wot-color-bg-page);
}
// 用户信息卡片 // 用户信息卡片
.user-profile { .user-profile {
position: relative; position: relative;
@@ -549,35 +549,7 @@ onShow(() => {
} }
// 退出登录按钮 // 退出登录按钮
.logout-btn-container { .logout-btn-wrap {
padding: 20rpx 30rpx; padding: 30rpx;
}
</style>
<style>
/* 使用全局样式解决微信小程序组件样式问题 */
.logout-btn-unocss {
display: flex !important;
align-items: center !important;
justify-content: center !important;
width: 100% !important;
height: 80rpx !important;
font-size: 32rpx !important;
font-weight: bold !important;
color: #fff !important;
background-color: var(--wot-color-theme) !important;
border: none !important;
border-radius: 40rpx !important;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.15) !important;
}
.btn-login {
width: 160rpx !important;
height: 60rpx !important;
font-size: 26rpx !important;
color: var(--wot-color-theme) !important;
background-color: #fff !important;
border: none !important;
border-radius: 30rpx !important;
} }
</style> </style>
+1 -1
View File
@@ -118,7 +118,7 @@ import { useToast } from "wot-design-uni";
import { useUserStore } from "@/store/modules/user.store"; import { useUserStore } from "@/store/modules/user.store";
import UserAPI, { type UserProfileForm } from "@/api/user"; import UserAPI, { type UserProfileForm } from "@/api/user";
import FileAPI, { type FileInfo } from "@/api/file"; import FileAPI, { type FileInfo } from "@/api/file";
import WechatProfile from "@/components/WechatProfile.vue"; import WechatProfile from "@/components/business/WechatProfile.vue";
const toast = useToast(); const toast = useToast();
const userStore = useUserStore(); const userStore = useUserStore();
+1 -6
View File
@@ -6,7 +6,7 @@
<wd-cell title="主题设置" icon="setting1" is-link @click="navigateToTheme" /> <wd-cell title="主题设置" icon="setting1" is-link @click="navigateToTheme" />
<wd-cell title="用户协议" icon="user" is-link @click="navigateToUserAgreement" /> <wd-cell title="用户协议" icon="user" is-link @click="navigateToUserAgreement" />
<wd-cell title="隐私政策" icon="folder" is-link @click="navigateToPrivacy" /> <wd-cell title="隐私政策" icon="folder" is-link @click="navigateToPrivacy" />
<wd-cell title="关于我们" icon="info" is-link @click="navigateToAbout" /> <wd-cell title="关于我们" icon="info-circle" is-link @click="navigateToAbout" />
</wd-cell-group> </wd-cell-group>
<wd-cell-group custom-style="margin-top:40rpx"> <wd-cell-group custom-style="margin-top:40rpx">
@@ -199,11 +199,6 @@ onLoad(() => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.settings-container { .settings-container {
min-height: 100vh;
padding: 20px;
color: var(--wot-color-text, #333);
background-color: var(--wot-color-bg-light, #f8f8f8);
// 强制 Wot 组件应用暗黑模式样式 // 强制 Wot 组件应用暗黑模式样式
:deep(.wd-cell-group) { :deep(.wd-cell-group) {
overflow: hidden; overflow: hidden;
+83 -188
View File
@@ -1,91 +1,81 @@
<template> <template>
<view class="theme-settings-container"> <view class="app-container">
<!-- 页面标题 --> <!-- 内容区域 -->
<view class="page-header"> <view class="content-wrapper">
<text class="page-title">主题设置</text> <!-- 页面标题 -->
<text class="page-subtitle">个性化您的应用外观</text> <view class="page-header">
</view> <text class="page-title">主题设置</text>
<text class="page-subtitle">个性化您的应用外观</text>
<!-- 暗黑模式设置 --> </view>
<wd-card custom-class="setting-card"> <!-- 暗黑模式设置 -->
<view class="setting-item"> <wd-card class="mb-3">
<view class="setting-info"> <view class="flex-between py-2">
<wd-icon name="moon" size="20" :color="currentThemeColor" /> <text>暗黑模式</text>
<text class="setting-label">暗黑模式</text> <wd-switch :model-value="theme === 'dark'" @change="toggleTheme" />
</view> </view>
<wd-switch :model-value="theme === 'dark'" @change="toggleTheme" /> </wd-card>
</view> <!-- 主题色选择 -->
</wd-card> <wd-card title="主题色" class="mb-3">
<view class="color-grid">
<!-- 主题色选择 --> <view
<wd-card custom-class="setting-card"> v-for="item in colorColumns"
<view class="setting-header"> :key="item.value"
<wd-icon name="palette" size="20" :color="currentThemeColor" /> class="color-item"
<text class="setting-title">主题色</text> :class="{ active: currentThemeColor === item.value }"
</view> @click="setThemeColor(item.value)"
>
<view class="color-grid"> <view class="color-box" :style="{ backgroundColor: item.value }">
<view <wd-icon
v-for="item in colorColumns" v-if="currentThemeColor === item.value"
:key="item.value" name="check"
class="color-item" size="16"
:class="{ active: currentThemeColor === item.value }" color="#fff"
@click="setThemeColor(item.value)" />
> </view>
<view class="color-box" :style="{ backgroundColor: item.value }"> <text class="color-label">{{ item.label }}</text>
<wd-icon v-if="currentThemeColor === item.value" name="check" size="16" color="#fff" />
</view> </view>
<text class="color-label">{{ item.label }}</text>
</view> </view>
</wd-card>
<!-- 自定义颜色 -->
<wd-card class="mb-3">
<view class="flex-between items-center py-2" @click="showCustomColorPopup = true">
<view class="flex-start gap-2 items-center">
<wd-icon name="edit" size="20" :color="currentThemeColor" />
<text>自定义颜色</text>
</view>
<view class="flex-start gap-2 items-center">
<view class="color-box small" :style="{ backgroundColor: currentThemeColor }"></view>
<text class="text-sm text-gray-500">{{ currentThemeColor }}</text>
<wd-icon name="arrow-right" size="14" color="#999" />
</view>
</view>
</wd-card>
<!-- 预览效果 -->
<wd-card title="预览效果" class="mb-3">
<view class="py-2">
<view class="flex-start gap-2">
<wd-button type="primary" size="small">主要按钮</wd-button>
<wd-button type="primary" plain size="small">次要按钮</wd-button>
<wd-tag type="primary">标签</wd-tag>
</view>
</view>
</wd-card>
<!-- 重置按钮 -->
<view class="mt-5 mx-3">
<wd-button plain block @click="handleReset">恢复默认</wd-button>
</view> </view>
</wd-card>
<!-- 自定义颜色 -->
<wd-card custom-class="setting-card">
<view class="setting-item" @click="showCustomColorPopup = true">
<view class="setting-info">
<wd-icon name="edit" size="20" :color="currentThemeColor" />
<text class="setting-label">自定义颜色</text>
</view>
<view class="custom-color-preview">
<view class="color-box small" :style="{ backgroundColor: currentThemeColor }"></view>
<text class="color-value">{{ currentThemeColor }}</text>
<wd-icon name="arrow-right" size="14" color="#999" />
</view>
</view>
</wd-card>
<!-- 预览效果 -->
<wd-card custom-class="setting-card">
<view class="preview-section">
<text class="preview-title">预览效果</text>
<view class="preview-items">
<wd-button type="primary" size="small">主要按钮</wd-button>
<wd-button type="primary" plain size="small">次要按钮</wd-button>
<wd-tag type="primary">标签</wd-tag>
</view>
</view>
</wd-card>
<!-- 重置按钮 -->
<view class="action-buttons">
<wd-button block @click="handleReset">恢复默认</wd-button>
</view> </view>
<!-- 自定义颜色弹窗 --> <!-- 自定义颜色弹窗 -->
<wd-popup v-model="showCustomColorPopup" position="bottom" closeable> <wd-popup v-model="showCustomColorPopup" position="bottom" closeable>
<view class="custom-color-popup"> <view class="custom-color-popup">
<view class="popup-header"> <view class="text-center mb-5"><text class="text-lg font-bold">自定义主题色</text></view>
<text class="popup-title">自定义主题色</text> <view class="mb-5">
</view>
<view class="color-input-section">
<view class="color-preview-large" :style="{ backgroundColor: customColor }"></view> <view class="color-preview-large" :style="{ backgroundColor: customColor }"></view>
<wd-input v-model="customColor" placeholder="请输入颜色值,如 #FF6B6B" clearable /> <wd-input v-model="customColor" placeholder="请输入颜色值,如 #FF6B6B" clearable />
<text class="input-tip">支持 HEX 格式颜色值</text> <text class="input-tip">支持 HEX 格式颜色值</text>
</view> </view>
<view class="flex gap-2">
<view class="popup-actions">
<wd-button type="info" block @click="showCustomColorPopup = false">取消</wd-button> <wd-button type="info" block @click="showCustomColorPopup = false">取消</wd-button>
<wd-button type="primary" block @click="applyCustomColor">应用</wd-button> <wd-button type="primary" block @click="applyCustomColor">应用</wd-button>
</view> </view>
@@ -93,9 +83,7 @@
</wd-popup> </wd-popup>
</view> </view>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue";
import { onShow } from "@dcloudio/uni-app"; import { onShow } from "@dcloudio/uni-app";
import { useTheme } from "@/composables/useTheme"; import { useTheme } from "@/composables/useTheme";
@@ -149,12 +137,9 @@ onShow(() => {
customColor.value = currentThemeColor.value; customColor.value = currentThemeColor.value;
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.theme-settings-container { .content-wrapper {
min-height: 100vh;
padding: 20rpx; padding: 20rpx;
background-color: var(--wot-color-bg-page);
} }
.page-header { .page-header {
@@ -178,58 +163,18 @@ onShow(() => {
} }
} }
.setting-card {
margin-bottom: 20rpx;
background-color: var(--wot-color-bg-container) !important;
border-radius: 16rpx !important;
:deep(.wd-card__body) {
padding: 30rpx !important;
}
}
.setting-item {
display: flex;
align-items: center;
justify-content: space-between;
.setting-info {
display: flex;
gap: 20rpx;
align-items: center;
}
.setting-label {
font-size: 30rpx;
color: var(--wot-color-text);
}
}
.setting-header {
display: flex;
gap: 20rpx;
align-items: center;
margin-bottom: 30rpx;
.setting-title {
font-size: 30rpx;
font-weight: 600;
color: var(--wot-color-text);
}
}
.color-grid { .color-grid {
display: grid; display: grid;
grid-template-columns: repeat(4, 1fr); grid-template-columns: repeat(4, 1fr);
gap: 20rpx; gap: 24rpx 20rpx;
} }
.color-item { .color-item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 10rpx; gap: 8rpx;
align-items: center; align-items: center;
padding: 10rpx; padding: 8rpx;
cursor: pointer; cursor: pointer;
&.active .color-box { &.active .color-box {
@@ -255,79 +200,29 @@ onShow(() => {
.color-label { .color-label {
font-size: 22rpx; font-size: 22rpx;
color: var(--wot-color-text-secondary); color: var(--wot-color-text-secondary);
text-align: center;
white-space: nowrap;
} }
} }
.custom-color-preview {
display: flex;
gap: 15rpx;
align-items: center;
.color-value {
font-size: 26rpx;
color: var(--wot-color-text-secondary);
}
}
.preview-section {
.preview-title {
display: block;
margin-bottom: 20rpx;
font-size: 28rpx;
color: var(--wot-color-text-secondary);
}
.preview-items {
display: flex;
flex-wrap: wrap;
gap: 20rpx;
align-items: center;
}
}
.action-buttons {
padding: 0 20rpx;
margin-top: 40rpx;
}
.custom-color-popup { .custom-color-popup {
padding: 40rpx 30rpx; padding: 40rpx 30rpx;
background-color: var(--wot-color-bg-container); background-color: var(--wot-color-bg-container);
.popup-header { .color-preview-large {
margin-bottom: 40rpx; width: 100%;
height: 120rpx;
margin-bottom: 30rpx;
border: 2rpx solid var(--wot-color-border);
border-radius: 16rpx;
}
.input-tip {
display: block;
margin-top: 15rpx;
font-size: 24rpx;
color: var(--wot-color-text-placeholder);
text-align: center; text-align: center;
.popup-title {
font-size: 32rpx;
font-weight: 600;
color: var(--wot-color-text);
}
}
.color-input-section {
margin-bottom: 40rpx;
.color-preview-large {
width: 100%;
height: 120rpx;
margin-bottom: 30rpx;
border: 2rpx solid var(--wot-color-border);
border-radius: 16rpx;
}
.input-tip {
display: block;
margin-top: 15rpx;
font-size: 24rpx;
color: var(--wot-color-text-placeholder);
text-align: center;
}
}
.popup-actions {
display: flex;
gap: 20rpx;
} }
} }
</style> </style>
-46
View File
@@ -1,46 +0,0 @@
/**
* 暗黑模式输入框修复
* 强制所有输入框在暗黑模式下保持透明背景
*/
/* 暗黑模式下的输入框 */
.wot-theme-dark {
/* 通用输入框 */
input,
textarea,
[contenteditable="true"] {
color: var(--wot-color-text, #f5f5f5) !important;
background-color: transparent !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
/* 自动填充覆盖 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
background: none !important;
background-color: transparent !important;
-webkit-box-shadow: 0 0 0 1000px rgba(31, 31, 31, 0.95) inset !important;
transition: background-color 5000s;
-webkit-text-fill-color: var(--wot-color-text, #f5f5f5) !important;
}
/* 登录页特殊处理 */
.login-card {
input,
.form-input {
background-color: transparent !important;
}
}
}
/* 登录页面特别修复 */
.login-container {
input,
.form-input {
background-color: transparent !important;
border: none !important;
}
}
+17
View File
@@ -0,0 +1,17 @@
@import "./theme";
html,
body,
#app {
height: 100%;
padding: 0;
margin: 0;
}
html {
font-size: 8px;
}
html.dark {
background: #121212;
}
+6
View File
@@ -16,6 +16,12 @@ export default {
"flex-start": "flex justify-start items-center", "flex-start": "flex justify-start items-center",
"flex-end": "flex justify-end items-center", "flex-end": "flex justify-end items-center",
"flex-between": "flex justify-between items-center", "flex-between": "flex justify-between items-center",
"flex-around": "flex justify-around items-center",
"flex-evenly": "flex justify-evenly items-center",
"flex-stretch": "flex justify-stretch items-center",
"flex-baseline": "flex justify-baseline items-center",
"flex-column": "flex flex-col",
"flex-row": "flex flex-row",
}, },
], ],