Skip to content

Commit 77f08c0

Browse files
committed
perf(code): 代码优化
1 parent c95dca8 commit 77f08c0

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

src/api/system/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ import { crud, DML } from '@/api/public/crud';
99

1010
export default function () {
1111
return crud(DML.SELECT, 'ad_codelist', {
12-
searchCondition: [{ field: 'codeType', operator: 'eq', value: '系统配置' }],
12+
searchCondition: [{ field: 'codeType', operator: 'eq', value: 'f844cb90-1738-4013-b9f2-b0755b63b9dc' }],
1313
});
1414
}

src/plugins/axios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ service.interceptors.response.use(
7272
customClass: 'msgBox',
7373
showClose: true,
7474
});
75-
} else {
75+
} else if (code !== 200) {
7676
// 业务失败情况统一拦截
7777
MessageBox.alert(`原因:${message}`, '操作失败', {
7878
confirmButtonText: '我知道了',

src/store/modules/user.ts

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -123,34 +123,19 @@ const user = {
123123
},
124124
// 删除客户端和服务端Token
125125
async clearToken({ commit }) {
126-
// 如果配置了“不请求后端接口”
127-
if (process.env.VUE_APP_REQUEST_API === 'false') {
128-
const promise = new Promise((resolve) => {
129-
commit('SET_TOKEN', null);
130-
window.location.reload();
131-
resolve();
132-
});
133-
return promise;
134-
}
135-
const promise = await logout().then(() => {
136-
commit('SET_TOKEN', null);
137-
window.location.reload();
138-
});
139-
return promise;
126+
commit('SET_TOKEN', null);
127+
window.location.reload();
140128
},
141129
// 客户端timeOut
142130
async clientTimeOut({ commit }) {
143-
const promise = await logout().then(() => {
144-
commit('SET_TOKEN', null);
145-
MessageBox.alert('长时间未操作,登录超时,请重新登录', {
146-
confirmButtonText: '重新登录',
147-
showClose: false,
148-
callback: () => {
149-
window.location.reload();
150-
},
151-
});
131+
commit('SET_TOKEN', null);
132+
MessageBox.alert('长时间未操作,登录超时,请重新登录', {
133+
confirmButtonText: '重新登录',
134+
showClose: false,
135+
callback: () => {
136+
window.location.reload();
137+
},
152138
});
153-
return promise;
154139
},
155140
// 修改密码
156141
async changePassword({ commit }, {

0 commit comments

Comments
 (0)