perf: 优化证书进度条颜色

This commit is contained in:
xiaojunnuo
2025-07-09 15:24:23 +08:00
parent f2551318fc
commit 2af91dbf2a
4 changed files with 24 additions and 8 deletions

View File

@@ -167,10 +167,14 @@ async function onDomainsChanged(domains: string[]) {
let planItem = planRef.value[domain];
const domainGroupItem = domainGroups[domain];
if (!planItem) {
let type = props.defaultType || "cname";
if (type === "dnses") {
type = "dns";
}
planItem = {
domain,
//@ts-ignore
type: props.defaultType || "cname",
type: type,
//@ts-ignore
cnameVerifyPlan: {},
//@ts-ignore

View File

@@ -228,7 +228,11 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
const leftDays = dayjs(value).diff(dayjs(), "day");
const color = leftDays < 20 ? "red" : "#389e0d";
const percent = (leftDays / 90) * 100;
return <a-progress title={expireDate + t("certd.expires")} percent={percent} strokeColor={color} format={(percent: number) => `${leftDays}${t("certd.days")}`} />;
const textColor = leftDays < 20 ? "red" : leftDays > 60 ? "#389e0d" : "";
const format = () => {
return <span style={{ color: textColor }}>{`${leftDays}${t("certd.days")}`}</span>;
};
return <a-progress title={expireDate + t("certd.expires")} percent={percent} strokeColor={color} format={format} />;
},
},
},

View File

@@ -363,13 +363,19 @@ export default function ({ crudExpose, context: { groupDictRef, selectedRowKeys
},
column: {
cellRender({ row }) {
if (!row.lastVars?.certExpiresTime) {
const value = row.lastVars?.certExpiresTime;
if (!value) {
return "-";
}
const leftDays = dayjs(row.lastVars.certExpiresTime).diff(dayjs(), "day");
const expireDate = dayjs(value).format("YYYY-MM-DD");
const leftDays = dayjs(value).diff(dayjs(), "day");
const color = leftDays < 20 ? "red" : "#389e0d";
const percent = (leftDays / 90) * 100;
return <a-progress percent={percent} strokeColor={color} format={percent => `${leftDays}`} />;
const textColor = leftDays < 20 ? "red" : leftDays > 60 ? "#389e0d" : "";
const format = () => {
return <span style={{ color: textColor }}>{`${leftDays}${t("certd.days")}`}</span>;
};
return <a-progress title={expireDate + t("certd.expires")} percent={percent} strokeColor={color} format={format} />;
},
width: 150,
},