|
|
@@ -112,11 +112,6 @@ class Request {
|
|
|
if (response.config.config.loading) {
|
|
|
uni.hideLoading()
|
|
|
}
|
|
|
- // const client_hash = response.header.client_hash || null
|
|
|
- // console.log('X-Client-Hash', response.header['X-Client-Hash'])
|
|
|
- // if (client_hash) {
|
|
|
- // uni.setStorageSync('client_hash', client_hash)
|
|
|
- // }
|
|
|
return response
|
|
|
}
|
|
|
|
|
|
@@ -137,11 +132,6 @@ class Request {
|
|
|
options.complete = (response) => {
|
|
|
const statusCode = response.statusCode
|
|
|
response.config = _config
|
|
|
- // if(config.method === 'get') {
|
|
|
- // response.config.config = config
|
|
|
- // }else if(config.method === 'post'){
|
|
|
- // response.config.config.config = config
|
|
|
- // }
|
|
|
response.config.config = config
|
|
|
response = this.requestComFun(response)
|
|
|
// 全局忽略错误,在单个请求里面自行处理
|
|
|
@@ -159,29 +149,15 @@ class Request {
|
|
|
}
|
|
|
reject(response.data)
|
|
|
} else if (response.data.code && response.data.code == -1) {
|
|
|
- // 无权限或者登录过期
|
|
|
- // uni.removeStorageSync('token')
|
|
|
- // uni.showToast({ title: '登录已失效...', icon: 'none', mask: true })
|
|
|
- // setTimeout(() => {
|
|
|
- // getCheckLogin()
|
|
|
- // }, 1000)
|
|
|
+
|
|
|
} else if (response.data.code == 2) {
|
|
|
uni.removeStorageSync('token')
|
|
|
uni.removeStorageSync('shopUser')
|
|
|
uni.removeStorageSync('account')
|
|
|
uni.showToast({ title: '登录已失效..', icon: 'none', mask: true })
|
|
|
- setTimeout(() => {
|
|
|
- //getCheckLogin()
|
|
|
- }, 1000)
|
|
|
} else {
|
|
|
- console.log('response.data', response.data)
|
|
|
if (!config.hideError) {
|
|
|
- // this.$msg(response.data.msg)
|
|
|
- uni.showToast({
|
|
|
- title: response.data.msg,
|
|
|
- icon: 'none',
|
|
|
- mask: true
|
|
|
- })
|
|
|
+ uni.showToast({ title: response.data.msg, icon: 'none', mask: true })
|
|
|
}
|
|
|
reject(response.data)
|
|
|
}
|
|
|
@@ -206,7 +182,6 @@ class Request {
|
|
|
}
|
|
|
|
|
|
get(url, data = {}, options = {}, config = {}) {
|
|
|
- // options.url = url + common.queryData(data, true)
|
|
|
options.url = url + parse(data)
|
|
|
options.data = {}
|
|
|
options.method = 'GET'
|