Skip to content

Commit 06ae63d

Browse files
committed
fix: 异常处理
1 parent dd6adc9 commit 06ae63d

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

src/views/course.vue

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,18 +275,30 @@ export default {
275275
}
276276
},
277277
refreshCourse: async function () {
278+
this.show = true;
278279
let resp = await checkLogin()
279280
if (resp.data.code === 3401) {
280281
showFailToast("登录状态失效, 请登录后重试");
281282
this.$router.push('/login');
282283
} else {
283-
this.show = true;
284-
refreshExpCourse(() => {
285-
refreshNormalCourse(() => {
286-
this.get();
287-
this.show = false;
288-
showSuccessToast("更新成功");
289-
});
284+
refreshExpCourse((response) => {
285+
if (response.status !== 200) {
286+
showFailToast("后端服务器错误");
287+
} else if (response.data.code !== 0) {
288+
this.handleErrorCode(response.data.code, "实验课表")
289+
} else {
290+
refreshNormalCourse(() => {
291+
if (response.status !== 200) {
292+
showFailToast("后端服务器错误");
293+
} else if (response.data.code !== 0) {
294+
this.handleErrorCode(response.data.code, "普通课表")
295+
} else {
296+
this.get();
297+
showSuccessToast("更新成功");
298+
}
299+
this.show = false;
300+
});
301+
}
290302
});
291303
}
292304
}

0 commit comments

Comments
 (0)