From 82fae9ed4bf2fdcd2684abc8f5ddb15eb4fc6183 Mon Sep 17 00:00:00 2001
From: ray <1490493387@qq.com>
Date: Sat, 31 May 2025 07:42:27 +0800
Subject: [PATCH] =?UTF-8?q?wip:=20=E4=B8=B4=E6=97=B6=E6=8F=90=E4=BA=A4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 31 ++
components.d.ts | 12 +-
pages.config.ts | 5 +-
src/App.vue | 6 +-
.../{ => business}/WechatProfile.vue | 41 ++-
src/components/business/index.ts | 11 +
src/components/todo/TodoItem.vue | 122 --------
src/components/todo/TodoList.vue | 43 ---
src/composables/useTheme.ts | 28 +-
src/layouts/default.vue | 68 ++++-
src/layouts/tabbar.vue | 28 +-
src/main.ts | 10 +-
src/pages.json | 5 +-
src/pages/index/index.vue | 32 +--
src/pages/login/index.vue | 11 +-
src/pages/mine/index.vue | 52 +---
src/pages/mine/profile/complete-profile.vue | 2 +-
src/pages/mine/settings/index.vue | 7 +-
src/pages/mine/settings/theme/index.vue | 271 ++++++------------
src/styles/dark-mode-fix.scss | 46 ---
src/styles/index.scss | 17 ++
unocss.config.ts | 6 +
22 files changed, 308 insertions(+), 546 deletions(-)
rename src/components/{ => business}/WechatProfile.vue (85%)
create mode 100644 src/components/business/index.ts
delete mode 100644 src/components/todo/TodoItem.vue
delete mode 100644 src/components/todo/TodoList.vue
delete mode 100644 src/styles/dark-mode-fix.scss
create mode 100644 src/styles/index.scss
diff --git a/README.md b/README.md
index 1993c64..960bd2f 100644
--- a/README.md
+++ b/README.md
@@ -25,3 +25,34 @@ pnpm run dev:h5
```
访问 [http://localhost:4096](http://localhost:4096)
+
+## 组件结构
+
+项目组件分为以下几类:
+
+- **基础组件**:`src/components` 下的通用组件
+- **业务组件**:`src/components/business` 下的业务相关组件
+ - `WechatProfile.vue`: 微信小程序环境下的头像、昵称和性别选择组件
+
+使用业务组件:
+
+```vue
+
+
+
+
+
+```
diff --git a/components.d.ts b/components.d.ts
index 8d00a5d..b62069f 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -19,18 +19,22 @@ declare module 'vue' {
QiunDataCharts: typeof import('./src/components/qiun-data-charts/qiun-data-charts.vue')['default']
QiunError: typeof import('./src/components/qiun-error/qiun-error.vue')['default']
QiunLoading: typeof import('./src/components/qiun-loading/qiun-loading.vue')['default']
- TodoItem: typeof import('./src/components/todo/TodoItem.vue')['default']
- TodoList: typeof import('./src/components/todo/TodoList.vue')['default']
+ TodoItem: (typeof import("./src/components/todo/TodoItem.vue"))["default"]
+ TodoList: (typeof import("./src/components/todo/TodoList.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']
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']
+ 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']
- 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']
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']
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']
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']
@@ -45,6 +49,6 @@ declare module 'vue' {
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']
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']
}
}
diff --git a/pages.config.ts b/pages.config.ts
index 4d68a28..e7a2291 100644
--- a/pages.config.ts
+++ b/pages.config.ts
@@ -14,8 +14,11 @@ export default defineUniPages({
},
],
globalStyle: {
+ navigationStyle: "custom",
navigationBarTextStyle: "black",
- navigationBarTitleText: "vue-uniapp-template",
+ navigationBarTitleText: "youlai-mall-app",
+ navigationBarBackgroundColor: "#F8F8F8",
+ backgroundColor: "#F8F8F8",
},
tabBar: {
diff --git a/src/App.vue b/src/App.vue
index bf99123..bcf15fa 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,7 +2,6 @@
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
import { useTheme } from "@/composables/useTheme";
-// 使用主题 composable
const { initTheme } = useTheme();
onLaunch(() => {
@@ -20,7 +19,4 @@ onHide(() => {
});
-
+
diff --git a/src/components/WechatProfile.vue b/src/components/business/WechatProfile.vue
similarity index 85%
rename from src/components/WechatProfile.vue
rename to src/components/business/WechatProfile.vue
index a4bbbb3..bcfb9c0 100644
--- a/src/components/WechatProfile.vue
+++ b/src/components/business/WechatProfile.vue
@@ -40,13 +40,28 @@
import { ref, watch } from "vue";
import FileAPI, { type FileInfo } from "@/api/file";
+/**
+ * 微信小程序头像昵称组件
+ *
+ * @description 用于微信小程序环境下的头像、昵称和性别选择
+ * @component WechatProfile
+ * @example
+ *
+ */
+
+defineOptions({
+ name: "WechatProfile",
+});
+
// Props
+interface ProfileData {
+ avatar?: string;
+ nickname?: string;
+ gender?: number;
+}
+
interface Props {
- modelValue?: {
- avatar?: string;
- nickname?: string;
- gender?: number;
- };
+ modelValue?: ProfileData;
}
const props = withDefaults(defineProps(), {
@@ -59,8 +74,8 @@ const props = withDefaults(defineProps(), {
// Emits
const emit = defineEmits<{
- "update:modelValue": [value: { avatar?: string; nickname?: string; gender?: number }];
- change: [value: { avatar?: string; nickname?: string; gender?: number }];
+ "update:modelValue": [value: ProfileData];
+ change: [value: ProfileData];
}>();
// 响应式数据
@@ -134,7 +149,7 @@ watch(gender, () => {
margin-bottom: 20rpx;
font-size: 32rpx;
font-weight: 600;
- color: #333;
+ color: var(--wot-color-text);
}
.avatar-section {
@@ -171,14 +186,14 @@ watch(gender, () => {
justify-content: center;
width: 100%;
height: 100%;
- background: #f8f9fa;
- border: 2rpx dashed #ddd;
+ background: var(--wot-color-bg-light);
+ border: 2rpx dashed var(--wot-color-border);
border-radius: 50%;
.placeholder-text {
margin-top: 10rpx;
font-size: 24rpx;
- color: #999;
+ color: var(--wot-color-text-secondary);
}
}
}
@@ -192,8 +207,8 @@ watch(gender, () => {
height: 80rpx;
padding: 0 20rpx;
font-size: 28rpx;
- background: #f8f9fa;
- border: 1rpx solid #e9ecef;
+ background: var(--wot-color-bg-light);
+ border: 1rpx solid var(--wot-color-border);
border-radius: 12rpx;
}
}
diff --git a/src/components/business/index.ts b/src/components/business/index.ts
new file mode 100644
index 0000000..a606365
--- /dev/null
+++ b/src/components/business/index.ts
@@ -0,0 +1,11 @@
+/**
+ * 业务组件导出索引
+ */
+import WechatProfile from "./WechatProfile.vue";
+
+export { WechatProfile };
+
+// 用于批量注册组件
+export default {
+ WechatProfile,
+};
diff --git a/src/components/todo/TodoItem.vue b/src/components/todo/TodoItem.vue
deleted file mode 100644
index ee40ea9..0000000
--- a/src/components/todo/TodoItem.vue
+++ /dev/null
@@ -1,122 +0,0 @@
-
-
-
-
-
-
-
- {{ todo.title }}
-
- {{ todo.description }}
-
-
-
- {{ formatDate(todo.deadline) }}
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/components/todo/TodoList.vue b/src/components/todo/TodoList.vue
deleted file mode 100644
index dc8a449..0000000
--- a/src/components/todo/TodoList.vue
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/src/composables/useTheme.ts b/src/composables/useTheme.ts
index ecc120e..6618cc1 100644
--- a/src/composables/useTheme.ts
+++ b/src/composables/useTheme.ts
@@ -3,18 +3,22 @@ import type { ConfigProviderThemeVars } from "wot-design-uni";
/* 默认的主题色列表 */
export const colorColumns = [
- { value: "#165DFF", label: "蓝色" },
- { value: "#0FC6C2", label: "青绿色" },
- { value: "#722ED1", label: "紫色" },
- { value: "#F5222D", label: "红色" },
- { value: "#FA8C16", label: "橙色" },
- { value: "#FADB14", label: "黄色" },
- { value: "#52C41A", label: "绿色" },
- { value: "#EB2F96", label: "粉色" },
- { value: "#13C2C2", label: "青色" },
- { value: "#1890FF", label: "天蓝色" },
- { value: "#CD5C5C", label: "经典红" },
- { value: "#228B22", label: "自然绿" },
+ { value: "#165DFF", label: "海洋蓝" },
+ { value: "#1677FF", label: "天空蓝" },
+ { value: "#0081FF", label: "梦幻蓝" },
+ { value: "#4080FF", label: "皇家蓝" },
+ { value: "#4D74FF", label: "靛蓝" },
+ { value: "#0FC6C2", label: "碧波绿" },
+ { value: "#722ED1", label: "魔幻紫" },
+ { value: "#F5222D", label: "热情红" },
+ { value: "#FA8C16", label: "活力橙" },
+ { value: "#FADB14", label: "阳光黄" },
+ { value: "#52C41A", label: "生机绿" },
+ { value: "#EB2F96", label: "浪漫粉" },
+ { value: "#13C2C2", label: "清新青" },
+ { value: "#36CFC9", label: "湖水蓝" },
+ { value: "#CD5C5C", label: "复古红" },
+ { value: "#228B22", label: "森林绿" },
];
/* 存储键名 */
diff --git a/src/layouts/default.vue b/src/layouts/default.vue
index bdd524f..18d3e07 100644
--- a/src/layouts/default.vue
+++ b/src/layouts/default.vue
@@ -1,7 +1,57 @@
diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index bebcf98..01566f2 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -1,12 +1,10 @@
-
+
-