From ea4e931b3e06e4abcd31d74de9e90fa0a8998f3a Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期三, 02 十月 2019 23:50:53 +0800
Subject: [PATCH] 业主报修功能开发完成
---
WebService/src/main/resources/static/js/core.js | 66 ++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 1 deletions(-)
diff --git a/WebService/src/main/resources/static/js/core.js b/WebService/src/main/resources/static/js/core.js
index 8025d01..b95230a 100644
--- a/WebService/src/main/resources/static/js/core.js
+++ b/WebService/src/main/resources/static/js/core.js
@@ -69,8 +69,32 @@
});
},
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);
+ vc.loading('close');
+ });
+ },
+ upload:function(componentCode,componentMethod,param,options,successCallback,errorCallback){
+ vc.loading('open');
+ Vue.http.post('/callComponent/upload/'+componentCode +"/"+componentMethod, param, options)
.then(function(res){
successCallback(res.bodyText,res);
vc.loading('close');
@@ -78,7 +102,7 @@
errorCallback(error.bodyText,error);
vc.loading('close');
});
- }
+ },
};
@@ -146,6 +170,24 @@
return JSON.parse(window.localStorage.getItem('hc_menus'));
};
+ //淇濆瓨鑿滃崟鐘舵��
+ vc.setMenuState = function(_menuState){
+ window.localStorage.setItem('hc_menu_state',_menuState);
+ };
+ //鑾峰彇鑿滃崟鐘舵��
+ vc.getMenuState = function(){
+ return window.localStorage.getItem('hc_menu_state');
+ };
+
+ //淇濆瓨鐢ㄦ埛鑿滃崟
+ 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));
@@ -182,6 +224,14 @@
}
}
};
+ //鎵╁睍 鐜版湁鐨勫璞� 娌℃湁鐨勫睘鎬ф墿鍏呬笂鍘�
+ vc.extendObject = function(org,dst){
+ for(var key in dst){
+ if (!org.hasOwnProperty(key)){
+ dst[key] = org[key]
+ }
+ }
+ };
//鑾峰彇url鍙傛暟
vc.getParam = function(_key){
//杩斿洖褰撳墠 URL 鐨勬煡璇㈤儴鍒嗭紙闂彿 ? 涔嬪悗鐨勯儴鍒嗭級銆�
@@ -203,6 +253,12 @@
return "";
};
+ //鏌ヨurl
+ vc.getUrl = function(){
+ //杩斿洖褰撳墠 URL 鐨勬煡璇㈤儴鍒嗭紙闂彿 ? 涔嬪悗鐨勯儴鍒嗭級銆�
+ var urlParameters = location.pathname;
+ return urlParameters;
+ };
//瀵硅薄杞琯et鍙傛暟
vc.objToGetParam =function(obj){
var str = [];
@@ -211,6 +267,13 @@
str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
}
return str.join("&");
+ }
+ //绌哄垽鏂� true 涓洪潪绌� false 涓虹┖
+ vc.notNull = function(_paramObj){
+ if(_paramObj == null || _paramObj == undefined || _paramObj.trim() == ''){
+ return false;
+ }
+ return true;
}
@@ -255,6 +318,7 @@
var s = time.getSeconds();
return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
}
+
})(window.vc);
--
Gitblit v1.8.0