update:格式化代码

This commit is contained in:
hrz
2025-04-05 20:19:28 +08:00
parent d255edfd5f
commit 03441c8582
23 changed files with 414 additions and 417 deletions
+8 -8
View File
@@ -1,7 +1,7 @@
import {goToPage, showDanger, showWarning, isNotNull} from '../utils/index'
import Constant from '../utils/constant'
import Fly from 'flyio/dist/npm/fly';
import store from '../store/index'
import store from '../store/index';
import Constant from '../utils/constant';
import { goToPage, isNotNull, showDanger, showWarning } from '../utils/index';
const fly = new Fly()
// 设置超时
@@ -22,11 +22,11 @@ function sendRequest() {
_failCallback: null,
_method: 'GET',
_data: {},
_header: {'content-type': 'application/json; charset=utf-8'},
_header: { 'content-type': 'application/json; charset=utf-8' },
_url: '',
_responseType: undefined, // 新增响应类型字段
'send'() {
if(isNotNull(store.getters.getToken)){
if (isNotNull(store.getters.getToken)) {
this._header.Authorization = 'Bearer ' + (JSON.parse(store.getters.getToken)).token
}
@@ -40,7 +40,7 @@ function sendRequest() {
if (error) {
return
}
if (this._sucCallback) {
this._sucCallback(res)
}
@@ -101,13 +101,13 @@ function sendRequest() {
// 在错误处理函数中添加日志
function httpHandlerError(info, callBack) {
console.log('httpHandlerError', info)
/** 请求成功,退出该函数 可以根据项目需求来判断是否请求成功。这里判断的是status为200的时候是成功 */
let networkError = false
if (info.status === 200) {
if (info.data.code === 'success' || info.data.code === 0 || info.data.code === undefined) {
return networkError
}else if (info.data.code === 401) {
} else if (info.data.code === 401) {
console.log('触发 401,清除 Token 并跳转登录页');
store.commit('clearAuth');
goToPage(Constant.PAGE.LOGIN, true);