perf: 支持部署到maoyun cdn

This commit is contained in:
xiaojunnuo
2025-05-15 01:03:21 +08:00
parent b8edd14f39
commit 68f333fb87
4 changed files with 139 additions and 132 deletions

View File

@@ -1,87 +1 @@
import { merge } from "lodash-es";
export function createCertDomainGetterInputDefine(opts?: { certInputKey?: string; props?: any }) {
const certInputKey = opts?.certInputKey || "cert";
return merge(
{
title: "当前证书域名",
component: {
name: "cert-domains-getter",
},
mergeScript: `
return {
component:{
inputKey: ctx.compute(({form})=>{
return form.${certInputKey}
}),
}
}
`,
required: true,
},
opts?.props
);
}
export function createRemoteSelectInputDefine(opts?: {
title: string;
certDomainsInputKey?: string;
accessIdInputKey?: string;
typeName?: string;
action: string;
type?: string;
watches?: string[];
helper?: string;
formItem?: any;
mode?: string;
multi?: boolean;
required?: boolean;
rules?: any;
mergeScript?: string;
}) {
const title = opts?.title || "请选择";
const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains";
const accessIdInputKey = opts?.accessIdInputKey || "accessId";
const typeName = opts?.typeName;
const action = opts?.action;
const type = opts?.type || "plugin";
const watches = opts?.watches || [];
const helper = opts?.helper || "请选择";
let mode = "tags";
if (opts.multi === false) {
mode = undefined;
} else {
mode = opts?.mode ?? "tags";
}
const item = {
title,
component: {
name: "remote-select",
vModel: "value",
mode,
type,
typeName,
action,
watches: [certDomainsInputKey, accessIdInputKey, ...watches],
},
rules: opts?.rules,
required: opts.required ?? true,
mergeScript:
opts.mergeScript ??
`
return {
component:{
form: ctx.compute(({form})=>{
return form
})
},
}
`,
helper,
};
return merge(item, opts?.formItem);
}
export * from "./util.js";

View File

@@ -0,0 +1,85 @@
import { merge } from "lodash-es";
export function createCertDomainGetterInputDefine(opts?: { certInputKey?: string; props?: any }) {
const certInputKey = opts?.certInputKey || "cert";
return merge(
{
title: "当前证书域名",
component: {
name: "cert-domains-getter",
},
mergeScript: `
return {
component:{
inputKey: ctx.compute(({form})=>{
return form.${certInputKey}
}),
}
}
`,
required: true,
},
opts?.props
);
}
export function createRemoteSelectInputDefine(opts?: {
title: string;
certDomainsInputKey?: string;
accessIdInputKey?: string;
typeName?: string;
action: string;
type?: string;
watches?: string[];
helper?: string;
formItem?: any;
mode?: string;
multi?: boolean;
required?: boolean;
rules?: any;
mergeScript?: string;
}) {
const title = opts?.title || "请选择";
const certDomainsInputKey = opts?.certDomainsInputKey || "certDomains";
const accessIdInputKey = opts?.accessIdInputKey || "accessId";
const typeName = opts?.typeName;
const action = opts?.action;
const type = opts?.type || "plugin";
const watches = opts?.watches || [];
const helper = opts?.helper || "请选择";
let mode = "tags";
if (opts.multi === false) {
mode = undefined;
} else {
mode = opts?.mode ?? "tags";
}
const item = {
title,
component: {
name: "remote-select",
vModel: "value",
mode,
type,
typeName,
action,
watches: [certDomainsInputKey, accessIdInputKey, ...watches],
},
rules: opts?.rules,
required: opts.required ?? true,
mergeScript:
opts.mergeScript ??
`
return {
component:{
form: ctx.compute(({form})=>{
return form
})
},
}
`,
helper,
};
return merge(item, opts?.formItem);
}

View File

@@ -24,7 +24,7 @@ export class FtpAccess extends BaseAccess {
host!: string;
@AccessInput({
title: "host",
title: "端口",
value: 21,
component: {
placeholder: "21",