From a11bc1b2471e492a267e0dc18d29e60c9bb2f0c6 Mon Sep 17 00:00:00 2001 From: txai-dev Date: Sun, 13 Sep 2026 13:42:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=91=E7=9A=84=E9=A1=B5=E6=8C=89?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=86=B3=E5=AE=9A=E7=A7=BB=E9=99=A4=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E4=B8=80=E9=94=AE=E7=99=BB=E5=BD=95/=E6=9A=82?= =?UTF-8?q?=E4=B8=8D=E7=99=BB=E5=BD=95=E6=8C=89=E9=92=AE=EF=BC=88=E8=AE=A2?= =?UTF-8?q?=E9=98=85=E5=8D=A1=E4=B8=BA=E7=99=BB=E5=BD=95=E5=85=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=89=EF=BC=9B=E7=89=88=E6=9C=AC=E5=8F=B7=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=20manifest=20=E5=8D=95=E4=B8=80=E6=9D=A5=E6=BA=90=EF=BC=88?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E9=A1=B5+=E6=88=91=E7=9A=84=E9=A1=B5?= =?UTF-8?q?=EF=BC=89=EF=BC=9B=E7=99=BB=E5=BD=95=E9=94=99=E8=AF=AF=E7=9C=9F?= =?UTF-8?q?=E5=AE=9E=E5=8E=9F=E5=9B=A0=E9=80=8F=E5=87=BA=E5=88=B0=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E4=B8=8E=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/pages/login/login.vue | 3 +- client/src/pages/profile/profile.vue | 61 +- client/src/pages/settings/settings.vue | 5 +- client/src/utils/version.ts | 4 + server/src/routes/auth.js | 1196 ++++++++++++------------ 5 files changed, 613 insertions(+), 656 deletions(-) create mode 100644 client/src/utils/version.ts diff --git a/client/src/pages/login/login.vue b/client/src/pages/login/login.vue index 201f5ae..975cce3 100644 --- a/client/src/pages/login/login.vue +++ b/client/src/pages/login/login.vue @@ -219,7 +219,8 @@ const wechatLogin = async () => { uni.showToast({ title: '登录成功', icon: 'success' }) setTimeout(() => uni.switchTab({ url: '/pages/index/index' }), 1000) } catch (err) { - uni.showToast({ title: '登录失败,请重试', icon: 'none' }) + const msg = (err && (err.message || err.errMsg)) || '' + uni.showToast({ title: msg ? `登录失败:${msg}` : '登录失败,请重试', icon: 'none' }) } finally { loading.value = false } diff --git a/client/src/pages/profile/profile.vue b/client/src/pages/profile/profile.vue index 0381478..5f85216 100644 --- a/client/src/pages/profile/profile.vue +++ b/client/src/pages/profile/profile.vue @@ -122,22 +122,15 @@ - + - - - - {{ loginLoading ? '登录中...' : '微信一键登录' }} - - - 登录 / 注册 - - 暂不登录,先体验 + + 去登录,同步点亮进度 @@ -155,8 +148,8 @@ import { useUserStore } from '@/stores/user' import { knowledgeApi, aiChatApi } from '@/utils/api' import { DIMENSIONS } from '@/utils/dimensions' import AppIcon from '@/components/AppIcon.vue' +import { APP_VERSION } from '@/utils/version' -const VERSION = '1.2.0' const SUB_GUEST = '游客 · 点亮进度保存在本机,登录后同步' const SUB_USER = '已点亮 {n} 颗星球 · 连续 {d} 天' const PLAN_FREE = '✦ 免费版' @@ -169,9 +162,8 @@ const collectedCount = ref(0) const stats = ref(null) const byDim = ref({}) const quotaInfo = ref(null) -const loginLoading = ref(false) -const versionText = VERSION +const versionText = APP_VERSION const profileSubText = computed(() => { if (!userStore.isLoggedIn) return SUB_GUEST @@ -269,49 +261,6 @@ async function handleLogout() { function goLogin() { uni.navigateTo({ url: '/pages/login/login' }) } -// 小程序端:我的页就地微信一键登录(登录页保留为账号登录入口) -// #ifdef MP-WEIXIN -async function wechatLogin() { - if (loginLoading.value) return - const agreed = uni.getStorageSync('wx_login_agreed') - if (!agreed) { - uni.showModal({ - title: '用户协议', - content: '登录即表示同意《用户协议》与《隐私政策》', - confirmText: '同意并登录', - cancelText: '取消', - success: (res) => { - if (res.confirm) { - uni.setStorageSync('wx_login_agreed', '1') - doWechatLogin() - } - } - }) - return - } - doWechatLogin() -} - -async function doWechatLogin() { - loginLoading.value = true - try { - const loginRes = await new Promise((resolve, reject) => { - uni.login({ success: resolve, fail: reject }) - }) - if (!loginRes.code) throw new Error('no code') - await userStore.login(loginRes.code, {}) - uni.showToast({ title: '登录成功', icon: 'success' }) - // 登录后原地刷新档案数据,无需跳页 - await userStore.fetchMe() - await Promise.all([loadStats(), loadCollected(), loadQuota()]) - } catch (e) { - uni.showToast({ title: '登录失败,请重试', icon: 'none' }) - } finally { - loginLoading.value = false - } -} -// #endif -function goBrowse() { uni.switchTab({ url: '/pages/index/index' }) } function goChat() { uni.switchTab({ url: '/pages/chat/chat' }) } function goFavorites() { uni.navigateTo({ url: '/pages/favorites/favorites' }) } function goProgress() { uni.navigateTo({ url: '/pages/progress/progress' }) } diff --git a/client/src/pages/settings/settings.vue b/client/src/pages/settings/settings.vue index 5ec59eb..e1e78e5 100644 --- a/client/src/pages/settings/settings.vue +++ b/client/src/pages/settings/settings.vue @@ -59,11 +59,12 @@ - 宇之然 AI 维度 v1.0.0 + 宇之然 AI 维度 v{{ appVersion }}