From 15ab3f0b633c1c7fe19c5d255449f6b1d49d5428 Mon Sep 17 00:00:00 2001 From: txai-dev Date: Sun, 13 Sep 2026 12:20:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=88=91=E7=9A=84=E9=A1=B5=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E4=B8=80=E9=94=AE=E7=99=BB=E5=BD=95=E5=B0=B1=E5=9C=B0?= =?UTF-8?q?=E5=AE=8C=E6=88=90=EF=BC=88=E4=B8=8D=E8=B7=B3=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=EF=BC=89=EF=BC=8CH5=20=E7=AB=AF=E8=B5=B0=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E9=A1=B5=E5=85=A5=E5=8F=A3=E2=80=94=E2=80=94v1.2.0=20?= =?UTF-8?q?=E6=9C=AA=E6=8F=90=E5=AE=A1=E6=B2=BF=E7=94=A8=E5=90=8C=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + client/src/pages/profile/profile.vue | 57 +++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af2ee5..abe6b84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## v1.2.0(2026-09-13)星图点亮体系重构 - **登录修复**:微信一键登录恢复(Docker 迁移环境变量补齐 + 容器网络修复);趋势页筛选按钮单行紧凑化、产品图标修复 +- **我的页就地登录**:小程序端"微信一键登录"点击直接登录(首次协议确认一次),不再跳登录页;登录页保留为账号登录入口(H5 端按钮改为"登录/注册") - **详情页修复**:正文按段落渲染,71 条知识不再"暂无内容" - **读后检测**:AI 批量生成 36 道检测题,服务端判题,答对点亮星球(点亮进度/streak 入档案) diff --git a/client/src/pages/profile/profile.vue b/client/src/pages/profile/profile.vue index da5f297..0381478 100644 --- a/client/src/pages/profile/profile.vue +++ b/client/src/pages/profile/profile.vue @@ -124,9 +124,18 @@ - - 微信一键登录 + + + + {{ loginLoading ? '登录中...' : '微信一键登录' }} + + + + + 登录 / 注册 + + 暂不登录,先体验 @@ -160,6 +169,7 @@ const collectedCount = ref(0) const stats = ref(null) const byDim = ref({}) const quotaInfo = ref(null) +const loginLoading = ref(false) const versionText = VERSION @@ -258,6 +268,49 @@ 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' }) }