From 431afd618f547cecf9a29433f46d4367619e2ecf Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sun, 22 Mar 2026 00:49:54 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=81=E4=B8=9A=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E9=9D=A2=E5=A2=9E=E5=8A=A0=E4=B8=AA=E4=BA=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=81=E7=A7=BB=E7=9A=84=E5=BC=95=E5=AF=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/locales/langs/en-US/certd.ts | 2 + .../src/locales/langs/zh-CN/certd.ts | 1 + .../certd-client/src/store/settings/index.tsx | 109 +++++++++--------- .../src/views/certd/project/detail/index.vue | 7 +- .../src/views/sys/settings/tabs/mode.vue | 14 ++- .../src/views/sys/settings/tabs/oauth.vue | 2 +- 6 files changed, 79 insertions(+), 56 deletions(-) diff --git a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts index d300dc382..61ea3973c 100644 --- a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts @@ -795,6 +795,8 @@ export default { reverseProxyEmpty: "No reverse proxy list configured", environmentVars: "Environment Variables", environmentVarsHelper: "configure the runtime environment variables, one per line, format: KEY=VALUE", + + bindUrl: "Bind URL", }, }, modal: { diff --git a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts index 39c496214..fcc346979 100644 --- a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts @@ -804,6 +804,7 @@ export default { reverseProxyEmpty: "未配置反向代理", environmentVars: "环境变量", environmentVarsHelper: "配置运行时环境变量,每行一个,格式:KEY=VALUE", + bindUrl: "绑定URL", }, }, modal: { diff --git a/packages/ui/certd-client/src/store/settings/index.tsx b/packages/ui/certd-client/src/store/settings/index.tsx index 09ccb3e24..955c242b4 100644 --- a/packages/ui/certd-client/src/store/settings/index.tsx +++ b/packages/ui/certd-client/src/store/settings/index.tsx @@ -272,14 +272,27 @@ export const useSettingStore = defineStore({ }, async checkUrlBound() { const userStore = useUserStore(); - const settingStore = useSettingStore(); if (!userStore.isAdmin) { return; } + const bindUrl = this.installInfo.bindUrl; + const bindUrl2 = this.installInfo.bindUrl2; + if (!bindUrl) { + //绑定url + await this.doBindUrl("url"); + } else { + //检查当前url 是否与绑定的url一致 + const url = window.location.href; + if (!url.startsWith(bindUrl) && !url.startsWith(bindUrl2)) { + this.openBindUrlModal(); + } + } + }, + + openBindUrlModal() { const event: any = { ModalRef: null }; mitter.emit("getModal", event); const Modal = event.ModalRef; - let modalRef: any = null; const bindUrl = this.installInfo.bindUrl; const bindUrl2 = this.installInfo.bindUrl2; @@ -289,57 +302,47 @@ export const useSettingStore = defineStore({ modalRef.destroy(); } }; - - if (!bindUrl) { - //绑定url - await this.doBindUrl("url"); - } else { - //检查当前url 是否与绑定的url一致 - const url = window.location.href; - if (!url.startsWith(bindUrl) && !url.startsWith(bindUrl2)) { - modalRef = Modal.warning({ - title: "URL地址未绑定,是否绑定此地址?", - width: 500, - keyboard: false, - content: () => { - return ( -
-
- - 绑定地址1: - {bindUrl || "未占用"} - - doBindRequest("url")}> - 绑定到地址1 - -
-
- - 绑定地址2: - {bindUrl2 || "未占用"} - - doBindRequest("url2")}> - 绑定到地址2 - -
-
- ); - }, - onOk: async () => { - // await this.doBindUrl(); - window.location.href = bindUrl; - }, - okButtonProps: { - danger: true, - }, - okText: "不,回到原来的地址", - cancelText: "不,回到原来的地址", - onCancel: () => { - window.location.href = bindUrl; - }, - }); - } - } + const modalRef: any = Modal.warning({ + title: "URL地址未绑定,是否绑定此地址?", + width: 500, + keyboard: false, + content: () => { + return ( +
+
+ + 绑定地址1: + {bindUrl || "未占用"} + + doBindRequest("url")}> + 绑定到地址1 + +
+
+ + 绑定地址2: + {bindUrl2 || "未占用"} + + doBindRequest("url2")}> + 绑定到地址2 + +
+
+ ); + }, + onOk: async () => { + // await this.doBindUrl(); + window.location.href = bindUrl; + }, + okButtonProps: { + danger: true, + }, + okText: "不,回到原来的地址", + cancelText: "不,回到原来的地址", + onCancel: () => { + window.location.href = bindUrl; + }, + }); }, async loadProductInfo() { try { diff --git a/packages/ui/certd-client/src/views/certd/project/detail/index.vue b/packages/ui/certd-client/src/views/certd/project/detail/index.vue index f3cce0f7c..c2bb178cc 100644 --- a/packages/ui/certd-client/src/views/certd/project/detail/index.vue +++ b/packages/ui/certd-client/src/views/certd/project/detail/index.vue @@ -49,6 +49,7 @@ defineOptions({ const route = useRoute(); const projectIdStr = route.query.projectId as string; +const migrate = route.query.migrate as string; let projectId = Number(projectIdStr); const projectStore = useProjectStore(); if (!projectId) { @@ -116,7 +117,11 @@ onMounted(async () => { return; } await loadProjectDetail(); - crudExpose.doRefresh(); + await crudExpose.doRefresh(); + + if (migrate === "true") { + openTransferDialog(); + } }); onActivated(async () => { await crudExpose.doRefresh(); diff --git a/packages/ui/certd-client/src/views/sys/settings/tabs/mode.vue b/packages/ui/certd-client/src/views/sys/settings/tabs/mode.vue index ee466d074..746f5197e 100644 --- a/packages/ui/certd-client/src/views/sys/settings/tabs/mode.vue +++ b/packages/ui/certd-client/src/views/sys/settings/tabs/mode.vue @@ -8,9 +8,10 @@
SaaS模式:每个用户管理自己的流水线和授权资源,独立使用。
企业模式:通过项目合作管理流水线证书和授权资源,所有用户视为企业内部员工。
+
更多管理模式介绍
建议在开始使用时固定一个合适的模式,之后就不要随意切换了。
+
设置为企业模式之后,之前创建的个人数据不会显示,您可以选择 将个人数据迁移到项目
商业版不建议设置为企业模式,除非你确定要转成企业内部使用
-
更多管理模式介绍
@@ -33,6 +34,7 @@ import { useI18n } from "/src/locales"; import { dict } from "@fast-crud/fast-crud"; import { useProjectStore } from "/@/store/project"; import AdminModeIntro from "/@/views/sys/enterprise/project/intro.vue"; +import { useRouter } from "vue-router"; const { t } = useI18n(); defineOptions({ @@ -82,5 +84,15 @@ const onFinish = async (form: any) => { saveLoading.value = false; } }; + +const router = useRouter(); +const goCurrentProject = () => { + router.push({ + path: "/certd/project/detail", + query: { + migrate: "true", + }, + }); +}; diff --git a/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue b/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue index c6782fe07..0d8bacfd5 100644 --- a/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue +++ b/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue @@ -8,7 +8,7 @@
{{ t("certd.sys.setting.passkeyEnabledHelper", [bindDomain]) }}
- {{ t("certd.sys.setting.passkeyHostnameNotSame") }} + {{ t("certd.sys.setting.passkeyHostnameNotSame") }} {{ t("certd.sys.setting.bindUrl") }}