mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 12:26:47 +08:00
日志
This commit is contained in:
@@ -513,33 +513,35 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 改变热点状态
|
// 改变热点状态
|
||||||
const handleHotChange1 = async (record) => {
|
// const handleHotChange1 = async (record) => {
|
||||||
const originalStatus = record.isHot;
|
// const originalStatus = record.isHot;
|
||||||
try {
|
// try {
|
||||||
console.log("修改热点 参数 : ",record);
|
// console.log("修改热点 参数 : ",record);
|
||||||
changeTagHot(record.id).then ((res) => {
|
// changeTagHot(record.id).then ((res) => {
|
||||||
console.log("修改热点 结果 : ",res);
|
// console.log("修改热点 结果 : ",res);
|
||||||
if (res.status === 200 ) {
|
// if (res.status === 200 ) {
|
||||||
console.log("更新成功");
|
// console.log("更新成功");
|
||||||
}else {
|
// }else {
|
||||||
record.isHot = false;
|
// record.isHot = false;
|
||||||
message.warning(res.message);
|
// message.warning(res.message);
|
||||||
}
|
// }
|
||||||
})
|
// })
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
record.isHot = originalStatus;
|
// record.isHot = originalStatus;
|
||||||
message.error('更新失败');
|
// message.error('更新失败');
|
||||||
}
|
// }
|
||||||
};
|
// };
|
||||||
|
|
||||||
// 改变热点状态
|
// 改变热点状态
|
||||||
const handleHotChange = async (record) => {
|
const handleHotChange = async (record) => {
|
||||||
const originalStatus = record.isHot;
|
const originalStatus = record.isHot;
|
||||||
try {
|
try {
|
||||||
console.log("修改热点 参数 : ",record);
|
console.log("修改热点 参数 : ", record);
|
||||||
const res = await changeTagHot(record.id);
|
const res = await changeTagHot(record.id);
|
||||||
console.log("修改热点 结果 : ",res);
|
console.log("修改热点 结果 : ", res);
|
||||||
if (res.status === 200) {
|
|
||||||
|
// 使用 code 或 data 判断成功,而不是 status
|
||||||
|
if (res.code === 200 || res.data === "修改成功") {
|
||||||
console.log("更新成功");
|
console.log("更新成功");
|
||||||
message.success('更新成功');
|
message.success('更新成功');
|
||||||
// 更新成功后重新获取列表以同步最新状态
|
// 更新成功后重新获取列表以同步最新状态
|
||||||
@@ -547,7 +549,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
// 状态不是200时回滚状态并显示错误信息
|
// 状态不是200时回滚状态并显示错误信息
|
||||||
record.isHot = originalStatus;
|
record.isHot = originalStatus;
|
||||||
message.warning(res.message || '更新失败');
|
message.warning(res.msg || res.message || '更新失败');
|
||||||
// 重新加载列表以确保数据一致性
|
// 重新加载列表以确保数据一致性
|
||||||
await getTagList();
|
await getTagList();
|
||||||
}
|
}
|
||||||
@@ -555,6 +557,8 @@ export default {
|
|||||||
// 网络错误或异常情况
|
// 网络错误或异常情况
|
||||||
record.isHot = originalStatus;
|
record.isHot = originalStatus;
|
||||||
message.error('更新失败: ' + error.message);
|
message.error('更新失败: ' + error.message);
|
||||||
|
// 出现异常时也重新加载数据
|
||||||
|
await getTagList();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user