fix(AccountListModal): 更新账号状态显示逻辑和颜色标识

修改账号状态显示逻辑,将字符串状态改为数字类型,并更新对应的颜色标识和状态文本。同时更新构建产物的文件引用路径。
This commit is contained in:
超级老白兔
2025-08-28 16:06:16 +08:00
parent 1053d4125f
commit 31d75be68e
3 changed files with 40 additions and 29 deletions

View File

@@ -61,29 +61,40 @@ const AccountListModal: React.FC<AccountListModalProps> = ({
}, [visible, ruleId]);
const title = ruleName ? `${ruleName} - 已添加账号列表` : "已添加账号列表";
const getStatusColor = (status?: string) => {
switch (status) {
case "normal":
return "#52c41a";
case "limited":
return "#faad14";
case "blocked":
return "#ff4d4f";
const getStatusColor = (status?: string | number) => {
// 确保status是数字类型
const statusNum = Number(status);
switch (statusNum) {
case 0:
return "#faad14"; // 待添加 - 黄色警告色
case 1:
return "#1890ff"; // 添加中 - 蓝色进行中
case 2:
return "#ff4d4f"; // 添加失败 - 红色错误色
case 3:
return "#ff4d4f"; // 添加失败 - 红色错误色
case 4:
return "#52c41a"; // 已添加 - 绿色成功色
default:
return "#d9d9d9";
return "#d9d9d9"; // 未知状态 - 灰色
}
};
const getStatusText = (status?: string) => {
const getStatusText = (status?: number) => {
switch (status) {
case "normal":
return "正常";
case "limited":
return "受限";
case "blocked":
return "封禁";
case 0:
return "待添加";
case 1:
return "添加中";
case 2:
return "添加失败";
case 3:
return "添加失败";
case 4:
return "已添加";
default:
return "未知";
return "未知状态";
}
};
@@ -149,7 +160,7 @@ const AccountListModal: React.FC<AccountListModalProps> = ({
style={{ backgroundColor: getStatusColor(account.status) }}
/>
<span className={style.statusText}>
{getStatusText(account.status)}
{getStatusText(Number(account.status))}
</span>
</div>
</div>