From b3f85b60ba9e39572e686009d36b5e5d7e81e910 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期四, 11 七月 2019 20:30:10 +0800
Subject: [PATCH] 合并远程信息
---
WebService/src/main/resources/static/js/core.js | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/WebService/src/main/resources/static/js/core.js b/WebService/src/main/resources/static/js/core.js
index 8025d01..0c40761 100644
--- a/WebService/src/main/resources/static/js/core.js
+++ b/WebService/src/main/resources/static/js/core.js
@@ -69,10 +69,23 @@
});
},
get:function(componentCode,componentMethod,param,successCallback,errorCallback){
+ //鍔犲叆缂撳瓨鏈哄埗
+ var _getPath = '/'+componentCode +'/' +componentMethod;
+ if(vc.constant.GET_CACHE_URL.includes(_getPath)){
+ var _cacheData = vc.getData(_getPath);
+ //娴忚鍣ㄧ紦瀛樹腑鑳借幏鍙栧埌
+ if(_cacheData != null && _cacheData != undefined){
+ successCallback(JSON.stringify(_cacheData),{status:200});
+ return ;
+ }
+ }
vc.loading('open');
Vue.http.get('/callComponent/'+componentCode +"/"+componentMethod, param)
.then(function(res){
successCallback(res.bodyText,res);
+ if(vc.constant.GET_CACHE_URL.includes(_getPath) && res.status == 200){
+ vc.saveData(_getPath,JSON.parse(res.bodyText));
+ }
vc.loading('close');
}, function(error){
errorCallback(error.bodyText,error);
@@ -146,6 +159,15 @@
return JSON.parse(window.localStorage.getItem('hc_menus'));
};
+ //淇濆瓨鐢ㄦ埛鑿滃崟
+ vc.saveData = function(_key,_value){
+ window.localStorage.setItem(_key,JSON.stringify(_value));
+ };
+ //鑾峰彇鐢ㄦ埛鑿滃崟
+ vc.getData = function(_key){
+ return JSON.parse(window.localStorage.getItem(_key));
+ };
+
//淇濆瓨褰撳墠灏忓尯淇℃伅 _communityInfo : {"communityId":"123213","name":"娴嬭瘯灏忓尯"}
vc.setCurrentCommunity = function(_currentCommunityInfo){
window.localStorage.setItem('hc_currentCommunityInfo',JSON.stringify(_currentCommunityInfo));
@@ -203,6 +225,12 @@
return "";
};
+ //鏌ヨurl
+ vc.getUrl = function(){
+ //杩斿洖褰撳墠 URL 鐨勬煡璇㈤儴鍒嗭紙闂彿 ? 涔嬪悗鐨勯儴鍒嗭級銆�
+ var urlParameters = location.pathname;
+ return urlParameters;
+ };
//瀵硅薄杞琯et鍙傛暟
vc.objToGetParam =function(obj){
var str = [];
--
Gitblit v1.8.0