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