diff --git a/src/assets/styles/index.scss b/src/assets/styles/index.scss index bb87292..7c6919a 100644 --- a/src/assets/styles/index.scss +++ b/src/assets/styles/index.scss @@ -10,7 +10,12 @@ body { -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; - font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; + font-family: "Source Han Sans CN", "思源黑体", sans-serif; +} + +/* 覆盖所有 Element UI 组件字体 */ +[class^="el-"] { + font-family: "Source Han Sans CN", "思源黑体", sans-serif !important; } label { @@ -104,7 +109,7 @@ aside { display: block; line-height: 32px; font-size: 16px; - font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; + font-family: "Source Han Sans SC", "Noto Sans SC", sans-serif; color: #2c3e50; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; @@ -175,4 +180,4 @@ aside { vertical-align: middle; margin-bottom: 10px; } -} +} \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index bf8b3ce..b9b9f2d 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -82,15 +82,27 @@ service.interceptors.response.use(res => { if (res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer') { return res.data } - if (code === 401) { + if (code === 401 || code == 910) { + // 防止重复弹窗,使用延时重置锁,兼容并发请求 if (!isRelogin.show) { isRelogin.show = true - MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => { - isRelogin.show = false - store.dispatch('LogOut').then(() => { - location.href = '/index' - }) + MessageBox.confirm( + '登录状态已过期,您可以继续留在该页面,或者重新登录', + '系统提示', + { + confirmButtonText: '重新登录', + cancelButtonText: '取消', + type: 'warning' + } + ).then(() => { + // 退出登录并跳转 + return store.dispatch('LogOut') + }).then(() => { + location.href = '/index' }).catch(() => { + // 捕获异常,保证锁一定释放 + }).finally(() => { + // 无论点确定/取消/报错,最终都解锁 isRelogin.show = false }) }