More translation

This commit is contained in:
Lorenzo
2025-06-27 01:31:31 +02:00
parent adc3ab7e0a
commit fc1084ce33
18 changed files with 2772 additions and 2253 deletions
@@ -447,4 +447,237 @@ export default {
subdomainManagement: "Subdomain Management", subdomainManagement: "Subdomain Management",
isDisabled: "Is Disabled", isDisabled: "Is Disabled",
enabled: "Enabled", enabled: "Enabled",
uploadCustomCert: "Upload Custom Certificate",
sourcee: "Source",
sourcePipeline: "Pipeline",
sourceManualUpload: "Manual Upload",
domains: "Domains",
enterDomain: "Please enter domain",
validDays: "Valid Days",
expires: " expires",
days: " days",
expireTime: "Expiration Time",
certIssuer: "Certificate Issuer",
applyTime: "Application Time",
relatedPipeline: "Related Pipeline",
statusSuccess: "Success",
statusChecking: "Checking",
statusError: "Error",
actionImportBatch: "Batch Import",
actionSyncIp: "Sync IP",
modalTitleSyncIp: "Sync IP",
modalContentSyncIp: "Are you sure to sync IP?",
notificationSyncComplete: "Sync Complete",
actionCheckAll: "Check All",
modalTitleConfirm: "Confirm",
modalContentCheckAll: "Confirm to trigger checking all IP site's certificates?",
notificationCheckSubmitted: "Check task submitted",
notificationCheckDescription: "Please refresh later to see results",
tooltipCheckNow: "Check Now",
notificationCheckSubmittedPleaseRefresh: "Check task submitted, please refresh later",
columnId: "ID",
columnIp: "IP",
helperIpCname: "Supports entering CNAME domain name",
ruleIpRequired: "Please enter IP",
columnCertDomains: "Certificate Domains",
columnCertProvider: "Issuer",
columnCertStatus: "Certificate Status",
statusNormal: "Normal",
statusExpired: "Expired",
columnCertExpiresTime: "Certificate Expiration Time",
expired: "expired",
columnCheckStatus: "Check Status",
columnLastCheckTime: "Last Check Time",
columnSource: "Source",
sourceSync: "Sync",
sourceManual: "Manual",
sourceImport: "Import",
columnDisabled: "Enabled/Disabled",
columnRemark: "Remark",
pluginFile: "Plugin File",
selectPluginFile: "Select plugin file",
overrideSameName: "Override same name",
override: "Override",
noOverride: "No override",
overrideHelper: "If a plugin with the same name exists, override it directly",
importPlugin: "Import Plugin",
operationSuccess: "Operation successful",
customPlugin: "Custom Plugin",
import: "Import",
export: "Export",
pluginType: "Plugin Type",
auth: "Authorization",
dns: "DNS",
deployPlugin: "Deploy Plugin",
icon: "Icon",
pluginName: "Plugin Name",
pluginNameHelper: "Must be English letters or digits, camelCase with type prefix\nExample: AliyunDeployToCDN\nDo not modify name once plugin is used",
pluginNameRuleMsg: "Must be English letters or digits, camelCase with type prefix",
author: "Author",
authorHelper: "Used as prefix when uploading to plugin store, e.g., greper/pluginName",
authorRuleMsg: "Must be English letters or digits",
titleHelper: "Plugin name in Chinese",
descriptionHelper: "Description of the plugin",
builtIn: "Built-in",
custom: "Custom",
store: "Store",
version: "Version",
pluginDependencies: "Plugin Dependencies",
pluginDependenciesHelper: "Dependencies to install first in format: [author/]pluginName[:version]",
editableRunStrategy: "Editable Run Strategy",
editable: "Editable",
notEditable: "Not Editable",
runStrategy: "Run Strategy",
normalRun: "Normal Run",
skipOnSuccess: "Skip on success (Deploy task)",
defaultRunStrategyHelper: "Default run strategy",
enableDisable: "Enable/Disable",
clickToToggle: "Click to toggle enable/disable",
confirmToggle: "Are you sure to",
disable: "disable",
enable: "enable",
pluginGroup: "Plugin Group",
icpRegistrationNumber: "ICP Registration Number",
icpPlaceholder: "Guangdong ICP xxxxxxx Number",
publicSecurityRegistrationNumber: "Public Security Registration Number",
publicSecurityPlaceholder: "Beijing Public Security xxxxxxx Number",
enableAssistant: "Enable Assistant",
allowCrawlers: "Allow Crawlers",
httpProxy: "HTTP Proxy",
httpProxyPlaceholder: "http://192.168.1.2:18010/",
httpProxyHelper: "Configure when some websites are blocked",
httpsProxy: "HTTPS Proxy",
httpsProxyPlaceholder: "http://192.168.1.2:18010/",
saveThenTestTitle: "Save first, then click test",
testButton: "Test",
httpsProxyHelper: "Usually both proxies are the same, save first then test",
dualStackNetwork: "Dual Stack Network",
default: "Default",
ipv4Priority: "IPv4 Priority",
ipv6Priority: "IPv6 Priority",
dualStackNetworkHelper: "If IPv6 priority is selected, enable IPv6 in docker-compose.yaml",
enableCommonCnameService: "Enable Public CNAME Service",
commonCnameHelper: "Allow use of public CNAME service. If disabled and no <router-link to='/sys/cname/provider'>custom CNAME service</router-link> is set, CNAME proxy certificate application will not work.",
saveButton: "Save",
stopSuccess: "Stopped successfully",
google: "Google",
baidu: "Baidu",
success: "Success",
testFailed: "Test Failed",
testCompleted: "Test Completed",
manageOtherUserPipeline: "Manage other users' pipelines",
limitUserPipelineCount: "Limit user pipeline count",
limitUserPipelineCountHelper: "0 means no limit",
enableSelfRegistration: "Enable self-registration",
enableUserValidityPeriod: "Enable user validity period",
userValidityPeriodHelper: "Users can use normally within validity; pipelines disabled after expiry",
enableUsernameRegistration: "Enable username registration",
enableEmailRegistration: "Enable email registration",
proFeature: "Pro feature",
emailServerSetup: "Set up email server",
enableSmsLoginRegister: "Enable SMS login and registration",
commFeature: "Commercial feature",
smsProvider: "SMS provider",
aliyunSms: "Aliyun SMS",
yfySms: "YFY SMS",
smsTest: "SMS test",
testMobilePlaceholder: "Enter test mobile number",
saveThenTest: "Save first then test",
enterTestMobile: "Please enter test mobile number",
sendSuccess: "Sent successfully",
atLeastOneLoginRequired: "At least one of password login or SMS login must be enabled",
fieldRequired: "This field is required",
siteHide: "Site Hide",
enableSiteHide: "Enable Site Hide",
siteHideDescription: "You can disable site accessibility normally and enable it when needed to enhance site security",
helpDoc: "Help Document",
randomAddress: "Random Address",
siteHideUrlHelper: "After the site is hidden, you need to visit this URL to unlock to access normally",
fullUnlockUrl: "Full Unlock URL",
saveThisUrl: "Please save this URL carefully",
unlockPassword: "Unlock Password",
unlockPasswordHelper: "Password needed to unlock the hide; set on first time or reset when filled",
autoHideTime: "Auto Hide Time",
autoHideTimeHelper: "Minutes without requests before auto hiding",
hideOpenApi: "Hide Open API",
hideOpenApiHelper: "Whether to hide open APIs; whether to expose /api/v1 prefixed endpoints",
hideSiteImmediately: "Hide Site Immediately",
hideImmediately: "Hide Immediately",
confirmHideSiteTitle: "Are you sure to hide the site immediately?",
confirmHideSiteContent: "After hiding, the site will be inaccessible. Please operate cautiously.",
siteHiddenSuccess: "Site has been hidden",
emailServerSettings: "Email Server Settings",
setEmailSendingServer: "Set the email sending server",
useCustomEmailServer: "Use Custom Email Server",
smtpDomain: "SMTP Domain",
pleaseEnterSmtpDomain: "Please enter SMTP domain or IP",
smtpPort: "SMTP Port",
pleaseEnterSmtpPort: "Please enter SMTP port",
username: "Username",
pleaseEnterUsername: "Please enter username",
password: "Password",
pleaseEnterPassword: "Please enter password",
qqEmailAuthCodeHelper: "If using QQ email, get an authorization code in QQ email settings as the password",
senderEmail: "Sender Email",
pleaseEnterSenderEmail: "Please enter sender email",
useSsl: "Use SSL",
sslPortNote: "SSL and non-SSL SMTP ports are different, please adjust port accordingly",
ignoreCertValidation: "Ignore Certificate Validation",
useOfficialEmailServer: "Use Official Email Server",
useOfficialEmailServerHelper: "Send emails directly using the official server to avoid complicated setup",
testReceiverEmail: "Test Receiver Email",
pleaseEnterTestReceiverEmail: "Please enter test receiver email",
saveBeforeTest: "Save before testing",
sendFailHelpDoc: "Failed to send??? ",
emailConfigHelpDoc: "Email configuration help document",
tryOfficialEmailServer: "You can also try using the official email server ↗↗↗↗↗↗↗↗",
pluginManagement: "Plugin Management",
pluginBetaWarning: "Custom plugins are in BETA and may have breaking changes in future",
pleaseSelectRecord: "Please select records first",
permissionManagement: "Permission Management",
adda: "Add",
rootNode: "Root Node",
permissionName: "Permission Name",
enterPermissionName: "Please enter permission name",
permissionCode: "Permission Code",
enterPermissionCode: "Please enter permission code",
max100Chars: "Maximum 100 characters",
examplePermissionCode: "e.g.: sys:user:view",
sortOrder: "Sort Order",
sortRequired: "Sort order is required",
parentNode: "Parent Node",
roleManagement: "Role Management",
assignPermissions: "Assign Permissions",
roleName: "Role Name",
enterRoleName: "Please enter role name",
unlockLogin: "Unlock Login",
notice: "Notice",
confirmUnlock: "Are you sure you want to unlock this user's login?",
unlockSuccess: "Unlock successful",
enterUsername: "Please enter username",
modifyPasswordIfFilled: "Fill in to change the password",
emaila: "Email",
mobile: "Mobile",
avatar: "Avatar",
validTime: "Valid Time",
remark: "Remark",
roles: "Roles",
cnameTitle: "CNAME Service Configuration",
cnameDescription:
"The domain name configured here serves as a proxy for verifying other domains. When other domains apply for certificates, they map to this domain via CNAME for ownership verification. The advantage is that any domain can apply for a certificate this way without providing an AccessSecret.",
cnameLinkText: "CNAME principle and usage instructions",
confirmTitle: "Confirm",
confirmDeleteBatch: "Are you sure you want to delete these {count} records?",
selectRecordsFirst: "Please select records first",
cnameDomain: "CNAME Domain",
cnameDomainPlaceholder: "cname.handsfree.work",
cnameDomainHelper:
"Requires a domain registered with a DNS provider on the right (or you can transfer other domain DNS servers here).\nOnce the CNAME domain is set, it cannot be changed. It is recommended to use a first-level subdomain.",
dnsProvider: "DNS Provider",
dnsProviderAuthorization: "DNS Provider Authorization",
setDefault: "Set Default",
confirmSetDefault: "Are you sure to set as default?",
setAsDefault: "Set as Default",
disabledLabel: "Disabled",
confirmToggleStatus: "Are you sure to {action}?",
}; };
@@ -453,4 +453,238 @@ export default {
subdomainManagement: "子域管理", subdomainManagement: "子域管理",
isDisabled: "是否禁用", isDisabled: "是否禁用",
enabled: "启用", enabled: "启用",
uploadCustomCert: "上传自定义证书",
sourcee: "来源",
sourcePipeline: "流水线",
sourceManualUpload: "手动上传",
domains: "域名",
enterDomain: "请输入域名",
validDays: "有效天数",
expires: "过期",
days: "天",
expireTime: "过期时间",
certIssuer: "证书颁发机构",
applyTime: "申请时间",
relatedPipeline: "关联流水线",
statusSuccess: "成功",
statusChecking: "检查中",
statusError: "异常",
actionImportBatch: "批量导入",
actionSyncIp: "同步IP",
modalTitleSyncIp: "同步IP",
modalContentSyncIp: "确定要同步IP吗?",
notificationSyncComplete: "同步完成",
actionCheckAll: "检查全部",
modalTitleConfirm: "确认",
modalContentCheckAll: "确认触发检查全部IP站点的证书吗?",
notificationCheckSubmitted: "检查任务已提交",
notificationCheckDescription: "请稍后刷新页面查看结果",
tooltipCheckNow: "立即检查",
notificationCheckSubmittedPleaseRefresh: "检查任务已提交,请稍后刷新查看结果",
columnId: "ID",
columnIp: "IP",
helperIpCname: "也支持填写CNAME域名",
ruleIpRequired: "请输入IP",
columnCertDomains: "证书域名",
columnCertProvider: "颁发机构",
columnCertStatus: "证书状态",
statusNormal: "正常",
statusExpired: "过期",
columnCertExpiresTime: "证书到期时间",
expired: "过期",
columnCheckStatus: "检查状态",
columnLastCheckTime: "上次检查时间",
columnSource: "来源",
sourceSync: "同步",
sourceManual: "手动",
sourceImport: "导入",
columnDisabled: "禁用启用",
columnRemark: "备注",
pluginFile: "插件文件",
selectPluginFile: "选择插件文件",
overrideSameName: "同名覆盖",
override: "覆盖",
noOverride: "不覆盖",
overrideHelper: "如果已有相同名称插件,直接覆盖",
importPlugin: "导入插件",
operationSuccess: "操作成功",
customPlugin: "自定义插件",
import: "导入",
export: "导出",
pluginType: "插件类型",
auth: "授权",
dns: "DNS",
deployPlugin: "部署插件",
icon: "图标",
pluginName: "插件名称",
pluginNameHelper: "必须为英文或数字,驼峰命名,类型作为前缀\n示例:AliyunDeployToCDN\n插件使用后,名称不可修改",
pluginNameRuleMsg: "必须为英文或数字,驼峰命名,类型作为前缀",
author: "作者",
authorHelper: "上传插件市场时作为前缀,如 greper/pluginName",
authorRuleMsg: "必须为英文或数字",
titleHelper: "插件中文名称",
descriptionHelper: "插件描述",
builtIn: "内置",
custom: "自定义",
store: "市场",
version: "版本",
pluginDependencies: "插件依赖",
pluginDependenciesHelper: "格式: [作者/]插件名[:版本],需先安装依赖插件",
editableRunStrategy: "可编辑运行策略",
editable: "可编辑",
notEditable: "不可编辑",
runStrategy: "运行策略",
normalRun: "正常运行",
skipOnSuccess: "成功跳过(部署任务)",
defaultRunStrategyHelper: "默认运行策略",
enableDisable: "启用/禁用",
clickToToggle: "点击切换启用/禁用",
confirmToggle: "确认要",
disable: "禁用",
enable: "启用",
pluginGroup: "插件分组",
icpRegistrationNumber: "ICP备案号",
icpPlaceholder: "粤ICP备xxxxxxx号",
publicSecurityRegistrationNumber: "网安备案号",
publicSecurityPlaceholder: "京公网安备xxxxxxx号",
enableAssistant: "开启小助手",
allowCrawlers: "允许爬虫",
httpProxy: "HTTP代理",
httpProxyPlaceholder: "http://192.168.1.2:18010/",
httpProxyHelper: "当某些网站被墙时可以配置",
httpsProxy: "HTTPS代理",
httpsProxyPlaceholder: "http://192.168.1.2:18010/",
saveThenTestTitle: "保存后,再点击测试",
testButton: "测试",
httpsProxyHelper: "一般这两个代理填一样的,保存后再测试",
dualStackNetwork: "双栈网络",
default: "默认",
ipv4Priority: "IPV4优先",
ipv6Priority: "IPV6优先",
dualStackNetworkHelper: "如果选择IPv6优先,需要在docker-compose.yaml中启用ipv6",
enableCommonCnameService: "启用公共CNAME服务",
commonCnameHelper: "是否可以使用公共CNAME服务,如果禁用,且没有设置<router-link to='/sys/cname/provider'>自定义CNAME服务</router-link>,则无法使用CNAME代理方式申请证书",
saveButton: "保存",
stopSuccess: "停止成功",
google: "Google",
baidu: "百度",
success: "成功",
testFailed: "测试失败",
testCompleted: "测试完成",
manageOtherUserPipeline: "管理其他用户流水线",
limitUserPipelineCount: "限制用户流水线数量",
limitUserPipelineCountHelper: "0为不限制",
enableSelfRegistration: "开启自助注册",
enableUserValidityPeriod: "开启用户有效期",
userValidityPeriodHelper: "有效期内用户可正常使用,失效后流水线将被停用",
enableUsernameRegistration: "开启用户名注册",
enableEmailRegistration: "开启邮箱注册",
proFeature: "专业版功能",
emailServerSetup: "设置邮箱服务器",
enableSmsLoginRegister: "开启手机号登录、注册",
commFeature: "商业版功能",
smsProvider: "短信提供商",
aliyunSms: "阿里云短信",
yfySms: "易发云短信",
smsTest: "短信测试",
testMobilePlaceholder: "输入测试手机号",
saveThenTest: "保存后再点击测试",
enterTestMobile: "请输入测试手机号",
sendSuccess: "发送成功",
atLeastOneLoginRequired: "密码登录和手机号登录至少开启一个",
fieldRequired: "此项必填",
siteHide: "站点隐藏",
enableSiteHide: "启用站点隐藏",
siteHideDescription: "可以在平时关闭站点的可访问性,需要时再打开,增强站点安全性",
helpDoc: "帮助说明",
randomAddress: "随机地址",
siteHideUrlHelper: "站点被隐藏后,需要访问此URL解锁,才能正常访问",
fullUnlockUrl: "完整解除隐藏地址",
saveThisUrl: "请保存好此地址",
unlockPassword: "解除密码",
unlockPasswordHelper: "解除隐藏时需要输入密码,第一次需要设置密码,填写则重置密码",
autoHideTime: "自动隐藏时间",
autoHideTimeHelper: "多少分钟内无请求自动隐藏",
hideOpenApi: "隐藏开放接口",
hideOpenApiHelper: "是否隐藏开放接口,是否放开/api/v1开头的接口",
hideSiteImmediately: "立即隐藏站点",
hideImmediately: "立即隐藏",
confirmHideSiteTitle: "确定要立即隐藏站点吗?",
confirmHideSiteContent: "隐藏后,将无法访问站点,请谨慎操作",
siteHiddenSuccess: "站点已隐藏",
emailServerSettings: "邮件服务器设置",
setEmailSendingServer: "设置邮件发送服务器",
useCustomEmailServer: "使用自定义邮件服务器",
smtpDomain: "SMTP域名",
pleaseEnterSmtpDomain: "请输入smtp域名或ip",
smtpPort: "SMTP端口",
pleaseEnterSmtpPort: "请输入smtp端口号",
username: "用户名",
pleaseEnterUsername: "请输入用户名",
password: "密码",
pleaseEnterPassword: "请输入密码",
qqEmailAuthCodeHelper: "如果是qq邮箱,需要到qq邮箱的设置里面申请授权码作为密码",
senderEmail: "发件邮箱",
pleaseEnterSenderEmail: "请输入发件邮箱",
useSsl: "是否ssl",
sslPortNote: "ssl和非ssl的smtp端口是不一样的,注意修改端口",
ignoreCertValidation: "忽略证书校验",
useOfficialEmailServer: "使用官方邮件服务器",
useOfficialEmailServerHelper: "使用官方邮箱服务器直接发邮件,免除繁琐的配置",
testReceiverEmail: "测试收件邮箱",
pleaseEnterTestReceiverEmail: "请输入测试收件邮箱",
saveBeforeTest: "保存后再点击测试",
sendFailHelpDoc: "发送失败???",
emailConfigHelpDoc: "邮件配置帮助文档",
tryOfficialEmailServer: "您还可以试试使用官方邮件服务器↗↗↗↗↗↗↗↗",
pluginManagement: "插件管理",
pluginBetaWarning: "自定义插件处于BETA测试版,后续可能会有破坏性变更",
pleaseSelectRecord: "请先勾选记录",
permissionManagement: "权限管理",
adda: "添加",
rootNode: "根节点",
permissionName: "权限名称",
enterPermissionName: "请输入权限名称",
permissionCode: "权限代码",
enterPermissionCode: "请输入权限代码",
max100Chars: "最大100个字符",
examplePermissionCode: "例如:sys:user:view",
sortOrder: "排序",
sortRequired: "排序号必填",
parentNode: "父节点",
roleManagement: "角色管理",
assignPermissions: "分配权限",
roleName: "角色名称",
enterRoleName: "请输入角色名称",
unlockLogin: "解除登录锁定",
notice: "提示",
confirmUnlock: "确定要解除该用户的登录锁定吗?",
unlockSuccess: "解除成功",
enterUsername: "请输入用户名",
modifyPasswordIfFilled: "填写则修改密码",
emaila: "邮箱",
mobile: "手机号",
avatar: "头像",
validTime: "有效期",
remark: "备注",
roles: "角色",
cnameTitle: "CNAME服务配置",
cnameDescription:
"此处配置的域名作为其他域名校验的代理,当别的域名需要申请证书时,通过CNAME映射到此域名上来验证所有权。好处是任何域名都可以通过此方式申请证书,也无需填写AccessSecret。",
cnameLinkText: "CNAME功能原理及使用说明",
confirmTitle: "确认",
confirmDeleteBatch: "确定要批量删除这{count}条记录吗",
selectRecordsFirst: "请先勾选记录",
cnameDomain: "CNAME域名",
cnameDomainPlaceholder: "cname.handsfree.work",
cnameDomainHelper:
"需要一个右边DNS提供商注册的域名(也可以将其他域名的dns服务器转移到这几家来)。\nCNAME域名一旦确定不可修改,建议使用一级子域名",
dnsProvider: "DNS提供商",
dnsProviderAuthorization: "DNS提供商授权",
setDefault: "设置默认",
confirmSetDefault: "确定要设置为默认吗?",
setAsDefault: "设为默认",
disabledLabel: "禁用",
confirmToggleStatus: "确定要{action}吗?",
}; };
@@ -82,7 +82,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
show: true, show: true,
buttons: { buttons: {
add: { add: {
text: "上传自定义证书", text: t('certd.uploadCustomCert'),
type: "primary", type: "primary",
show: false, show: false,
async click() { async click() {
@@ -150,15 +150,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
fromType: { fromType: {
title: "来源", title: t('certd.sourcee'),
search: { search: {
show: true, show: true,
}, },
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
data: [ data: [
{ label: "流水线", value: "pipeline" }, { label: t('certd.sourcePipeline'), value: "pipeline" },
{ label: "手动上传", value: "upload" }, { label: t('certd.sourceManualUpload'), value: "upload" },
], ],
}), }),
form: { form: {
@@ -179,13 +179,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
domains: { domains: {
title: "域名", title: t('certd.domains'),
search: { search: {
show: true, show: true,
}, },
type: "text", type: "text",
form: { form: {
rules: [{ required: true, message: "请输入域名" }], rules: [{ required: true, message: t('certd.enterDomain') }],
}, },
column: { column: {
width: 450, width: 450,
@@ -197,7 +197,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
domainCount: { domainCount: {
title: "域名数量", title: t('certd.domainCount'),
type: "number", type: "number",
form: { form: {
show: false, show: false,
@@ -209,7 +209,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
expiresLeft: { expiresLeft: {
title: "有效天数", title: t('certd.validDays'),
search: { search: {
show: false, show: false,
}, },
@@ -229,12 +229,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const leftDays = dayjs(value).diff(dayjs(), "day"); const leftDays = dayjs(value).diff(dayjs(), "day");
const color = leftDays < 20 ? "red" : "#389e0d"; const color = leftDays < 20 ? "red" : "#389e0d";
const percent = (leftDays / 90) * 100; const percent = (leftDays / 90) * 100;
return <a-progress title={expireDate + "过期"} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}`} />; return <a-progress title={expireDate + t('certd.expires')} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}${t('certd.days')}`} />;
}, },
}, },
}, },
expiresTime: { expiresTime: {
title: "过期时间", title: t('certd.expireTime'),
search: { search: {
show: false, show: false,
}, },
@@ -247,7 +247,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certProvider: { certProvider: {
title: "证书颁发机构", title: t('certd.certIssuer'),
search: { search: {
show: false, show: false,
}, },
@@ -260,7 +260,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
applyTime: { applyTime: {
title: "申请时间", title: t('certd.applyTime'),
search: { search: {
show: false, show: false,
}, },
@@ -273,7 +273,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
"pipeline.title": { "pipeline.title": {
title: "关联流水线", title: t('certd.relatedPipeline'),
search: { show: false }, search: { show: false },
type: "link", type: "link",
form: { form: {
@@ -291,6 +291,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
}, },
}, },
}, },
}; };
@@ -7,6 +7,7 @@ import { Modal, notification } from "ant-design-vue";
import { useSiteIpMonitor } from "/@/views/certd/monitor/site/ip/use"; import { useSiteIpMonitor } from "/@/views/certd/monitor/site/ip/use";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n();
const api = siteIpApi; const api = siteIpApi;
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
@@ -36,9 +37,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const checkStatusDict = dict({ const checkStatusDict = dict({
data: [ data: [
{ label: "成功", value: "ok", color: "green" }, { label: t("certd.statusSuccess"), value: "ok", color: "green" },
{ label: "检查中", value: "checking", color: "blue" }, { label: t("certd.statusChecking"), value: "checking", color: "blue" },
{ label: "异常", value: "error", color: "red" }, { label: t("certd.statusError"), value: "error", color: "red" },
], ],
}); });
const { openSiteIpImportDialog } = useSiteIpMonitor(); const { openSiteIpImportDialog } = useSiteIpMonitor();
@@ -74,7 +75,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
import: { import: {
show: true, show: true,
text: "批量导入", text: t("certd.actionImportBatch"),
type: "primary", type: "primary",
async click() { async click() {
openSiteIpImportDialog({ openSiteIpImportDialog({
@@ -86,34 +87,34 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
load: { load: {
text: "同步IP", text: t("certd.actionSyncIp"),
type: "primary", type: "primary",
async click() { async click() {
Modal.confirm({ Modal.confirm({
title: "同步IP", title: t("certd.modalTitleSyncIp"),
content: "确定要同步IP吗?", content: t("certd.modalContentSyncIp"),
onOk: async () => { onOk: async () => {
await api.DoSync(context.props.siteId); await api.DoSync(context.props.siteId);
await crudExpose.doRefresh(); await crudExpose.doRefresh();
notification.success({ notification.success({
message: "同步完成", message: t("certd.notificationSyncComplete"),
}); });
}, },
}); });
}, },
}, },
checkAll: { checkAll: {
text: "检查全部", text: t("certd.actionCheckAll"),
type: "primary", type: "primary",
click: () => { click: () => {
Modal.confirm({ Modal.confirm({
title: "确认", title: t("certd.modalTitleConfirm"),
content: "确认触发检查全部IP站点的证书吗?", content: t("certd.modalContentCheckAll"),
onOk: async () => { onOk: async () => {
await siteIpApi.CheckAll(context.props.siteId); await siteIpApi.CheckAll(context.props.siteId);
notification.success({ notification.success({
message: "检查任务已提交", message: t("certd.notificationCheckSubmitted"),
description: "请稍后刷新页面查看结果", description: t("certd.notificationCheckDescription"),
}); });
}, },
}); });
@@ -130,14 +131,14 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
type: "link", type: "link",
text: null, text: null,
tooltip: { tooltip: {
title: "立即检查", title: t("certd.tooltipCheckNow"),
}, },
icon: "ion:play-sharp", icon: "ion:play-sharp",
click: async ({ row }) => { click: async ({ row }) => {
await api.DoCheck(row.id); await api.DoCheck(row.id);
await crudExpose.doRefresh(); await crudExpose.doRefresh();
notification.success({ notification.success({
message: "检查任务已提交,请稍后刷新查看结果", message: t("certd.notificationCheckSubmittedPleaseRefresh"),
}); });
}, },
}, },
@@ -145,7 +146,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
columns: { columns: {
id: { id: {
title: "ID", title: t("certd.columnId"),
key: "id", key: "id",
type: "number", type: "number",
search: { search: {
@@ -160,21 +161,21 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
ipAddress: { ipAddress: {
title: "IP", title: t("certd.columnIp"),
search: { search: {
show: true, show: true,
}, },
type: "text", type: "text",
helper: "也支持填写CNAME域名", helper: t("certd.helperIpCname"),
form: { form: {
rules: [{ required: true, message: "请输入IP" }], rules: [{ required: true, message: t("certd.ruleIpRequired") }],
}, },
column: { column: {
width: 160, width: 160,
}, },
}, },
certDomains: { certDomains: {
title: "证书域名", title: t("certd.columnCertDomains"),
search: { search: {
show: false, show: false,
}, },
@@ -196,7 +197,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certProvider: { certProvider: {
title: "颁发机构", title: t("certd.columnCertProvider"),
search: { search: {
show: false, show: false,
}, },
@@ -214,15 +215,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certStatus: { certStatus: {
title: "证书状态", title: t("certd.columnCertStatus"),
search: { search: {
show: true, show: true,
}, },
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
data: [ data: [
{ label: "正常", value: "ok", color: "green" }, { label: t("certd.statusNormal"), value: "ok", color: "green" },
{ label: "过期", value: "expired", color: "red" }, { label: t("certd.statusExpired"), value: "expired", color: "red" },
], ],
}), }),
form: { form: {
@@ -236,7 +237,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
certExpiresTime: { certExpiresTime: {
title: "证书到期时间", title: t("certd.columnCertExpiresTime"),
search: { search: {
show: false, show: false,
}, },
@@ -254,12 +255,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const leftDays = dayjs(value).diff(dayjs(), "day"); const leftDays = dayjs(value).diff(dayjs(), "day");
const color = leftDays < 20 ? "red" : "#389e0d"; const color = leftDays < 20 ? "red" : "#389e0d";
const percent = (leftDays / 90) * 100; const percent = (leftDays / 90) * 100;
return <a-progress title={expireDate + "过期"} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}`} />; return <a-progress title={expireDate + " " + t("certd.expired")} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays} ${t("certd.days")}`} />;
}, },
}, },
}, },
checkStatus: { checkStatus: {
title: "检查状态", title: t("certd.columnCheckStatus"),
search: { search: {
show: false, show: false,
}, },
@@ -282,7 +283,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
lastCheckTime: { lastCheckTime: {
title: "上次检查时间", title: t("certd.columnLastCheckTime"),
search: { search: {
show: false, show: false,
}, },
@@ -296,16 +297,16 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
from: { from: {
title: "来源", title: t("certd.columnSource"),
search: { search: {
show: false, show: false,
}, },
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "同步", value: "sync", color: "green" }, { label: t("certd.sourceSync"), value: "sync", color: "green" },
{ label: "手动", value: "manual", color: "blue" }, { label: t("certd.sourceManual"), value: "manual", color: "blue" },
{ label: "导入", value: "import", color: "blue" }, { label: t("certd.sourceImport"), value: "import", color: "blue" },
], ],
}), }),
form: { form: {
@@ -318,15 +319,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
disabled: { disabled: {
title: "禁用启用", title: t("certd.columnDisabled"),
search: { search: {
show: false, show: false,
}, },
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "启用", value: false, color: "green" }, { label: t("certd.enabled"), value: false, color: "green" },
{ label: "禁用", value: true, color: "red" }, { label: t("certd.disabled"), value: true, color: "red" },
], ],
}), }),
form: { form: {
@@ -339,7 +340,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
remark: { remark: {
title: "备注", title: t("certd.columnRemark"),
search: { search: {
show: false, show: false,
}, },
@@ -1,7 +1,9 @@
import * as api from "./api.js"; import * as api from "./api.js";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { useI18n } from "vue-i18n";
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n();
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
const list = await api.GetTree(); const list = await api.GetTree();
@@ -39,7 +41,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
value: "id", value: "id",
label: "title", label: "title",
async onReady({ dict }: any) { async onReady({ dict }: any) {
dict.setData([{ id: -1, title: "根节点", children: dict.data }]); dict.setData([{ id: -1, title: t("certd.rootNode"), children: dict.data }]);
} }
}); });
return { return {
@@ -81,51 +83,50 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
} }
}, },
title: { title: {
title: "权限名称", title: t("certd.permissionName"),
type: "text", type: "text",
form: { form: {
rules: [ rules: [
{ required: true, message: "请输入权限名称" }, { required: true, message: t("certd.enterPermissionName") },
{ max: 50, message: "最大50个字符" } { max: 50, message: t("certd.max50Chars") }
], ],
component: { component: {
placeholder: "权限名称" placeholder: t("certd.permissionName")
} }
}, },
column: { column: {
width: 200 width: 200
} }
}, },
permission: { permission: {
title: "权限代码", title: t("certd.permissionCode"),
type: "text", type: "text",
column: { column: {
width: 170 width: 170
}, },
form: { form: {
rules: [ rules: [
{ required: true, message: "请输入权限代码" }, { required: true, message: t("certd.enterPermissionCode") },
{ max: 100, message: "最大100个字符" } { max: 100, message: t("certd.max100Chars") }
], ],
component: { component: {
placeholder: "例如:sys:user:view" placeholder: t("certd.examplePermissionCode")
} }
} }
}, },
sort: { sort: {
title: "排序", title: t("certd.sortOrder"),
type: "number", type: "number",
column: { column: {
width: 100 width: 100
}, },
form: { form: {
value: 100, value: 100,
rules: [{ required: true, type: "number", message: "排序号必填" }] rules: [{ required: true, type: "number", message: t("certd.sortRequired") }]
} }
}, },
parentId: { parentId: {
title: "父节点", title: t("certd.parentNode"),
type: "dict-tree", type: "dict-tree",
column: { column: {
width: 100 width: 100
@@ -144,6 +145,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
} }
} }
} }
} }
} }
}; };
@@ -1,23 +1,16 @@
<template> <template>
<a-tree <a-tree v-if="computedTree" ref="treeRef" class="fs-permission-tree" :class="{ 'is-editable': editable }"
v-if="computedTree" :selectable="false" show-line :show-icon="false" :default-expand-all="true" :tree-data="computedTree"
ref="treeRef" @check="onChecked">
class="fs-permission-tree"
:class="{ 'is-editable': editable }"
:selectable="false"
show-line
:show-icon="false"
:default-expand-all="true"
:tree-data="computedTree"
@check="onChecked"
>
<template #title="scope"> <template #title="scope">
<div class="node-title-pane"> <div class="node-title-pane">
<div class="node-title">{{ scope.title }}</div> <div class="node-title">{{ scope.title }}</div>
<div v-if="editable === true" class="node-suffix"> <div v-if="editable === true" class="node-suffix">
<fs-icon v-if="actions.add !== false" :icon="$fsui.icons.add" @click.stop="add(scope)" /> <fs-icon v-if="actions.add !== false" :icon="$fsui.icons.add" @click.stop="add(scope)" />
<fs-icon v-if="actions.edit !== false && scope.id !== -1" :icon="$fsui.icons.edit" @click.stop="edit(scope)" /> <fs-icon v-if="actions.edit !== false && scope.id !== -1" :icon="$fsui.icons.edit"
<fs-icon v-if="actions.remove !== false && scope.id !== -1" :icon="$fsui.icons.remove" @click.stop="remove(scope)" /> @click.stop="edit(scope)" />
<fs-icon v-if="actions.remove !== false && scope.id !== -1" :icon="$fsui.icons.remove"
@click.stop="remove(scope)" />
</div> </div>
</div> </div>
</template> </template>
@@ -28,6 +21,7 @@
import { utils } from "@fast-crud/fast-crud"; import { utils } from "@fast-crud/fast-crud";
import { cloneDeep } from "lodash-es"; import { cloneDeep } from "lodash-es";
import { computed, defineComponent, ref } from "vue"; import { computed, defineComponent, ref } from "vue";
import { useI18n } from "vue-i18n";
export default defineComponent({ export default defineComponent({
name: "FsPermissionTree", name: "FsPermissionTree",
@@ -48,6 +42,7 @@ export default defineComponent({
} as any, } as any,
emits: ["add", "edit", "remove"], emits: ["add", "edit", "remove"],
setup(props: any, ctx) { setup(props: any, ctx) {
const { t } = useI18n();
const treeRef = ref(); const treeRef = ref();
const computedTree = computed(() => { const computedTree = computed(() => {
if (props.tree == null) { if (props.tree == null) {
@@ -94,7 +89,7 @@ export default defineComponent({
}); });
return [ return [
{ {
title: "根节点", title: t("certd.rootNode"),
id: -1, id: -1,
children: clone children: clone
} }
@@ -127,7 +122,8 @@ export default defineComponent({
remove, remove,
treeRef, treeRef,
onChecked, onChecked,
getChecked getChecked,
t
}; };
} }
}); });
@@ -138,11 +134,13 @@ export default defineComponent({
.ant-tree-list-holder-inner { .ant-tree-list-holder-inner {
flex-direction: row !important; flex-direction: row !important;
flex-wrap: wrap; flex-wrap: wrap;
.is-twig { .is-twig {
width: 100%; width: 100%;
} }
.is-leaf { .is-leaf {
//border-bottom: 1px solid #ddd; //border-bottom: 1px solid #ddd;
&::before { &::before {
display: none; display: none;
@@ -159,12 +157,14 @@ export default defineComponent({
} }
} }
} }
//.is-twig ul { //.is-twig ul {
// display: flex; // display: flex;
// flex-wrap: wrap; // flex-wrap: wrap;
//} //}
.node-title-pane { .node-title-pane {
display: flex; display: flex;
.node-title { .node-title {
width: 110px; width: 110px;
white-space: nowrap; white-space: nowrap;
@@ -184,6 +184,7 @@ export default defineComponent({
.node-suffix { .node-suffix {
visibility: hidden; visibility: hidden;
>* { >* {
margin-left: 3px; margin-left: 3px;
} }
@@ -1,24 +1,27 @@
<template> <template>
<fs-page> <fs-page>
<template #header> <template #header>
<div class="title">权限管理</div> <div class="title">{{ t("certd.permissionManagement") }}</div>
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<a-button v-permission="'1sys:auth:per:add'" style="margin-left: 20px" @click="addHandle({})"> <a-button v-permission="'1sys:auth:per:add'" style="margin-left: 20px" @click="addHandle({})">
<fs-icon :icon="ui.icons.add"></fs-icon> <fs-icon :icon="ui.icons.add"></fs-icon>
添加 {{ t("certd.adda") }}
</a-button> </a-button>
<fs-permission-tree class="permission-tree mt-10" :tree="crudBinding.data" :checkable="false" :actions="permission" @add="addHandle" @edit="editHandle" @remove="removeHandle"></fs-permission-tree> <fs-permission-tree class="permission-tree mt-10" :tree="crudBinding.data" :checkable="false"
:actions="permission" @add="addHandle" @edit="editHandle" @remove="removeHandle"></fs-permission-tree>
</fs-crud> </fs-crud>
</fs-page> </fs-page>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, onActivated, onMounted, ref } from "vue"; import { defineComponent, onActivated, onMounted, ref } from "vue";
import createCrudOptions from "./crud.js"; import createCrudOptions from "./crud.js";
import FsPermissionTree from "./fs-permission-tree.vue"; import FsPermissionTree from "./fs-permission-tree.vue";
import { usePermission } from "/src/plugin/permission"; import { usePermission } from "/src/plugin/permission";
import { useFs, useUi } from "@fast-crud/fast-crud"; import { useFs, useUi } from "@fast-crud/fast-crud";
import { useI18n } from "vue-i18n";
export default defineComponent({ export default defineComponent({
name: "AuthorityManager", name: "AuthorityManager",
@@ -27,6 +30,7 @@ export default defineComponent({
// 此处传入permission进行通用按钮权限设置,会通过commonOptions去设置actionbar和rowHandle的按钮的show属性 // 此处传入permission进行通用按钮权限设置,会通过commonOptions去设置actionbar和rowHandle的按钮的show属性
// 更多关于按钮权限的源代码设置,请参考 ./src/plugin/fast-crud/index.js 75-77行) // 更多关于按钮权限的源代码设置,请参考 ./src/plugin/fast-crud/index.js 75-77行)
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: "sys:auth:per" } }); const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: { permission: "sys:auth:per" } });
const { t } = useI18n();
// 页面打开后获取列表数据 // 页面打开后获取列表数据
onMounted(async () => { onMounted(async () => {
@@ -65,6 +69,7 @@ export default defineComponent({
editHandle, editHandle,
removeHandle, removeHandle,
permission, permission,
t
}; };
}, },
}); });
@@ -1,7 +1,9 @@
import * as api from "./api"; import * as api from "./api";
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud"; import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
import { useI18n } from "vue-i18n";
export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsProps): CreateCrudOptionsRet { export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const { t } = useI18n();
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
return await api.GetList(query); return await api.GetList(query);
}; };
@@ -47,13 +49,13 @@ export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsPr
} }
}, },
name: { name: {
title: "角色名称", title: t("certd.roleName"),
type: "text", type: "text",
search: { show: true }, search: { show: true },
form: { form: {
rules: [ rules: [
{ required: true, message: "请输入角色名称" }, { required: true, message: t("certd.enterRoleName") },
{ max: 50, message: "最大50个字符" } { max: 50, message: t("certd.max50Chars") }
] ]
}, // 表单配置 }, // 表单配置
column: { column: {
@@ -61,7 +63,7 @@ export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsPr
} }
}, },
createTime: { createTime: {
title: "创建时间", title: t("certd.createTime"),
type: "datetime", type: "datetime",
column: { column: {
sorter: true sorter: true
@@ -71,7 +73,7 @@ export default function ({ crudExpose, context: { authz } }: CreateCrudOptionsPr
} }
}, },
updateTime: { updateTime: {
title: "更新时间", title: t("certd.updateTime"),
type: "datetime", type: "datetime",
column: { column: {
sorter: true sorter: true
@@ -1,15 +1,18 @@
<template> <template>
<fs-page> <fs-page>
<template #header> <template #header>
<div class="title">角色管理</div> <div class="title">{{ t("certd.roleManagement") }}</div>
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding" /> <fs-crud ref="crudRef" v-bind="crudBinding" />
<a-modal v-model:open="authzDialogVisible" width="860px" title="分配权限" @ok="updatePermission"> <a-modal v-model:open="authzDialogVisible" width="860px" :title="t('certd.assignPermissions')"
<fs-permission-tree ref="permissionTreeRef" v-model:checked-keys="checkedKeys" :tree="permissionTreeData" :editable="false" checkable :replace-fields="{ key: 'id', label: 'title' }"> </fs-permission-tree> @ok="updatePermission">
<fs-permission-tree ref="permissionTreeRef" v-model:checked-keys="checkedKeys" :tree="permissionTreeData"
:editable="false" checkable :replace-fields="{ key: 'id', label: 'title' }"> </fs-permission-tree>
</a-modal> </a-modal>
</fs-page> </fs-page>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, onActivated, onMounted, ref } from "vue"; import { defineComponent, onActivated, onMounted, ref } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
@@ -19,6 +22,7 @@ import * as api from "./api";
import { message } from "ant-design-vue"; import { message } from "ant-design-vue";
import FsPermissionTree from "../permission/fs-permission-tree.vue"; import FsPermissionTree from "../permission/fs-permission-tree.vue";
import { UseCrudPermissionCompProps, UseCrudPermissionExtraProps } from "/@/plugin/permission"; import { UseCrudPermissionCompProps, UseCrudPermissionExtraProps } from "/@/plugin/permission";
import { useI18n } from "vue-i18n";
function useAuthz() { function useAuthz() {
const checkedKeys = ref(); const checkedKeys = ref();
@@ -88,6 +92,7 @@ export default defineComponent({
components: { FsPermissionTree }, components: { FsPermissionTree },
setup() { setup() {
//授权配置 //授权配置
const { t } = useI18n();
const authz = useAuthz(); const authz = useAuthz();
const permission: UseCrudPermissionCompProps = { const permission: UseCrudPermissionCompProps = {
prefix: "sys:auth:role", //权限代码前缀 prefix: "sys:auth:role", //权限代码前缀
@@ -115,6 +120,7 @@ export default defineComponent({
crudBinding, crudBinding,
crudRef, crudRef,
...authz, ...authz,
t
}; };
}, },
}); });
@@ -42,18 +42,18 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
fixed: "right", fixed: "right",
buttons: { buttons: {
unlock: { unlock: {
title: "解除登录锁定", title: t("certd.unlockLogin"),
text: null, text: null,
type: "link", type: "link",
icon: "ion:lock-open-outline", icon: "ion:lock-open-outline",
click: async ({ row }) => { click: async ({ row }) => {
Modal.confirm({ Modal.confirm({
title: "提示", title: t("certd.notice"),
content: "确定要解除该用户的登录锁定吗?", content: t("certd.confirmUnlock"),
onOk: async () => { onOk: async () => {
await api.Unlock(row.id); await api.Unlock(row.id);
notification.success({ notification.success({
message: "解除成功", message: t("certd.unlockSuccess"),
}); });
}, },
}); });
@@ -78,7 +78,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
createTime: { createTime: {
title: "创建时间", title: t("certd.createTime"),
type: "datetime", type: "datetime",
form: { show: false }, // 表单配置 form: { show: false }, // 表单配置
column: { column: {
@@ -96,13 +96,13 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
// } // }
// }, // },
username: { username: {
title: "用户名", title: t("certd.username"),
type: "text", type: "text",
search: { show: true }, // 开启查询 search: { show: true }, // 开启查询
form: { form: {
rules: [ rules: [
{ required: true, message: "请输入用户名" }, { required: true, message: t("certd.enterUsername") },
{ max: 50, message: "最大50个字符" }, { max: 50, message: t("certd.max50Chars") },
], ],
}, },
editForm: { component: { disabled: false } }, editForm: { component: { disabled: false } },
@@ -112,18 +112,18 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
password: { password: {
title: "密码", title: t("certd.password"),
type: "text", type: "text",
key: "password", key: "password",
column: { column: {
show: false, show: false,
}, },
form: { form: {
rules: [{ max: 50, message: "最大50个字符" }], rules: [{ max: 50, message: t("certd.max50Chars") }],
component: { component: {
showPassword: true, showPassword: true,
}, },
helper: "填写则修改密码", helper: t("certd.modifyPasswordIfFilled"),
}, },
}, },
nickName: { nickName: {
@@ -138,11 +138,11 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
email: { email: {
title: "邮箱", title: t("certd.emaila"),
type: "text", type: "text",
search: { show: true }, // 开启查询 search: { show: true }, // 开启查询
form: { form: {
rules: [{ max: 50, message: "最大50个字符" }], rules: [{ max: 50, message: t("certd.max50Chars") }],
}, },
column: { column: {
sorter: true, sorter: true,
@@ -150,11 +150,11 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
mobile: { mobile: {
title: "手机号", title: t("certd.mobile"),
type: "text", type: "text",
search: { show: true }, // 开启查询 search: { show: true }, // 开启查询
form: { form: {
rules: [{ max: 50, message: "最大50个字符" }], rules: [{ max: 50, message: t("certd.max50Chars") }],
}, },
column: { column: {
sorter: true, sorter: true,
@@ -162,12 +162,11 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
avatar: { avatar: {
title: "头像", title: t("certd.avatar"),
type: "cropper-uploader", type: "cropper-uploader",
column: { column: {
width: 70, width: 70,
component: { component: {
//设置高度,修复操作列错位的问题
style: { style: {
height: "30px", height: "30px",
width: "auto", width: "auto",
@@ -205,12 +204,12 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
status: { status: {
title: "状态", title: t("certd.status"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "启用", value: 1, color: "green" }, { label: t("certd.enabled"), value: 1, color: "green" },
{ label: "禁用", value: 0, color: "red" }, { label: t("certd.disabled"), value: 0, color: "red" },
], ],
}), }),
column: { column: {
@@ -220,7 +219,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
validTime: { validTime: {
title: "有效期", title: t("certd.validTime"),
type: "date", type: "date",
form: { form: {
show: userValidTimeEnabled, show: userValidTimeEnabled,
@@ -235,7 +234,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
return ""; return "";
} }
if (value < dayjs().valueOf()) { if (value < dayjs().valueOf()) {
return <a-tag color={"red"}></a-tag>; return <a-tag color={"red"}>{t("certd.expired")}</a-tag>;
} }
const date = dayjs(value).format("YYYY-MM-DD"); const date = dayjs(value).format("YYYY-MM-DD");
return ( return (
@@ -257,17 +256,17 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
}, },
}, },
remark: { remark: {
title: "备注", title: t("certd.remark"),
type: "text", type: "text",
column: { column: {
sorter: true, sorter: true,
}, },
form: { form: {
rules: [{ max: 100, message: "最大100个字符" }], rules: [{ max: 100, message: t("certd.max100Chars") }],
}, },
}, },
roles: { roles: {
title: "角色", title: t("certd.roles"),
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
url: "/sys/authority/role/list", url: "/sys/authority/role/list",
@@ -73,55 +73,55 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
} }
}, },
domain: { domain: {
title: "CNAME域名", title: t("certd.cnameDomain"),
type: "text", type: "text",
editForm: { editForm: {
component: { component: {
disabled: true disabled: true,
} },
}, },
search: { search: {
show: true show: true,
}, },
form: { form: {
component: { component: {
placeholder: "cname.handsfree.work" placeholder: t("certd.cnameDomainPlaceholder"),
}, },
helper: "需要一个右边DNS提供商注册的域名(也可以将其他域名的dns服务器转移到这几家来)。\nCNAME域名一旦确定不可修改,建议使用一级子域名", helper: t("certd.cnameDomainHelper"),
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: t("certd.requiredField") }],
}, },
column: { column: {
width: 200 width: 200,
} },
}, },
dnsProviderType: { dnsProviderType: {
title: "DNS提供商", title: t("certd.dnsProvider"),
type: "dict-select", type: "dict-select",
search: { search: {
show: true show: true,
}, },
dict: dict({ dict: dict({
url: "pi/dnsProvider/list", url: "pi/dnsProvider/list",
value: "key", value: "key",
label: "title" label: "title",
}), }),
form: { form: {
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: t("certd.requiredField") }],
}, },
column: { column: {
width: 150, width: 150,
component: { component: {
color: "auto" color: "auto",
} },
} },
}, },
accessId: { accessId: {
title: "DNS提供商授权", title: t("certd.dnsProviderAuthorization"),
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
url: "/pi/access/list", url: "/pi/access/list",
value: "id", value: "id",
label: "name" label: "name",
}), }),
form: { form: {
component: { component: {
@@ -129,40 +129,40 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
vModel: "modelValue", vModel: "modelValue",
type: compute(({ form }) => { type: compute(({ form }) => {
return form.dnsProviderType; return form.dnsProviderType;
}) }),
}, },
rules: [{ required: true, message: "此项必填" }] rules: [{ required: true, message: t("certd.requiredField") }],
}, },
column: { column: {
width: 150, width: 150,
component: { component: {
color: "auto" color: "auto",
} },
} },
}, },
isDefault: { isDefault: {
title: "是否默认", title: t("certd.isDefault"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "是", value: true, color: "success" }, { label: t("certd.yes"), value: true, color: "success" },
{ label: "否", value: false, color: "default" } { label: t("certd.no"), value: false, color: "default" },
] ],
}), }),
form: { form: {
value: false, value: false,
rules: [{ required: true, message: "请选择是否默认" }] rules: [{ required: true, message: t("certd.selectIsDefault") }],
}, },
column: { column: {
align: "center", align: "center",
width: 100 width: 100,
} },
}, },
setDefault: { setDefault: {
title: "设置默认", title: t("certd.setDefault"),
type: "text", type: "text",
form: { form: {
show: false show: false,
}, },
column: { column: {
width: 100, width: 100,
@@ -174,77 +174,77 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
} }
const onClick = async () => { const onClick = async () => {
Modal.confirm({ Modal.confirm({
title: "提示", title: t("certd.prompt"),
content: `确定要设置为默认吗?`, content: t("certd.confirmSetDefault"),
onOk: async () => { onOk: async () => {
await api.SetDefault(row.id); await api.SetDefault(row.id);
await crudExpose.doRefresh(); await crudExpose.doRefresh();
} },
}); });
}; };
return ( return (
<a-button type={"link"} size={"small"} onClick={onClick}> <a-button type={"link"} size={"small"} onClick={onClick}>
{t("certd.setAsDefault")}
</a-button> </a-button>
); );
} },
} },
}, },
disabled: { disabled: {
title: "禁用/启用", title: t("certd.disabled"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "启用", value: false, color: "success" }, { label: t("certd.enabled"), value: false, color: "success" },
{ label: "禁用", value: true, color: "error" } { label: t("certd.disabledLabel"), value: true, color: "error" },
] ],
}), }),
form: { form: {
value: false value: false,
}, },
column: { column: {
width: 100, width: 100,
component: { component: {
title: "点击可禁用/启用", title: t("certd.clickToToggle"),
on: { on: {
async click({ value, row }) { async click({ value, row }) {
Modal.confirm({ Modal.confirm({
title: "提示", title: t("certd.prompt"),
content: `确定要${!value ? "禁用" : "启用"}吗?`, content: t("certd.confirmToggleStatus", { action: !value ? t("certd.disable") : t("certd.enable") }),
onOk: async () => { onOk: async () => {
await api.SetDisabled(row.id, !value); await api.SetDisabled(row.id, !value);
await crudExpose.doRefresh(); await crudExpose.doRefresh();
} },
}); });
} },
} },
} },
} },
}, },
createTime: { createTime: {
title: "创建时间", title: t("certd.createTime"),
type: "datetime", type: "datetime",
form: { form: {
show: false show: false,
}, },
column: { column: {
sorter: true, sorter: true,
width: 160, width: 160,
align: "center" align: "center",
} },
}, },
updateTime: { updateTime: {
title: "更新时间", title: t("certd.updateTime"),
type: "datetime", type: "datetime",
form: { form: {
show: false show: false,
}, },
column: { column: {
show: true, show: true,
width: 160 width: 160,
} },
} },
} }
} }
}; };
@@ -2,16 +2,18 @@
<fs-page class="page-cert"> <fs-page class="page-cert">
<template #header> <template #header>
<div class="title"> <div class="title">
CNAME服务配置 {{ t("certd.cnameTitle") }}
<span class="sub"> <span class="sub">
此处配置的域名作为其他域名校验的代理当别的域名需要申请证书时通过CNAME映射到此域名上来验证所有权好处是任何域名都可以通过此方式申请证书也无需填写AccessSecret {{ t("certd.cnameDescription") }}
<a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">CNAME功能原理及使用说明</a> <a href="https://certd.docmirror.cn/guide/feature/cname/" target="_blank">
{{ t("certd.cnameLinkText") }}
</a>
</span> </span>
</div> </div>
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<template #pagination-left> <template #pagination-left>
<a-tooltip title="批量删除"> <a-tooltip :title="t('certd.batchDelete')">
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button> <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
</a-tooltip> </a-tooltip>
</template> </template>
@@ -19,12 +21,16 @@
</fs-page> </fs-page>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onActivated, onMounted } from "vue"; import { onActivated, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "CnameProvider", name: "CnameProvider",
@@ -35,20 +41,21 @@ const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
if (selectedRowKeys.value?.length > 0) { if (selectedRowKeys.value?.length > 0) {
Modal.confirm({ Modal.confirm({
title: "确认", title: t("certd.confirmTitle"),
content: `确定要批量删除这${selectedRowKeys.value.length}条记录吗`, content: t("certd.confirmDeleteBatch", { count: selectedRowKeys.value.length }),
async onOk() { async onOk() {
await DeleteBatch(selectedRowKeys.value); await DeleteBatch(selectedRowKeys.value);
message.info("删除成功"); message.info(t("certd.deleteSuccess"));
crudExpose.doRefresh(); crudExpose.doRefresh();
selectedRowKeys.value = []; selectedRowKeys.value = [];
}, },
}); });
} else { } else {
message.error("请先勾选记录"); message.error(t("certd.selectRecordsFirst"));
} }
}; };
// 页面打开后获取列表数据 // 页面打开后获取列表数据
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
@@ -14,7 +14,6 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
let lastType = ""; let lastType = "";
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => { const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
if (lastType && lastType != query?.query?.type) { if (lastType && lastType != query?.query?.type) {
//lastType有变化
query.page.offset = 0; query.page.offset = 0;
} }
lastType = query?.query?.type; lastType = query?.query?.type;
@@ -44,7 +43,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
crudOptions: { crudOptions: {
columns: { columns: {
content: { content: {
title: "插件文件", title: t("certd.pluginFile"),
type: "text", type: "text",
form: { form: {
component: { component: {
@@ -57,21 +56,21 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
col: { col: {
span: 24, span: 24,
}, },
helper: "选择插件文件", helper: t("certd.selectPluginFile"),
}, },
}, },
override: { override: {
title: "同名覆盖", title: t("certd.overrideSameName"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ {
value: true, value: true,
label: "覆盖", label: t("certd.override"),
}, },
{ {
value: false, value: false,
label: "不覆盖", label: t("certd.noOverride"),
}, },
], ],
}), }),
@@ -80,17 +79,17 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
col: { col: {
span: 24, span: 24,
}, },
helper: "如果已有相同名称插件,直接覆盖", helper: t("certd.overrideHelper"),
}, },
}, },
}, },
form: { form: {
wrapper: { wrapper: {
title: "导入插件", title: t("certd.importPlugin"),
saveRemind: false, saveRemind: false,
}, },
afterSubmit() { afterSubmit() {
notification.success({ message: "操作成功" }); notification.success({ message: t("certd.operationSuccess") });
crudExpose.doRefresh(); crudExpose.doRefresh();
}, },
async doSubmit({ form }: any) { async doSubmit({ form }: any) {
@@ -109,12 +108,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
crudOptions: { crudOptions: {
settings: { settings: {
plugins: { plugins: {
//这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
rowSelection: { rowSelection: {
enabled: true, enabled: true,
order: -2, order: -2,
before: true, before: true,
// handle: (pluginProps,useCrudProps)=>CrudOptions,
props: { props: {
multiple: true, multiple: true,
crossPage: true, crossPage: true,
@@ -134,12 +131,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
add: { add: {
show: true, show: true,
icon: "ion:ios-add-circle-outline", icon: "ion:ios-add-circle-outline",
text: "自定义插件", text: t("certd.customPlugin"),
}, },
import: { import: {
show: true, show: true,
icon: "ion:cloud-upload-outline", icon: "ion:cloud-upload-outline",
text: "导入", text: t("certd.import"),
type: "primary", type: "primary",
async click() { async click() {
await openImportDialog(); await openImportDialog();
@@ -171,13 +168,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
export: { export: {
text: null, text: null,
icon: "ion:cloud-download-outline", icon: "ion:cloud-download-outline",
title: "导出", title: t("certd.export"),
type: "link", type: "link",
show: compute(({ row }) => { show: compute(({ row }) => {
return row.type === "custom"; return row.type === "custom";
}), }),
async click({ row }) { async click({ row }) {
//将文本内容,作为文件下载
const content = await api.ExportPlugin(row.id); const content = await api.ExportPlugin(row.id);
if (content) { if (content) {
const blob = new Blob([content], { type: "text/plain;charset=utf-8" }); const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
@@ -215,19 +211,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
columns: { columns: {
// id: {
// title: "ID",
// key: "id",
// type: "number",
// column: {
// width: 100
// },
// form: {
// show: false
// }
// },
pluginType: { pluginType: {
title: "插件类型", title: t("certd.pluginType"),
type: "dict-select", type: "dict-select",
search: { search: {
show: true, show: true,
@@ -246,9 +231,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
dict: dict({ dict: dict({
data: [ data: [
{ label: "授权", value: "access" }, { label: t("certd.auth"), value: "access" },
{ label: "DNS", value: "dnsProvider" }, { label: t("certd.dns"), value: "dnsProvider" },
{ label: "部署插件", value: "deploy" }, { label: t("certd.deployPlugin"), value: "deploy" },
], ],
}), }),
column: { column: {
@@ -260,7 +245,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
icon: { icon: {
title: "图标", title: t("certd.icon"),
type: "icon", type: "icon",
form: { form: {
rules: [{ required: true }], rules: [{ required: true }],
@@ -278,20 +263,20 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
name: { name: {
title: "插件名称", title: t("certd.pluginName"),
type: "text", type: "text",
search: { search: {
show: true, show: true,
}, },
form: { form: {
show: true, show: true,
helper: "必须为英文或数字,驼峰命名,类型作为前缀\n例如AliyunDeployToCDN\n插件一旦被使用,不要修改名称", helper: t("certd.pluginNameHelper"),
rules: [ rules: [
{ required: true }, { required: true },
{ {
type: "regexp", type: "regexp",
pattern: /^[a-zA-Z][a-zA-Z0-9]+$/, pattern: /^[a-zA-Z][a-zA-Z0-9]+$/,
message: "必须为英文或数字,驼峰命名,类型作为前缀", message: t("certd.pluginNameRuleMsg"),
}, },
], ],
}, },
@@ -307,20 +292,20 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
author: { author: {
title: "作者", title: t("certd.author"),
type: "text", type: "text",
search: { search: {
show: true, show: true,
}, },
form: { form: {
show: true, show: true,
helper: "上传到插件商店时,将作为插件名称前缀,例如:greper/pluginName", helper: t("certd.authorHelper"),
rules: [ rules: [
{ required: true }, { required: true },
{ {
type: "regexp", type: "regexp",
pattern: /^[a-zA-Z][a-zA-Z0-9]+$/, pattern: /^[a-zA-Z][a-zA-Z0-9]+$/,
message: "必须为英文字母或数字", message: t("certd.authorRuleMsg"),
}, },
], ],
}, },
@@ -330,10 +315,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
title: { title: {
title: "标题", title: t("certd.titlea"),
type: "text", type: "text",
form: { form: {
helper: "插件中文名称", helper: t("certd.titleHelper"),
rules: [{ required: true }], rules: [{ required: true }],
}, },
column: { column: {
@@ -347,17 +332,16 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
desc: { desc: {
title: "描述", title: t("certd.description"),
type: "textarea", type: "textarea",
helper: "插件的描述", helper: t("certd.descriptionHelper"),
column: { column: {
width: 300, width: 300,
show: false, show: false,
}, },
}, },
type: { type: {
title: "来源", title: t("certd.sourcee"),
type: "dict-select", type: "dict-select",
search: { search: {
show: true, show: true,
@@ -370,9 +354,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
dict: dict({ dict: dict({
data: [ data: [
{ label: "内置", value: "builtIn" }, { label: t("certd.builtIn"), value: "builtIn" },
{ label: "自建", value: "custom" }, { label: t("certd.custom"), value: "custom" },
{ label: "商店", value: "store" }, { label: t("certd.store"), value: "store" },
], ],
}), }),
column: { column: {
@@ -384,31 +368,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
version: { version: {
title: "版本", title: t("certd.version"),
type: "text", type: "text",
column: { column: {
width: 100, width: 100,
align: "center", align: "center",
}, },
}, },
// "extra.dependLibs": {
// title: "第三方依赖",
// type: "text",
// form: {
// helper: "依赖的第三方库,package.dependencies的格式:name[:^version]",
// component: {
// name: "a-select",
// mode: "tags",
// allowClear: true,
// open: false,
// },
// },
// column: {
// show: false,
// },
// },
"extra.dependPlugins": { "extra.dependPlugins": {
title: "插件依赖", title: t("certd.pluginDependencies"),
type: "text", type: "text",
form: { form: {
component: { component: {
@@ -417,19 +385,19 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
open: false, open: false,
allowClear: true, allowClear: true,
}, },
helper: "安装时会先安装依赖的插件,格式:[author/]pluginName[:version]", helper: t("certd.pluginDependenciesHelper"),
}, },
column: { column: {
show: false, show: false,
}, },
}, },
"extra.showRunStrategy": { "extra.showRunStrategy": {
title: "可修改运行策略", title: t("certd.editableRunStrategy"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ value: true, label: "可修改" }, { value: true, label: t("certd.editable") },
{ value: false, label: "不可修改" }, { value: false, label: t("certd.notEditable") },
], ],
}), }),
form: { form: {
@@ -443,18 +411,18 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
"extra.default.strategy.runStrategy": { "extra.default.strategy.runStrategy": {
title: "运行策略", title: t("certd.runStrategy"),
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
data: [ data: [
{ value: 0, label: "正常运行" }, { value: 0, label: t("certd.normalRun") },
{ value: 1, label: "成功后跳过(部署任务)" }, { value: 1, label: t("certd.skipOnSuccess") },
], ],
}), }),
form: { form: {
value: 1, value: 1,
rules: [{ required: true }], rules: [{ required: true }],
helper: "默认运行策略", helper: t("certd.defaultRunStrategyHelper"),
show: compute(({ form }) => { show: compute(({ form }) => {
return form.extra.showRunStrategy; return form.extra.showRunStrategy;
}), }),
@@ -479,28 +447,28 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
disabled: { disabled: {
title: "点击禁用/启用", title: t("certd.enableDisable"),
type: "dict-switch", type: "dict-switch",
dict: dict({ dict: dict({
data: [ data: [
{ label: "启用", value: false, color: "success" }, { label: t("certd.enabled"), value: false, color: "success" },
{ label: "禁用", value: true, color: "error" }, { label: t("certd.disabled"), value: true, color: "error" },
], ],
}), }),
form: { form: {
title: "禁用/启用", title: t("certd.enableDisable"),
value: false, value: false,
}, },
column: { column: {
width: 120, width: 120,
align: "center", align: "center",
component: { component: {
title: "点击可禁用/启用", title: t("certd.clickToToggle"),
on: { on: {
async click({ value, row }) { async click({ value, row }) {
Modal.confirm({ Modal.confirm({
title: "提示", title: t("certd.confirm"),
content: `确定要${!value ? "禁用" : "启用"}吗?`, content: `${t("certd.confirmToggle")} ${!value ? t("certd.disable") : t("certd.enable")}?`,
onOk: async () => { onOk: async () => {
await api.SetDisabled({ await api.SetDisabled({
id: row.id, id: row.id,
@@ -517,7 +485,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
group: { group: {
title: "插件分组", title: t("certd.pluginGroup"),
type: "dict-select", type: "dict-select",
dict: dict({ dict: dict({
url: "/pi/plugin/groupsList", url: "/pi/plugin/groupsList",
@@ -539,7 +507,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
createTime: { createTime: {
title: "创建时间", title: t("certd.createTime"),
type: "datetime", type: "datetime",
form: { form: {
show: false, show: false,
@@ -551,7 +519,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}, },
}, },
updateTime: { updateTime: {
title: "更新时间", title: t("certd.updateTime"),
type: "datetime", type: "datetime",
form: { form: {
show: false, show: false,
@@ -2,13 +2,13 @@
<fs-page class="page-cert"> <fs-page class="page-cert">
<template #header> <template #header>
<div class="title"> <div class="title">
插件管理 {{ t("certd.pluginManagement") }}
<span class="sub">自定义插件处于BETA测试版后续可能会有破坏性变更</span> <span class="sub">{{ t("certd.pluginBetaWarning") }}</span>
</div> </div>
</template> </template>
<fs-crud ref="crudRef" v-bind="crudBinding"> <fs-crud ref="crudRef" v-bind="crudBinding">
<!-- <template #pagination-left>--> <!-- <template #pagination-left>-->
<!-- <a-tooltip title="批量删除">--> <!-- <a-tooltip :title="t('certd.batchDelete')">-->
<!-- <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>--> <!-- <fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>-->
<!-- </a-tooltip>--> <!-- </a-tooltip>-->
<!-- </template>--> <!-- </template>-->
@@ -16,12 +16,16 @@
</fs-page> </fs-page>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { onActivated, onMounted } from "vue"; import { onActivated, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud"; import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud"; import createCrudOptions from "./crud";
import { message, Modal } from "ant-design-vue"; import { message, Modal } from "ant-design-vue";
import { DeleteBatch } from "./api"; import { DeleteBatch } from "./api";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "SysPlugin", name: "SysPlugin",
@@ -36,20 +40,21 @@ const selectedRowKeys = context.selectedRowKeys;
const handleBatchDelete = () => { const handleBatchDelete = () => {
if (selectedRowKeys.value?.length > 0) { if (selectedRowKeys.value?.length > 0) {
Modal.confirm({ Modal.confirm({
title: "确认", title: t("certd.confirm"),
content: `确定要批量删除这${selectedRowKeys.value.length}条记录吗`, content: t("certd.batchDeleteConfirm", { count: selectedRowKeys.value.length }),
async onOk() { async onOk() {
await DeleteBatch(selectedRowKeys.value); await DeleteBatch(selectedRowKeys.value);
message.info("删除成功"); message.info(t("certd.deleteSuccess"));
crudExpose.doRefresh(); crudExpose.doRefresh();
selectedRowKeys.value = []; selectedRowKeys.value = [];
}, },
}); });
} else { } else {
message.error("请先勾选记录"); message.error(t("certd.pleaseSelectRecord"));
} }
}; };
// 页面打开后获取列表数据 // 页面打开后获取列表数据
onMounted(() => { onMounted(() => {
crudExpose.doRefresh(); crudExpose.doRefresh();
@@ -2,72 +2,85 @@
<fs-page class="page-setting-email"> <fs-page class="page-setting-email">
<template #header> <template #header>
<div class="title"> <div class="title">
邮件服务器设置 {{ t('certd.emailServerSettings') }}
<span class="sub">设置邮件发送服务器</span> <span class="sub">{{ t('certd.setEmailSendingServer') }}</span>
</div> </div>
</template> </template>
<div class="flex-o"> <div class="flex-o">
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" class="email-form-box" @finish="onFinish" @finish-failed="onFinishFailed"> <a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
autocomplete="off" class="email-form-box" @finish="onFinish" @finish-failed="onFinishFailed">
<div v-if="!formState.usePlus" class="email-form"> <div v-if="!formState.usePlus" class="email-form">
<a-form-item label="使用自定义邮件服务器"> </a-form-item> <a-form-item :label="t('certd.useCustomEmailServer')"> </a-form-item>
<a-form-item label="SMTP域名" name="host" :rules="[{ required: true, message: '请输入smtp域名或ip' }]"> <a-form-item :label="t('certd.smtpDomain')" name="host"
:rules="[{ required: true, message: t('certd.pleaseEnterSmtpDomain') }]">
<a-input v-model:value="formState.host" /> <a-input v-model:value="formState.host" />
</a-form-item> </a-form-item>
<a-form-item label="SMTP端口" name="port" :rules="[{ required: true, message: '请输入smtp端口号' }]"> <a-form-item :label="t('certd.smtpPort')" name="port"
:rules="[{ required: true, message: t('certd.pleaseEnterSmtpPort') }]">
<a-input v-model:value="formState.port" /> <a-input v-model:value="formState.port" />
</a-form-item> </a-form-item>
<a-form-item label="用户名" :name="['auth', 'user']" :rules="[{ required: true, message: '请输入用户名' }]"> <a-form-item :label="t('certd.username')" :name="['auth', 'user']"
:rules="[{ required: true, message: t('certd.pleaseEnterUsername') }]">
<a-input v-model:value="formState.auth.user" /> <a-input v-model:value="formState.auth.user" />
</a-form-item> </a-form-item>
<a-form-item label="密码" :name="['auth', 'pass']" :rules="[{ required: true, message: '请输入密码' }]"> <a-form-item :label="t('certd.password')" :name="['auth', 'pass']"
:rules="[{ required: true, message: t('certd.pleaseEnterPassword') }]">
<a-input-password v-model:value="formState.auth.pass" /> <a-input-password v-model:value="formState.auth.pass" />
<div class="helper">如果是qq邮箱需要到qq邮箱的设置里面申请授权码作为密码</div> <div class="helper">{{ t('certd.qqEmailAuthCodeHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="发件邮箱" name="sender" :rules="[{ required: true, message: '请输入发件邮箱' }]"> <a-form-item :label="t('certd.senderEmail')" name="sender"
:rules="[{ required: true, message: t('certd.pleaseEnterSenderEmail') }]">
<a-input v-model:value="formState.sender" /> <a-input v-model:value="formState.sender" />
</a-form-item> </a-form-item>
<a-form-item label="是否ssl" name="secure"> <a-form-item :label="t('certd.useSsl')" name="secure">
<a-switch v-model:checked="formState.secure" /> <a-switch v-model:checked="formState.secure" />
<div class="helper">ssl和非ssl的smtp端口是不一样的注意修改端口</div> <div class="helper">{{ t('certd.sslPortNote') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="忽略证书校验" :name="['tls', 'rejectUnauthorized']"> <a-form-item :label="t('certd.ignoreCertValidation')" :name="['tls', 'rejectUnauthorized']">
<a-switch v-model:checked="formState.tls.rejectUnauthorized" /> <a-switch v-model:checked="formState.tls.rejectUnauthorized" />
</a-form-item> </a-form-item>
<a-form-item :wrapper-col="{ offset: 8, span: 16 }"> <a-form-item :wrapper-col="{ offset: 8, span: 16 }">
<a-button type="primary" html-type="submit">保存</a-button> <a-button type="primary" html-type="submit">{{ t('certd.save') }}</a-button>
</a-form-item> </a-form-item>
</div> </div>
<div class="email-form"> <div class="email-form">
<a-form-item label="使用官方邮件服务器" name="usePlus"> <a-form-item :label="t('certd.useOfficialEmailServer')" name="usePlus">
<div class="flex-o"> <div class="flex-o">
<a-switch v-model:checked="formState.usePlus" :disabled="!settingStore.isPlus" @change="onUsePlusChanged" /> <a-switch v-model:checked="formState.usePlus" :disabled="!settingStore.isPlus"
@change="onUsePlusChanged" />
<vip-button class="ml-5" mode="button"></vip-button> <vip-button class="ml-5" mode="button"></vip-button>
</div> </div>
<div class="helper">使用官方邮箱服务器直接发邮件免除繁琐的配置</div> <div class="helper">{{ t('certd.useOfficialEmailServerHelper') }}</div>
</a-form-item> </a-form-item>
</div> </div>
</a-form> </a-form>
</div> </div>
<div class="email-form"> <div class="email-form">
<a-form :model="testFormState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onTestSend"> <a-form :model="testFormState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
<a-form-item label="测试收件邮箱" name="receiver" :rules="[{ required: true, message: '请输入测试收件邮箱' }]"> autocomplete="off" @finish="onTestSend">
<a-form-item :label="t('certd.testReceiverEmail')" name="receiver"
:rules="[{ required: true, message: t('certd.pleaseEnterTestReceiverEmail') }]">
<a-input v-model:value="testFormState.receiver" /> <a-input v-model:value="testFormState.receiver" />
<div class="helper">保存后再点击测试</div> <div class="helper">{{ t('certd.saveBeforeTest') }}</div>
<div class="helper">发送失败<a href="https://certd.docmirror.cn/guide/use/email/" target="_blank">邮件配置帮助文档</a></div> <div class="helper">{{ t('certd.sendFailHelpDoc') }}<a
<div class="helper">您还可以试试使用官方邮件服务器</div> href="https://certd.docmirror.cn/guide/use/email/" target="_blank">{{
t('certd.emailConfigHelpDoc') }}</a></div>
<div class="helper">{{ t('certd.tryOfficialEmailServer') }}</div>
</a-form-item> </a-form-item>
<a-form-item :wrapper-col="{ offset: 8, span: 16 }"> <a-form-item :wrapper-col="{ offset: 8, span: 16 }">
<a-button type="primary" :loading="testFormState.loading" html-type="submit">测试</a-button> <a-button type="primary" :loading="testFormState.loading" html-type="submit">{{ t('certd.test')
}}</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
</fs-page> </fs-page>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { reactive } from "vue"; import { reactive } from "vue";
import * as api from "../api"; import * as api from "../api";
@@ -75,6 +88,9 @@ import * as emailApi from "./api.email";
import { notification } from "ant-design-vue"; import { notification } from "ant-design-vue";
import { useSettingStore } from "/src/store/settings"; import { useSettingStore } from "/src/store/settings";
import * as _ from "lodash-es"; import * as _ from "lodash-es";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "EmailSetting", name: "EmailSetting",
}); });
@@ -115,10 +131,11 @@ const onFinish = async (form: any) => {
console.log("Success:", form); console.log("Success:", form);
await api.EmailSettingsSave(form); await api.EmailSettingsSave(form);
notification.success({ notification.success({
message: "保存成功", message: t("certd.saveSuccess"),
}); });
}; };
const onFinishFailed = (errorInfo: any) => { const onFinishFailed = (errorInfo: any) => {
// console.log("Failed:", errorInfo); // console.log("Failed:", errorInfo);
}; };
@@ -140,13 +157,14 @@ async function onTestSend() {
try { try {
await emailApi.TestSend(testFormState.receiver); await emailApi.TestSend(testFormState.receiver);
notification.success({ notification.success({
message: "发送成功", message: t("certd.sendSuccess"),
}); });
} finally { } finally {
testFormState.loading = false; testFormState.loading = false;
} }
} }
const settingStore = useSettingStore(); const settingStore = useSettingStore();
</script> </script>
@@ -155,6 +173,7 @@ const settingStore = useSettingStore();
.email-form-box { .email-form-box {
display: flex; display: flex;
} }
.email-form { .email-form {
width: 500px; width: 500px;
margin: 20px; margin: 20px;
@@ -1,54 +1,59 @@
<template> <template>
<div class="sys-settings-form sys-settings-base"> <div class="sys-settings-form sys-settings-base">
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish" @finish-failed="onFinishFailed"> <a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off"
<a-form-item label="ICP备案号" :name="['public', 'icpNo']"> @finish="onFinish" @finish-failed="onFinishFailed">
<a-input v-model:value="formState.public.icpNo" placeholder="粤ICP备xxxxxxx号" /> <a-form-item :label="t('certd.icpRegistrationNumber')" :name="['public', 'icpNo']">
<a-input v-model:value="formState.public.icpNo" :placeholder="t('certd.icpPlaceholder')" />
</a-form-item> </a-form-item>
<a-form-item label="网安备案号" :name="['public', 'mpsNo']"> <a-form-item :label="t('certd.publicSecurityRegistrationNumber')" :name="['public', 'mpsNo']">
<a-input v-model:value="formState.public.mpsNo" placeholder="京公网安备xxxxxxx号" /> <a-input v-model:value="formState.public.mpsNo" :placeholder="t('certd.publicSecurityPlaceholder')" />
</a-form-item> </a-form-item>
<a-form-item label="开启小助手" :name="['public', 'aiChatEnabled']"> <a-form-item :label="t('certd.enableAssistant')" :name="['public', 'aiChatEnabled']">
<a-switch v-model:checked="formState.public.aiChatEnabled" /> <a-switch v-model:checked="formState.public.aiChatEnabled" />
</a-form-item> </a-form-item>
<a-form-item label="允许爬虫" :name="['public', 'robots']"> <a-form-item :label="t('certd.allowCrawlers')" :name="['public', 'robots']">
<a-switch v-model:checked="formState.public.robots" /> <a-switch v-model:checked="formState.public.robots" />
</a-form-item> </a-form-item>
<a-form-item label="HTTP代理" :name="['private', 'httpProxy']" :rules="urlRules"> <a-form-item :label="t('certd.httpProxy')" :name="['private', 'httpProxy']" :rules="urlRules">
<a-input v-model:value="formState.private.httpProxy" placeholder="http://192.168.1.2:18010/" /> <a-input v-model:value="formState.private.httpProxy" :placeholder="t('certd.httpProxyPlaceholder')" />
<div class="helper">当某些网站被墙时可以配置</div> <div class="helper">{{ t('certd.httpProxyHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="HTTPS代理" :name="['private', 'httpsProxy']" :rules="urlRules"> <a-form-item :label="t('certd.httpsProxy')" :name="['private', 'httpsProxy']" :rules="urlRules">
<div class="flex"> <div class="flex">
<a-input v-model:value="formState.private.httpsProxy" placeholder="http://192.168.1.2:18010/" /> <a-input v-model:value="formState.private.httpsProxy"
<a-button class="ml-5" type="primary" :loading="testProxyLoading" title="保存后,再点击测试" @click="testProxy">测试</a-button> :placeholder="t('certd.httpsProxyPlaceholder')" />
<a-button class="ml-5" type="primary" :loading="testProxyLoading"
:title="t('certd.saveThenTestTitle')" @click="testProxy">{{ t('certd.testButton') }}</a-button>
</div> </div>
<div class="helper">一般这两个代理填一样的保存后再测试</div> <div class="helper">{{ t('certd.httpsProxyHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="双栈网络" :name="['private', 'dnsResultOrder']"> <a-form-item :label="t('certd.dualStackNetwork')" :name="['private', 'dnsResultOrder']">
<a-select v-model:value="formState.private.dnsResultOrder"> <a-select v-model:value="formState.private.dnsResultOrder">
<a-select-option value="verbatim">默认</a-select-option> <a-select-option value="verbatim">{{ t('certd.default') }}</a-select-option>
<a-select-option value="ipv4first">IPV4优先</a-select-option> <a-select-option value="ipv4first">{{ t('certd.ipv4Priority') }}</a-select-option>
<a-select-option value="ipv6first">IPV6优先</a-select-option> <a-select-option value="ipv6first">{{ t('certd.ipv6Priority') }}</a-select-option>
</a-select> </a-select>
<div class="helper">如果选择IPv6优先需要在docker-compose.yaml中启用ipv6</div> <div class="helper">{{ t('certd.dualStackNetworkHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="启用公共CNAME服务" :name="['private', 'commonCnameEnabled']"> <a-form-item :label="t('certd.enableCommonCnameService')" :name="['private', 'commonCnameEnabled']">
<a-switch v-model:checked="formState.private.commonCnameEnabled" /> <a-switch v-model:checked="formState.private.commonCnameEnabled" />
<div class="helper">是否可以使用公共CNAME服务如果禁用且没有设置<router-link to="/sys/cname/provider">自定义CNAME服务</router-link>则无法使用CNAME代理方式申请证书</div> <div class="helper" v-html="t('certd.commonCnameHelper')"></div>
</a-form-item> </a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }"> <a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">保存</a-button> <a-button :loading="saveLoading" type="primary" html-type="submit">{{ t('certd.saveButton')
}}</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { reactive, ref } from "vue"; import { reactive, ref } from "vue";
import { SysSettings } from "/@/views/sys/settings/api"; import { SysSettings } from "/@/views/sys/settings/api";
@@ -57,6 +62,9 @@ import { merge } from "lodash-es";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { notification } from "ant-design-vue"; import { notification } from "ant-design-vue";
import { util } from "/@/utils"; import { util } from "/@/utils";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "SettingBase", name: "SettingBase",
@@ -89,13 +97,14 @@ const onFinish = async (form: any) => {
await api.SysSettingsSave(form); await api.SysSettingsSave(form);
await settingsStore.loadSysSettings(); await settingsStore.loadSysSettings();
notification.success({ notification.success({
message: "保存成功", message: t('certd.saveSuccess'),
}); });
} finally { } finally {
saveLoading.value = false; saveLoading.value = false;
} }
}; };
const onFinishFailed = (errorInfo: any) => { const onFinishFailed = (errorInfo: any) => {
// console.log("Failed:", errorInfo); // console.log("Failed:", errorInfo);
}; };
@@ -103,7 +112,7 @@ const onFinishFailed = (errorInfo: any) => {
async function stopOtherUserTimer() { async function stopOtherUserTimer() {
await api.stopOtherUserTimer(); await api.stopOtherUserTimer();
notification.success({ notification.success({
message: "停止成功", message: t('certd.stopSuccess'),
}); });
} }
@@ -119,28 +128,28 @@ async function testProxy() {
const content = () => { const content = () => {
return ( return (
<div> <div>
<div>Google: {res.google === true ? "成功" : util.maxLength(res.google)}</div> <div>{t('certd.google')}: {res.google === true ? t('certd.success') : util.maxLength(res.google)}</div>
<div>Baidu: {res.baidu === true ? "成功" : util.maxLength(res.google)}</div> <div>{t('certd.baidu')}: {res.baidu === true ? t('certd.success') : util.maxLength(res.baidu)}</div>
</div> </div>
); );
}; };
if (!success) { if (!success) {
notification.error({ notification.error({
message: "测试失败", message: t('certd.testFailed'),
description: content, description: content,
}); });
return; return;
} }
notification.success({ notification.success({
message: "测试完成", message: t('certd.testCompleted'),
description: content, description: content,
}); });
} finally { } finally {
testProxyLoading.value = false; testProxyLoading.value = false;
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
.sys-settings-base { .sys-settings-base {}
}
</style> </style>
@@ -1,64 +1,75 @@
<template> <template>
<div class="sys-settings-form sys-settings-register"> <div class="sys-settings-form sys-settings-register">
<a-form :model="formState" name="register" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish"> <a-form :model="formState" name="register" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
<a-form-item label="管理其他用户流水线" :name="['public', 'managerOtherUserPipeline']"> autocomplete="off" @finish="onFinish">
<a-form-item :label="t('certd.manageOtherUserPipeline')" :name="['public', 'managerOtherUserPipeline']">
<a-switch v-model:checked="formState.public.managerOtherUserPipeline" /> <a-switch v-model:checked="formState.public.managerOtherUserPipeline" />
</a-form-item> </a-form-item>
<a-form-item label="限制用户流水线数量" :name="['public', 'limitUserPipelineCount']"> <a-form-item :label="t('certd.limitUserPipelineCount')" :name="['public', 'limitUserPipelineCount']">
<a-input-number v-model:value="formState.public.limitUserPipelineCount" /> <a-input-number v-model:value="formState.public.limitUserPipelineCount" />
<div class="helper">0为不限制</div> <div class="helper">{{ t('certd.limitUserPipelineCountHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item label="开启自助注册" :name="['public', 'registerEnabled']"> <a-form-item :label="t('certd.enableSelfRegistration')" :name="['public', 'registerEnabled']">
<a-switch v-model:checked="formState.public.registerEnabled" /> <a-switch v-model:checked="formState.public.registerEnabled" />
</a-form-item> </a-form-item>
<a-form-item label="开启用户有效期" :name="['public', 'userValidTimeEnabled']"> <a-form-item :label="t('certd.enableUserValidityPeriod')" :name="['public', 'userValidTimeEnabled']">
<div class="flex-o"> <div class="flex-o">
<a-switch v-model:checked="formState.public.userValidTimeEnabled" :disabled="!settingsStore.isPlus" /> <a-switch v-model:checked="formState.public.userValidTimeEnabled"
:disabled="!settingsStore.isPlus" />
<vip-button class="ml-5" mode="button"></vip-button> <vip-button class="ml-5" mode="button"></vip-button>
</div> </div>
<div class="helper">有效期内用户可正常使用失效后流水线将被停用</div> <div class="helper">{{ t('certd.userValidityPeriodHelper') }}</div>
</a-form-item> </a-form-item>
<template v-if="formState.public.registerEnabled"> <template v-if="formState.public.registerEnabled">
<a-form-item label="开启用户名注册" :name="['public', 'usernameRegisterEnabled']"> <a-form-item :label="t('certd.enableUsernameRegistration')"
:name="['public', 'usernameRegisterEnabled']">
<a-switch v-model:checked="formState.public.usernameRegisterEnabled" /> <a-switch v-model:checked="formState.public.usernameRegisterEnabled" />
</a-form-item> </a-form-item>
<a-form-item label="开启邮箱注册" :name="['public', 'emailRegisterEnabled']"> <a-form-item :label="t('certd.enableEmailRegistration')" :name="['public', 'emailRegisterEnabled']">
<div class="flex-o"> <div class="flex-o">
<a-switch v-model:checked="formState.public.emailRegisterEnabled" :disabled="!settingsStore.isPlus" title="专业版功能" /> <a-switch v-model:checked="formState.public.emailRegisterEnabled"
:disabled="!settingsStore.isPlus" :title="t('certd.proFeature')" />
<vip-button class="ml-5" mode="button"></vip-button> <vip-button class="ml-5" mode="button"></vip-button>
</div> </div>
<div class="helper">需要<router-link to="/sys/settings/email">设置邮箱服务器</router-link></div> <div class="helper">
<router-link to="/sys/settings/email">{{ t('certd.emailServerSetup') }}</router-link>
</div>
</a-form-item> </a-form-item>
<a-form-item label="开启手机号登录、注册" :name="['public', 'smsLoginEnabled']"> <a-form-item :label="t('certd.enableSmsLoginRegister')" :name="['public', 'smsLoginEnabled']">
<div class="flex-o"> <div class="flex-o">
<a-switch v-model:checked="formState.public.smsLoginEnabled" :disabled="!settingsStore.isComm" title="商业版功能" /> <a-switch v-model:checked="formState.public.smsLoginEnabled" :disabled="!settingsStore.isComm"
:title="t('certd.commFeature')" />
<vip-button class="ml-5" mode="comm"></vip-button> <vip-button class="ml-5" mode="comm"></vip-button>
</div> </div>
</a-form-item> </a-form-item>
<template v-if="formState.public.smsLoginEnabled"> <template v-if="formState.public.smsLoginEnabled">
<a-form-item label="短信提供商" :name="['private', 'sms', 'type']"> <a-form-item :label="t('certd.smsProvider')" :name="['private', 'sms', 'type']">
<a-select v-model:value="formState.private.sms.type" @change="smsTypeChange"> <a-select v-model:value="formState.private.sms.type" @change="smsTypeChange">
<a-select-option value="aliyun">阿里云短信</a-select-option> <a-select-option value="aliyun">{{ t('certd.aliyunSms') }}</a-select-option>
<a-select-option value="yfysms">易发云短信</a-select-option> <a-select-option value="yfysms">{{ t('certd.yfySms') }}</a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
<template v-for="item of smsTypeDefineInputs" :key="item.simpleKey"> <template v-for="item of smsTypeDefineInputs" :key="item.simpleKey">
<fs-form-item v-model="formState.private.sms.config[item.simpleKey]" :path="'private.sms.config' + item.key" :item="item" /> <fs-form-item v-model="formState.private.sms.config[item.simpleKey]"
:path="'private.sms.config' + item.key" :item="item" />
</template> </template>
<a-form-item label="短信测试"> <a-form-item :label="t('certd.smsTest')">
<div class="flex"> <div class="flex">
<a-input v-model:value="testMobile" placeholder="输入测试手机号" /> <a-input v-model:value="testMobile" :placeholder="t('certd.testMobilePlaceholder')" />
<loading-button class="ml-5" title="保存后再点击测试" type="primary" :click="testSendSms">测试</loading-button> <loading-button class="ml-5" :title="t('certd.saveThenTest')" type="primary"
:click="testSendSms">{{
t('certd.testButton') }}</loading-button>
</div> </div>
<div class="helper">保存后再点击测试</div> <div class="helper">{{ t('certd.saveThenTest') }}</div>
</a-form-item> </a-form-item>
</template> </template>
</template> </template>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }"> <a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
<a-button :loading="saveLoading" type="primary" html-type="submit">保存</a-button> <a-button :loading="saveLoading" type="primary" html-type="submit">{{ t('certd.saveButton')
}}</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
@@ -71,6 +82,9 @@ import * as api from "/@/views/sys/settings/api";
import { merge } from "lodash-es"; import { merge } from "lodash-es";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { notification } from "ant-design-vue"; import { notification } from "ant-design-vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "SettingRegister", name: "SettingRegister",
@@ -80,7 +94,7 @@ const testMobile = ref("");
async function testSendSms() { async function testSendSms() {
if (!testMobile.value) { if (!testMobile.value) {
notification.error({ notification.error({
message: "请输入测试手机号", message: t('certd.enterTestMobile'),
}); });
return; return;
} }
@@ -88,9 +102,10 @@ async function testSendSms() {
mobile: testMobile.value, mobile: testMobile.value,
}); });
notification.success({ notification.success({
message: "发送成功", message: t('certd.sendSuccess'),
}); });
} }
const formState = reactive<Partial<SysSettings>>({ const formState = reactive<Partial<SysSettings>>({
public: { public: {
registerEnabled: false, registerEnabled: false,
@@ -107,7 +122,7 @@ const rules = {
leastOneLogin: { leastOneLogin: {
validator: (rule: any, value: any) => { validator: (rule: any, value: any) => {
if (!formState.public.passwordLoginEnabled && !formState.public.smsLoginEnabled) { if (!formState.public.passwordLoginEnabled && !formState.public.smsLoginEnabled) {
return Promise.reject("密码登录和手机号登录至少开启一个"); return Promise.reject(t('certd.atLeastOneLoginRequired'));
} }
return Promise.resolve(); return Promise.resolve();
}, },
@@ -115,10 +130,11 @@ const rules = {
required: { required: {
required: true, required: true,
trigger: "change", trigger: "change",
message: "此项必填", message: t('certd.fieldRequired'),
}, },
}; };
async function smsTypeChange(value: string) { async function smsTypeChange(value: string) {
if (formState.private?.sms?.config) { if (formState.private?.sms?.config) {
formState.private.sms.config = {}; formState.private.sms.config = {};
@@ -180,7 +196,7 @@ const onFinish = async (form: any) => {
await api.SysSettingsSave(form); await api.SysSettingsSave(form);
await settingsStore.loadSysSettings(); await settingsStore.loadSysSettings();
notification.success({ notification.success({
message: "保存成功", message: t('certd.saveSuccess'),
}); });
} finally { } finally {
saveLoading.value = false; saveLoading.value = false;
@@ -188,6 +204,5 @@ const onFinish = async (form: any) => {
}; };
</script> </script>
<style lang="less"> <style lang="less">
.sys-settings-site { .sys-settings-site {}
}
</style> </style>
@@ -1,54 +1,63 @@
<template> <template>
<div class="sys-settings-form sys-settings-safe"> <div class="sys-settings-form sys-settings-safe">
<a-form ref="formRef" :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off"> <a-form ref="formRef" :model="formState" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }"
<h2>站点隐藏</h2> autocomplete="off">
<a-form-item label="启用站点隐藏" :name="['hidden', 'enabled']" :required="true"> <h2>{{ t('certd.siteHide') }}</h2>
<a-form-item :label="t('certd.enableSiteHide')" :name="['hidden', 'enabled']" :required="true">
<div class="flex"> <div class="flex">
<a-switch v-model:checked="formState.hidden.enabled" /> <a-switch v-model:checked="formState.hidden.enabled" />
</div> </div>
<div class="helper"> <div class="helper">
可以在平时关闭站点的可访问性需要时再打开增强站点安全性 {{ t('certd.siteHideDescription') }}
<a href="https://certd.docmirror.cn/guide/feature/safe/hidden" class="flex items-center" target="_blank"> <a href="https://certd.docmirror.cn/guide/feature/safe/hidden" class="flex items-center"
<span>帮助说明</span> target="_blank">
<fs-icon class="ml-1" icon="mingcute:question-line"></fs-icon <span>{{ t('certd.helpDoc') }}</span>
></a> <fs-icon class="ml-1" icon="mingcute:question-line"></fs-icon></a>
</div> </div>
</a-form-item> </a-form-item>
<a-form-item v-if="formState.hidden.enabled" label="随机地址" :name="['hidden', 'openPath']" :required="true"> <a-form-item v-if="formState.hidden.enabled" :label="t('certd.randomAddress')"
:name="['hidden', 'openPath']" :required="true">
<a-input-search v-model:value="formState.hidden.openPath" :allow-clear="true" @search="changeOpenPath"> <a-input-search v-model:value="formState.hidden.openPath" :allow-clear="true" @search="changeOpenPath">
<template #enterButton> <template #enterButton>
<fs-icon icon="ion:refresh"></fs-icon> <fs-icon icon="ion:refresh"></fs-icon>
</template> </template>
</a-input-search> </a-input-search>
<div class="helper">站点被隐藏后需要访问此URL解锁才能正常访问</div> <div class="helper">{{ t('certd.siteHideUrlHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item v-if="formState.hidden.enabled" label="完整解除隐藏地址" :name="['hidden', 'openPath']" :required="true"> <a-form-item v-if="formState.hidden.enabled" :label="t('certd.fullUnlockUrl')"
:name="['hidden', 'openPath']" :required="true">
<div class="flex"><fs-copyable v-model="openUrl" class="flex-inline"></fs-copyable></div> <div class="flex"><fs-copyable v-model="openUrl" class="flex-inline"></fs-copyable></div>
<div class="helper red">请保存好此地址</div> <div class="helper red">{{ t('certd.saveThisUrl') }}</div>
</a-form-item> </a-form-item>
<a-form-item v-if="formState.hidden.enabled" label="解除密码" :name="['hidden', 'openPassword']" :required="false"> <a-form-item v-if="formState.hidden.enabled" :label="t('certd.unlockPassword')"
:name="['hidden', 'openPassword']" :required="false">
<a-input-password v-model:value="formState.hidden.openPassword" :allow-clear="true" /> <a-input-password v-model:value="formState.hidden.openPassword" :allow-clear="true" />
<div class="helper">解除隐藏时需要输入密码第一次需要设置密码填写则重置密码</div> <div class="helper">{{ t('certd.unlockPasswordHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item v-if="formState.hidden.enabled" label="自动隐藏时间" :name="['hidden', 'autoHiddenTimes']" :required="true"> <a-form-item v-if="formState.hidden.enabled" :label="t('certd.autoHideTime')"
:name="['hidden', 'autoHiddenTimes']" :required="true">
<a-input-number v-model:value="formState.hidden.autoHiddenTimes" :allow-clear="true" /> <a-input-number v-model:value="formState.hidden.autoHiddenTimes" :allow-clear="true" />
<div class="helper">多少分钟内无请求自动隐藏</div> <div class="helper">{{ t('certd.autoHideTimeHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item v-if="formState.hidden.enabled" label="隐藏开放接口" :name="['hidden', 'hiddenOpenApi']" :required="true"> <a-form-item v-if="formState.hidden.enabled" :label="t('certd.hideOpenApi')"
:name="['hidden', 'hiddenOpenApi']" :required="true">
<a-switch v-model:checked="formState.hidden.hiddenOpenApi" /> <a-switch v-model:checked="formState.hidden.hiddenOpenApi" />
<div class="helper">是否隐藏开放接口是否放开/api/v1开头的接口</div> <div class="helper">{{ t('certd.hideOpenApiHelper') }}</div>
</a-form-item> </a-form-item>
<a-form-item v-if="formState.hidden.enabled" label="立即隐藏站点"> <a-form-item v-if="formState.hidden.enabled" :label="t('certd.hideSiteImmediately')">
<loading-button class="ml-1" type="primary" html-type="button" :click="doHiddenImmediate">立即隐藏</loading-button> <loading-button class="ml-1" type="primary" html-type="button" :click="doHiddenImmediate">{{
t('certd.hideImmediately') }}</loading-button>
</a-form-item> </a-form-item>
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }"> <a-form-item label=" " :colon="false" :wrapper-col="{ span: 16 }">
<loading-button type="primary" html-type="button" :click="onClick">保存</loading-button> <loading-button type="primary" html-type="button" :click="onClick">{{ t('certd.save')
}}</loading-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
</div> </div>
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { computed, reactive, ref } from "vue"; import { computed, reactive, ref } from "vue";
import { merge } from "lodash-es"; import { merge } from "lodash-es";
@@ -56,6 +65,9 @@ import { Modal, notification } from "ant-design-vue";
import { request } from "/@/api/service"; import { request } from "/@/api/service";
import { util, utils } from "/@/utils"; import { util, utils } from "/@/utils";
import { useSettingStore } from "/@/store/settings"; import { useSettingStore } from "/@/store/settings";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
defineOptions({ defineOptions({
name: "SettingSafe", name: "SettingSafe",
}); });
@@ -138,24 +150,24 @@ const onClick = async () => {
await api.SettingSave(form); await api.SettingSave(form);
await loadSettings(); await loadSettings();
notification.success({ notification.success({
message: "保存成功", message: t('certd.saveSuccess'),
}); });
}; };
async function doHiddenImmediate() { async function doHiddenImmediate() {
Modal.confirm({ Modal.confirm({
title: "确定要立即隐藏站点吗?", title: t('certd.confirmHideSiteTitle'),
content: "隐藏后,将无法访问站点,请谨慎操作", content: t('certd.confirmHideSiteContent'),
async onOk() { async onOk() {
await api.HiddenImmediate(); await api.HiddenImmediate();
notification.success({ notification.success({
message: "站点已隐藏", message: t('certd.siteHiddenSuccess'),
}); });
}, },
}); });
} }
</script> </script>
<style lang="less"> <style lang="less">
.sys-settings-base { .sys-settings-base {}
}
</style> </style>