16
This commit is contained in:
@@ -52,6 +52,8 @@ const app = new Vue({
|
|||||||
store,
|
store,
|
||||||
...App,
|
...App,
|
||||||
});
|
});
|
||||||
|
app.REQUEST_TRACE = process.env.NODE_ENV == 'development';
|
||||||
|
app.REQUEST_TRACE = false;
|
||||||
|
|
||||||
// 引入请求封装
|
// 引入请求封装
|
||||||
import request from "./util/request/index";
|
import request from "./util/request/index";
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export default {
|
|||||||
const _this = this;
|
const _this = this;
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
plus.runtime.getProperty(plus.runtime.appid, (inf) => {
|
plus.runtime.getProperty(plus.runtime.appid, (inf) => {
|
||||||
console.log(inf);
|
//console.log(inf);
|
||||||
_this.appversion = inf.version
|
_this.appversion = inf.version
|
||||||
});
|
});
|
||||||
// if(options.isRedirect){
|
// if(options.isRedirect){
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
module.exports = (vm) => {
|
module.exports = (vm) => {
|
||||||
uni.$u.http.interceptors.response.use((response) => {
|
uni.$u.http.interceptors.response.use((response) => {
|
||||||
|
if(vm.REQUEST_TRACE){
|
||||||
console.log("\n-"
|
console.log("\n-"
|
||||||
+"\n============================================================="
|
+"\n============================================================="
|
||||||
+"\nurl:"+response.config.fullPath
|
+"\nurl:"+response.config.fullPath
|
||||||
@@ -12,6 +13,7 @@ module.exports = (vm) => {
|
|||||||
+"\nheader:"+JSON.stringify(response.config.header)
|
+"\nheader:"+JSON.stringify(response.config.header)
|
||||||
+"\nresponse:"+JSON.stringify(response.data)
|
+"\nresponse:"+JSON.stringify(response.data)
|
||||||
+"\n=============================================================\n");
|
+"\n=============================================================\n");
|
||||||
|
}
|
||||||
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
/* 对响应成功做点什么 可使用async await 做异步操作*/
|
||||||
const data = response.data;
|
const data = response.data;
|
||||||
// 自定义参数
|
// 自定义参数
|
||||||
@@ -39,6 +41,5 @@ module.exports = (vm) => {
|
|||||||
(response) => {
|
(response) => {
|
||||||
/* 对响应错误做点什么 (statusCode !== 200)*/
|
/* 对响应错误做点什么 (statusCode !== 200)*/
|
||||||
return Promise.reject(response);
|
return Promise.reject(response);
|
||||||
},
|
});
|
||||||
);
|
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user