Commit 123f0d71 by NGUYEN HOANG SON

implement init session parameter

parent 0e078919
......@@ -212,11 +212,17 @@
<script>
$(document).ready(function() {
$("#footer").load("main-footer.html", function() {
if (location.hash === '#dashboard') {
CHK_Footer.goDashboard();
} else if (location.hash === '#operationList') {
CHK_Footer.goOperationList();
} else {
if (CHK_DashboardSetting.isSettingEnabled(CHK_Dashboard.settingKey.dashboardHome)) {
CHK_Footer.goDashboard();
} else {
CHK_Footer.goOperationList();
}
}
});
});
</script>
......
......@@ -49,8 +49,9 @@ CHK_Footer.isIndexPage = function() {
return false;
}
CHK_Footer.goIndexPage = function() {
location.href = 'index.html';
CHK_Footer.goIndexPage = function(param) {
var href = 'index.html' + param;
location.href = href;
}
CHK_Footer.activeDashboardBottomNav = function() {
......@@ -64,7 +65,7 @@ CHK_Footer.goDashboard = function() {
CHK_Footer.showPage('dashboard');
return;
}
CHK_Footer.goIndexPage();
CHK_Footer.goIndexPage('#dashboard');
}
CHK_Footer.goOperationList = function() {
......@@ -74,4 +75,5 @@ CHK_Footer.goOperationList = function() {
CHK_Footer.showPage('operationList');
return;
}
CHK_Footer.goIndexPage('#operationList');
}
\ No newline at end of file
......@@ -313,6 +313,48 @@ CHK.hasAddTaskAuthority = function() {
});
};
CHK.sessionKeys = [
'reportType', 'isCms', 'isWeb', 'isWindows', 'isAndroid', 'isIOS', 'isRFIDBarcodeScan', 'isOperationGroupMaster',
'lang', 'debug', 'isMobile',
];
CHK.loadSessionData = function() {
if (typeof sessionStorage.CHK === 'undefined') {
return {};
}
let sessionData = JSON.parse(sessionStorage.CHK);
if (typeof sessionData !== 'object') {
return {};
}
return sessionData;
}
CHK.loadSessionKey = function(key) {
let sessionData = CHK.loadSessionData();
if (typeof sessionData[key] !== 'undefined' && typeof CHK[key] === 'undefined') {
CHK[key] = sessionData[key];
}
}
CHK.loadInitSession = function() {
let sessionData = CHK.loadSessionData();
CHK.sessionKeys.forEach(function(key) {
if (typeof sessionData[key] !== 'undefined' && typeof CHK[key] === 'undefined') {
CHK[key] = sessionData[key];
}
});
}
CHK.saveInitSession = function() {
var sessionData = {};
CHK.sessionKeys.forEach(function(key) {
if (typeof CHK[key] !== 'undefined') {
sessionData[key] = CHK[key];
}
});
sessionStorage.CHK = JSON.stringify(sessionData);
}
// 共通初期処理
CHK.initCommon = function() {
//JSON初期化
......@@ -333,6 +375,14 @@ CHK.initCommon = function() {
CHK.isOperationGroupMaster = urlParam.isOperationGroupMaster && urlParam.isOperationGroupMaster == "1";
if (typeof CHK.sortIndex == 'undefined') CHK.sortIndex = urlParam.sortIndex;
CHK.lang = urlParam.lang;
CHK.debug = urlParam.debug;
CHK.isMobile = urlParam.mobile_flg && urlParam.mobile_flg == "1";
CHK.loadInitSession();
if (typeof location.pathname === 'string' && location.pathname.includes('index.html') == true) {
//save url parameter of top page
CHK.saveInitSession();
}
// ウェブの場合、作業一覧の表示広さを変更
if (CHK.isWeb) {
......@@ -351,8 +401,6 @@ CHK.initCommon = function() {
$("#operationGroupMasterButton").removeClass("d-none");
}
CHK.debug = urlParam.debug;
CHK.isMobile = urlParam.mobile_flg && urlParam.mobile_flg == "1";
if (CHK.isCms) {
CHK.setBeforeunload();
}
......@@ -2036,7 +2084,7 @@ CHK.generateUuid = function() {
*
*/
CHK.getUrlParameter = function() {
var ret;
var ret = {};
if (location.search) {
var param = {};
location.search.substring(1).split('&').forEach(function(val) {
......@@ -3288,9 +3336,13 @@ CHK.openCategory = function() {
$(document).ready(function () {
var urlParam = CHK.getUrlParameter();
CHK.lang = 'ja';
if (typeof urlParam !== 'undefined' && typeof urlParam.lang !== 'undefined') {
CHK.lang = urlParam.lang;
} else {
CHK.loadSessionKey('lang');
}
if (typeof CHK.lang === 'undefined') {
CHK.lang = 'ja';
}
console.log("CHK.lang:" + CHK.lang);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment