扫描二维码
This commit is contained in:
67
utils/api.js
67
utils/api.js
@@ -1,7 +1,8 @@
|
||||
//testURL
|
||||
// const BASE_URL = 'https://lmqhznn.goho.co';
|
||||
const BASE_URL = 'https://lmqhznn.goho.co';
|
||||
// const BASE_URL = 'http://120.27.209.4:8093';
|
||||
//prodURL
|
||||
const BASE_URL = 'https://api.hongyutiyu.top';
|
||||
// const BASE_URL = 'https://api.hongyutiyu.top';
|
||||
// const platformId = 1;
|
||||
import {
|
||||
getCurrentPageUrl
|
||||
@@ -74,7 +75,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
} else if (res.err_code == 20005) {
|
||||
wx.removeStorageSync('accessToken');
|
||||
wx.removeStorageSync('history');
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: res.err_msg,
|
||||
icon: 'none',
|
||||
@@ -82,7 +85,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
})
|
||||
reject(res);
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: res.err_msg,
|
||||
icon: 'none',
|
||||
@@ -92,7 +97,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none',
|
||||
@@ -102,7 +109,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
},
|
||||
fail: function(err) {
|
||||
console.log(err);
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none',
|
||||
@@ -125,7 +134,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
success: function(res) {
|
||||
console.log("POST返回数据", url,res);
|
||||
if (res.data.err_code == 0) {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
resolve(res.data);
|
||||
} else {
|
||||
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
||||
@@ -141,7 +152,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
} else if (res.data.err_code == 20005) {
|
||||
wx.removeStorageSync('accessToken');
|
||||
wx.removeStorageSync('history');
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@@ -149,7 +162,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
})
|
||||
reject(res);
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@@ -161,7 +176,9 @@ export function fetchPost(url, params, needToken, multiple) {
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
icon: 'none',
|
||||
@@ -194,7 +211,9 @@ export function fetchGet(url, params, needToken) {
|
||||
console.log("GET返回数据", url, res);
|
||||
if (res.statusCode == 200) {
|
||||
if (res.data.err_code == 0) {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
resolve(res.data);
|
||||
} else {
|
||||
if (res.data.err_code == 10003 || res.data.err_code == 10006 || res.data.err_code == 20006) {
|
||||
@@ -204,7 +223,9 @@ export function fetchGet(url, params, needToken) {
|
||||
} else if (res.data.err_code == 20005) {
|
||||
wx.removeStorageSync('accessToken');
|
||||
wx.removeStorageSync('history');
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@@ -212,7 +233,9 @@ export function fetchGet(url, params, needToken) {
|
||||
})
|
||||
reject(res);
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
wx.showToast({
|
||||
title: res.data.err_msg,
|
||||
icon: 'none',
|
||||
@@ -222,7 +245,9 @@ export function fetchGet(url, params, needToken) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
reject(res)
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
@@ -232,7 +257,9 @@ export function fetchGet(url, params, needToken) {
|
||||
}
|
||||
},
|
||||
fail: function(res) {
|
||||
wx.hideLoading();
|
||||
wx.hideLoading({
|
||||
complete: (complete) => {}
|
||||
},1000);
|
||||
reject(res)
|
||||
wx.showToast({
|
||||
title: '网络错误',
|
||||
@@ -431,5 +458,15 @@ export default {
|
||||
// 已用手机号登录,支付,再跳转微信登录
|
||||
memberLoginCheckWx(params) {
|
||||
return fetchPost('/member/login/checkWx', params, true);
|
||||
},
|
||||
// 初始化扫描进场逻辑
|
||||
scanCodeInitVenue(params) {
|
||||
return fetchGet('/qrCode/init',params,true);
|
||||
},
|
||||
|
||||
// 用户发起开门逻辑
|
||||
enterVenue(params) {
|
||||
return fetchGet('/qrCode/enter',params,true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user