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

@@ -57,7 +57,6 @@
<script lang="ts" setup>
import { type LoginFormData } from "@/api/auth";
import { useUserStore } from "@/store/modules/user";
import { useDictStore } from "@/store/modules/dict";
const loginFormRef = ref();
const loginFormData = ref<LoginFormData>({
@@ -66,7 +65,6 @@ const loginFormData = ref<LoginFormData>({
});
const userStore = useUserStore();
const dictStore = useDictStore();
// 登录处理
const handleLogin = () => {
@@ -75,23 +73,14 @@ const handleLogin = () => {
try {
await userStore.login(loginFormData.value);
await userStore.getInfo();
await dictStore.loadDictionaries();
uni.showToast({ title: "登录成功", icon: "success" });
// 检查是否有上一页
const pages = getCurrentPages();
console.log("pages", pages.length);
if (pages.length > 1) {
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
setTimeout(() => {
uni.reLaunch({
url: "/pages/index/index",
});
}, 1500);
}
setTimeout(() => {
uni.reLaunch({
url: "/pages/index/index",
});
}, 1500);
} catch (error: any) {
console.log("登录失败", error.message);
}

View File

@@ -125,7 +125,7 @@ const handleSubmit = async () => {
setTimeout(() => {
uni.navigateBack();
}, 1500);
} catch (error) {
} catch {
toast.error("提交失败,请重试");
} finally {
submitting.value = false;

View File

@@ -95,7 +95,7 @@ const handleQuestionFeedback = () => {
uni.navigateTo({ url: "/pages/mine/feedback/index" });
};
// 建设中
const handleItemclick = (item: any) => {
const handleItemclick = () => {
toast.show("建设中...");
};
</script>

View File

@@ -63,12 +63,7 @@
</view>
</template>
<script setup lang="ts">
import UserAPI, {
type UserProfileVO,
UserProfileForm,
MobileBindingForm,
EmailBindingForm,
} from "@/api/system/user";
import UserAPI, { type UserProfileVO, UserProfileForm } from "@/api/system/user";
import FileAPI, { type FileInfo } from "@/api/file";
const originalSrc = ref<string>(""); //选取的原图路径

View File

@@ -126,7 +126,7 @@ const handleClearCache = async () => {
title: "清理成功",
icon: "success",
});
} catch (error) {
} catch {
uni.showToast({
title: "清理失败",
icon: "error",

View File

@@ -101,7 +101,7 @@ const getNetworkType = async () => {
? `${(navigator as any).connection.effectiveType || "未知"}`
: "不支持";
// #endif
} catch (error) {
} catch {
networkType.value = "获取失败";
signalStrength.value = "获取失败";
}
@@ -143,13 +143,13 @@ const startTest = async () => {
try {
const startTime = Date.now();
// #ifdef H5
const res = await uni.request({
await uni.request({
url: "/api/v1/auth/captcha",
timeout: 5000,
});
// #endif
// #ifndef H5
const resOther = await request({
await request({
url: "/api/v1/auth/captcha",
timeout: 5000,
});
@@ -159,7 +159,7 @@ const startTest = async () => {
pingResult.value.delay = delay;
pingResult.value.status = delay < 300 ? "正常" : "较慢";
} catch (error) {
} catch {
pingResult.value.delay = "--";
pingResult.value.status = "连接失败";
} finally {

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",
});
}