This commit is contained in:
cansnow
2025-12-17 09:13:15 +08:00
parent 2e793c3f77
commit 59d1ba9a7e
3 changed files with 40 additions and 37 deletions
+2
View File
@@ -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";
+1 -1
View File
@@ -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){
+3 -2
View File
@@ -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);
},
);
});
};