Commit fa9227de by Takatoshi Miura

1.4.0_miura_iOSの作業一覧対応(Json連動)

parent 58e6e236
......@@ -14,6 +14,7 @@
<script src="js/jquery-1.11.2.min.js?__UPDATEID__"></script>
<script src="script/check.js?__UPDATEID__"></script>
<script src="script/check-list.js?__UPDATEID__"></script>
<script src="script/check-foriOS.js"></script>
</head>
<body onload="CHK_L.init();">
......
......@@ -19,9 +19,31 @@ function callNativeApp(iosKey, jsonData) {
return result;
}
// CHK_iOS.getBeforeRoomType = function () {
// return callNativeApp(NATIVE_KEY_IOS.getBeforeRoomType, {});
// };
CHK_iOS.getCachePath = function () {
return callNativeApp(NATIVE_KEY_IOS.getCachePath, {});
};
CHK_iOS.getOperationListJson = function () {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getOperationListJson, {})
);
};
CHK_iOS.getOperationGroupMasterListJson = function () {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getOperationGroupMasterListJson, {})
);
};
CHK_iOS.getOperationGroupMasterRelationListJson = function () {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getOperationGroupMasterRelationListJson, {})
);
};
CHK_iOS.getPushMessageListJson = function () {
return JSON.parse(
callNativeApp(NATIVE_KEY_IOS.getPushMessageListJson, {})
);
};
\ No newline at end of file
......@@ -5,6 +5,7 @@ CHK.operationType; //プロジェクトタイプ 0:リストコンテン
CHK.isCms = false; //true:CMSモード
CHK.isWeb = false; //true:Web表示モード
CHK.isAndroid = false;
CHK.isIOS = false;
CHK.reportMode = "1"; //報告モード default1で、定期点検で変更される
CHK.debug; //1:デバッグモード
CHK.isMobile; //1:モバイル対応で表示
......@@ -163,6 +164,14 @@ CHK.actCmd = {
deleteReport: "actTaskReport", //作業報告削除
deleteRoutineTaskReport: "actRoutineTaskReport", //点検作業報告保存・更新
};
//iOS送信用コマンド
const NATIVE_KEY_IOS = {
getCachePath: "getCachePath",
getOperationListJson: "getOperationListJson",
getOperationGroupMasterListJson: "getOperationGroupMasterListJson",
getOperationGroupMasterRelationListJson: "getOperationGroupMasterRelationListJson",
getPushMessageListJson: "getPushMessageListJson"
};
// レポートファイル保存タイプ
CHK.REPORT_SAVE_TYPE = {
OZD: "0",
......@@ -258,6 +267,7 @@ CHK.initCommon = function() {
CHK.isWeb = urlParam.is_web;
CHK.isWindows = urlParam.app && urlParam.app == "windows"; // windowsアプリの対応追加 v1.1.0
CHK.isAndroid = urlParam.app && urlParam.app == "android";
CHK.isIOS = urlParam.app && urlParam.app == "ios";
// ウェブの場合、作業一覧の表示広さを変更
if (CHK.isWeb) {
$("#checkList").addClass("web");
......@@ -372,7 +382,7 @@ CHK.initReport = function(callback) {
CHK.initReportApp = function (callback) {
// 作業一覧JSONデータ
CHK.loadJson(CHK.jsonPath.operationList, function (json) {
if (CHK.isAndroid) {
if (CHK.isAndroid || CHK.isIOS) {
$('#operationTable').empty();
}
CHK.operation = json;
......@@ -478,10 +488,29 @@ CHK.updateReportJsonWeb = function(json, callback) {
CHK.loadJson = function(fileName, callback) {
if (CHK.isAndroid) {
fileName = android.getCachePath() + "/" + fileName;
} else if (CHK.isIOS) {
} else {
//キャッシュ対応
fileName = fileName + "?" + new Date().getTime().toString(16);
}
if (CHK.isIOS) {
if (fileName == CHK.jsonPath.operationList) {
json = CHK_iOS.getOperationListJson();
callback(json);
} else if (fileName == CHK.jsonPath.operationGroupMasterList) {
json = CHK_iOS.getOperationGroupMasterListJson();
callback(json);
} else if (fileName == CHK.jsonPath.operationGroupMasterRelationList) {
json = CHK_iOS.getOperationGroupMasterRelationListJson();
callback(json);
} else if (fileName == CHK.jsonPath.pushMessageList) {
json = CHK_iOS.getPushMessageListJson();
callback(json);
}
return;
}
$.getJSON(fileName, function(json) {
console.log("load json file", fileName, json);
callback(json);
......@@ -970,6 +999,8 @@ CHK.sendABookCheckApi = function(param, callback) {
window.external.notify(JSON.stringify(param));
} else if(CHK.isAndroid){
android.sendParam(JSON.stringify(param));
} else if(CHK.isIOS){
webkit.messageHandlers.sendParam.postMessage(JSON.stringify(param));
} else {
var query = "";
for (var key in param) {
......
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