From e97cbd81486e8737d66855faa8be109bd114c022 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: Wed, 24 Jul 2024 17:30:46 +0800
Subject: [PATCH] 提交
---
common/request.js | 17 ++++++++---------
1 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/common/request.js b/common/request.js
index 61413b2..c960dcc 100644
--- a/common/request.js
+++ b/common/request.js
@@ -3,32 +3,31 @@
let server_url = VUE_APP_BASE_URL;
let token = uni.getStorageSync('tk');
export function service(options = {}) {
- console.log(("option",options))
options.url = `${server_url}${options.url}`;
//配置请求头
if(uni.getStorageSync('tk')){
options.header = {
'Content-type': options.header || 'application/json',
- 'tk':uni.getStorageSync('tk'),
- 'uid': uni.getStorageSync('uid')
+ 'Authorization':uni.getStorageSync('tk'),
+ // 'uid': uni.getStorageSync('uid')
};
}
else {
options.header = {
- 'Content-type': options.header || 'application/json'
+ 'Content-type': options.header || 'application/json',
+ 'Authorization': ''
};
}
return new Promise((resolved, rejected) => {
//成功
options.success = (res) => {
- console.log("ressssss",res)
// if (Number(res.data.code) == 100) {
- if(Number(res.data.code) == 405){
+ if(Number(res.data.code) == 403 || Number(res.data.code) == 401){
uni.showToast({
icon: 'none',
duration: 2000,
position: 'top',
- title: `${res.data.msg}`
+ title: `${res.data.message}`
});
rejected(res.data.msg);
setTimeout(()=>{
@@ -38,14 +37,14 @@
url: '/pages/index/index'
})
},2000)
- }else if(Number(res.data.code) == 100){
+ }else if(Number(res.data.code) == 200){
if(res.data.msg == '您点击太快了,请稍后尝试'){
uni.showToast({
icon: 'none',
duration: 2000,
position: 'top',
- title: `${res.data.msg}`
+ title: `${res.data.message}`
});
}
}
--
Gitblit v1.9.2