Browse Source

update static/js/request.js.

Signed-off-by: 陈凯楠 <1403191743@qq.com>
dev
陈凯楠 7 months ago
committed by Gitee
parent
commit
4945246eaf
No known key found for this signature in database GPG Key ID: 173E9B9CA92EEF8F
  1. 5
      static/js/request.js

5
static/js/request.js

@ -20,7 +20,6 @@ const getToken = () => {
// 定义错误处理函数 // 定义错误处理函数
const handleError = (res, reject) => { const handleError = (res, reject) => {
uni.hideLoading();
setTimeout(() => { setTimeout(() => {
uni.showToast({ uni.showToast({
title: res.data?.msg || res.msg, title: res.data?.msg || res.msg,
@ -58,7 +57,8 @@ Vue.prototype.Post = (params = {}, apiurl) => {
}, },
success: (res) => { success: (res) => {
console.log('success', res.data); console.log('success', res.data);
if (res.data.code === 200) { uni.hideLoading()
if (res.data.code === 200 || res.data.code === 1) {
resolve(res.data); resolve(res.data);
} else { } else {
handleError(res, reject); handleError(res, reject);
@ -66,6 +66,7 @@ Vue.prototype.Post = (params = {}, apiurl) => {
}, },
fail: (err) => { fail: (err) => {
console.log('err', err); console.log('err', err);
uni.hideLoading()
handleError(err, reject); handleError(err, reject);
} }
}); });

Loading…
Cancel
Save