剩余模块:生产退料
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import env from './env';
|
||||
// import uniChat from "./uniChat";
|
||||
export default function requst(url : string, type : string, params : any, header : object = {}) {
|
||||
export default function requst(url : string, type : string, params : any, header : object = {}, noMsg:boolean = true) {
|
||||
// #ifndef APP-PLUS
|
||||
uni.showLoading({
|
||||
mask: true
|
||||
@@ -10,6 +10,7 @@ export default function requst(url : string, type : string, params : any, header
|
||||
plus.nativeUI.showWaiting();
|
||||
// #endif
|
||||
console.log('检查URL' + env.API_URL + url,)
|
||||
console.log('检查TOKEN' + 'Bearer '+ uni.getStorageSync('TOKEN'),)
|
||||
console.log(params);
|
||||
var apiHeader = ''
|
||||
var headerObj = {}
|
||||
@@ -37,10 +38,8 @@ export default function requst(url : string, type : string, params : any, header
|
||||
console.log(result);
|
||||
let res = result.data;
|
||||
if (res.code === 200) {
|
||||
console.log('请求成功')
|
||||
resolve(res);
|
||||
} else if (res.code == 401) {
|
||||
console.log('请求失败')
|
||||
// #ifdef APP-PLUS
|
||||
plus.nativeUI.toast('登录状态失效,请重新登录');
|
||||
// #endif
|
||||
@@ -56,13 +55,15 @@ export default function requst(url : string, type : string, params : any, header
|
||||
// tools.jumpTo('/pages/client/account/login', {}, 0)
|
||||
resolve(res)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
title: res.msg
|
||||
if(!noMsg){
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
title: res.msg
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
resolve(res)
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user