From 45dedf5bc779fea852e1f33dda4f31db2765633c Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Wed, 13 May 2026 23:47:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E7=99=BB=E5=BD=95=E4=B8=A2=E5=A4=B1state=E6=97=B6?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=9C=A8=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=BB=91=E5=AE=9A=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/certd-client/src/store/user/index.ts | 3 +++ .../views/framework/oauth/oauth-callback.vue | 21 ++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/ui/certd-client/src/store/user/index.ts b/packages/ui/certd-client/src/store/user/index.ts index 6a2f5e360..0c8a37d8e 100644 --- a/packages/ui/certd-client/src/store/user/index.ts +++ b/packages/ui/certd-client/src/store/user/index.ts @@ -38,6 +38,9 @@ export const useUserStore = defineStore({ getToken(): string { return this.token || LocalStorage.get(TOKEN_KEY); }, + isLogined(): boolean { + return !!this.getToken; + }, isAdmin(): boolean { return this.getUserInfo.roleIds?.includes(1) || this.getUserInfo.id === 1; }, diff --git a/packages/ui/certd-client/src/views/framework/oauth/oauth-callback.vue b/packages/ui/certd-client/src/views/framework/oauth/oauth-callback.vue index e470adaef..9b05a6c8e 100644 --- a/packages/ui/certd-client/src/views/framework/oauth/oauth-callback.vue +++ b/packages/ui/certd-client/src/views/framework/oauth/oauth-callback.vue @@ -9,8 +9,9 @@
第三方({{ oauthType }})登录成功,您还未绑定账号,请选择
- 绑定已有账号 - 创建新账号 + 绑定已有账号 + 绑定当前登录账号({{ userStore.getUserInfo.username }} - {{ userStore.getUserInfo.nickName }}) + 创建新账号绑定
@@ -63,6 +64,15 @@ async function handleOauthToken() { } } +async function doBindCurrent() { + await api.BindUser(validationCode); + notification.success({ + message: "绑定成功", + }); + //跳转到首页 + router.replace("/certd/mine/user-profile"); +} + onMounted(async () => { if (error.value) { return; @@ -70,12 +80,7 @@ onMounted(async () => { if (forType === "bind") { //从用户中心页面,进行第三方账号的绑定 - await api.BindUser(validationCode); - notification.success({ - message: "绑定成功", - }); - //跳转到首页 - router.replace("/certd/mine/user-profile"); + await doBindCurrent(); return; }