diff --git a/packages/libs/lib-huawei/package.json b/packages/libs/lib-huawei/package.json index 01811c3fc..3a17e48f5 100644 --- a/packages/libs/lib-huawei/package.json +++ b/packages/libs/lib-huawei/package.json @@ -1,7 +1,7 @@ { "name": "@certd/lib-huawei", "private": false, - "version": "1.39.15", + "version": "1.39.16", "main": "./dist/bundle.js", "module": "./dist/bundle.js", "types": "./dist/d/index.d.ts", diff --git a/packages/libs/lib-iframe/package.json b/packages/libs/lib-iframe/package.json index 4bc67557b..808b94725 100644 --- a/packages/libs/lib-iframe/package.json +++ b/packages/libs/lib-iframe/package.json @@ -1,7 +1,7 @@ { "name": "@certd/lib-iframe", "private": false, - "version": "1.39.15", + "version": "1.39.16", "type": "module", "main": "./dist/index.js", "module": "./dist/index.js", diff --git a/packages/libs/lib-jdcloud/package.json b/packages/libs/lib-jdcloud/package.json index 7c53c6ecf..d047f0979 100644 --- a/packages/libs/lib-jdcloud/package.json +++ b/packages/libs/lib-jdcloud/package.json @@ -1,6 +1,6 @@ { "name": "@certd/jdcloud", - "version": "1.39.15", + "version": "1.39.16", "description": "jdcloud openApi sdk", "main": "./dist/bundle.js", "module": "./dist/bundle.js", diff --git a/packages/libs/lib-server/src/system/settings/service/models.ts b/packages/libs/lib-server/src/system/settings/service/models.ts index 89e96760f..c8daffbaf 100644 --- a/packages/libs/lib-server/src/system/settings/service/models.ts +++ b/packages/libs/lib-server/src/system/settings/service/models.ts @@ -64,6 +64,7 @@ export class SysPublicSettings extends BaseSettings { type: string; title: string; addonId: number; + icon?: string; }> = {}; notice?: string; diff --git a/packages/libs/midway-flyway-js/package.json b/packages/libs/midway-flyway-js/package.json index b1198c58c..3a49d67ad 100644 --- a/packages/libs/midway-flyway-js/package.json +++ b/packages/libs/midway-flyway-js/package.json @@ -1,6 +1,6 @@ { "name": "@certd/midway-flyway-js", - "version": "1.39.15", + "version": "1.39.16", "description": "midway with flyway, sql upgrade way ", "private": false, "type": "module", diff --git a/packages/ui/certd-client/package.json b/packages/ui/certd-client/package.json index bf9c63fba..8876e98be 100644 --- a/packages/ui/certd-client/package.json +++ b/packages/ui/certd-client/package.json @@ -106,7 +106,7 @@ "zod-defaults": "^0.1.3" }, "devDependencies": { - "@certd/lib-iframe": "^1.39.15", + "@certd/lib-iframe": "^1.39.16", "@certd/pipeline": "^1.39.16", "@rollup/plugin-commonjs": "^25.0.7", "@rollup/plugin-node-resolve": "^15.2.3", diff --git a/packages/ui/certd-client/src/store/settings/api.basic.ts b/packages/ui/certd-client/src/store/settings/api.basic.ts index 4134621de..1d6a248f2 100644 --- a/packages/ui/certd-client/src/store/settings/api.basic.ts +++ b/packages/ui/certd-client/src/store/settings/api.basic.ts @@ -85,6 +85,7 @@ export type SysPublicSetting = { type: string; title: string; addonId: number; + icon?: string; } >; // 系统通知 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/certd/mine/api.ts b/packages/ui/certd-client/src/views/certd/mine/api.ts index c30fb7d78..5cabbd16c 100644 --- a/packages/ui/certd-client/src/views/certd/mine/api.ts +++ b/packages/ui/certd-client/src/views/certd/mine/api.ts @@ -68,20 +68,23 @@ export async function GetOauthProviders() { }); } -export async function UnbindOauth(type: string) { +export async function UnbindOauth(type: string, subtype?: string) { return await request({ url: "/oauth/unbind", method: "POST", - data: { type }, + data: { + type: subtype ? `${type}:${subtype}` : type, + }, }); } -export async function OauthBoundUrl(type: string) { +export async function OauthBoundUrl(type: string, subtype?: string) { return await request({ url: "/oauth/login", method: "POST", data: { type, + subtype, forType: "bind", }, }); diff --git a/packages/ui/certd-client/src/views/certd/mine/user-profile.vue b/packages/ui/certd-client/src/views/certd/mine/user-profile.vue index c7160cae3..8fb3e8145 100644 --- a/packages/ui/certd-client/src/views/certd/mine/user-profile.vue +++ b/packages/ui/certd-client/src/views/certd/mine/user-profile.vue @@ -78,11 +78,11 @@ 未绑定 - + 解绑 - + 绑定 @@ -214,7 +214,7 @@ async function loadOauthProviders() { const computedOauthBounds = computed(() => { const list = oauthProviders.value.map(item => { - const bound = oauthBounds.value.find(bound => bound.type === item.name); + const bound = oauthBounds.value.find(bound => bound.type === buildOauthBoundType(item)); return { ...item, bound, @@ -223,20 +223,24 @@ const computedOauthBounds = computed(() => { return list; }); -async function unbind(type: string) { +function buildOauthBoundType(item: any) { + return item.subtype ? `${item.name}:${item.subtype}` : item.name; +} + +async function unbind(item: any) { Modal.confirm({ title: "确认解绑吗?", okText: "确认", okType: "danger", onOk: async () => { - await api.UnbindOauth(type); + await api.UnbindOauth(item.name, item.subtype); await loadOauthBounds(); }, }); } -async function bind(type: string) { - const res = await api.OauthBoundUrl(type); +async function bind(item: any) { + const res = await api.OauthBoundUrl(item.name, item.subtype); const loginUrl = res.loginUrl; window.location.href = loginUrl; } diff --git a/packages/ui/certd-client/src/views/framework/oauth/api.ts b/packages/ui/certd-client/src/views/framework/oauth/api.ts index 1c5ab8ae5..2149b767a 100644 --- a/packages/ui/certd-client/src/views/framework/oauth/api.ts +++ b/packages/ui/certd-client/src/views/framework/oauth/api.ts @@ -2,7 +2,7 @@ import { request } from "/src/api/service"; const apiPrefix = "/oauth"; -export async function OauthLogin(type: string, forType?: string, from?: string) { +export async function OauthLogin(type: string, forType?: string, from?: string, subtype?: string) { return await request({ url: apiPrefix + `/login`, method: "post", @@ -10,6 +10,7 @@ export async function OauthLogin(type: string, forType?: string, from?: string) type, forType: forType || "login", from: from || "web", + subtype, }, }); } 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 05035cb51..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; } @@ -98,7 +103,7 @@ async function autoRegister() { //登录成功 userStore.onLoginSuccess(res); //跳转到首页 - router.replace("/"); + router.replace("/index"); }