From a3a48da30bdea132d2bfbb47fa2ccf83f1937c45 Mon Sep 17 00:00:00 2001 From: queenwuli <942534046@qq.com> Date: Tue, 19 Jan 2021 08:29:55 +0800 Subject: [PATCH] 提交 --- hive-app/common/jssdk/httpUtils.js | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-) diff --git a/hive-app/common/jssdk/httpUtils.js b/hive-app/common/jssdk/httpUtils.js index 24b9cf5..d142275 100644 --- a/hive-app/common/jssdk/httpUtils.js +++ b/hive-app/common/jssdk/httpUtils.js @@ -9,7 +9,7 @@ baseUrl: '/api', // #endif // #ifndef H5 - baseUrl: 'http://120.27.238.55:8801', + baseUrl: 'http://test.hive.jyymatrix.cc', // #endif handleToken(url){ let token = StorageUtil.getStorage('userInfo','token'); @@ -22,13 +22,19 @@ let timeStamp = new Date().getTime(); return encrypt.encrypt(token + '_' + timeStamp + '_' + url); }, - request (url, data = {}, method = 'GET', extraObj = {}) { + request (url, data = {}, method = 'GET', extraObj = {isShowLoad: false}) { let header = { 'Authorization': 'Bearer ' + this.handleToken(url), 'lang': 'zh_CN', 'content-type': 'application/json; charset=utf-8' } return new Promise((resolve, reject) => { + if(extraObj.isShowLoad){ + uni.showLoading({ + mask: true, + title: '加载中' + }) + } uni.request({ url: this.baseUrl + url, method, @@ -46,7 +52,7 @@ success: (res) => { reject(result); uni.navigateTo({ - url: '/pages/login/index' + url: '/pages/login/index?isNotLogin=1' }) }, fail() { @@ -57,8 +63,10 @@ } }); } + extraObj.isShowLoad && uni.hideLoading() }, fail: (error) => { + extraObj.isShowLoad && uni.hideLoading() reject(error); } }); @@ -66,6 +74,15 @@ }, isNotLogin(err) { return !err || !err.status || err.status == 700014; + }, + getRoleInfo(){ + return StorageUtil.getStorage('userInfo','roleInfo') + }, + getToken(){ + return StorageUtil.getStorage('userInfo','token') + }, + getUserFunction(){ + return StorageUtil.getStorage('userInfo','userFunction') } } export default httpUtils; \ No newline at end of file -- Gitblit v1.9.1