Skip to content

Commit

Permalink
perf(code): 代码优化
Browse files Browse the repository at this point in the history
  • Loading branch information
BoBoooooo committed Sep 11, 2020
1 parent c95dca8 commit 77f08c0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/api/system/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import { crud, DML } from '@/api/public/crud';

export default function () {
return crud(DML.SELECT, 'ad_codelist', {
searchCondition: [{ field: 'codeType', operator: 'eq', value: '系统配置' }],
searchCondition: [{ field: 'codeType', operator: 'eq', value: 'f844cb90-1738-4013-b9f2-b0755b63b9dc' }],
});
}
2 changes: 1 addition & 1 deletion src/plugins/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ service.interceptors.response.use(
customClass: 'msgBox',
showClose: true,
});
} else {
} else if (code !== 200) {
// 业务失败情况统一拦截
MessageBox.alert(`原因:${message}`, '操作失败', {
confirmButtonText: '我知道了',
Expand Down
33 changes: 9 additions & 24 deletions src/store/modules/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,34 +123,19 @@ const user = {
},
// 删除客户端和服务端Token
async clearToken({ commit }) {
// 如果配置了“不请求后端接口”
if (process.env.VUE_APP_REQUEST_API === 'false') {
const promise = new Promise((resolve) => {
commit('SET_TOKEN', null);
window.location.reload();
resolve();
});
return promise;
}
const promise = await logout().then(() => {
commit('SET_TOKEN', null);
window.location.reload();
});
return promise;
commit('SET_TOKEN', null);
window.location.reload();
},
// 客户端timeOut
async clientTimeOut({ commit }) {
const promise = await logout().then(() => {
commit('SET_TOKEN', null);
MessageBox.alert('长时间未操作,登录超时,请重新登录', {
confirmButtonText: '重新登录',
showClose: false,
callback: () => {
window.location.reload();
},
});
commit('SET_TOKEN', null);
MessageBox.alert('长时间未操作,登录超时,请重新登录', {
confirmButtonText: '重新登录',
showClose: false,
callback: () => {
window.location.reload();
},
});
return promise;
},
// 修改密码
async changePassword({ commit }, {
Expand Down

0 comments on commit 77f08c0

Please sign in to comment.