|
@@ -3,6 +3,11 @@ import {
|
|
|
platform
|
|
|
} from '../utils/index';
|
|
|
import store from '@/store/index.js'
|
|
|
+
|
|
|
+import {
|
|
|
+ goLoginPage
|
|
|
+} from "@/mixins/index.js"
|
|
|
+
|
|
|
const program = {
|
|
|
H5: "wap",
|
|
|
APP: "app",
|
|
@@ -33,25 +38,17 @@ export const $http = (url, method, data, json) => {
|
|
|
uni.hideLoading()
|
|
|
const res = response.data;
|
|
|
if (whiteCodes.indexOf(res.code) < 0) {
|
|
|
+ if (res.code === 1001) {
|
|
|
+ goLoginPage()
|
|
|
+ return {}
|
|
|
+ }
|
|
|
+
|
|
|
uni.showToast({
|
|
|
title: res.message || 'Error',
|
|
|
icon: 'none',
|
|
|
duration: 1500
|
|
|
})
|
|
|
|
|
|
- if (res.code === 1001 || res.code === 7777 || res.code === 8888) {
|
|
|
-
|
|
|
- // return response.data = await doRequest(response, url)//动态刷新token,并重新完成request请求
|
|
|
- // store.dispatch('user/resetToken').then(() => {
|
|
|
- // uni.navigateTo({
|
|
|
- // url: '/pages/login/indexs'
|
|
|
- // })
|
|
|
- // })
|
|
|
-
|
|
|
- // uni.navigateTo({
|
|
|
- // url: '/pages/login/indexs'
|
|
|
- // })
|
|
|
- }
|
|
|
return Promise.reject(new Error(res.message || 'Error'))
|
|
|
} else {
|
|
|
return res
|
|
@@ -129,4 +126,4 @@ export default {
|
|
|
post,
|
|
|
put,
|
|
|
del
|
|
|
-}
|
|
|
+}
|