| | |
| | | import environments from '@/environments' |
| | | import message from './message' |
| | | import storage from './storage' |
| | | // import store from '../store' |
| | | import store from '../store' |
| | | import utils from './util.js' |
| | | // import Vue from 'vue' |
| | | // import { |
| | |
| | | dataType: options.dataType ? options.dataType : 'json', |
| | | data: options.data || null, |
| | | header, |
| | | timeout: 30000, |
| | | success: async (res) => { |
| | | if (!options.ignore) { |
| | | message.hideLoading() |
| | |
| | | code: 0, |
| | | msg: '' |
| | | }) |
| | | } else if (res.data.code === '3000' || res.data && res.data.code && |
| | | } else if (res.data.code === '3000' || res.data.code === '30000' || res.data && res.data.code && |
| | | res.data.code.startsWith('3000')) { |
| | | let validmsg = '' |
| | | if (Array.isArray(res.data.data)) { |
| | |
| | | res.data.code.startsWith('401')) { |
| | | console.log('resp', res) |
| | | // storage.removeItem('token') |
| | | await store.dispatch('logout') |
| | | message.showToast('登录信息失效') |
| | | // await store.dispatch('logout') |
| | | store.commit('updateLogin', false) |
| | | |
| | | await message.showToast('登录信息失效') |
| | | |
| | | // #ifdef PUB_CUSTOMER |
| | | uni.reLaunch({ |
| | |
| | | // commit('updat') |
| | | // store.commit('updateLogin', false) |
| | | console.log('401', res) |
| | | storage.removeItem('token') |
| | | await store.dispatch('logout') |
| | | message.showToast('登录信息失效') |
| | | // storage.removeItem('token') |
| | | // await store.dispatch('logout') |
| | | store.commit('updateLogin', false) |
| | | await message.showToast('登录信息失效') |
| | | |
| | | |
| | | // #ifdef PUB_CUSTOMER |
| | |
| | | if (!options.ignore) { |
| | | message.hideLoading() |
| | | } |
| | | message.showToast('网络异常') |
| | | reject({ |
| | | data: null, |
| | | code: 9999, |