diff --git a/packages/libs/lib-server/src/user/addon/api/api.ts b/packages/libs/lib-server/src/user/addon/api/api.ts index 560bccf2..4e65ce86 100644 --- a/packages/libs/lib-server/src/user/addon/api/api.ts +++ b/packages/libs/lib-server/src/user/addon/api/api.ts @@ -23,6 +23,7 @@ export type AddonDefine = Registrable & { input?: { [key: string]: AddonInputDefine; }; + showTest?: boolean; }; export type AddonInstanceConfig = { 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 84c99f02..e26e524e 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 @@ -707,6 +707,10 @@ export default { pipeline: "Pipeline", }, + addonType: "Type", + addonName: "Name", + addonNameHelper: "Fill freely, helps to distinguish when multiple same type exist", + addonTypeSelect: "Select type", sys: { setting: { showRunStrategy: "Show RunStrategy", @@ -714,7 +718,12 @@ export default { captchaEnabled: "Enable Login Captcha", captchaHelper: "Whether to enable captcha verification for login", - captchaType: "Captcha Type", + captchaType: "Captcha Setting", + + baseSetting: "Base Settings", + registerSetting: "Register Settings", + safeSetting: "Safe Settings", + paymentSetting: "Payment Settings", }, }, 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 13a48dd8..75005bd9 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 @@ -695,7 +695,10 @@ export default { setAsDefault: "设为默认", disabledLabel: "禁用", confirmToggleStatus: "确定要{action}吗?", - + addonType: "类型", + addonName: "名称", + addonNameHelper: "随意填写,相同类型助于区分即可", + addonTypeSelect: "请选择", template: { title: "流水线模版", edit: "流水线模版编辑", @@ -717,7 +720,12 @@ export default { captchaEnabled: "启用登录验证码", captchaHelper: "登录时是否启用验证码", - captchaType: "验证码类型", + captchaType: "验证码配置", + + baseSetting: "基本设置", + registerSetting: "注册设置", + safeSetting: "安全设置", + paymentSetting: "支付设置", }, }, modal: { diff --git a/packages/ui/certd-client/src/views/certd/addon/api.ts b/packages/ui/certd-client/src/views/certd/addon/api.ts index f3004e82..998d65cc 100644 --- a/packages/ui/certd-client/src/views/certd/addon/api.ts +++ b/packages/ui/certd-client/src/views/certd/addon/api.ts @@ -127,3 +127,16 @@ export function createAddonApi(opts: { from: any; addonType: string }) { }, }; } + +export const AddonTypeDefines = { + captcha: { + name: "captcha", + title: "验证码", + showDefault: false, + showTest: false, + }, +}; + +export function getAddonTypeDefine(addonType: string) { + return AddonTypeDefines[addonType]; +} diff --git a/packages/ui/certd-client/src/views/certd/addon/common.tsx b/packages/ui/certd-client/src/views/certd/addon/common.tsx index 9a9e9805..353aea8d 100644 --- a/packages/ui/certd-client/src/views/certd/addon/common.tsx +++ b/packages/ui/certd-client/src/views/certd/addon/common.tsx @@ -6,6 +6,7 @@ import { Modal } from "ant-design-vue"; import { mitter } from "/@/utils/util.mitt"; import { useI18n } from "/src/locales"; import * as pipelineApi from "/@/views/certd/pipeline/api"; +import { getAddonTypeDefine } from "/@/views/certd/addon/api"; export function addonProvide(api: any) { provide("addonApi", api); @@ -104,7 +105,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a // }, // }, type: { - title: t("certd.notificationType"), + title: t("certd.addonType"), type: "dict-select", dict: addonTypeDictRef, search: { @@ -138,7 +139,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a ); }, }, - rules: [{ required: true, message: t("certd.selectNotificationType") }], + rules: [{ required: true, message: t("certd.addonTypeSelect") }], valueChange: { immediate: true, async handle({ value, mode, form, immediate }) { @@ -173,14 +174,14 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a }, } as ColumnCompositionProps, name: { - title: t("certd.notificationName"), + title: t("certd.addonName"), search: { show: true, }, type: ["text"], form: { rules: [{ required: true, message: t("certd.enterName") }], - helper: t("certd.helperNotificationName"), + helper: t("certd.addonNameHelper"), }, column: { width: 200, @@ -196,6 +197,9 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a ], }), form: { + show: computed(() => { + return getAddonTypeDefine(addonType)?.showDefault ?? false; + }), value: false, rules: [{ required: true, message: t("certd.selectIsDefault") }], order: 999, @@ -203,6 +207,9 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a column: { align: "center", width: 100, + show: computed(() => { + return getAddonTypeDefine(addonType)?.showDefault ?? false; + }), component: { name: "a-switch", vModel: "checked", @@ -210,6 +217,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a return value === true; }), on: { + // @ts-ignore change({ row }) { Modal.confirm({ title: t("certd.prompt"), @@ -226,12 +234,12 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a }, }, }, - } as ColumnCompositionProps, + }, test: { title: t("certd.test"), form: { show: compute(({ form }) => { - return !!form.type; + return !!form.type && currentDefine.value?.showTest === true; }), component: { name: "api-test", diff --git a/packages/ui/certd-client/src/views/sys/settings/index.vue b/packages/ui/certd-client/src/views/sys/settings/index.vue index c16a76c5..2c5af5de 100644 --- a/packages/ui/certd-client/src/views/sys/settings/index.vue +++ b/packages/ui/certd-client/src/views/sys/settings/index.vue @@ -5,17 +5,17 @@
- + - + - + - - + +
@@ -30,9 +30,11 @@ import SettingSafe from "/@/views/sys/settings/tabs/safe.vue"; import { useRoute, useRouter } from "vue-router"; import { ref } from "vue"; import { useSettingStore } from "/@/store/settings"; +import { useI18n } from "/@/locales"; defineOptions({ name: "SysSettings", }); +const { t } = useI18n(); const settingsStore = useSettingStore(); const activeKey = ref("base"); const route = useRoute(); diff --git a/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts b/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts index 000194ec..a5272988 100644 --- a/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-captcha/geetest/index.ts @@ -5,22 +5,24 @@ import { ICaptchaAddon } from "../api.js"; @IsAddon({ addonType:"captcha", name: 'geetest', - title: '极验验证码', + title: '极验验证码v4', desc: '', + showTest:false, }) export class GeeTestCaptcha extends BaseAddon implements ICaptchaAddon{ @AddonInput({ - title: 'captchaId', + title: '验证ID', component: { placeholder: 'captchaId', }, + helper:"[极验验证码v4](https://console.geetest.com/sensbot/management) -> 创建业务模块 -> 新增业务场景", required: true, }) captchaId = ''; @AddonInput({ - title: 'captchaKey', + title: '验证Key', component: { placeholder: 'captchaKey', }, diff --git a/packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts b/packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts index 4e58cd63..ff3b79bd 100644 --- a/packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts +++ b/packages/ui/certd-server/src/plugins/plugin-captcha/image/index.ts @@ -8,6 +8,7 @@ import { nanoid } from "nanoid"; name: 'image', title: '图片验证码', desc: '', + showTest:false, }) export class ImageCaptcha extends BaseAddon implements ICaptchaAddon{