From 07e9ce725cd6cbd26f60610a473a8c415952aba3 Mon Sep 17 00:00:00 2001 From: ray <1490493387@qq.com> Date: Sun, 1 Jun 2025 17:25:56 +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 --- components.d.ts | 3 + src/api/auth.ts | 10 +- src/layouts/tabbar.vue | 14 +- src/pages.json | 5 - src/pages/mine/about/index.vue | 242 ++++++-------------- src/pages/mine/profile/complete-profile.vue | 15 +- src/pages/mine/profile/index.vue | 81 +++---- src/pages/mine/settings/account/index.vue | 42 ++-- src/pages/mine/settings/agreement/index.vue | 98 ++++---- src/pages/mine/settings/index.vue | 208 +++++------------ src/pages/mine/settings/network/index.vue | 223 +++++------------- src/pages/mine/settings/privacy/index.vue | 103 --------- src/pages/mine/settings/theme/index.vue | 137 +++++------ src/styles/index.scss | 20 +- src/utils/request.ts | 41 +++- uni-pages.d.ts | 1 - unocss.config.ts | 6 +- 17 files changed, 422 insertions(+), 827 deletions(-) delete mode 100644 src/pages/mine/settings/privacy/index.vue diff --git a/components.d.ts b/components.d.ts index d65e7a9..f51f5aa 100644 --- a/components.d.ts +++ b/components.d.ts @@ -33,10 +33,13 @@ declare module 'vue' { 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'] + WdLoading: typeof import('wot-design-uni/components/wd-loading/wd-loading.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'] WdNoticeBar: typeof import('wot-design-uni/components/wd-notice-bar/wd-notice-bar.vue')['default'] WdNotify: typeof import('wot-design-uni/components/wd-notify/wd-notify.vue')['default'] WdPopup: typeof import('wot-design-uni/components/wd-popup/wd-popup.vue')['default'] + 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'] WdSwiper: typeof import('wot-design-uni/components/wd-swiper/wd-swiper.vue')['default'] diff --git a/src/api/auth.ts b/src/api/auth.ts index 86e88ce..109cdbd 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -1,4 +1,4 @@ -import request from "@/utils/request"; +import request, { publicRequest } from "@/utils/request"; const AUTH_BASE_URL = "/api/v1/auth"; @@ -35,7 +35,7 @@ const AuthAPI = { password: data.password, }; - return request({ + return publicRequest({ url: `${AUTH_BASE_URL}/login`, method: "POST", data: formData, @@ -51,7 +51,7 @@ const AuthAPI = { * @returns 登录结果 */ loginByWxMiniAppCode(code: string): Promise { - return request({ + return publicRequest({ url: `${AUTH_BASE_URL}/wx/miniapp/code-login`, method: "POST", data: { code }, @@ -64,7 +64,7 @@ const AuthAPI = { * @returns 登录结果 */ loginByWxMiniAppPhone(data: WxLoginData): Promise { - return request({ + return publicRequest({ url: `${AUTH_BASE_URL}/wx/miniapp/phone-login`, method: "POST", data, @@ -99,7 +99,7 @@ const AuthAPI = { * @returns 新的访问令牌 */ refreshToken(refreshToken: string): Promise<{ accessToken: string; expiresIn: number }> { - return request<{ accessToken: string; expiresIn: number }>({ + return publicRequest<{ accessToken: string; expiresIn: number }>({ url: `${AUTH_BASE_URL}/refresh-token`, method: "POST", data: { refreshToken }, diff --git a/src/layouts/tabbar.vue b/src/layouts/tabbar.vue index 2c42d86..06a251e 100644 --- a/src/layouts/tabbar.vue +++ b/src/layouts/tabbar.vue @@ -23,7 +23,7 @@ interface TabbarItem { // 根据 pages.json 配置的 tabbar 项目 const tabbarItems = ref([ - { name: "index", value: null, active: true, title: "首页123", icon: "home" }, + { name: "index", value: null, active: true, title: "首页", icon: "home" }, { name: "mine", value: null, active: false, title: "我的", icon: "user" }, ]); @@ -83,15 +83,19 @@ const updateTabbarByRoute = () => { function handleTabbarChange({ value }: { value: string }) { console.log(`用户点击 tabbar: ${value}`); - setTabbarItemActive(value); - // 根据 tabbar 项目导航到对应页面 + // 立即设置激活状态 + tabbarItems.value.forEach((item) => { + item.active = item.name === value; + }); + + // 导航到对应页面 if (value === "index") { - uni.switchTab({ + uni.reLaunch({ url: "/pages/index/index", }); } else if (value === "mine") { - uni.switchTab({ + uni.reLaunch({ url: "/pages/mine/index", }); } diff --git a/src/pages.json b/src/pages.json index a0b7b55..93eebcc 100644 --- a/src/pages.json +++ b/src/pages.json @@ -62,11 +62,6 @@ "type": "page", "style": {} }, - { - "path": "pages/mine/settings/privacy/index", - "type": "page", - "style": {} - }, { "path": "pages/mine/settings/theme/index", "type": "page", diff --git a/src/pages/mine/about/index.vue b/src/pages/mine/about/index.vue index 02bf88c..8a32427 100644 --- a/src/pages/mine/about/index.vue +++ b/src/pages/mine/about/index.vue @@ -1,66 +1,80 @@ diff --git a/src/pages/mine/profile/complete-profile.vue b/src/pages/mine/profile/complete-profile.vue index ccdacd3..2aab07d 100644 --- a/src/pages/mine/profile/complete-profile.vue +++ b/src/pages/mine/profile/complete-profile.vue @@ -1,5 +1,7 @@ - + 提交 @@ -211,6 +213,11 @@ const mobileTimer = ref | null>(null); const emailCountdown = ref(0); const emailTimer = ref | null>(null); +// 处理返回按钮点击 +const handleBack = () => { + uni.navigateBack(); +}; + /** 加载用户信息 */ const loadUserProfile = async () => { userProfile.value = await UserAPI.getProfile(); @@ -319,25 +326,4 @@ onMounted(() => { loadUserProfile(); }); - + diff --git a/src/pages/mine/settings/agreement/index.vue b/src/pages/mine/settings/agreement/index.vue index 5798a44..87ca4d6 100644 --- a/src/pages/mine/settings/agreement/index.vue +++ b/src/pages/mine/settings/agreement/index.vue @@ -1,20 +1,36 @@ - + diff --git a/src/pages/mine/settings/index.vue b/src/pages/mine/settings/index.vue index 1ab878e..6a5f98c 100644 --- a/src/pages/mine/settings/index.vue +++ b/src/pages/mine/settings/index.vue @@ -1,11 +1,18 @@ diff --git a/src/pages/mine/settings/network/index.vue b/src/pages/mine/settings/network/index.vue index 921839c..983573d 100644 --- a/src/pages/mine/settings/network/index.vue +++ b/src/pages/mine/settings/network/index.vue @@ -1,48 +1,48 @@ @@ -79,6 +79,15 @@ const getPingStatus = computed(() => { return "bad"; }); +// 计算状态对应的Tag类型 +const getPingStatusType = computed(() => { + const status = getPingStatus.value; + if (status === "good") return "success"; + if (status === "normal") return "warning"; + if (status === "bad") return "danger"; + return "primary"; +}); + // 方法 const getNetworkType = async () => { try { @@ -172,6 +181,11 @@ const startTest = async () => { } }; +// 返回 +const handleBack = () => { + uni.navigateBack(); +}; + // 生命周期钩子 onMounted(() => { getNetworkType(); @@ -193,134 +207,23 @@ onBeforeUnmount(() => { diff --git a/src/pages/mine/settings/privacy/index.vue b/src/pages/mine/settings/privacy/index.vue deleted file mode 100644 index a5a03f9..0000000 --- a/src/pages/mine/settings/privacy/index.vue +++ /dev/null @@ -1,103 +0,0 @@ - - - - - diff --git a/src/pages/mine/settings/theme/index.vue b/src/pages/mine/settings/theme/index.vue index 641bc71..37a582d 100644 --- a/src/pages/mine/settings/theme/index.vue +++ b/src/pages/mine/settings/theme/index.vue @@ -1,69 +1,65 @@