优化代码

This commit is contained in:
java110 2020-12-01 09:21:23 +08:00
parent 3b0d0e9310
commit 15bfd8476d
2 changed files with 27 additions and 1 deletions

View File

@ -32,6 +32,10 @@
},
_initMethod: function () {
if (!vc.isBack()) {
return;
}
//检查是否有缓存数据
let _tempData = vc.getData(TEMP_SEARCH);

View File

@ -1247,6 +1247,10 @@
vcFramework.saveData = function (_key, _value) {
window.localStorage.setItem(_key, JSON.stringify(_value));
};
//保存用户菜单
vcFramework.removeData = function (_key) {
Object.keys(localStorage).forEach(item => item.indexOf(_key) !== -1 ? localStorage.removeItem(item) : '');
};
//获取用户菜单
vcFramework.getData = function (_key) {
return JSON.parse(window.localStorage.getItem(_key));
@ -1348,12 +1352,30 @@
let urlParameters = location.pathname;
return urlParameters;
};
vcFramework.isBack = function () {
let _back = vc.getData("JAVA110_IS_BACK");
if (_back == null) {
return false;
}
vc.removeData("JAVA110_IS_BACK");
let beforeTime = _back;
let _date = new Date();
if (_date.getTime() - beforeTime < 10 * 1000) {
return true;
}
return false;
};
vcFramework.getBack = function () {
//window.location.href = document.referrer;
let _date = new Date();
vc.saveData("JAVA110_IS_BACK", _date.getTime());
window.history.back(-1);
}
vcFramework.goBack = function () {
//window.location.href = document.referrer;
let _date = new Date();
vc.saveData("JAVA110_IS_BACK", _date.getTime());
window.history.back(-1);
}
//对象转get参数
@ -1598,7 +1620,7 @@
_callBack(value);
});
}
// vcFramework.initDateDay = function (_dateStr, _callBack) {
// $('.' + _dateStr).datetimepicker({
// language: 'zh-CN',