mirror of
https://github.com/certd/certd.git
synced 2026-04-16 14:00:51 +08:00
Merge branch 'v2-dev' into v2-dev-buy
This commit is contained in:
@@ -12,6 +12,14 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "image",
|
||||
},
|
||||
addonId: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
const captchaRef = ref(null);
|
||||
const settingStore = useSettingStore();
|
||||
@@ -23,7 +31,7 @@ const captchaAddonId = computed(() => {
|
||||
return settingStore.sysPublic.captchaAddonId ?? 0;
|
||||
});
|
||||
const captchaComponent = computed(() => {
|
||||
let type: any = "image";
|
||||
let type: any = props.type ?? "image";
|
||||
if (settingStore.sysPublic.captchaAddonId && settingStore.sysPublic.captchaType) {
|
||||
type = settingStore.sysPublic.captchaType;
|
||||
}
|
||||
@@ -48,10 +56,10 @@ function onChange(data: any) {
|
||||
}
|
||||
|
||||
async function getCaptchaForm() {
|
||||
return await captchaRef.value.getCaptchaForm();
|
||||
return await captchaRef.value?.getCaptchaForm();
|
||||
}
|
||||
async function reset() {
|
||||
await captchaRef.value.reset();
|
||||
await captchaRef.value?.reset();
|
||||
}
|
||||
defineExpose({
|
||||
getCaptchaForm,
|
||||
|
||||
@@ -7,6 +7,14 @@ import { useSettingStore } from "/@/store/settings";
|
||||
import { request } from "/src/api/service";
|
||||
import { notification } from "ant-design-vue";
|
||||
|
||||
import { loadScript } from "vue-plugin-load-script";
|
||||
const loaded = ref(false);
|
||||
async function loadCaptchaScript() {
|
||||
// 加载验证码js
|
||||
await loadScript("https://static.geetest.com/v4/gt4.js");
|
||||
loaded.value = true;
|
||||
}
|
||||
|
||||
defineOptions({
|
||||
name: "GeetestCaptcha",
|
||||
});
|
||||
@@ -16,15 +24,10 @@ const props = defineProps<{
|
||||
captchaGet: () => Promise<any>;
|
||||
}>();
|
||||
const captchaRef = ref(null);
|
||||
// const addonApi = createAddonApi();
|
||||
const settingStore = useSettingStore();
|
||||
|
||||
const captchaInstanceRef: Ref = ref({});
|
||||
async function init() {
|
||||
// if (!initGeetest4) {
|
||||
// await import("https://static.geetest.com/v4/gt4.js");
|
||||
// }
|
||||
|
||||
await loadCaptchaScript();
|
||||
const { captchaId } = await props.captchaGet();
|
||||
// @ts-ignore
|
||||
initGeetest4(
|
||||
|
||||
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div ref="captchaRef" class="tencent_captcha_wrapper" :class="{ tencent_captcha_ok: modelValue }" @click="triggerCaptcha">
|
||||
<div class="validation-box" :class="{ validated: modelValue != null }">
|
||||
<div class="sweep-animation"></div>
|
||||
<div class="box-content">
|
||||
<div class="box-icon">✓</div>
|
||||
<span v-if="modelValue == null" class="status-text">点击进行验证</span>
|
||||
<span v-else class="status-text">验证成功</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onMounted, defineProps, defineEmits, ref, onUnmounted, Ref, watch } from "vue";
|
||||
import { notification } from "ant-design-vue";
|
||||
|
||||
import { loadScript } from "vue-plugin-load-script";
|
||||
const loaded = ref(false);
|
||||
async function loadCaptchaScript() {
|
||||
// 加载验证码js
|
||||
// var appid = "您的CaptchaAppId";
|
||||
// loadScript("https://turing.captcha.qq.com/TJCaptcha.js?appid=" + appid);
|
||||
await loadScript("https://turing.captcha.qcloud.com/TJCaptcha.js");
|
||||
loaded.value = true;
|
||||
}
|
||||
loadCaptchaScript();
|
||||
|
||||
defineOptions({
|
||||
name: "TencentCaptcha",
|
||||
});
|
||||
const emit = defineEmits(["update:modelValue", "change"]);
|
||||
const props = defineProps<{
|
||||
modelValue: any;
|
||||
captchaGet: () => Promise<any>;
|
||||
}>();
|
||||
const captchaRef = ref(null);
|
||||
|
||||
const captchaInstanceRef: Ref = ref({});
|
||||
|
||||
// 定义回调函数
|
||||
function callback(res: { ret: number; ticket: string; randstr: string; errorCode?: number; errorMessage?: string }) {
|
||||
// 第一个参数传入回调结果,结果如下:
|
||||
// ret Int 验证结果,0:验证成功。2:用户主动关闭验证码。
|
||||
// ticket String 验证成功的票据,当且仅当 ret = 0 时 ticket 有值。
|
||||
// CaptchaAppId String 验证码应用ID。
|
||||
// bizState Any 自定义透传参数。
|
||||
// randstr String 本次验证的随机串,后续票据校验时需传递该参数。
|
||||
// verifyDuration Int 验证码校验接口耗时(ms)。
|
||||
// actionDuration Int 操作校验成功耗时(用户动作+校验完成)(ms)。
|
||||
// sid String 链路sid。
|
||||
console.log("callback:", res);
|
||||
// res(用户主动关闭验证码)= {ret: 2, ticket: null}
|
||||
// res(验证成功) = {ret: 0, ticket: "String", randstr: "String"}
|
||||
// res(请求验证码发生错误,验证码自动返回trerror_前缀的容灾票据) = {ret: 0, ticket: "String", randstr: "String", errorCode: Number, errorMessage: "String"}
|
||||
// 此处代码仅为验证结果的展示示例,真实业务接入,建议基于ticket和errorCode情况做不同的业务处理
|
||||
|
||||
if (res.errorCode && res.errorCode > 0) {
|
||||
notification.error({
|
||||
message: `验证码验证失败:${res.errorMessage || res.errorCode}`,
|
||||
});
|
||||
}
|
||||
|
||||
if (res.ret === 0) {
|
||||
emitChange({
|
||||
ticket: res.ticket,
|
||||
randstr: res.randstr,
|
||||
});
|
||||
} else if (res.ret === 2) {
|
||||
console.log("用户主动关闭验证码");
|
||||
}
|
||||
}
|
||||
|
||||
// 定义验证码js加载错误处理函数
|
||||
function loadErrorCallback(error: any) {
|
||||
// var appid = "您的CaptchaAppId";
|
||||
// // 生成容灾票据或自行做其它处理
|
||||
// var ticket = "trerror_1001_" + appid + "_" + Math.floor(new Date().getTime() / 1000);
|
||||
// callback({
|
||||
// ret: 0,
|
||||
// randstr: "@" + Math.random().toString(36).substr(2),
|
||||
// ticket: ticket,
|
||||
// errorCode: 1001,
|
||||
// errorMessage: "jsload_error",
|
||||
// });
|
||||
notification.error({
|
||||
message: `验证码加载失败:${error?.message || error}`,
|
||||
});
|
||||
}
|
||||
async function triggerCaptcha() {
|
||||
if (!loaded.value) {
|
||||
notification.error({
|
||||
message: "验证码还未加载完成,请稍后再试",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const { captchaAppId } = await props.captchaGet();
|
||||
|
||||
try {
|
||||
// 生成一个验证码对象
|
||||
// CaptchaAppId:登录验证码控制台,从【验证管理】页面进行查看。如果未创建过验证,请先新建验证。注意:不可使用客户端类型为小程序的CaptchaAppId,会导致数据统计错误。
|
||||
//callback:定义的回调函数
|
||||
// @ts-ignore
|
||||
var captcha = new TencentCaptcha(captchaAppId + "", callback, {
|
||||
userLanguage: "zh-cn",
|
||||
// showFn: (ret: any) => {
|
||||
// const {
|
||||
// duration, // 验证码渲染完成的耗时(ms)
|
||||
// sid, // 链路sid
|
||||
// } = ret;
|
||||
// },
|
||||
});
|
||||
// 调用方法,显示验证码
|
||||
captcha.show();
|
||||
} catch (error) {
|
||||
// 加载异常,调用验证码js加载错误处理函数
|
||||
loadErrorCallback(error);
|
||||
}
|
||||
}
|
||||
|
||||
function emitChange(value: any) {
|
||||
emit("update:modelValue", value);
|
||||
emit("change", value);
|
||||
}
|
||||
function reset() {
|
||||
captchaInstanceRef.value?.instance?.reset();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => {
|
||||
return props.modelValue;
|
||||
},
|
||||
value => {
|
||||
if (value == null) {
|
||||
reset();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
defineExpose({
|
||||
reset,
|
||||
});
|
||||
</script>
|
||||
<style lang="less">
|
||||
.tencent_captcha_wrapper {
|
||||
.validation-box {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
margin: 0 auto 30px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.validation-box:hover {
|
||||
border-color: #aaa;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
.validation-box.validated {
|
||||
border-color: #4caf50;
|
||||
background-color: #f1f8e9;
|
||||
}
|
||||
|
||||
.box-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.box-icon {
|
||||
font-size: 18px;
|
||||
color: #bbb;
|
||||
margin-right: 15px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.validation-box.validated .box-icon {
|
||||
color: #4caf50;
|
||||
}
|
||||
|
||||
.status-text {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #888;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.validation-box.validated .status-text {
|
||||
color: #4caf50;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 划过动画效果 */
|
||||
.sweep-animation {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(90deg, transparent, rgba(76, 175, 80, 0.2), transparent);
|
||||
z-index: 1;
|
||||
opacity: 0;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.validation-box.validated .sweep-animation {
|
||||
animation: sweep 0.8s ease forwards;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
@keyframes sweep {
|
||||
0% {
|
||||
left: -100%;
|
||||
}
|
||||
50% {
|
||||
left: 0;
|
||||
}
|
||||
100% {
|
||||
left: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -45,6 +45,16 @@ export async function DoVerify(id: number) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function ResetStatus(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/resetStatus",
|
||||
method: "post",
|
||||
data: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function ParseDomain(fullDomain: string) {
|
||||
return await request({
|
||||
url: subDomainApiPrefix + "/parseDomain",
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
<a-tooltip v-if="cnameRecord.error" :title="cnameRecord.error">
|
||||
<fs-icon class="ml-5 color-red" icon="ion:warning-outline"></fs-icon>
|
||||
</a-tooltip>
|
||||
<a-tooltip v-if="cnameRecord.status === 'valid'" title="重置校验状态,重新校验">
|
||||
<fs-icon class="ml-2 color-yellow text-md pointer" icon="solar:undo-left-square-bold" @click="resetStatus"></fs-icon>
|
||||
</a-tooltip>
|
||||
</td>
|
||||
<td class="center">
|
||||
<template v-if="cnameRecord.status !== 'valid'">
|
||||
@@ -35,6 +38,7 @@ import { ref, watch } from "vue";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import * as api from "./api.js";
|
||||
import CnameTip from "./cname-tip.vue";
|
||||
import { Modal } from "ant-design-vue";
|
||||
const statusDict = dict({
|
||||
data: [
|
||||
{ label: "待设置CNAME", value: "cname", color: "warning" },
|
||||
@@ -71,12 +75,15 @@ function onRecordChange() {
|
||||
});
|
||||
}
|
||||
|
||||
async function loadRecord() {
|
||||
cnameRecord.value = await GetByDomain(props.domain);
|
||||
}
|
||||
let refreshIntervalId: any = null;
|
||||
async function doRefresh() {
|
||||
if (!props.domain) {
|
||||
return;
|
||||
}
|
||||
cnameRecord.value = await GetByDomain(props.domain);
|
||||
await loadRecord();
|
||||
onRecordChange();
|
||||
|
||||
if (cnameRecord.value.status === "validating") {
|
||||
@@ -114,6 +121,17 @@ async function doVerify() {
|
||||
}
|
||||
await doRefresh();
|
||||
}
|
||||
|
||||
async function resetStatus() {
|
||||
Modal.confirm({
|
||||
title: "重置状态",
|
||||
content: "确定要重置校验状态吗?",
|
||||
onOk: async () => {
|
||||
await api.ResetStatus(cnameRecord.value.id);
|
||||
await loadRecord();
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
@@ -57,6 +57,7 @@ export default {
|
||||
suiteBuy: "Suite Purchase",
|
||||
myTrade: "My Orders",
|
||||
paymentReturn: "Payment Return",
|
||||
hasExpired: "Expired",
|
||||
user: {
|
||||
greeting: "Hello",
|
||||
profile: "Account Info",
|
||||
@@ -136,10 +137,16 @@ export default {
|
||||
triggerType: "Trigger Type",
|
||||
pipelineId: "Pipeline Id",
|
||||
},
|
||||
|
||||
pi: {
|
||||
validTime: "Piepline Valid Time",
|
||||
validTimeHelper: "Not filled in means permanent validity",
|
||||
},
|
||||
types: {
|
||||
certApply: "Certificate Application",
|
||||
certUpload: "Certificate Upload",
|
||||
certApply: "Cert Apply",
|
||||
certUpload: "Cert Upload",
|
||||
custom: "Custom",
|
||||
template: "Template",
|
||||
},
|
||||
myPipelines: "My Pipelines",
|
||||
selectedCount: "Selected {count} items",
|
||||
@@ -175,6 +182,7 @@ export default {
|
||||
suiteSetting: "Suite Settings",
|
||||
orderManager: "Order Management",
|
||||
userSuites: "User Suites",
|
||||
netTest: "Network Test",
|
||||
},
|
||||
certificateRepo: {
|
||||
title: "Certificate Repository",
|
||||
@@ -223,9 +231,13 @@ export default {
|
||||
notificationWhen: "Notification Timing",
|
||||
notificationHelper: "Get real-time alerts when the task fails",
|
||||
groupIdTitle: "Pipeline Group",
|
||||
|
||||
addToMonitorEnabled: "Add to Cert Monitor",
|
||||
addToMonitorDomains: "Add to Monitor Domains",
|
||||
},
|
||||
notificationDefault: "Use Default Notification",
|
||||
monitor: {
|
||||
remark: "Remark",
|
||||
title: "Site Certificate Monitoring",
|
||||
description: "Check website certificates' expiration at 0:00 daily; reminders sent 10 days before expiration (using default notification channel);",
|
||||
settingLink: "Site Monitoring Settings",
|
||||
@@ -247,6 +259,7 @@ export default {
|
||||
certDomains: "Certificate Domains",
|
||||
certProvider: "Issuer",
|
||||
certStatus: "Certificate Status",
|
||||
error: "Error",
|
||||
status: {
|
||||
ok: "Valid",
|
||||
expired: "Expired",
|
||||
@@ -280,6 +293,8 @@ export default {
|
||||
cronTrigger: "Scheduled trigger for monitoring",
|
||||
dnsServer: "DNS Server",
|
||||
dnsServerHelper: "Use a custom domain name resolution server, such as: 1.1.1.1 , support multiple",
|
||||
certValidDays: "Certificate Valid Days",
|
||||
certValidDaysHelper: "Number of days before expiration to send a notification",
|
||||
},
|
||||
},
|
||||
checkStatus: {
|
||||
@@ -289,7 +304,7 @@ export default {
|
||||
},
|
||||
domainList: {
|
||||
title: "Domain List",
|
||||
helper: "Format: domain:port:name, one per line. Port and name are optional.\nExamples:\nwww.baidu.com:443:Baidu\nwww.taobao.com::Taobao\nwww.google.com",
|
||||
helper: "Format: domain:port:name:remark, one per line. Port and name are optional.\nExamples:\nwww.baidu.com:443:Baidu:remarkText\nwww.taobao.com::Taobao\nwww.google.com",
|
||||
required: "Please enter domains to import",
|
||||
placeholder: "www.baidu.com:443:Baidu\nwww.taobao.com::Taobao\nwww.google.com\n",
|
||||
},
|
||||
@@ -447,6 +462,7 @@ export default {
|
||||
description: "Description",
|
||||
createTime: "Creation Time",
|
||||
updateTime: "Update Time",
|
||||
mainDomain: "Main Domain",
|
||||
edit: "Edit",
|
||||
groupName: "Group Name",
|
||||
enterGroupName: "Please enter group name",
|
||||
@@ -715,19 +731,32 @@ export default {
|
||||
addonName: "Name",
|
||||
addonNameHelper: "Fill freely, helps to distinguish when multiple same type exist",
|
||||
addonTypeSelect: "Select type",
|
||||
dates: {
|
||||
years: "{count} years",
|
||||
months: "{count} months",
|
||||
},
|
||||
sys: {
|
||||
setting: {
|
||||
baseSetting: "Base Settings",
|
||||
registerSetting: "Register Settings",
|
||||
safeSetting: "Safe Settings",
|
||||
paymentSetting: "Payment Settings",
|
||||
captchaSetting: "Captcha Setting",
|
||||
pipelineSetting: "Pipeline Settings",
|
||||
showRunStrategy: "Show RunStrategy",
|
||||
showRunStrategyHelper: "Allow modify the run strategy of the task",
|
||||
|
||||
captchaEnabled: "Enable Login Captcha",
|
||||
captchaHelper: "Whether to enable captcha verification for login",
|
||||
captchaType: "Captcha Setting",
|
||||
captchaTest: "Captcha Test",
|
||||
// 保存后再点击测试,请务必测试通过了,再开启登录验证码
|
||||
captchaTestHelper: "Save and click test, please make sure the test is passed before enabling login captcha",
|
||||
|
||||
baseSetting: "Base Settings",
|
||||
registerSetting: "Register Settings",
|
||||
safeSetting: "Safe Settings",
|
||||
paymentSetting: "Payment Settings",
|
||||
pipelineValidTimeEnabled: "Enable Pipeline Valid Time",
|
||||
pipelineValidTimeEnabledHelper: "Whether to enable the valid time of the pipeline",
|
||||
certDomainAddToMonitorEnabled: "Add Domain to Certificate Monitor",
|
||||
certDomainAddToMonitorEnabledHelper: "Whether to add the domain to the certificate monitor",
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
|
||||
@@ -62,6 +62,7 @@ export default {
|
||||
suiteBuy: "套餐购买",
|
||||
myTrade: "我的订单",
|
||||
paymentReturn: "支付返回",
|
||||
hasExpired: "已过期",
|
||||
|
||||
user: {
|
||||
greeting: "您好",
|
||||
@@ -142,10 +143,15 @@ export default {
|
||||
triggerType: "触发类型",
|
||||
pipelineId: "流水线Id",
|
||||
},
|
||||
pi: {
|
||||
validTime: "流水线有效期",
|
||||
validTimeHelper: "不填则为永久有效",
|
||||
},
|
||||
types: {
|
||||
certApply: "证书申请",
|
||||
certUpload: "证书上传",
|
||||
custom: "自定义",
|
||||
template: "模版",
|
||||
},
|
||||
myPipelines: "我的流水线",
|
||||
selectedCount: "已选择 {count} 项",
|
||||
@@ -181,6 +187,7 @@ export default {
|
||||
suiteSetting: "套餐设置",
|
||||
orderManager: "订单管理",
|
||||
userSuites: "用户套餐",
|
||||
netTest: "网络测试",
|
||||
},
|
||||
certificateRepo: {
|
||||
title: "证书仓库",
|
||||
@@ -228,9 +235,12 @@ export default {
|
||||
notificationWhen: "通知时机",
|
||||
notificationHelper: "任务执行失败实时提醒",
|
||||
groupIdTitle: "流水线分组",
|
||||
addToMonitorEnabled: "添加到证书监控",
|
||||
addToMonitorDomains: "添加到监控域名",
|
||||
},
|
||||
notificationDefault: "使用默认通知",
|
||||
monitor: {
|
||||
remark: "备注",
|
||||
title: "站点证书监控",
|
||||
description: "每天0点,检查网站证书的过期时间,到期前10天时将发出提醒(使用默认通知渠道);",
|
||||
settingLink: "站点监控设置",
|
||||
@@ -252,6 +262,7 @@ export default {
|
||||
certDomains: "证书域名",
|
||||
certProvider: "颁发机构",
|
||||
certStatus: "证书状态",
|
||||
error: "错误信息",
|
||||
status: {
|
||||
ok: "正常",
|
||||
expired: "过期",
|
||||
@@ -285,6 +296,8 @@ export default {
|
||||
cronTrigger: "定时触发监控",
|
||||
dnsServer: "DNS服务器",
|
||||
dnsServerHelper: "使用自定义的域名解析服务器,如:1.1.1.1 , 支持多个",
|
||||
certValidDays: "证书到期前天数",
|
||||
certValidDaysHelper: "证书到期前多少天发送通知",
|
||||
},
|
||||
},
|
||||
checkStatus: {
|
||||
@@ -294,9 +307,9 @@ export default {
|
||||
},
|
||||
domainList: {
|
||||
title: "域名列表",
|
||||
helper: "格式【域名:端口:名称】,一行一个,其中端口、名称可以省略\n比如:\nwww.baidu.com:443:百度\nwww.taobao.com::淘宝\nwww.google.com",
|
||||
helper: "格式【域名:端口:名称:备注】,一行一个,其中端口、名称、备注可以省略\n比如:\nwww.baidu.com:443:百度:备注文本\nwww.taobao.com::淘宝\nwww.google.com",
|
||||
required: "请输入要导入的域名",
|
||||
placeholder: "www.baidu.com:443:百度\nwww.taobao.com::淘宝\nwww.google.com\n",
|
||||
placeholder: "www.baidu.com:443:百度:备注文本\nwww.taobao.com::淘宝\nwww.google.com\n",
|
||||
},
|
||||
accountInfo: "账号信息",
|
||||
securitySettings: "认证安全设置",
|
||||
@@ -453,6 +466,7 @@ export default {
|
||||
description: "说明",
|
||||
createTime: "创建时间",
|
||||
updateTime: "更新时间",
|
||||
mainDomain: "主域名",
|
||||
edit: "编辑",
|
||||
groupName: "分组名称",
|
||||
enterGroupName: "请输入分组名称",
|
||||
@@ -461,7 +475,7 @@ export default {
|
||||
batchDeleteConfirm: "确定要批量删除这{count}条记录吗",
|
||||
selectRecordFirst: "请先勾选记录",
|
||||
subdomainHosted: "托管的子域名",
|
||||
subdomainHelpText: "如果您不理解什么是子域托管,请不要随意设置,可能导致证书无法申请,可以参考文档",
|
||||
subdomainHelpText: "如果您不理解什么是子域托管,请不要随意设置(可能导致证书无法申请,以前设置过的cname记录也需要重新配置),可以参考文档",
|
||||
subdomainManagement: "子域管理",
|
||||
isDisabled: "是否禁用",
|
||||
enabled: "启用",
|
||||
@@ -717,19 +731,32 @@ export default {
|
||||
copyPipelineConfig: "复制该流水线配置作为模板来源",
|
||||
pipeline: "流水线",
|
||||
},
|
||||
dates: {
|
||||
years: "{count}年",
|
||||
months: "{count}月",
|
||||
},
|
||||
sys: {
|
||||
setting: {
|
||||
baseSetting: "基本设置",
|
||||
registerSetting: "注册设置",
|
||||
safeSetting: "安全设置",
|
||||
paymentSetting: "支付设置",
|
||||
captchaSetting: "验证码设置",
|
||||
pipelineSetting: "流水线设置",
|
||||
|
||||
showRunStrategy: "显示运行策略选择",
|
||||
showRunStrategyHelper: "任务设置中是否允许选择运行策略",
|
||||
|
||||
captchaEnabled: "启用登录验证码",
|
||||
captchaHelper: "登录时是否启用验证码",
|
||||
captchaType: "验证码配置",
|
||||
captchaTest: "测试验证码",
|
||||
captchaTestHelper: "保存后再点击测试,请务必测试通过了,再开启登录验证码",
|
||||
|
||||
baseSetting: "基本设置",
|
||||
registerSetting: "注册设置",
|
||||
safeSetting: "安全设置",
|
||||
paymentSetting: "支付设置",
|
||||
pipelineValidTimeEnabled: "启用流水线有效期",
|
||||
pipelineValidTimeEnabledHelper: "是否启用流水线有效期",
|
||||
certDomainAddToMonitorEnabled: "证书域名添加到证书监控",
|
||||
certDomainAddToMonitorEnabledHelper: "创建证书流水线时是否可以选择将域名添加到证书监控",
|
||||
},
|
||||
},
|
||||
modal: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { request } from "/src/api/service";
|
||||
// import "/src/mock";
|
||||
import { ColumnCompositionProps, CrudOptions, FastCrud, PageQuery, PageRes, setLogger, TransformResProps, useColumns, UseCrudProps, UserPageQuery, useTypes, utils } from "@fast-crud/fast-crud";
|
||||
import { ColumnCompositionProps, CrudOptions, FastCrud, PageQuery, PageRes, setLogger, TransformResProps, useColumns, UseCrudProps, UserPageQuery, useTypes, utils, forEachTableColumns } from "@fast-crud/fast-crud";
|
||||
import "@fast-crud/fast-crud/dist/style.css";
|
||||
import { FsExtendsCopyable, FsExtendsEditor, FsExtendsJson, FsExtendsTime, FsExtendsUploader, FsExtendsInput } from "@fast-crud/fast-extends";
|
||||
import "@fast-crud/fast-extends/dist/style.css";
|
||||
@@ -14,25 +14,27 @@ import { usePreferences } from "/@/vben/preferences";
|
||||
import { LocalStorage } from "/@/utils/util.storage";
|
||||
|
||||
import { FsEditorCode } from "@fast-crud/editor-code";
|
||||
import "@fast-crud/editor-code/dist/style.css"
|
||||
import "@fast-crud/editor-code/dist/style.css";
|
||||
|
||||
class ColumnSizeSaver {
|
||||
save: (key: string, size: number) => void;
|
||||
constructor() {
|
||||
this.save = debounce((key: string, size: number) => {
|
||||
type: string;
|
||||
save: (key: string, value: any) => void;
|
||||
constructor(type: string = "columnSize") {
|
||||
this.type = type;
|
||||
this.save = debounce((key: string, value: any) => {
|
||||
const saveKey = this.getKey();
|
||||
let data = LocalStorage.get(saveKey);
|
||||
if (!data) {
|
||||
data = {};
|
||||
}
|
||||
data[key] = size;
|
||||
data[key] = value;
|
||||
LocalStorage.set(saveKey, data);
|
||||
});
|
||||
}
|
||||
getKey() {
|
||||
const loc = window.location;
|
||||
const currentUrl = `${loc.pathname}${loc.search}${loc.hash}`;
|
||||
return `columnSize-${currentUrl}`;
|
||||
return `${this.type}-${currentUrl}`;
|
||||
}
|
||||
get(key: string) {
|
||||
const saveKey = this.getKey();
|
||||
@@ -45,6 +47,7 @@ class ColumnSizeSaver {
|
||||
}
|
||||
}
|
||||
const columnSizeSaver = new ColumnSizeSaver();
|
||||
const tableSortSaver = new ColumnSizeSaver("tableSorter");
|
||||
|
||||
function install(app: App, options: any = {}) {
|
||||
app.use(UiAntdv);
|
||||
@@ -63,6 +66,8 @@ function install(app: App, options: any = {}) {
|
||||
commonOptions(props: UseCrudProps): CrudOptions {
|
||||
utils.logger.debug("commonOptions:", props);
|
||||
const crudBinding = props.crudExpose?.crudBinding;
|
||||
const crudExpose = props.crudExpose;
|
||||
|
||||
const { isMobile } = usePreferences();
|
||||
const opts: CrudOptions = {
|
||||
settings: {
|
||||
@@ -74,6 +79,20 @@ function install(app: App, options: any = {}) {
|
||||
},
|
||||
},
|
||||
},
|
||||
onUseCrud(bindings: any) {
|
||||
const oldSorter = tableSortSaver.get("sorter");
|
||||
if (oldSorter) {
|
||||
const { prop, order } = oldSorter;
|
||||
forEachTableColumns(bindings.table.columns, (column: any) => {
|
||||
if (column.key === prop) {
|
||||
column.sortOrder = order;
|
||||
} else {
|
||||
column.sortOrder = false;
|
||||
}
|
||||
});
|
||||
bindings.table.sort = oldSorter;
|
||||
}
|
||||
},
|
||||
},
|
||||
table: {
|
||||
scroll: {
|
||||
@@ -104,6 +123,30 @@ function install(app: App, options: any = {}) {
|
||||
return "-";
|
||||
},
|
||||
},
|
||||
onSortChange: (sortChange: any) => {
|
||||
const { isServerSort, prop, asc, order } = sortChange;
|
||||
const oldSort = crudBinding.value.table.sort;
|
||||
const newSorter = isServerSort ? { prop, order, asc } : null;
|
||||
|
||||
forEachTableColumns(crudBinding.value.table.columns, (column: any) => {
|
||||
if (column.key === prop) {
|
||||
column.sortOrder = order;
|
||||
} else {
|
||||
column.sortOrder = false;
|
||||
}
|
||||
});
|
||||
|
||||
crudBinding.value.table.sort = newSorter;
|
||||
if (newSorter) {
|
||||
tableSortSaver.save("sorter", newSorter);
|
||||
} else {
|
||||
tableSortSaver.clear();
|
||||
}
|
||||
|
||||
if (isServerSort || oldSort != null) {
|
||||
crudExpose.doRefresh();
|
||||
}
|
||||
},
|
||||
},
|
||||
toolbar: {
|
||||
export: {
|
||||
@@ -189,6 +232,10 @@ function install(app: App, options: any = {}) {
|
||||
},
|
||||
wrapperCol: {
|
||||
span: null,
|
||||
buttons: {
|
||||
copy: { show: false },
|
||||
paste: { show: false },
|
||||
},
|
||||
},
|
||||
wrapper: {
|
||||
saveRemind: true,
|
||||
|
||||
@@ -249,6 +249,17 @@ export const sysResources = [
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "certd.sysResources.netTest",
|
||||
name: "NetTest",
|
||||
path: "/sys/nettest",
|
||||
component: "/sys/nettest/index.vue",
|
||||
meta: {
|
||||
icon: "ion:build-outline",
|
||||
auth: true,
|
||||
keepAlive: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -50,6 +50,12 @@ export type SysPublicSetting = {
|
||||
captchaEnabled?: boolean;
|
||||
captchaType?: number;
|
||||
captchaAddonId?: number;
|
||||
|
||||
//流水线是否启用有效期
|
||||
pipelineValidTimeEnabled?: boolean;
|
||||
|
||||
//证书域名添加到监控
|
||||
certDomainAddToMonitorEnabled?: boolean;
|
||||
};
|
||||
export type SuiteSetting = {
|
||||
enabled?: boolean;
|
||||
@@ -63,6 +69,9 @@ export type SysPrivateSetting = {
|
||||
type?: string;
|
||||
config?: any;
|
||||
};
|
||||
|
||||
//http请求超时时间
|
||||
httpRequestTimeout?: number;
|
||||
};
|
||||
export type SysInstallInfo = {
|
||||
siteId: string;
|
||||
|
||||
@@ -19,6 +19,10 @@ div#app {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
pre.pre{
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
width: 12px !important;
|
||||
height: 12px !important;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
width: 8px;
|
||||
width: 12px !important;
|
||||
background: rgba(#101f1c, 0.1);
|
||||
-webkit-border-radius: 2em;
|
||||
-moz-border-radius: 2em;
|
||||
border-radius: 2em;
|
||||
-webkit-border-radius: 4em;
|
||||
-moz-border-radius: 4em;
|
||||
border-radius: 4em;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
// background-color: rgba(#101F1C, 0.5);
|
||||
background-clip: padding-box;
|
||||
min-height: 28px;
|
||||
-webkit-border-radius: 2em;
|
||||
-moz-border-radius: 2em;
|
||||
border-radius: 2em;
|
||||
-webkit-border-radius: 4em;
|
||||
-moz-border-radius: 4em;
|
||||
border-radius: 4em;
|
||||
background-color: #b3b3b3;
|
||||
box-shadow: 0px 1px 1px #eee inset;
|
||||
}
|
||||
|
||||
@@ -54,8 +54,8 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
|
||||
);
|
||||
},
|
||||
{
|
||||
inheritAttrs: false,
|
||||
name: "VbenParentModal",
|
||||
inheritAttrs: false,
|
||||
}
|
||||
);
|
||||
return [Modal, extendedApi as ExtendedModalApi] as const;
|
||||
@@ -104,8 +104,8 @@ export function useVbenModal<TParentModalProps extends ModalProps = ModalProps>(
|
||||
);
|
||||
},
|
||||
{
|
||||
inheritAttrs: false,
|
||||
name: "VbenModal",
|
||||
inheritAttrs: false,
|
||||
}
|
||||
);
|
||||
injectData.extendApi?.(extendedApi);
|
||||
|
||||
@@ -91,6 +91,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "number",
|
||||
column: {
|
||||
width: 50,
|
||||
order: -999,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
|
||||
@@ -66,6 +66,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100,
|
||||
order: -999,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
|
||||
@@ -75,6 +75,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any, a
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100,
|
||||
order: -999,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
|
||||
64
packages/ui/certd-client/src/views/certd/basic/group/api.ts
Normal file
64
packages/ui/certd-client/src/views/certd/basic/group/api.ts
Normal file
@@ -0,0 +1,64 @@
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { request } from "/src/api/service";
|
||||
|
||||
export function createApi() {
|
||||
const apiPrefix = "/basic/group";
|
||||
return {
|
||||
async GetList(query: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "post",
|
||||
data: query,
|
||||
});
|
||||
},
|
||||
|
||||
async AddObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
},
|
||||
|
||||
async UpdateObj(obj: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj,
|
||||
});
|
||||
},
|
||||
|
||||
async DelObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
},
|
||||
|
||||
async GetObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "post",
|
||||
params: { id },
|
||||
});
|
||||
},
|
||||
async ListAll(type: string) {
|
||||
return await request({
|
||||
url: apiPrefix + "/all",
|
||||
method: "post",
|
||||
params: { type },
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const pipelineGroupApi = createApi();
|
||||
|
||||
export function createGroupDictRef(type: string) {
|
||||
return dict({
|
||||
url: "/basic/group/all?type=" + type,
|
||||
value: "id",
|
||||
label: "name",
|
||||
});
|
||||
}
|
||||
142
packages/ui/certd-client/src/views/certd/basic/group/crud.tsx
Normal file
142
packages/ui/certd-client/src/views/certd/basic/group/crud.tsx
Normal file
@@ -0,0 +1,142 @@
|
||||
import { useI18n } from "/src/locales";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { pipelineGroupApi } from "./api";
|
||||
import { ref } from "vue";
|
||||
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const api = pipelineGroupApi;
|
||||
const typeRef = ref(context.type);
|
||||
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async (req: EditReq) => {
|
||||
const { form, row } = req;
|
||||
form.id = row.id;
|
||||
const res = await api.UpdateObj(form);
|
||||
return res;
|
||||
};
|
||||
const delRequest = async (req: DelReq) => {
|
||||
const { row } = req;
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async (req: AddReq) => {
|
||||
const { form } = req;
|
||||
form.type = typeRef.value;
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
settings: {
|
||||
plugins: {
|
||||
mobile: {
|
||||
props: {
|
||||
rowHandle: {
|
||||
width: 160,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
search: {
|
||||
initialForm: {
|
||||
type: typeRef.value,
|
||||
},
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
span: null,
|
||||
style: {
|
||||
width: "100px",
|
||||
},
|
||||
},
|
||||
col: {
|
||||
span: 22,
|
||||
},
|
||||
wrapper: {
|
||||
width: 600,
|
||||
},
|
||||
},
|
||||
rowHandle: {
|
||||
width: 200,
|
||||
group: {
|
||||
editable: {
|
||||
edit: {
|
||||
text: t("certd.edit"),
|
||||
order: -1,
|
||||
type: "primary",
|
||||
click({ row, index }) {
|
||||
crudExpose.openEdit({
|
||||
index,
|
||||
row,
|
||||
});
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
table: {
|
||||
editable: {
|
||||
enabled: true,
|
||||
mode: "cell",
|
||||
exclusive: true,
|
||||
//排他式激活效果,将其他行的编辑状态触发保存
|
||||
exclusiveEffect: "save", //自动保存其他行编辑状态,cancel = 自动关闭其他行编辑状态
|
||||
async updateCell(opts) {
|
||||
const { row, key, value } = opts;
|
||||
//如果是添加,需要返回{[rowKey]:xxx},比如:{id:2}
|
||||
return await api.UpdateObj({ id: row.id, [key]: value });
|
||||
},
|
||||
},
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
column: {
|
||||
width: 100,
|
||||
editable: {
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
name: {
|
||||
title: t("certd.groupName"),
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
type: "text",
|
||||
form: {
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: t("certd.enterGroupName"),
|
||||
},
|
||||
],
|
||||
},
|
||||
column: {
|
||||
width: 400,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<template>
|
||||
<div class="pi-group-selector flex full-w">
|
||||
<div class="flex-1">
|
||||
<fs-dict-select :value="modelValue" :dict="groupDictRef" :allow-clear="true" @update:value="doUpdate"></fs-dict-select>
|
||||
</div>
|
||||
|
||||
<fs-table-select
|
||||
class="flex-0"
|
||||
:create-crud-options="createCrudOptions"
|
||||
:crud-options-override="{
|
||||
search: { show: false, initialForm: { type: props.type } },
|
||||
table: {
|
||||
scroll: {
|
||||
x: 540,
|
||||
},
|
||||
},
|
||||
}"
|
||||
:model-value="modelValue"
|
||||
:dict="groupDictRef"
|
||||
:show-current="false"
|
||||
:show-select="false"
|
||||
:dialog="{ width: 960 }"
|
||||
:destroy-on-close="false"
|
||||
height="400px"
|
||||
@update:model-value="doUpdate"
|
||||
@dialog-closed="doRefresh"
|
||||
>
|
||||
<template #default="scope">
|
||||
<fs-button class="ml-5" type="primary" icon="ant-design:edit-outlined" @click="scope.open({ context: { type: props.type } })"></fs-button>
|
||||
</template>
|
||||
</fs-table-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { createGroupDictRef } from "./api";
|
||||
import createCrudOptions from "./crud";
|
||||
import { dict, FsDictSelect } from "@fast-crud/fast-crud";
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: number;
|
||||
type: string;
|
||||
}>();
|
||||
|
||||
defineOptions({
|
||||
name: "GroupSelector",
|
||||
});
|
||||
const groupDictRef = createGroupDictRef(props.type);
|
||||
const emit = defineEmits(["refresh", "update:modelValue", "change"]);
|
||||
function doRefresh() {
|
||||
emit("refresh");
|
||||
groupDictRef.reloadDict();
|
||||
}
|
||||
|
||||
function doUpdate(value: any) {
|
||||
emit("update:modelValue", value);
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,37 @@
|
||||
<template>
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">
|
||||
分组管理
|
||||
<span class="sub">流水线分组</span>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "BasicGroupManager",
|
||||
setup() {
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
onActivated(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
};
|
||||
},
|
||||
});
|
||||
</script>
|
||||
@@ -57,4 +57,3 @@ export async function DeleteBatch(ids: any[]) {
|
||||
data: { ids },
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "number",
|
||||
column: {
|
||||
width: 80,
|
||||
order: -999,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
|
||||
@@ -67,3 +67,13 @@ export async function DoVerify(id: number) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export async function ResetStatus(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/resetStatus",
|
||||
method: "post",
|
||||
data: {
|
||||
id,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useRouter } from "vue-router";
|
||||
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { useUserStore } from "/@/store/user";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { message } from "ant-design-vue";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import CnameTip from "/@/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue";
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const router = useRouter();
|
||||
@@ -79,6 +79,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "number",
|
||||
column: {
|
||||
width: 80,
|
||||
order: -999,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
@@ -188,16 +189,32 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
column: {
|
||||
width: 120,
|
||||
align: "center",
|
||||
align: "left",
|
||||
cellRender({ value, row }) {
|
||||
async function resetStatus() {
|
||||
Modal.confirm({
|
||||
title: "重置状态",
|
||||
content: "确定要重置校验状态吗?",
|
||||
onOk: async () => {
|
||||
await api.ResetStatus(row.id);
|
||||
await crudExpose.doRefresh();
|
||||
},
|
||||
});
|
||||
}
|
||||
return (
|
||||
<div class={"flex flex-center"}>
|
||||
<div class={"flex flex-left"}>
|
||||
<fs-values-format modelValue={value} dict={dictRef}></fs-values-format>
|
||||
{row.error && (
|
||||
<a-tooltip title={row.error}>
|
||||
<fs-icon class={"ml-5 color-red"} icon="ion:warning-outline"></fs-icon>
|
||||
</a-tooltip>
|
||||
)}
|
||||
|
||||
{row.status === "valid" && (
|
||||
<a-tooltip title={"重置校验状态,重新校验"}>
|
||||
<fs-icon class={"ml-5 pointer "} icon="solar:undo-left-square-bold" onClick={resetStatus}></fs-icon>
|
||||
</a-tooltip>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
@@ -251,6 +268,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
},
|
||||
mainDomain: {
|
||||
title: t("certd.mainDomain"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.createTime"),
|
||||
type: "datetime",
|
||||
|
||||
@@ -93,6 +93,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100,
|
||||
order: -999,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
|
||||
@@ -217,14 +217,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: false,
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
sorter: false,
|
||||
conditionalRender: false,
|
||||
cellRender({ row }) {
|
||||
const {
|
||||
applyTime,
|
||||
effectiveTime,
|
||||
expiresTime,
|
||||
} = row || {};
|
||||
const { applyTime, effectiveTime, expiresTime } = row || {};
|
||||
if (!expiresTime) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
@@ -35,6 +35,14 @@ export const siteInfoApi = {
|
||||
});
|
||||
},
|
||||
|
||||
async BatchDelObj(ids: number[]) {
|
||||
return await request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
data: { ids },
|
||||
});
|
||||
},
|
||||
|
||||
async GetObj(id: number) {
|
||||
return await request({
|
||||
url: apiPrefix + "/info",
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
// @ts-ignore
|
||||
import { useI18n } from "/src/locales";
|
||||
import { AddReq, ColumnCompositionProps, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { AddReq, ColumnCompositionProps, ColumnProps, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DataFormatterContext, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { siteInfoApi } from "./api";
|
||||
import * as settingApi from "./setting/api";
|
||||
import dayjs from "dayjs";
|
||||
import { Modal, notification } from "ant-design-vue";
|
||||
import { message, Modal, notification } from "ant-design-vue";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { mySuiteApi } from "/@/views/certd/suite/mine/api";
|
||||
import { mitter } from "/@/utils/util.mitt";
|
||||
import { useSiteIpMonitor } from "./ip/use";
|
||||
import { useSiteImport } from "/@/views/certd/monitor/site/use";
|
||||
|
||||
import { ref } from "vue";
|
||||
import GroupSelector from "../../basic/group/group-selector.vue";
|
||||
import { createGroupDictRef } from "../../basic/group/api";
|
||||
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { t } = useI18n();
|
||||
const api = siteInfoApi;
|
||||
@@ -30,6 +33,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
|
||||
const addRequest = async (req: AddReq) => {
|
||||
const { form } = req;
|
||||
delete form.id;
|
||||
const res = await api.AddObj(form);
|
||||
return res;
|
||||
};
|
||||
@@ -47,6 +51,35 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const { openSiteIpMonitorDialog } = useSiteIpMonitor();
|
||||
const { openSiteImportDialog } = useSiteImport();
|
||||
|
||||
const certValidDaysRef = ref(10);
|
||||
|
||||
async function loadSetting() {
|
||||
const setting = await settingApi.SiteMonitorSettingsGet();
|
||||
certValidDaysRef.value = setting?.certValidDays || 10;
|
||||
}
|
||||
loadSetting();
|
||||
|
||||
const selectedRowKeys = ref([]);
|
||||
|
||||
const handleBatchDelete = () => {
|
||||
if (selectedRowKeys.value?.length > 0) {
|
||||
Modal.confirm({
|
||||
title: "确认",
|
||||
content: `确定要批量删除这${selectedRowKeys.value.length}条记录吗`,
|
||||
async onOk() {
|
||||
await api.BatchDelObj(selectedRowKeys.value);
|
||||
message.info("删除成功");
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
},
|
||||
});
|
||||
} else {
|
||||
message.error("请先勾选记录");
|
||||
}
|
||||
};
|
||||
|
||||
context.handleBatchDelete = handleBatchDelete;
|
||||
|
||||
function checkAll() {
|
||||
Modal.confirm({
|
||||
title: t("certd.monitor.confirmTitle"), // "确认"
|
||||
@@ -60,6 +93,16 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const GroupTypeSite = "site";
|
||||
const groupDictRef = createGroupDictRef(GroupTypeSite);
|
||||
|
||||
function getDefaultGroupId() {
|
||||
const searchFrom = crudExpose.getSearchValidatedFormData();
|
||||
if (searchFrom.groupId) {
|
||||
return searchFrom.groupId;
|
||||
}
|
||||
}
|
||||
return {
|
||||
id: "siteMonitorCrud",
|
||||
crudOptions: {
|
||||
@@ -69,6 +112,68 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
editRequest,
|
||||
delRequest,
|
||||
},
|
||||
tabs: {
|
||||
name: "groupId",
|
||||
show: true,
|
||||
},
|
||||
toolbar: {
|
||||
buttons: {
|
||||
export: {
|
||||
show: true,
|
||||
},
|
||||
},
|
||||
export: {
|
||||
dataFrom: "search",
|
||||
columnFilter: (col: ColumnProps) => {
|
||||
//列过滤器,返回true则导出该列
|
||||
//例如: 只导出show=true的列
|
||||
return col.show === true;
|
||||
},
|
||||
dataFormatter: (opts: DataFormatterContext) => {
|
||||
//例如 格式化日期
|
||||
const { row, originalRow, col, exportCol } = opts;
|
||||
const key = col.key;
|
||||
const element = originalRow[key];
|
||||
if (key.includes("Time") && element) {
|
||||
row[key] = dayjs(element).format("YYYY-MM-DD HH:mm:ss");
|
||||
}
|
||||
|
||||
if (col.width) {
|
||||
exportCol.width = col.width / 10;
|
||||
}
|
||||
|
||||
if (col.key === "certInfo" && originalRow?.certProvider) {
|
||||
row[key] = originalRow?.certProvider + " " + originalRow?.certDomains;
|
||||
}
|
||||
|
||||
//参数说明
|
||||
// DataFormatterContext = {row: any,originalRow: any, key: string, col: ColumnProps, exportCol:ExportColumn}
|
||||
// row = 当前行数据
|
||||
// originalRow = 当前行原始数据
|
||||
// key = 当前列的key
|
||||
// col = 当前列的配置
|
||||
// exportCol = 当前列的导出配置
|
||||
},
|
||||
},
|
||||
},
|
||||
pagination: {
|
||||
pageSizeOptions: ["10", "20", "50", "100", "200"],
|
||||
},
|
||||
settings: {
|
||||
plugins: {
|
||||
//这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
|
||||
rowSelection: {
|
||||
enabled: true,
|
||||
props: {
|
||||
multiple: true,
|
||||
crossPage: false,
|
||||
selectedRowKeys: () => {
|
||||
return selectedRowKeys;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
form: {
|
||||
labelCol: {
|
||||
//固定label宽度
|
||||
@@ -112,7 +217,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
}
|
||||
}
|
||||
|
||||
await crudExpose.openAdd({});
|
||||
const defaultGroupId = getDefaultGroupId();
|
||||
await crudExpose.openAdd({
|
||||
row: { groupId: defaultGroupId },
|
||||
});
|
||||
},
|
||||
},
|
||||
//导入按钮
|
||||
@@ -121,7 +229,9 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
text: t("certd.monitor.bulkImport"),
|
||||
type: "primary",
|
||||
async click() {
|
||||
const defaultGroupId = getDefaultGroupId();
|
||||
openSiteImportDialog({
|
||||
defaultGroupId,
|
||||
afterSubmit() {
|
||||
crudExpose.doRefresh();
|
||||
},
|
||||
@@ -173,10 +283,10 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
},
|
||||
},
|
||||
},
|
||||
tabs: {
|
||||
name: "disabled",
|
||||
show: true,
|
||||
},
|
||||
// tabs: {
|
||||
// name: "disabled",
|
||||
// show: true,
|
||||
// },
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
@@ -357,6 +467,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 155,
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
certExpiresTime: {
|
||||
@@ -385,10 +496,8 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
column: {
|
||||
conditionalRender: false,
|
||||
cellRender({ row }) {
|
||||
const {
|
||||
certEffectiveTime: effectiveTime,
|
||||
certExpiresTime: expiresTime,
|
||||
} = row || {};
|
||||
const certValidDays = certValidDaysRef.value;
|
||||
const { certEffectiveTime: effectiveTime, certExpiresTime: expiresTime } = row || {};
|
||||
if (!expiresTime) {
|
||||
return "-";
|
||||
}
|
||||
@@ -400,13 +509,53 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
const effectiveDays = Math.max(90, dayjs(expiresTime).diff(applyDate, "day"));
|
||||
// 距离失效时间剩余天数
|
||||
const leftDays = dayjs(expiresTime).diff(dayjs(), "day");
|
||||
const color = leftDays < 20 ? "red" : "#389e0d";
|
||||
const color = leftDays < certValidDays ? "red" : "#389e0d";
|
||||
const percent = (leftDays / effectiveDays) * 100;
|
||||
// console.log('cellRender', 'effectiveDays', effectiveDays, 'expiresTime', expiresTime, 'applyTime', applyTime, 'percent', percent, row)
|
||||
return <a-progress title={expireDate + t("certd.monitor.expired")} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}${t("certd.monitor.days")}`} />;
|
||||
},
|
||||
},
|
||||
},
|
||||
groupId: {
|
||||
title: t("certd.fields.group"),
|
||||
type: "dict-select",
|
||||
search: {
|
||||
show: true,
|
||||
},
|
||||
dict: groupDictRef,
|
||||
form: {
|
||||
component: {
|
||||
name: GroupSelector,
|
||||
vModel: "modelValue",
|
||||
type: GroupTypeSite,
|
||||
onRefresh() {
|
||||
groupDictRef.reloadDict();
|
||||
},
|
||||
},
|
||||
},
|
||||
column: {
|
||||
width: 130,
|
||||
align: "center",
|
||||
component: {
|
||||
color: "auto",
|
||||
},
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
remark: {
|
||||
title: t("certd.monitor.remark"),
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "text",
|
||||
column: {
|
||||
width: 200,
|
||||
sorter: true,
|
||||
cellRender({ value }) {
|
||||
return <a-tooltip title={value}>{value}</a-tooltip>;
|
||||
},
|
||||
},
|
||||
},
|
||||
lastCheckTime: {
|
||||
title: t("certd.monitor.lastCheckTime"),
|
||||
search: {
|
||||
@@ -574,6 +723,21 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
show: false,
|
||||
},
|
||||
},
|
||||
error: {
|
||||
title: t("certd.monitor.error"),
|
||||
search: {
|
||||
show: false,
|
||||
},
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: {
|
||||
width: 200,
|
||||
sorter: true,
|
||||
cellRender({ value }) {
|
||||
return <a-tooltip title={value}>{value}</a-tooltip>;
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -15,23 +15,28 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<template #pagination-left>
|
||||
<a-tooltip title="批量删除">
|
||||
<fs-button icon="DeleteOutlined" @click="handleBatchDelete"></fs-button>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
</fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import { onActivated, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { siteInfoApi } from "./api";
|
||||
import { Modal, notification } from "ant-design-vue";
|
||||
import { useI18n } from "/src/locales";
|
||||
|
||||
const { t } = useI18n();
|
||||
defineOptions({
|
||||
name: "SiteCertMonitor",
|
||||
});
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, context: {} });
|
||||
const { crudBinding, crudRef, crudExpose, context } = useFs({ createCrudOptions });
|
||||
|
||||
const handleBatchDelete = context.handleBatchDelete;
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
|
||||
@@ -6,6 +6,7 @@ export type UserSiteMonitorSetting = {
|
||||
retryTimes?: number;
|
||||
cron?: string;
|
||||
dnsServer?: string[];
|
||||
certValidDays?: number;
|
||||
};
|
||||
|
||||
export async function SiteMonitorSettingsGet() {
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.monitor.setting.monitorRetryTimes") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.monitor.setting.certValidDays')" :name="['certValidDays']">
|
||||
<div class="flex">
|
||||
<a-input-number v-model:value="formState.certValidDays" />
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.monitor.setting.certValidDaysHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.monitor.setting.dnsServer')" :name="['dnsServer']">
|
||||
<div class="flex">
|
||||
<a-select v-model:value="formState.dnsServer" mode="tags" :open="false" />
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { useFormWrapper } from "@fast-crud/fast-crud";
|
||||
import { siteInfoApi } from "./api";
|
||||
import { useI18n } from "/src/locales";
|
||||
|
||||
import GroupSelector from "../../basic/group/group-selector.vue";
|
||||
export function useSiteImport() {
|
||||
const { t } = useI18n();
|
||||
const { openCrudFormDialog } = useFormWrapper();
|
||||
|
||||
async function openSiteImportDialog(opts: { afterSubmit: any }) {
|
||||
const { afterSubmit } = opts;
|
||||
async function openSiteImportDialog(opts: { afterSubmit: any; defaultGroupId?: number }) {
|
||||
const { afterSubmit, defaultGroupId } = opts;
|
||||
await openCrudFormDialog<any>({
|
||||
crudOptions: {
|
||||
columns: {
|
||||
@@ -26,6 +26,21 @@ export function useSiteImport() {
|
||||
},
|
||||
},
|
||||
},
|
||||
groupId: {
|
||||
type: "select",
|
||||
title: t("certd.fields.group"),
|
||||
form: {
|
||||
value: defaultGroupId,
|
||||
component: {
|
||||
name: GroupSelector,
|
||||
vModel: "modelValue",
|
||||
type: "site",
|
||||
},
|
||||
col: {
|
||||
span: 24,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
form: {
|
||||
|
||||
@@ -72,6 +72,7 @@ export function getCommonColumnDefine(crudExpose: any, typeRef: any, api: any) {
|
||||
type: "number",
|
||||
column: {
|
||||
width: 100,
|
||||
order: -999,
|
||||
},
|
||||
form: {
|
||||
show: false,
|
||||
|
||||
@@ -6,12 +6,13 @@ import { useRouter } from "vue-router";
|
||||
import { compute, CreateCrudOptionsRet, dict, useFormWrapper } from "@fast-crud/fast-crud";
|
||||
import NotificationSelector from "/@/views/certd/notification/notification-selector/index.vue";
|
||||
import { useReference } from "/@/use/use-refrence";
|
||||
import { ref } from "vue";
|
||||
import { computed, ref } from "vue";
|
||||
import * as api from "../api";
|
||||
import { PluginGroup, usePluginStore } from "/@/store/plugin";
|
||||
import { createNotificationApi } from "/@/views/certd/notification/api";
|
||||
import GroupSelector from "../group/group-selector.vue";
|
||||
import { useI18n } from "/src/locales";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
|
||||
export function fillPipelineByDefaultForm(pipeline: any, form: any) {
|
||||
const triggers = [];
|
||||
@@ -78,6 +79,7 @@ export function useCertPipelineCreator() {
|
||||
const { openCrudFormDialog } = useFormWrapper();
|
||||
|
||||
const pluginStore = usePluginStore();
|
||||
const settingStore = useSettingStore();
|
||||
const router = useRouter();
|
||||
|
||||
function createCrudOptions(certPlugins: any[], getFormData: any, doSubmit: any): CreateCrudOptionsRet {
|
||||
@@ -251,7 +253,48 @@ export function useCertPipelineCreator() {
|
||||
name: GroupSelector,
|
||||
vModel: "modelValue",
|
||||
},
|
||||
order: 9999,
|
||||
order: 888,
|
||||
},
|
||||
},
|
||||
addToMonitorEnabled: {
|
||||
title: t("certd.pipelineForm.addToMonitorEnabled"),
|
||||
type: "switch",
|
||||
form: {
|
||||
show: computed(() => {
|
||||
return settingStore.isPlus && settingStore.sysPublic?.certDomainAddToMonitorEnabled;
|
||||
}),
|
||||
value: false,
|
||||
component: {
|
||||
name: "a-switch",
|
||||
vModel: "checked",
|
||||
},
|
||||
col: {
|
||||
span: 24,
|
||||
},
|
||||
order: 999,
|
||||
valueChange({ value, form }) {
|
||||
if (value) {
|
||||
form.addToMonitorDomains = form.domains.join("\n").replaceAll("*", "www");
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
addToMonitorDomains: {
|
||||
title: t("certd.pipelineForm.addToMonitorDomains"),
|
||||
type: "text",
|
||||
form: {
|
||||
show: compute(({ form }) => {
|
||||
return form.addToMonitorEnabled;
|
||||
}),
|
||||
component: {
|
||||
name: "a-textarea",
|
||||
vModel: "value",
|
||||
},
|
||||
col: {
|
||||
span: 24,
|
||||
},
|
||||
helper: t("certd.domainList.helper"),
|
||||
order: 999,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -330,6 +373,8 @@ export function useCertPipelineCreator() {
|
||||
keepHistoryCount: 30,
|
||||
type: "cert",
|
||||
groupId,
|
||||
addToMonitorEnabled: form.addToMonitorEnabled,
|
||||
addToMonitorDomains: form.addToMonitorDomains,
|
||||
});
|
||||
if (form.email) {
|
||||
try {
|
||||
|
||||
@@ -366,10 +366,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||
},
|
||||
column: {
|
||||
cellRender({ row }) {
|
||||
const {
|
||||
certEffectiveTime: effectiveTime,
|
||||
certExpiresTime: expiresTime,
|
||||
} = row?.lastVars || {};
|
||||
const { certEffectiveTime: effectiveTime, certExpiresTime: expiresTime } = row?.lastVars || {};
|
||||
if (!expiresTime) {
|
||||
return "-";
|
||||
}
|
||||
@@ -469,7 +466,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 80,
|
||||
width: 100,
|
||||
align: "center",
|
||||
component: {
|
||||
name: "fs-dict-switch",
|
||||
@@ -516,7 +513,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||
{ value: "cert", label: t("certd.types.certApply") },
|
||||
{ value: "cert_upload", label: t("certd.types.certUpload") },
|
||||
{ value: "custom", label: t("certd.types.custom") },
|
||||
{ value: "template", label: "模版" },
|
||||
{ value: "template", label: t("certd.types.template") },
|
||||
],
|
||||
}),
|
||||
form: {
|
||||
@@ -525,7 +522,7 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||
},
|
||||
column: {
|
||||
sorter: true,
|
||||
width: 90,
|
||||
width: 110,
|
||||
align: "center",
|
||||
show: true,
|
||||
component: {
|
||||
@@ -558,16 +555,53 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
|
||||
sorter: true,
|
||||
},
|
||||
},
|
||||
createTime: {
|
||||
title: t("certd.fields.createTime"),
|
||||
type: "datetime",
|
||||
validTime: {
|
||||
title: t("certd.pi.validTime"),
|
||||
type: "date",
|
||||
form: {
|
||||
show: false,
|
||||
show: computed(() => {
|
||||
return settingStore.isPlus && settingStore.sysPublic.pipelineValidTimeEnabled && userStore.isAdmin;
|
||||
}),
|
||||
helper: t("certd.pi.validTimeHelper"),
|
||||
valueResolve({ form, key, value }) {
|
||||
if (value) {
|
||||
form[key] = value.valueOf();
|
||||
}
|
||||
},
|
||||
valueBuilder({ form, key, value }) {
|
||||
if (value) {
|
||||
form[key] = dayjs(value);
|
||||
}
|
||||
},
|
||||
component: {
|
||||
presets: [
|
||||
{ label: t("certd.dates.months", { count: 3 }), value: dayjs().add(3, "month") },
|
||||
{ label: t("certd.dates.months", { count: 6 }), value: dayjs().add(6, "month") },
|
||||
{ label: t("certd.dates.years", { count: 1 }), value: dayjs().add(1, "year") },
|
||||
{ label: t("certd.dates.years", { count: 2 }), value: dayjs().add(2, "year") },
|
||||
{ label: t("certd.dates.years", { count: 3 }), value: dayjs().add(3, "year") },
|
||||
{ label: t("certd.dates.years", { count: 4 }), value: dayjs().add(4, "year") },
|
||||
{ label: t("certd.dates.years", { count: 5 }), value: dayjs().add(5, "year") },
|
||||
{ label: t("certd.dates.years", { count: 6 }), value: dayjs().add(6, "year") },
|
||||
],
|
||||
},
|
||||
},
|
||||
column: {
|
||||
show: computed(() => {
|
||||
return settingStore.isPlus && settingStore.sysPublic.pipelineValidTimeEnabled;
|
||||
}),
|
||||
sorter: true,
|
||||
width: 155,
|
||||
align: "center",
|
||||
cellRender({ value }) {
|
||||
if (!value || value <= 0) {
|
||||
return "-";
|
||||
}
|
||||
if (value < Date.now()) {
|
||||
return t("certd.hasExpired");
|
||||
}
|
||||
return dayjs(value).format("YYYY-MM-DD");
|
||||
},
|
||||
},
|
||||
},
|
||||
updateTime: {
|
||||
|
||||
@@ -37,6 +37,7 @@ const pipelineOptions: PipelineOptions = {
|
||||
type: detail.pipeline.type,
|
||||
from: detail.pipeline.from,
|
||||
},
|
||||
validTime: detail.pipeline.validTime,
|
||||
} as PipelineDetail;
|
||||
},
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
import { onActivated, onMounted, ref } from "vue";
|
||||
import { dict, useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import PiCertdForm from "./certd-form/index.vue";
|
||||
import ChangeGroup from "./components/change-group.vue";
|
||||
import ChangeTrigger from "./components/change-trigger.vue";
|
||||
import { Modal, notification } from "ant-design-vue";
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
未设置触发源,不会自动执行
|
||||
</span>
|
||||
</a-tag>
|
||||
<a-tag v-if="pipelineEntity.validTime > 0 && settingStore.sysPublic.pipelineValidTimeEnabled && settingStore.isPlus" :color="pipelineEntity.validTime > Date.now() ? 'green' : 'red'">
|
||||
<span class="flex">
|
||||
<fs-icon icon="ion:time-outline"></fs-icon>
|
||||
<span v-if="pipelineEntity.validTime > Date.now()"> 有效期:<FsTimeHumanize :model-value="pipelineEntity.validTime" :options="{ units: ['d'] }" format="YYYY-MM-DD"></FsTimeHumanize> </span>
|
||||
<span v-else> 已过期 </span>
|
||||
</span>
|
||||
</a-tag>
|
||||
</div>
|
||||
<div class="basis-40 flex justify-end mr-10">
|
||||
<template v-if="editMode">
|
||||
@@ -343,7 +350,7 @@ export default defineComponent({
|
||||
const { t } = useI18n();
|
||||
const currentPipeline: Ref<any> = ref({});
|
||||
const pipeline: Ref<any> = ref({});
|
||||
|
||||
const pipelineEntity: Ref<any> = ref({});
|
||||
const histories: Ref<RunHistory[]> = ref([]);
|
||||
|
||||
const currentHistory: Ref<any> = ref({});
|
||||
@@ -490,6 +497,7 @@ export default defineComponent({
|
||||
return;
|
||||
}
|
||||
const detail: PipelineDetail = await props.options.getPipelineDetail({ pipelineId: value });
|
||||
pipelineEntity.value = detail;
|
||||
currentPipeline.value = merge(
|
||||
{
|
||||
title: "新管道流程",
|
||||
@@ -808,7 +816,7 @@ export default defineComponent({
|
||||
return nodes;
|
||||
},
|
||||
});
|
||||
throw new Error(errorMessage);
|
||||
throw new Error(errorMessages?.join(","));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -822,10 +830,6 @@ export default defineComponent({
|
||||
saveLoading.value = true;
|
||||
try {
|
||||
if (props.options.doSave) {
|
||||
if (pipeline.value.version == null) {
|
||||
pipeline.value.version = 0;
|
||||
}
|
||||
pipeline.value.version++;
|
||||
currentPipeline.value = pipeline.value;
|
||||
|
||||
//移除空阶段
|
||||
@@ -970,6 +974,7 @@ export default defineComponent({
|
||||
nextTriggerTimes,
|
||||
viewCert,
|
||||
downloadCert,
|
||||
pipelineEntity,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ import { PluginGroups } from "/@/store/plugin";
|
||||
|
||||
export type PipelineDetail = {
|
||||
pipeline: Pipeline;
|
||||
validTime?: number;
|
||||
};
|
||||
|
||||
export type RunHistory = {
|
||||
|
||||
@@ -177,6 +177,8 @@ function isNewVersion(version: string, latestVersion: string) {
|
||||
for (let i = 0; i < current.length; i++) {
|
||||
if (parseInt(latest[i]) > parseInt(current[i])) {
|
||||
return true;
|
||||
} else if (parseInt(latest[i]) < parseInt(current[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -191,7 +193,6 @@ async function loadLatestVersion() {
|
||||
|
||||
const minVersion = settingsStore.productInfo?.app?.minVersion;
|
||||
if (minVersion) {
|
||||
//
|
||||
if (isNewVersion(version.value, minVersion)) {
|
||||
notification.error({
|
||||
message: settingsStore.productInfo?.app?.minVersionTip ?? "版本过低,为了您的数据安全,请尽快升级",
|
||||
|
||||
@@ -95,11 +95,14 @@ import SmsCode from "/@/views/framework/login/sms-code.vue";
|
||||
import { useI18n } from "/@/locales";
|
||||
import { LanguageToggle } from "/@/vben/layouts";
|
||||
import CaptchaInput from "/@/components/captcha/captcha-input.vue";
|
||||
import { useRoute } from "vue-router";
|
||||
export default defineComponent({
|
||||
name: "LoginPage",
|
||||
components: { LanguageToggle, SmsCode, CaptchaInput },
|
||||
setup() {
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const urlLoginType = route.query.loginType as string | undefined;
|
||||
const verifyCodeInputRef = ref();
|
||||
const loading = ref(false);
|
||||
const userStore = useUserStore();
|
||||
@@ -110,7 +113,7 @@ export default defineComponent({
|
||||
phoneCode: "86",
|
||||
mobile: "",
|
||||
password: "",
|
||||
loginType: "password", //password
|
||||
loginType: urlLoginType || "password", //password
|
||||
smsCode: "",
|
||||
captcha: null,
|
||||
smsCaptcha: null,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="main">
|
||||
<a-form ref="formRef" class="user-layout-register" name="custom-validation" :model="formState" :rules="rules" v-bind="layout" :label-col="{ span: 6 }" @finish="handleFinish" @finish-failed="handleFinishFailed">
|
||||
<a-tabs v-model:active-key="registerType">
|
||||
<a-tabs v-model:active-key="registerType" @change="handleTabChange">
|
||||
<a-tab-pane key="username" tab="用户名注册" :disabled="!settingsStore.sysPublic.usernameRegisterEnabled">
|
||||
<template v-if="registerType === 'username'">
|
||||
<a-form-item required has-feedback name="username" label="用户名" :rules="rules.username">
|
||||
@@ -61,7 +61,7 @@
|
||||
</a-input-password>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item has-feedback name="imgCode" label="验证码" :rules="rules.imgCode">
|
||||
<a-form-item has-feedback name="captchaForEmail" label="验证码" :rules="rules.captchaForEmail">
|
||||
<CaptchaInput v-model:model-value="formState.captchaForEmail"></CaptchaInput>
|
||||
</a-form-item>
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
</a-form-item>
|
||||
</template>
|
||||
</a-tab-pane>
|
||||
|
||||
<a-tab-pane v-if="settingsStore.sysPublic.smsLoginEnabled" key="mobile" tab="手机号注册"> </a-tab-pane>
|
||||
</a-tabs>
|
||||
|
||||
<a-form-item>
|
||||
@@ -90,6 +92,7 @@ import EmailCode from "./email-code.vue";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { notification } from "ant-design-vue";
|
||||
import CaptchaInput from "/@/components/captcha/captcha-input.vue";
|
||||
import { useRouter } from "vue-router";
|
||||
export default defineComponent({
|
||||
name: "RegisterPage",
|
||||
components: { CaptchaInput, EmailCode },
|
||||
@@ -115,6 +118,7 @@ export default defineComponent({
|
||||
password: "",
|
||||
confirmPassword: "",
|
||||
captcha: null,
|
||||
captchaForEmail: null,
|
||||
});
|
||||
|
||||
const rules = {
|
||||
@@ -171,6 +175,18 @@ export default defineComponent({
|
||||
message: "请输入邮件验证码",
|
||||
},
|
||||
],
|
||||
captcha: [
|
||||
{
|
||||
required: true,
|
||||
message: "请通过验证码",
|
||||
},
|
||||
],
|
||||
captchaForEmail: [
|
||||
{
|
||||
required: true,
|
||||
message: "请通过验证码",
|
||||
},
|
||||
],
|
||||
};
|
||||
const layout = {
|
||||
labelCol: {
|
||||
@@ -189,7 +205,7 @@ export default defineComponent({
|
||||
password: formState.password,
|
||||
username: formState.username,
|
||||
email: formState.email,
|
||||
captcha: formState.captcha,
|
||||
captcha: registerType.value === "email" ? formState.captchaForEmail : formState.captcha,
|
||||
validateCode: formState.validateCode,
|
||||
}) as any
|
||||
);
|
||||
@@ -206,6 +222,13 @@ export default defineComponent({
|
||||
formRef.value.resetFields();
|
||||
};
|
||||
|
||||
const router = useRouter();
|
||||
const handleTabChange = (key: string) => {
|
||||
if (key === "mobile") {
|
||||
router.push({ path: "/login", query: { loginType: "sms" } });
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
formState,
|
||||
formRef,
|
||||
@@ -216,6 +239,7 @@ export default defineComponent({
|
||||
resetForm,
|
||||
registerType,
|
||||
settingsStore,
|
||||
handleTabChange,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
<template>
|
||||
<div class="domain-test-card">
|
||||
<div class="card-header flex flex-wrap justify-start">
|
||||
<div v-if="title">{{ title }}</div>
|
||||
<a-form v-if="editing" layout="inline" :model="formData">
|
||||
<a-form-item label="域名">
|
||||
<a-input v-model:value="formData.domain" placeholder="请输入要测试的域名或IP" style="width: 240px" />
|
||||
</a-form-item>
|
||||
<a-form-item label="端口">
|
||||
<a-input-number v-model:value="formData.port" placeholder="请输入端口" :min="1" :max="65535" style="width: 120px" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
<div v-else class="domain-info">
|
||||
<span>域名: {{ formData.domain }}</span>
|
||||
<span>端口: {{ formData.port }}</span>
|
||||
</div>
|
||||
|
||||
<a-button :disabled="!formData.domain" size="small" type="primary" :loading="loading" @click="runAllTests"> 开始测试 </a-button>
|
||||
</div>
|
||||
|
||||
<div class="card-content">
|
||||
<div class="test-results">
|
||||
<!-- 域名解析结果 -->
|
||||
<test-case ref="domainResolveRef" title="域名解析" :test-method="() => createDomainResolveMethod()" :disabled="!getCurrentDomain()" />
|
||||
|
||||
<!-- Ping测试结果 -->
|
||||
<test-case ref="pingTestRef" title="Ping测试" :test-method="() => createPingTestMethod()" :disabled="!getCurrentDomain()" />
|
||||
|
||||
<!-- Telnet测试结果 -->
|
||||
<test-case ref="telnetTestRef" title="Telnet测试" :port="getCurrentPort()" :test-method="() => createTelnetTestMethod()" :disabled="!getCurrentDomain() || !getCurrentPort()" />
|
||||
</div>
|
||||
|
||||
<div class="summary">
|
||||
<a-alert :message="testSummary.title" :type="testSummary.status === 'success' ? 'success' : testSummary.status === 'failed' ? 'error' : 'warning'" show-icon :closable="false">
|
||||
<template v-if="testSummary.text" #description>
|
||||
<pre class="summary-text pre">{{ testSummary.text }}</pre>
|
||||
</template>
|
||||
</a-alert>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, computed, onMounted, watch } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import { DomainResolve, PingTest, TelnetTest } from "./api";
|
||||
import TestCase from "./TestCase.vue";
|
||||
|
||||
// 组件属性
|
||||
const props = defineProps<{
|
||||
title?: string;
|
||||
domain?: string;
|
||||
port?: number;
|
||||
autoStart?: boolean;
|
||||
}>();
|
||||
|
||||
const editing = ref(!props.domain);
|
||||
|
||||
// 测试组件的引用
|
||||
const domainResolveRef = ref();
|
||||
const pingTestRef = ref();
|
||||
const telnetTestRef = ref();
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
domain: props.domain || "",
|
||||
port: props.port || 443,
|
||||
});
|
||||
|
||||
// 加载状态
|
||||
const loading = ref(false);
|
||||
|
||||
// 创建域名解析测试方法
|
||||
const createDomainResolveMethod = async () => {
|
||||
const domain = getCurrentDomain();
|
||||
return DomainResolve(domain);
|
||||
};
|
||||
|
||||
// 创建Ping测试方法
|
||||
const createPingTestMethod = async () => {
|
||||
const domain = getCurrentDomain();
|
||||
return PingTest(domain);
|
||||
};
|
||||
|
||||
// 创建Telnet测试方法
|
||||
const createTelnetTestMethod = async () => {
|
||||
const domain = getCurrentDomain();
|
||||
const port = getCurrentPort();
|
||||
|
||||
return TelnetTest(domain, port);
|
||||
};
|
||||
|
||||
// 获取当前使用的域名
|
||||
const getCurrentDomain = () => {
|
||||
return formData.domain;
|
||||
};
|
||||
|
||||
// 获取当前使用的端口
|
||||
const getCurrentPort = () => {
|
||||
return formData.port;
|
||||
};
|
||||
|
||||
// 获取各测试用例的状态
|
||||
const getTestStatus = (testRef: any) => {
|
||||
const result = testRef?.getResult();
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const isNetTestResult = typeof result === "object" && result !== null && "success" in result && "message" in result;
|
||||
|
||||
return {
|
||||
success: isNetTestResult ? result.success : false,
|
||||
message: isNetTestResult ? result.message : "测试失败",
|
||||
};
|
||||
};
|
||||
|
||||
// 生成测试总结
|
||||
const testSummary = computed(() => {
|
||||
if (loading.value) {
|
||||
return { status: "waiting", title: "测试中,请稍后..." };
|
||||
}
|
||||
// 通过computed获取各测试结果
|
||||
const domainResolveResult = getTestStatus(domainResolveRef.value);
|
||||
const pingTestResult = getTestStatus(pingTestRef.value);
|
||||
const telnetTestResult = getTestStatus(telnetTestRef.value);
|
||||
|
||||
// 检查是否有测试结果
|
||||
const testDone = domainResolveResult != null && pingTestResult != null && telnetTestResult != null;
|
||||
if (!testDone) {
|
||||
return { status: "waiting", title: '请点击"开始测试"按钮进行网络测试' };
|
||||
}
|
||||
|
||||
// 详细分析不同的测试结果组合
|
||||
// 1. 三个测试都失败
|
||||
if (domainResolveResult?.success === false && pingTestResult?.success === false && telnetTestResult?.success === false) {
|
||||
return {
|
||||
status: "failed",
|
||||
title: "所有测试均未通过",
|
||||
text: `这表明应用容器内的网络可能完全不通。建议:\n1. 检查宿主机的网络连接状态\n2. 确认容器网络配置是否正确\n3. 检查防火墙设置是否阻止了网络访问`,
|
||||
};
|
||||
}
|
||||
|
||||
// 2. 域名解析成功,但Ping不通
|
||||
if (domainResolveResult?.success === true && pingTestResult?.success === false) {
|
||||
return {
|
||||
status: "partial",
|
||||
title: "域名解析成功,但Ping不通",
|
||||
text: `可能原因:\n1. DNS被劫持,解析到了错误的IP地址\n2. 目标服务器禁止了Ping请求\n3. 目标服务器IP被墙\n4. 目标服务器网络不通或已下线`,
|
||||
};
|
||||
}
|
||||
|
||||
// 3. 域名解析和Ping都成功,但Telnet连接失败
|
||||
if (domainResolveResult?.success === true && pingTestResult?.success === true && telnetTestResult?.success === false) {
|
||||
return {
|
||||
status: "partial",
|
||||
title: "域名解析和Ping测试均通过,但Telnet连接失败",
|
||||
text: `可能原因:\n1. 端口号输入错误,请确认目标服务使用的正确端口\n2. 目标服务器上该端口未开放或服务未启动\n3. 防火墙或安全组限制了该端口的访问\n4. 目标网站被墙`,
|
||||
};
|
||||
}
|
||||
|
||||
// 4. 域名解析失败,但其他测试可能成功或未执行
|
||||
if (domainResolveResult?.success === false) {
|
||||
return {
|
||||
status: "partial",
|
||||
title: "域名解析失败",
|
||||
text: `可能原因:\n1. 域名输入错误或不存在\n2. DNS服务器配置问题\n3. 本地网络DNS解析故障\n4. 域名已过期或被注销`,
|
||||
};
|
||||
}
|
||||
|
||||
// 5. 所有测试都成功
|
||||
if (domainResolveResult?.success === true && pingTestResult?.success === true && telnetTestResult?.success === true) {
|
||||
return {
|
||||
status: "success",
|
||||
title: "所有测试均通过",
|
||||
text: `域名${formData.domain}解析正常,能够正常Ping通,且端口${formData.port}可访问。`,
|
||||
};
|
||||
}
|
||||
|
||||
// 6. 其他部分成功的情况
|
||||
return {
|
||||
status: "partial",
|
||||
title: "部分测试未通过",
|
||||
text: `请结合具体测试结果进行分析:\n- 域名解析:${domainResolveResult ? (domainResolveResult.success ? "成功" : "失败") : "未执行"}\n- Ping测试:${pingTestResult ? (pingTestResult.success ? "成功" : "失败") : "未执行"}\n- Telnet测试:${telnetTestResult ? (telnetTestResult.success ? "成功" : "失败") : "未执行"}`,
|
||||
};
|
||||
});
|
||||
|
||||
// 运行全部测试
|
||||
async function runAllTests() {
|
||||
const domain = getCurrentDomain();
|
||||
|
||||
// 检查是否有域名
|
||||
if (!domain) {
|
||||
message.error("请输入域名");
|
||||
return;
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
|
||||
// 通过组件引用调用测试方法
|
||||
try {
|
||||
await Promise.allSettled([domainResolveRef.value?.test(), pingTestRef.value?.test(), telnetTestRef.value?.test()]);
|
||||
} catch (error) {
|
||||
message.error("部分测试执行失败,请查看详细结果");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (props.autoStart) {
|
||||
runAllTests();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.domain-test-card {
|
||||
border: 1px solid #e8e8e8;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
background-color: #fff;
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 16px;
|
||||
background-color: #fafafa;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
}
|
||||
|
||||
.card-header h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.input-form {
|
||||
margin-bottom: 12px;
|
||||
padding: 12px;
|
||||
background-color: #fafafa;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.domain-info {
|
||||
padding: 5.5px 12px;
|
||||
background-color: #f0f0f0;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.test-buttons {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.test-results {
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.summary {
|
||||
margin-top: 16px;
|
||||
padding: 12px;
|
||||
background-color: #f8f9fa;
|
||||
border-radius: 4px;
|
||||
.summary-text {
|
||||
}
|
||||
}
|
||||
|
||||
/* 调整按钮大小 */
|
||||
.ant-btn {
|
||||
font-size: 12px;
|
||||
padding: 2px 8px;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,140 @@
|
||||
<template>
|
||||
<a-card title="服务端信息" class="server-info-card">
|
||||
<template #extra>
|
||||
<a-button size="small" :loading="loading" @click="refreshServerInfo">
|
||||
<template #icon>
|
||||
<a-icon type="sync" :spin="loading" />
|
||||
</template>
|
||||
刷新
|
||||
</a-button>
|
||||
</template>
|
||||
<div v-if="loading" class="loading">
|
||||
<a-spin size="small" />
|
||||
<span style="margin-left: 8px">加载中...</span>
|
||||
</div>
|
||||
<div v-else-if="error" class="error">
|
||||
<a-alert message="获取服务器信息失败" :description="error" type="error" show-icon />
|
||||
</div>
|
||||
<div v-else class="server-info-grid">
|
||||
<!-- 本地IP -->
|
||||
<div class="info-item">
|
||||
<div class="info-label">本地IP:</div>
|
||||
<div v-if="serverInfo.localIP && serverInfo.localIP.length > 0" class="info-value">
|
||||
<a-tag v-for="ip in serverInfo.localIP" :key="ip" type="info" color="blue">{{ ip }}</a-tag>
|
||||
</div>
|
||||
<div v-else class="info-empty">暂无信息</div>
|
||||
</div>
|
||||
|
||||
<!-- 外网IP -->
|
||||
<div class="info-item">
|
||||
<div class="info-label">外网IP:</div>
|
||||
<div v-if="serverInfo.publicIP && serverInfo.publicIP.length > 0" class="info-value">
|
||||
<a-tag v-for="ip in serverInfo.publicIP" :key="ip" type="info" color="green">{{ ip }}</a-tag>
|
||||
</div>
|
||||
<div v-else class="info-empty">暂无信息</div>
|
||||
</div>
|
||||
|
||||
<!-- DNS服务器 -->
|
||||
<div class="info-item">
|
||||
<div class="info-label">DNS服务器:</div>
|
||||
<div v-if="serverInfo.dnsServers && serverInfo.dnsServers.length > 0" class="info-value">
|
||||
<a-tag v-for="dns in serverInfo.dnsServers" :key="dns" type="info" color="cyan">{{ dns }}</a-tag>
|
||||
</div>
|
||||
<div v-else class="info-empty">暂无信息</div>
|
||||
</div>
|
||||
</div>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import { GetServerInfo } from "./api";
|
||||
|
||||
// 服务器信息类型
|
||||
interface ServerInfo {
|
||||
localIP?: string[];
|
||||
publicIP?: string[];
|
||||
dnsServers?: string[];
|
||||
}
|
||||
|
||||
const loading = ref(false);
|
||||
const error = ref<string | null>(null);
|
||||
const serverInfo = ref<ServerInfo>({});
|
||||
|
||||
// 加载服务器信息
|
||||
const loadServerInfo = async () => {
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
try {
|
||||
serverInfo.value = await GetServerInfo();
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : String(e);
|
||||
message.error("获取服务器信息失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 刷新服务器信息
|
||||
const refreshServerInfo = () => {
|
||||
loadServerInfo();
|
||||
};
|
||||
|
||||
// 组件挂载时加载数据
|
||||
onMounted(() => {
|
||||
loadServerInfo();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.server-info-card {
|
||||
margin-bottom: 16px;
|
||||
|
||||
.loading {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.error {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.server-info-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.info-item {
|
||||
background-color: #fafafa;
|
||||
border-radius: 4px;
|
||||
padding: 12px;
|
||||
|
||||
.info-label {
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #666;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.info-value {
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
|
||||
.ant-list-item {
|
||||
padding: 4px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.info-empty {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
font-style: italic;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
186
packages/ui/certd-client/src/views/sys/nettest/TestCase.vue
Normal file
186
packages/ui/certd-client/src/views/sys/nettest/TestCase.vue
Normal file
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div class="test-case" :class="{ loading }">
|
||||
<div class="case-header">
|
||||
<span class="flex items-center">
|
||||
<fs-button size="small" type="text" icon="ion:play-circle" :loading="loading" :disabled="disabled" class="test-button" @click="runTest" />
|
||||
<a-tag color="blue" class="case-title">
|
||||
{{ title }}
|
||||
</a-tag>
|
||||
<span v-if="port" class="port-info">{{ port }}</span>
|
||||
</span>
|
||||
<span v-if="result && isNetTestResult" class="result-status flex-1" :style="{ color: isSuccess ? 'green' : 'red' }">
|
||||
<span>
|
||||
{{ isSuccess ? "✓" : "✗" }}
|
||||
</span>
|
||||
<span class="ml-2">
|
||||
{{ result.message }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div v-if="result" class="result-content">
|
||||
<div v-if="error" class="error-message">
|
||||
<span style="color: red">{{ error }}</span>
|
||||
</div>
|
||||
<div v-else-if="isNetTestResult">
|
||||
<div v-if="resultTestLog" class="test-log">
|
||||
<pre>{{ resultTestLog }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="typeof result === 'object'" class="object-result">
|
||||
<pre>{{ JSON.stringify(result, null, 2) }}</pre>
|
||||
</div>
|
||||
<div v-else class="text-result">
|
||||
<pre>{{ result }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="no-result">
|
||||
<p>暂无结果</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
|
||||
// 组件属性
|
||||
const props = defineProps<{
|
||||
title: string;
|
||||
port?: number | string;
|
||||
testMethod: () => Promise<any>;
|
||||
disabled?: boolean;
|
||||
}>();
|
||||
|
||||
// 内部状态
|
||||
const loading = ref(false);
|
||||
const result = ref<any>(null);
|
||||
const error = ref<string | null>(null);
|
||||
|
||||
// 运行测试
|
||||
const runTest = async () => {
|
||||
loading.value = true;
|
||||
error.value = null;
|
||||
result.value = null;
|
||||
try {
|
||||
const testResult = await props.testMethod();
|
||||
// 如果结果有 data 属性,则使用 data,否则使用整个结果
|
||||
result.value = testResult.data || testResult;
|
||||
} catch (err: any) {
|
||||
result.value = null;
|
||||
error.value = err.message || "测试失败";
|
||||
message.error(`${props.title} 测试失败: ${error.value}`);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
test: runTest,
|
||||
getResult: () => result.value,
|
||||
});
|
||||
|
||||
// 辅助计算属性,用于模板中显示结果
|
||||
const isNetTestResult = computed(() => {
|
||||
return typeof result.value === "object" && result.value !== null && "success" in result.value && "message" in result.value && "testLog" in result.value;
|
||||
});
|
||||
|
||||
const isSuccess = computed(() => {
|
||||
return isNetTestResult.value && result.value.success;
|
||||
});
|
||||
|
||||
const resultMessage = computed(() => {
|
||||
return isNetTestResult.value ? result.value.message : "";
|
||||
});
|
||||
|
||||
const resultTestLog = computed(() => {
|
||||
return isNetTestResult.value ? result.value.testLog : "";
|
||||
});
|
||||
|
||||
const resultError = computed(() => {
|
||||
return isNetTestResult.value ? result.value.error : "";
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.test-case {
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
position: relative;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&.loading {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.case-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.result-status {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.case-title {
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.port-info {
|
||||
font-size: 12px;
|
||||
color: #999;
|
||||
background-color: #f0f0f0;
|
||||
padding: 2px 6px;
|
||||
border-radius: 3px;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.test-button {
|
||||
color: #1890ff;
|
||||
font-size: 12px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
.result-content {
|
||||
.error-message,
|
||||
.object-result,
|
||||
.text-result {
|
||||
background-color: #f8f8f8;
|
||||
padding: 8px 10px;
|
||||
border-radius: 3px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.test-log {
|
||||
background-color: #f8f8f8;
|
||||
padding: 8px 10px;
|
||||
border-radius: 3px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.no-result {
|
||||
padding: 12px 0;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
33
packages/ui/certd-client/src/views/sys/nettest/api.ts
Normal file
33
packages/ui/certd-client/src/views/sys/nettest/api.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { request } from "/@/api/service";
|
||||
|
||||
export async function DomainResolve(domain: string) {
|
||||
return await request({
|
||||
url: "/sys/nettest/domainResolve",
|
||||
method: "post",
|
||||
data: { domain },
|
||||
});
|
||||
}
|
||||
|
||||
export async function PingTest(domain: string) {
|
||||
return await request({
|
||||
url: "/sys/nettest/ping",
|
||||
method: "post",
|
||||
data: { domain },
|
||||
});
|
||||
}
|
||||
|
||||
export async function TelnetTest(domain: string, port: number) {
|
||||
return await request({
|
||||
url: "/sys/nettest/telnet",
|
||||
method: "post",
|
||||
data: { domain, port },
|
||||
});
|
||||
}
|
||||
|
||||
// 获取服务器信息(包括本地IP、外网IP和DNS服务器)
|
||||
export async function GetServerInfo() {
|
||||
return await request({
|
||||
url: "/sys/nettest/serverInfo",
|
||||
method: "post",
|
||||
});
|
||||
}
|
||||
46
packages/ui/certd-client/src/views/sys/nettest/index.vue
Normal file
46
packages/ui/certd-client/src/views/sys/nettest/index.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<template>
|
||||
<fs-page class="page-sys-nettest">
|
||||
<template #header>
|
||||
<div class="title">
|
||||
网络测试
|
||||
<span class="sub">测试您的服务器容器网络连接是否正常</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="nettest-container">
|
||||
<!-- 服务端信息 -->
|
||||
<server-info-card />
|
||||
|
||||
<!-- 测试区域 -->
|
||||
<div class="test-areas flex-wrap md:flex-nowrap">
|
||||
<!-- 百度域名测试 (用于对比) -->
|
||||
<domain-test-card class="test-card" :domain="'baidu.com'" :port="443" :auto-start="true" />
|
||||
<!-- 用户输入域名测试 -->
|
||||
<domain-test-card class="test-card" :title="'自定义域名测试'" />
|
||||
</div>
|
||||
</div>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import DomainTestCard from "./DomainTestCard.vue";
|
||||
import ServerInfoCard from "./ServerInfoCard.vue";
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
.page-sys-nettest {
|
||||
.nettest-container {
|
||||
padding: 16px;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.test-areas {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.test-card {
|
||||
min-width: 50%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -79,6 +79,14 @@ export async function SysSettingsSave(data: SysSettings) {
|
||||
});
|
||||
}
|
||||
|
||||
export async function TestCaptcha(form: any) {
|
||||
return await request({
|
||||
url: apiPrefix + "/captchaTest",
|
||||
method: "post",
|
||||
data: form,
|
||||
});
|
||||
}
|
||||
|
||||
export async function TestProxy() {
|
||||
return await request({
|
||||
url: apiPrefix + "/testProxy",
|
||||
|
||||
@@ -17,6 +17,12 @@
|
||||
<a-tab-pane key="safe" :tab="t('certd.sys.setting.safeSetting')">
|
||||
<SettingSafe v-if="activeKey === 'safe'" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="captcha" :tab="t('certd.sys.setting.captchaSetting')">
|
||||
<SettingCaptcha v-if="activeKey === 'captcha'" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="pipeline" :tab="t('certd.sys.setting.pipelineSetting')">
|
||||
<SettingPipeline v-if="activeKey === 'pipeline'" />
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
</fs-page>
|
||||
@@ -27,6 +33,8 @@ import SettingBase from "/@/views/sys/settings/tabs/base.vue";
|
||||
import SettingRegister from "/@/views/sys/settings/tabs/register.vue";
|
||||
import SettingPayment from "/@/views/sys/settings/tabs/payment.vue";
|
||||
import SettingSafe from "/@/views/sys/settings/tabs/safe.vue";
|
||||
import SettingCaptcha from "/@/views/sys/settings/tabs/captcha.vue";
|
||||
import SettingPipeline from "/@/views/sys/settings/tabs/pipeline.vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ref } from "vue";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
@@ -58,7 +66,7 @@ function onChange(value: string) {
|
||||
<style lang="less">
|
||||
.page-sys-settings {
|
||||
.sys-settings-form {
|
||||
width: 600px;
|
||||
width: 800px;
|
||||
max-width: 100%;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<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" @finish="onFinish">
|
||||
<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>
|
||||
@@ -47,18 +47,6 @@
|
||||
<div class="helper" v-html="t('certd.commonCnameHelper')"></div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :label="t('certd.sys.setting.captchaEnabled')" :name="['public', 'captchaEnabled']">
|
||||
<a-switch v-model:checked="formState.public.captchaEnabled" />
|
||||
<div class="helper" v-html="t('certd.sys.setting.captchaHelper')"></div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.sys.setting.captchaType')" :name="['public', 'captchaAddonId']">
|
||||
<addon-selector v-model:model-value="formState.public.captchaAddonId" addon-type="captcha" from="sys" @selected-change="onAddonChanged" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :name="['public', 'captchaType']" class="hidden">
|
||||
<a-input v-model:model-value="formState.public.captchaType"></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
|
||||
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
|
||||
</a-form-item>
|
||||
@@ -76,6 +64,7 @@ import { notification } from "ant-design-vue";
|
||||
import { util } from "/@/utils";
|
||||
import { useI18n } from "/src/locales";
|
||||
import AddonSelector from "../../../certd/addon/addon-selector/index.vue";
|
||||
import CaptchaInput from "/@/components/captcha/captcha-input.vue";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
@@ -106,6 +95,7 @@ const settingsStore = useSettingStore();
|
||||
const onFinish = async (form: any) => {
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
|
||||
await api.SysSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
@@ -116,21 +106,6 @@ const onFinish = async (form: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
const onFinishFailed = (errorInfo: any) => {
|
||||
// console.log("Failed:", errorInfo);
|
||||
};
|
||||
|
||||
async function stopOtherUserTimer() {
|
||||
await api.stopOtherUserTimer();
|
||||
notification.success({
|
||||
message: t("certd.stopSuccess"),
|
||||
});
|
||||
}
|
||||
|
||||
function onAddonChanged(target: any) {
|
||||
formState.public.captchaType = target.type;
|
||||
}
|
||||
|
||||
const testProxyLoading = ref(false);
|
||||
async function testProxy() {
|
||||
testProxyLoading.value = true;
|
||||
|
||||
125
packages/ui/certd-client/src/views/sys/settings/tabs/captcha.vue
Normal file
125
packages/ui/certd-client/src/views/sys/settings/tabs/captcha.vue
Normal file
@@ -0,0 +1,125 @@
|
||||
<template>
|
||||
<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">
|
||||
<a-form-item :label="t('certd.sys.setting.captchaEnabled')" :name="['public', 'captchaEnabled']">
|
||||
<a-switch v-model:checked="formState.public.captchaEnabled" />
|
||||
<div class="helper" v-html="t('certd.sys.setting.captchaHelper')"></div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.sys.setting.captchaType')" :name="['public', 'captchaAddonId']">
|
||||
<addon-selector v-model:model-value="formState.public.captchaAddonId" addon-type="captcha" from="sys" @selected-change="onAddonChanged" />
|
||||
</a-form-item>
|
||||
<a-form-item v-if="formState.public.captchaType === settingsStore.sysPublic.captchaType" :label="t('certd.sys.setting.captchaTest')">
|
||||
<div class="flex">
|
||||
<CaptchaInput v-model:model-value="captchaTestForm.captcha" class="w-50%"></CaptchaInput>
|
||||
<a-button class="ml-2" type="primary" @click="doCaptchaValidate">后端验证</a-button>
|
||||
</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item :name="['public', 'captchaType']" class="hidden">
|
||||
<a-input v-model:model-value="formState.public.captchaType"></a-input>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
|
||||
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { reactive, ref } from "vue";
|
||||
import { SysSettings } from "/@/views/sys/settings/api";
|
||||
import * as api from "/@/views/sys/settings/api";
|
||||
import { merge } from "lodash-es";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { notification } from "ant-design-vue";
|
||||
import { util } from "/@/utils";
|
||||
import { useI18n } from "/src/locales";
|
||||
import AddonSelector from "../../../certd/addon/addon-selector/index.vue";
|
||||
import CaptchaInput from "/@/components/captcha/captcha-input.vue";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "SettingCaptcha",
|
||||
});
|
||||
|
||||
const captchaTestForm = reactive({
|
||||
captcha: null,
|
||||
pass: false,
|
||||
});
|
||||
|
||||
async function doCaptchaValidate() {
|
||||
if (!captchaTestForm.captcha) {
|
||||
notification.error({
|
||||
message: "请进行验证码验证",
|
||||
});
|
||||
return;
|
||||
}
|
||||
await api.TestCaptcha(captchaTestForm.captcha);
|
||||
notification.success({
|
||||
message: "校验通过",
|
||||
});
|
||||
captchaTestForm.pass = true;
|
||||
}
|
||||
|
||||
const formState = reactive<Partial<SysSettings>>({
|
||||
public: {
|
||||
icpNo: "",
|
||||
mpsNo: "",
|
||||
},
|
||||
private: {},
|
||||
});
|
||||
|
||||
async function loadSysSettings() {
|
||||
const data: any = await api.SysSettingsGet();
|
||||
merge(formState, data);
|
||||
}
|
||||
|
||||
const saveLoading = ref(false);
|
||||
loadSysSettings();
|
||||
const settingsStore = useSettingStore();
|
||||
const onFinish = async (form: any) => {
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
|
||||
if (form.public.captchaEnabled && !captchaTestForm.pass) {
|
||||
if (form.public.captchaType === settingsStore.sysPublic.captchaType) {
|
||||
notification.error({
|
||||
message: "您正在开启登录验证码,请先通过验证码测试,后端校验成功后才能保存",
|
||||
});
|
||||
} else {
|
||||
notification.error({
|
||||
message: "您正在开启登录验证码,请先关闭登录验证码开关,保存,然后会显示验证码,进行验证码测试,后端校验成功,之后再开启登录验证码,并保存",
|
||||
});
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
await api.SysSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
clearValidState();
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
function clearValidState() {
|
||||
captchaTestForm.pass = false;
|
||||
captchaTestForm.captcha = null;
|
||||
}
|
||||
|
||||
function onAddonChanged(target: any) {
|
||||
formState.public.captchaType = target.type;
|
||||
clearValidState();
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
.sys-settings-base {
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,75 @@
|
||||
<template>
|
||||
<div class="sys-settings-form sys-settings-pipeline">
|
||||
<a-form :model="formState" name="basic" :label-col="{ span: 8 }" :wrapper-col="{ span: 16 }" autocomplete="off" @finish="onFinish">
|
||||
<a-form-item :label="t('certd.manageOtherUserPipeline')" :name="['public', 'managerOtherUserPipeline']">
|
||||
<a-switch v-model:checked="formState.public.managerOtherUserPipeline" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.limitUserPipelineCount')" :name="['public', 'limitUserPipelineCount']">
|
||||
<a-input-number v-model:value="formState.public.limitUserPipelineCount" />
|
||||
<div class="helper">{{ t("certd.limitUserPipelineCountHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.sys.setting.pipelineValidTimeEnabled')" :name="['public', 'pipelineValidTimeEnabled']">
|
||||
<div class="flex items-center">
|
||||
<a-switch v-model:checked="formState.public.pipelineValidTimeEnabled" :disabled="!settingsStore.isPlus" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
|
||||
<div class="helper">{{ t("certd.sys.setting.pipelineValidTimeEnabledHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.sys.setting.certDomainAddToMonitorEnabled')" :name="['public', 'certDomainAddToMonitorEnabled']">
|
||||
<div class="flex items-center">
|
||||
<a-switch v-model:checked="formState.public.certDomainAddToMonitorEnabled" :disabled="!settingsStore.isPlus" />
|
||||
<vip-button class="ml-5" mode="button"></vip-button>
|
||||
</div>
|
||||
<div class="helper">{{ t("certd.sys.setting.certDomainAddToMonitorEnabledHelper") }}</div>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item label=" " :colon="false" :wrapper-col="{ span: 8 }">
|
||||
<a-button :loading="saveLoading" type="primary" html-type="submit">{{ t("certd.saveButton") }}</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="tsx">
|
||||
import { reactive, ref } from "vue";
|
||||
import { SysSettings } from "/@/views/sys/settings/api";
|
||||
import * as api from "/@/views/sys/settings/api";
|
||||
import { merge } from "lodash-es";
|
||||
import { useSettingStore } from "/@/store/settings";
|
||||
import { notification } from "ant-design-vue";
|
||||
import { useI18n } from "/src/locales";
|
||||
const { t } = useI18n();
|
||||
|
||||
defineOptions({
|
||||
name: "SettingPipeline",
|
||||
});
|
||||
|
||||
const formState = reactive<Partial<SysSettings>>({
|
||||
public: {},
|
||||
private: {},
|
||||
});
|
||||
|
||||
async function loadSysSettings() {
|
||||
const data: any = await api.SysSettingsGet();
|
||||
merge(formState, data);
|
||||
}
|
||||
|
||||
const saveLoading = ref(false);
|
||||
loadSysSettings();
|
||||
const settingsStore = useSettingStore();
|
||||
const onFinish = async (form: any) => {
|
||||
try {
|
||||
saveLoading.value = true;
|
||||
|
||||
await api.SysSettingsSave(form);
|
||||
await settingsStore.loadSysSettings();
|
||||
notification.success({
|
||||
message: t("certd.saveSuccess"),
|
||||
});
|
||||
} finally {
|
||||
saveLoading.value = false;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="less"></style>
|
||||
@@ -1,13 +1,6 @@
|
||||
<template>
|
||||
<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-item :label="t('certd.manageOtherUserPipeline')" :name="['public', 'managerOtherUserPipeline']">
|
||||
<a-switch v-model:checked="formState.public.managerOtherUserPipeline" />
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.limitUserPipelineCount')" :name="['public', 'limitUserPipelineCount']">
|
||||
<a-input-number v-model:value="formState.public.limitUserPipelineCount" />
|
||||
<div class="helper">{{ t("certd.limitUserPipelineCountHelper") }}</div>
|
||||
</a-form-item>
|
||||
<a-form-item :label="t('certd.enableSelfRegistration')" :name="['public', 'registerEnabled']">
|
||||
<a-switch v-model:checked="formState.public.registerEnabled" />
|
||||
</a-form-item>
|
||||
|
||||
@@ -55,15 +55,15 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
groups: {
|
||||
base: {
|
||||
header: t("certd.basicInfo"),
|
||||
columns: ["title", "type", "disabled", "order", "supportBuy", "intro"]
|
||||
columns: ["title", "type", "disabled", "order", "supportBuy", "intro"],
|
||||
},
|
||||
content: {
|
||||
header: t("certd.packageContent"),
|
||||
columns: ["content.maxDomainCount", "content.maxPipelineCount", "content.maxDeployCount", "content.maxMonitorCount"]
|
||||
columns: ["content.maxDomainCount", "content.maxPipelineCount", "content.maxDeployCount", "content.maxMonitorCount"],
|
||||
},
|
||||
price: {
|
||||
header: t("certd.price"),
|
||||
columns: ["durationPrices"]
|
||||
columns: ["durationPrices"],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -41,7 +41,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
|
||||
//这里使用行选择插件,生成行选择crudOptions配置,最终会与crudOptions合并
|
||||
rowSelection: {
|
||||
enabled: true,
|
||||
order: -2,
|
||||
order: -99,
|
||||
before: true,
|
||||
// handle: (pluginProps,useCrudProps)=>CrudOptions,
|
||||
props: {
|
||||
|
||||
Reference in New Issue
Block a user