From 6e54af776db885ad1a22ec582bdc97d7e1273c6c Mon Sep 17 00:00:00 2001
From: queenwuli <942534046@qq.com>
Date: Wed, 13 Jan 2021 17:31:30 +0800
Subject: [PATCH] 系统优化

---
 hive-app/common/jssdk/httpUtils.js |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/hive-app/common/jssdk/httpUtils.js b/hive-app/common/jssdk/httpUtils.js
index 17af48d..124b6f1 100644
--- a/hive-app/common/jssdk/httpUtils.js
+++ b/hive-app/common/jssdk/httpUtils.js
@@ -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);
 				}
 			});
@@ -69,6 +77,12 @@
 	},
 	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