bug
This commit is contained in:
parent
2427899247
commit
9ee9d2af52
@ -26,10 +26,10 @@
|
|||||||
width="50.82rpx" height="50.82rpx" @click='goBack'></u--image>
|
width="50.82rpx" height="50.82rpx" @click='goBack'></u--image>
|
||||||
<u--image v-else :showLoading="true" src="/static/images/LHYC/PFH.png" width="50.82rpx"
|
<u--image v-else :showLoading="true" src="/static/images/LHYC/PFH.png" width="50.82rpx"
|
||||||
height="50.82rpx" @click='goBack'></u--image> -->
|
height="50.82rpx" @click='goBack'></u--image> -->
|
||||||
<i class="iconfont icon-xiangzuo" v-if="cloudList.length>0"
|
<i class="iconfont icon-xiangzuo" v-if="cloudList.length>0"
|
||||||
style="font-size: 40rpx;text-align: left;" @click='goBack'></i>
|
style="font-size: 40rpx;text-align: left;" @click='goBack'></i>
|
||||||
<i class="iconfont icon-xiangzuo" v-else style="font-size: 40rpx;text-align: left;"
|
<i class="iconfont icon-xiangzuo" v-else style="font-size: 40rpx;text-align: left;"
|
||||||
@click='goBack'></i>
|
@click='goBack'></i>
|
||||||
|
|
||||||
<view class="head_tit" style="font-size: 36.8rpx;font-weight: 700;transform: skewX(-10deg);"
|
<view class="head_tit" style="font-size: 36.8rpx;font-weight: 700;transform: skewX(-10deg);"
|
||||||
:style="{color:cloudList.length>0?'':'black'}"
|
:style="{color:cloudList.length>0?'':'black'}"
|
||||||
@ -114,11 +114,11 @@
|
|||||||
<view style="align-items: center;display: flex;justify-content: space-between;">
|
<view style="align-items: center;display: flex;justify-content: space-between;">
|
||||||
<view class="" style="display: flex;align-items: center;">
|
<view class="" style="display: flex;align-items: center;">
|
||||||
<view class="back" style="margin-right: 17rpx;">
|
<view class="back" style="margin-right: 17rpx;">
|
||||||
<!-- <u--image :showLoading="true" src="/static/images/LHYC/FH.png" width="50.82rpx"
|
<!-- <u--image :showLoading="true" src="/static/images/LHYC/FH.png" width="50.82rpx"
|
||||||
height="50.82rpx" @click='goBack'></u--image> -->
|
height="50.82rpx" @click='goBack'></u--image> -->
|
||||||
|
|
||||||
<i class="iconfont icon-xiangzuo" style="font-size: 40rpx;text-align: left;"
|
<i class="iconfont icon-xiangzuo" style="font-size: 40rpx;text-align: left;"
|
||||||
@click='goBack'></i>
|
@click='goBack'></i>
|
||||||
</view>
|
</view>
|
||||||
<view class="" style="font-size: 40rpx;transform: skewX(-10deg);">
|
<view class="" style="font-size: 40rpx;transform: skewX(-10deg);">
|
||||||
供销综合云市场
|
供销综合云市场
|
||||||
|
137
utils/http.js
137
utils/http.js
@ -1,89 +1,94 @@
|
|||||||
import {
|
import {
|
||||||
HTTP_REQUEST_URL,
|
HTTP_REQUEST_URL,
|
||||||
HTTP_REQUEST_URL_TWO,
|
HTTP_REQUEST_URL_TWO,
|
||||||
HTTP_REQUEST_URL_THREE,
|
HTTP_REQUEST_URL_THREE,
|
||||||
HEADER,
|
HEADER,
|
||||||
TOKENNAME,
|
TOKENNAME,
|
||||||
} from '@/config/app';
|
} from '@/config/app';
|
||||||
import {
|
import {
|
||||||
checkLogin
|
checkLogin
|
||||||
} from '../libs/login';
|
} from '../libs/login';
|
||||||
import { Toast } from '../libs/uniApi';
|
import {
|
||||||
|
Toast
|
||||||
|
} from '../libs/uniApi';
|
||||||
import store from '../store';
|
import store from '../store';
|
||||||
|
|
||||||
function toLogin() {
|
function toLogin() {
|
||||||
store.commit("LOGOUT");
|
store.commit("LOGOUT");
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请登录',
|
title: '请登录',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function baseRequestTwo(url, method, data, {
|
function baseRequestTwo(url, method, data, {
|
||||||
noAuth = false,
|
noAuth = false,
|
||||||
noVerify = false
|
noVerify = false
|
||||||
}) {
|
}) {
|
||||||
let Url = HTTP_REQUEST_URL_TWO,
|
let Url = HTTP_REQUEST_URL_TWO,
|
||||||
header = HEADER;
|
header = HEADER;
|
||||||
|
|
||||||
if (!noAuth) {
|
if (!noAuth) {
|
||||||
//登录过期自动登录
|
//登录过期自动登录
|
||||||
if (!store.state.app.token && !checkLogin()) {
|
if (!store.state.app.token && !checkLogin()) {
|
||||||
toLogin();
|
toLogin();
|
||||||
return Promise.reject({
|
return Promise.reject({
|
||||||
msg: '未登录'
|
msg: '未登录'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
|
if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
|
||||||
|
|
||||||
return new Promise((reslove, reject) => {
|
return new Promise((reslove, reject) => {
|
||||||
uni.request({
|
uni.request({
|
||||||
url: Url + '/api' + url,
|
url: Url + '/api' + url,
|
||||||
method: method || 'GET',
|
method: method || 'GET',
|
||||||
header: header,
|
header: header,
|
||||||
data: data || {},
|
data: data || {},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// console.log('app', Url + '/api/' + url, res.data);
|
// console.log('app', Url + '/api/' + url, res.data);
|
||||||
// #endif
|
// #endif
|
||||||
if (noVerify)
|
if (noVerify)
|
||||||
// reslove(res.data, res);
|
// reslove(res.data, res);
|
||||||
reslove(res.data);
|
reslove(res.data);
|
||||||
else if (res.data.status == 200)
|
else if (res.data.status == 200)
|
||||||
reslove(res.data, res);
|
reslove(res.data, res);
|
||||||
else if (res.data.code == 1) {
|
else if (res.data.code == 1) {
|
||||||
reslove(res.data);
|
reslove(res.data);
|
||||||
} else if (res.data.code == 0) {
|
} else if (res.data.code == 0) {
|
||||||
reslove(res.data, res);
|
reslove(res.data, res);
|
||||||
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.status) !== -1) {
|
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.status) !== -1) {
|
||||||
toLogin();
|
toLogin();
|
||||||
reject(res.data);
|
reject(res.data);
|
||||||
} else if (res.data.status == 501) {
|
} else if (res.data.status == 501) {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: '/pages/error/index'
|
url: '/pages/error/index'
|
||||||
})
|
})
|
||||||
reject(res.data);
|
reject(res.data);
|
||||||
} else if (res.statusCode === 500)
|
} else if (res.statusCode === 500)
|
||||||
Toast("请检查网络")
|
Toast("请检查网络")
|
||||||
else
|
else
|
||||||
reject(res.data.message || '请检查网络');
|
reject(res.data.message || '请检查网络');
|
||||||
|
|
||||||
},
|
},
|
||||||
fail: (message) => {
|
fail: (message) => {
|
||||||
// console.log('message', message);
|
// console.log('message', message);
|
||||||
reject('请求失败');
|
reject('请求失败');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const http = {};
|
const http = {};
|
||||||
|
|
||||||
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
|
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
|
||||||
http[method] = (api, data, opt) => baseRequestTwo(api, method, data, opt || {})
|
http[method] = (api, data, opt) => baseRequestTwo(api, method, data, opt || {})
|
||||||
});
|
});
|
||||||
|
|
||||||
export default http;
|
export default http;
|
Loading…
x
Reference in New Issue
Block a user