fix: 🐛 修复 eslint 警告问题

This commit is contained in:
Ray.Hao
2025-04-04 23:50:18 +08:00
parent c1efba0a0a
commit 41c874092e
18 changed files with 372 additions and 274 deletions

View File

@@ -153,7 +153,7 @@ async function submitForm() {
loading.value = true;
try {
if (formRef.value) {
formRef.value!.validate().then(async ({ valid, errors }) => {
formRef.value!.validate().then(async ({ valid }) => {
if (valid) {
if (form.value.id) {
await ConfigAPI.update(form.value.id, form.value);
@@ -170,7 +170,7 @@ async function submitForm() {
}
});
}
} catch (error) {
} catch {
uni.showToast({ title: "操作失败", icon: "error" });
loading.value = false;
} finally {

View File

@@ -119,7 +119,7 @@ function loadmore() {
total.value = data.total;
queryParams.pageNum++;
})
.catch((e) => {
.catch(() => {
pageData.value = [];
})
.finally(() => {

View File

@@ -128,38 +128,23 @@ const formatDate = (date: Date | undefined): string => {
return date ? date.toString() : "-";
};
const getLevelType = (level: string | number | undefined): string => {
if (!level) return "-";
const levelMap: Record<string, string> = {
L: "低",
M: "中",
H: "高",
};
return levelMap[level] || "未知";
};
// 加载更多
const loadMore = async () => {
if (loadState.value === "loading") return;
loadState.value = "loading";
try {
const { list, total: totalCount } = await NoticeAPI.getPage(queryParams.value);
const { list, total: totalCount } = await NoticeAPI.getPage(queryParams.value);
if (queryParams.value.pageNum === 1) {
dataList.value = list;
} else {
dataList.value = [...dataList.value, ...list];
}
total.value = totalCount;
queryParams.value.pageNum++;
loadState.value = dataList.value.length >= total.value ? "finished" : "loading";
} catch (error) {
loadState.value = "error";
uni.showToast({ title: "加载失败", icon: "none" });
if (queryParams.value.pageNum === 1) {
dataList.value = list;
} else {
dataList.value = [...dataList.value, ...list];
}
total.value = totalCount;
queryParams.value.pageNum++;
loadState.value = dataList.value.length >= total.value ? "finished" : "loading";
};
// 查看详情
@@ -207,7 +192,7 @@ const handleDelete = (notice: NoticePageVO) => {
queryParams.value.pageNum = 1;
loadMore();
} catch (error) {
uni.showToast({ title: "删除失败", icon: "none" });
uni.showToast({ title: "删除失败" + error, icon: "none" });
}
}
},
@@ -228,7 +213,7 @@ const handlePublish = (notice: NoticePageVO) => {
queryParams.value.pageNum = 1;
loadMore();
} catch (error) {
uni.showToast({ title: "发布失败", icon: "none" });
uni.showToast({ title: "发布失败" + error, icon: "none" });
}
}
},
@@ -253,7 +238,7 @@ const handleRevoke = (notice: NoticePageVO) => {
loadMore();
} catch (error) {
uni.showToast({
title: "撤回失败",
title: "撤回失败" + error,
icon: "error",
});
}