From 030e19084fa37c9f4590a1d33ed38f18b348a7fc Mon Sep 17 00:00:00 2001
From: "Ray.Hao" <1490493387@qq.com>
Date: Mon, 21 Jul 2025 09:09:24 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=8F=8D?=
=?UTF-8?q?=E9=A6=88=E5=92=8C=E5=B8=83=E5=B1=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.env.development | 3 +-
components.d.ts | 6 +-
src/components/business/WechatProfile.vue | 231 ------------------
src/components/business/index.ts | 11 -
src/components/cu-dict-label/index.vue | 67 -----
src/components/cu-dict/index.vue | 141 -----------
src/layouts/default.vue | 19 +-
src/layouts/tabbar.vue | 249 ++++++++-----------
src/pages.json | 7 +-
src/pages/index/index.vue | 12 +-
src/pages/mine/feedback/index.vue | 255 ++++++++++----------
src/pages/mine/profile/complete-profile.vue | 159 ++++++++++--
src/pages/work/index.vue | 15 ++
src/types/todo.ts | 16 --
uni-pages.d.ts | 1 +
15 files changed, 417 insertions(+), 775 deletions(-)
delete mode 100644 src/components/business/WechatProfile.vue
delete mode 100644 src/components/business/index.ts
delete mode 100644 src/components/cu-dict-label/index.vue
delete mode 100644 src/components/cu-dict/index.vue
create mode 100644 src/pages/work/index.vue
delete mode 100644 src/types/todo.ts
diff --git a/.env.development b/.env.development
index 753c18e..a7153f9 100644
--- a/.env.development
+++ b/.env.development
@@ -7,7 +7,8 @@ VITE_APP_PORT = 4096
VITE_APP_BASE_API = '/dev-api'
# API 服务器的 URL
-VITE_APP_API_URL = http://localhost:8989
+#VITE_APP_API_URL = http://localhost:8989
+VITE_APP_API_URL = https://api.youlai.tech
# WebSocket 服务器的 URL,不配置默认关闭 WebSocket
#VITE_APP_WS_ENDPOINT= ws://localhost:4096/ws
\ No newline at end of file
diff --git a/components.d.ts b/components.d.ts
index f51f5aa..8af0191 100644
--- a/components.d.ts
+++ b/components.d.ts
@@ -8,8 +8,6 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
CuDateQuery: typeof import('./src/components/cu-date-query/index.vue')['default']
- CuDict: typeof import('./src/components/cu-dict/index.vue')['default']
- CuDictLabel: typeof import('./src/components/cu-dict-label/index.vue')['default']
CuPicker: typeof import('./src/components/cu-picker/index.vue')['default']
Loading1: typeof import('./src/components/qiun-loading/loading1.vue')['default']
Loading2: typeof import('./src/components/qiun-loading/loading2.vue')['default']
@@ -27,6 +25,7 @@ declare module 'vue' {
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']
WdForm: typeof import('wot-design-uni/components/wd-form/wd-form.vue')['default']
+ WdFormItem: typeof import('wot-design-uni/components/wd-form-item/wd-form-item.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']
@@ -42,14 +41,15 @@ declare module 'vue' {
WdProgress: typeof import('wot-design-uni/components/wd-progress/wd-progress.vue')['default']
WdRadio: typeof import('wot-design-uni/components/wd-radio/wd-radio.vue')['default']
WdRadioGroup: typeof import('wot-design-uni/components/wd-radio-group/wd-radio-group.vue')['default']
+ WdStatusTip: typeof import('wot-design-uni/components/wd-status-tip/wd-status-tip.vue')['default']
WdSwiper: typeof import('wot-design-uni/components/wd-swiper/wd-swiper.vue')['default']
WdSwitch: typeof import('wot-design-uni/components/wd-switch/wd-switch.vue')['default']
WdTabbar: typeof import('wot-design-uni/components/wd-tabbar/wd-tabbar.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']
+ WdText: typeof import('wot-design-uni/components/wd-text/wd-text.vue')['default']
WdTextarea: typeof import('wot-design-uni/components/wd-textarea/wd-textarea.vue')['default']
WdToast: typeof import('wot-design-uni/components/wd-toast/wd-toast.vue')['default']
WdUpload: typeof import('wot-design-uni/components/wd-upload/wd-upload.vue')['default']
- WechatProfile: typeof import('./src/components/business/WechatProfile.vue')['default']
}
}
diff --git a/src/components/business/WechatProfile.vue b/src/components/business/WechatProfile.vue
deleted file mode 100644
index bcfb9c0..0000000
--- a/src/components/business/WechatProfile.vue
+++ /dev/null
@@ -1,231 +0,0 @@
-
-
-
-
- 头像
-
-
-
-
-
- 昵称
-
-
-
-
-
- 性别
-
- 男
- 女
-
-
-
-
-
-
-
-
diff --git a/src/components/business/index.ts b/src/components/business/index.ts
deleted file mode 100644
index a606365..0000000
--- a/src/components/business/index.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * 业务组件导出索引
- */
-import WechatProfile from "./WechatProfile.vue";
-
-export { WechatProfile };
-
-// 用于批量注册组件
-export default {
- WechatProfile,
-};
diff --git a/src/components/cu-dict-label/index.vue b/src/components/cu-dict-label/index.vue
deleted file mode 100644
index 6dbc104..0000000
--- a/src/components/cu-dict-label/index.vue
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
- {{ label }}
-
-
- {{ label }}
-
-
-
-
diff --git a/src/components/cu-dict/index.vue b/src/components/cu-dict/index.vue
deleted file mode 100644
index 4e99869..0000000
--- a/src/components/cu-dict/index.vue
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/layouts/default.vue b/src/layouts/default.vue
index 9dd6be9..b789731 100644
--- a/src/layouts/default.vue
+++ b/src/layouts/default.vue
@@ -2,6 +2,21 @@
import { useTheme } from "@/composables/useTheme";
const { theme, themeVars } = useTheme();
+
+// 状态栏高度
+const statusBarHeight = ref(0);
+
+// 获取状态栏高度
+onMounted(() => {
+ uni.getSystemInfo({
+ success: (res) => {
+ statusBarHeight.value = res.statusBarHeight || 20;
+ },
+ fail: () => {
+ statusBarHeight.value = 20;
+ },
+ });
+});
diff --git a/src/pages.json b/src/pages.json
index 93eebcc..dd6ebbd 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -17,6 +17,11 @@
"style": {},
"layout": "tabbar"
},
+ {
+ "path": "pages/work/index",
+ "type": "page",
+ "style": {}
+ },
{
"path": "pages/mine/about/index",
"type": "page",
@@ -93,4 +98,4 @@
]
},
"subPackages": []
-}
+}
\ No newline at end of file
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index ea083dd..95acefd 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -147,25 +147,25 @@ const navList = reactive([
{
icon: "/static/icons/user.png",
title: "用户管理",
- url: "/pages/work/user/index",
+ url: "/pages/work/index",
prem: "sys:user:query",
},
{
icon: "/static/icons/role.png",
title: "角色管理",
- url: "/pages/work/role/index",
+ url: "/pages/work/index",
prem: "sys:role:query",
},
{
icon: "/static/icons/notice.png",
title: "通知公告",
- url: "/pages/work/notice/index",
+ url: "/pages/work/index",
prem: "sys:notice:query",
},
{
icon: "/static/icons/setting.png",
title: "系统配置",
- url: "/pages/work/config/index",
+ url: "/pages/work/index",
prem: "sys:config:query",
},
]);
@@ -265,6 +265,4 @@ onShow(() => {
});
-
+
diff --git a/src/pages/mine/feedback/index.vue b/src/pages/mine/feedback/index.vue
index 1f53a7d..969ea40 100644
--- a/src/pages/mine/feedback/index.vue
+++ b/src/pages/mine/feedback/index.vue
@@ -1,67 +1,62 @@
-
-
-
-
-
-
-
+
+
-
-
-
-
+ 123
+ 选填,最多上传3张图片
+
+
+
+
+
+ {{ item.label }}
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ 选填,便于我们与您联系
+
+
+
+
+
+ 提交反馈
+
-
-
-
-
-
-
-
-
-
-
- 提交反馈
-
-
-
-
+
-
diff --git a/src/pages/mine/profile/complete-profile.vue b/src/pages/mine/profile/complete-profile.vue
index 2aab07d..10fad64 100644
--- a/src/pages/mine/profile/complete-profile.vue
+++ b/src/pages/mine/profile/complete-profile.vue
@@ -15,7 +15,47 @@
基本信息
-
+
+
+
+
+
+ 头像
+
+
+
+
+
+ 昵称
+
+
+
+
+
+ 性别
+
+ 男
+ 女
+
+
+
@@ -120,7 +160,6 @@ import { useToast } from "wot-design-uni";
import { useUserStore } from "@/store/modules/user.store";
import UserAPI, { type UserProfileForm } from "@/api/user";
import FileAPI, { type FileInfo } from "@/api/file";
-import WechatProfile from "@/components/business/WechatProfile.vue";
const toast = useToast();
const userStore = useUserStore();
@@ -136,13 +175,6 @@ const profileForm = reactive({
mobile: "",
});
-// 微信头像昵称数据
-const wechatProfileData = ref({
- avatar: "",
- nickname: "",
- gender: 1,
-});
-
// 表单验证规则
const rules = {
nickname: [
@@ -179,6 +211,26 @@ onLoad((options: any) => {
}
});
+// 微信小程序头像选择处理
+const onChooseAvatar = async (e: any) => {
+ try {
+ const { avatarUrl } = e.detail;
+
+ // 上传头像到服务器
+ uni.showLoading({ title: "上传中..." });
+
+ const fileInfo: FileInfo = await FileAPI.upload(avatarUrl);
+ profileForm.avatar = fileInfo.url;
+
+ uni.hideLoading();
+ uni.showToast({ title: "头像上传成功", icon: "success" });
+ } catch (error) {
+ uni.hideLoading();
+ console.error("头像上传失败:", error);
+ uni.showToast({ title: "头像上传失败", icon: "error" });
+ }
+};
+
// 选择头像
const chooseAvatar = () => {
// #ifdef MP-WEIXIN
@@ -331,13 +383,6 @@ const handleSkip = () => {
});
};
-// 微信头像昵称变化处理
-const onWechatProfileChange = (data: { avatar?: string; nickname?: string; gender?: number }) => {
- profileForm.avatar = data.avatar || "";
- profileForm.nickname = data.nickname || "";
- profileForm.gender = data.gender || 1;
-};
-
// 返回
function handleBack() {
uni.navigateBack();
@@ -510,4 +555,86 @@ function handleBack() {
}
}
}
+
+/* 内联WechatProfile组件的样式 */
+.wechat-profile {
+ padding: 20rpx;
+
+ .avatar-section {
+ margin-bottom: 40rpx;
+
+ .avatar-button {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 160rpx;
+ height: 160rpx;
+ padding: 0;
+ margin: 0 auto;
+ overflow: hidden;
+ background: transparent;
+ border: none;
+ border-radius: 50%;
+
+ &::after {
+ border: none;
+ }
+ }
+
+ .avatar-image {
+ width: 100%;
+ height: 100%;
+ border-radius: 50%;
+ }
+
+ .avatar-placeholder {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+ 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: var(--wot-color-text-secondary);
+ }
+ }
+ }
+
+ .nickname-section {
+ margin-bottom: 40rpx;
+
+ .nickname-input {
+ box-sizing: border-box;
+ width: 100%;
+ height: 80rpx;
+ padding: 0 20rpx;
+ font-size: 28rpx;
+ background: var(--wot-color-bg-light);
+ border: 1rpx solid var(--wot-color-border);
+ border-radius: 12rpx;
+ }
+ }
+
+ .gender-section {
+ .gender-group {
+ display: flex;
+ gap: 20rpx;
+
+ .gender-radio {
+ flex: 1;
+
+ :deep(.wd-radio) {
+ justify-content: center;
+ width: 100%;
+ }
+ }
+ }
+ }
+}
diff --git a/src/pages/work/index.vue b/src/pages/work/index.vue
new file mode 100644
index 0000000..5ccab83
--- /dev/null
+++ b/src/pages/work/index.vue
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/types/todo.ts b/src/types/todo.ts
deleted file mode 100644
index a500742..0000000
--- a/src/types/todo.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-export interface Todo {
- id: string;
- title: string;
- description?: string;
- completed: boolean;
- deadline?: string;
- priority?: "low" | "medium" | "high";
- createdAt: string;
- updatedAt?: string;
-}
-
-export interface TodoState {
- todos: Todo[];
- loading: boolean;
- error: string | null;
-}
diff --git a/uni-pages.d.ts b/uni-pages.d.ts
index cc691ab..2065725 100644
--- a/uni-pages.d.ts
+++ b/uni-pages.d.ts
@@ -7,6 +7,7 @@ interface NavigateToOptions {
url: "/pages/index/index" |
"/pages/login/index" |
"/pages/mine/index" |
+ "/pages/work/index" |
"/pages/mine/about/index" |
"/pages/mine/faq/index" |
"/pages/mine/feedback/index" |