11
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import NO_TOKEN from './noToken';
|
||||
import env from './env';
|
||||
import tools from '../../tools/index';
|
||||
// import uniChat from "./uniChat";
|
||||
export default function requst(url : string, type : string, params : any, header : object = {}) {
|
||||
// #ifndef APP-PLUS
|
||||
@@ -12,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(params);
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: env.API_URL + url,
|
||||
@@ -22,6 +21,7 @@ export default function requst(url : string, type : string, params : any, header
|
||||
},
|
||||
timeout: 5000,
|
||||
success(result : any) {
|
||||
console.log(result);
|
||||
let res = result.data;
|
||||
if (res.code === 200) {
|
||||
console.log('请求成功')
|
||||
@@ -41,7 +41,7 @@ export default function requst(url : string, type : string, params : any, header
|
||||
// uni.removeStorageSync('userInfo');
|
||||
// uni.clearStorage();
|
||||
// tools.jumpTo('/pages/client/account/login', {}, 0)
|
||||
reject(res)
|
||||
resolve(res)
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.showToast({
|
||||
@@ -50,10 +50,11 @@ export default function requst(url : string, type : string, params : any, header
|
||||
title: res.msg
|
||||
})
|
||||
})
|
||||
reject(res)
|
||||
resolve(res)
|
||||
}
|
||||
},
|
||||
fail(error : any) {
|
||||
console.log(error);
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
|
||||
Reference in New Issue
Block a user