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; }