Merge branch 'dev1.0.0' into develop

msb_beta
ch 3 years ago
commit 61a94dc2fc

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 16:36:59 * @Date: 2022-03-17 16:36:59
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-04-20 10:41:17 * @LastEditTime: 2022-04-20 11:57:58
* @Description: 针对uniapp request请求做了一次封装使用思维参考axios * @Description: 针对uniapp request请求做了一次封装使用思维参考axios
* *
* *
@ -59,9 +59,10 @@ class MsbUniRequest {
method(option){ method(option){
option.header = {...this.header,...option.header}; option.header = {...this.header,...option.header};
option.url = this.baseUrl + option.url; option.url = this.baseUrl + option.url;
if(this.hook.request && !option.header){ if(this.hook.request){
option = this.hook.request(option); option = this.hook.request(option);
} };
if(!option){ if(!option){
throw new Error('没有请求配置或是request拦截未做return'); throw new Error('没有请求配置或是request拦截未做return');
} }
@ -69,6 +70,7 @@ class MsbUniRequest {
return option return option
} }
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
console.log(option);
uni.request({ uni.request({
...option, ...option,
success: res => { success: res => {

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 17:42:32 * @Date: 2022-03-17 17:42:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-04-20 11:03:08 * @LastEditTime: 2022-04-20 11:52:43
* @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法 * @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法
*/ */
@ -11,8 +11,8 @@ import $store from '@/common/store';
const ENV = 'test'; const ENV = 'test';
const BASE_URL = { const BASE_URL = {
'test' : 'http://k8s-horse-gateway.mashibing.cn', // 'test' : 'http://k8s-horse-gateway.mashibing.cn',
// 'test' : '', 'test' : '',
'release' : '', 'release' : '',
'prod' : '' 'prod' : ''
}; };
@ -102,7 +102,7 @@ MsbRequestTk.use('request', (option) => {
page.$Router.replace('/login'); page.$Router.replace('/login');
return Promise.reject({message:'要先登录才能操作哦~'}); return Promise.reject({message:'要先登录才能操作哦~'});
}else{ }else{
option.header = {...option.header, Authorization:$store.state.token}; option.header = {...option.header, Authorization:token};
if(option.header.repeat){ if(option.header.repeat){
// 如果当前请求不允许重复调用,则检查重复请求,当前接口有正在请求则不发起请求 // 如果当前请求不允许重复调用,则检查重复请求,当前接口有正在请求则不发起请求
@ -111,6 +111,7 @@ MsbRequestTk.use('request', (option) => {
return isRepeatVerify; return isRepeatVerify;
} }
} }
console.log(option);
return option; return option;
} }
}) })

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>马士兵严选</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>马士兵严选</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.a5c69d49.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.b5602bf5.js></script><script src=/static/js/index.70f3e4b8.js></script></body></html> document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.a5c69d49.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.b5602bf5.js></script><script src=/static/js/index.f2ba7ba9.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save