|
@@ -3,7 +3,9 @@ const install = (Vue, vm) => {
|
|
Vue.prototype.$u.http.setConfig({
|
|
Vue.prototype.$u.http.setConfig({
|
|
baseUrl: vm.config.baseUrl,
|
|
baseUrl: vm.config.baseUrl,
|
|
loadingText: '努力加载中~',
|
|
loadingText: '努力加载中~',
|
|
- loadingTime: 800
|
|
|
|
|
|
+ loadingTime: 800,
|
|
|
|
+ originalData: true,
|
|
|
|
+ dataType: 'text'
|
|
});
|
|
});
|
|
// 请求拦截,配置Token等参数
|
|
// 请求拦截,配置Token等参数
|
|
Vue.prototype.$u.http.interceptor.request = (config) => {
|
|
Vue.prototype.$u.http.interceptor.request = (config) => {
|
|
@@ -25,9 +27,12 @@ const install = (Vue, vm) => {
|
|
};
|
|
};
|
|
// 响应拦截,判断状态码是否通过
|
|
// 响应拦截,判断状态码是否通过
|
|
Vue.prototype.$u.http.interceptor.response = (res) => {
|
|
Vue.prototype.$u.http.interceptor.response = (res) => {
|
|
|
|
+ // 解决出现数据精度缺失问题
|
|
|
|
+ const jsonBigint = require('json-bigint')({ storeAsString: true });
|
|
|
|
+ res = jsonBigint.parse(res.data);
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
return res;
|
|
return res;
|
|
- } else if (res.code == 401 || (res.code == 400 && res.msg == '令牌不能为空') ) {
|
|
|
|
|
|
+ } else if (res.code == 401 || (res.code == 400 && res.msg == '令牌不能为空')) {
|
|
const backUrl = location.href,
|
|
const backUrl = location.href,
|
|
openidPage = vm.config.onlyWxLogin, // 只需要传openid的页面集合
|
|
openidPage = vm.config.onlyWxLogin, // 只需要传openid的页面集合
|
|
needValidPage = openidPage.filter((item) => backUrl.indexOf(item) > -1); // 是否为需要验证的页面集合
|
|
needValidPage = openidPage.filter((item) => backUrl.indexOf(item) > -1); // 是否为需要验证的页面集合
|