function fnOnMsg(msg) {
if (!msg.data.bIfContinue) {
alert(msg.strErrorDescription);
window.onmessage = window.fnOldOnmessage;
window.sessionStorage.removeItem('aryStrTaskName');
window.fnOldOnmessage = null;
window.objGlobalParam = null;
}
else if (msg.data.strName.match('') ||
msg.data.strName.match('') ||
msg.data.strName.match('') ||
msg.data.strName.match('') ||
msg.data.strName.match('') ||
msg.data.strName.match('') ||
msg.data.strName.match('') ||
msg.data.strName.match('start')
) {
let aryStrTaskName = window.sessionStorage.getItem('aryStrTaskName').split(',');
switch (aryStrTaskName.pop())
{
case "End":
window.onmessage = window.fnOldMainOnmessage;
window.sessionStorage.removeItem('aryStrTaskName');
window.fnOldMainOnmessage = null;
objParam = null;
objMsg = null;
window.objGlobalParam= null;
break;
case "fnGetInhouseReservationList":
fnGetInhouseReservationList(msg.data);
window.sessionStorage.setItem('aryStrTaskName', aryStrTaskName);
break;
case "fnParseFromRmNum2ResNum":
msg.data.name = "fnCallBackParseFromRmNum2ResNum"
fnParseFromRmNum2ResNum(parseInt(prompt("请输入房间号", "")), window.objGlobalParam.objAryInOutData);
window.sessionStorage.setItem('aryStrTaskName', aryStrTaskName);
window.postMessage(msg.data);
break;
}
}
else if (window.fnOldMainOnmessage != null)
window.fnOldMainOnmessage(msg);
}
function fnMain() {
window.fnOldMainOnmessage = window.onmessage;
window.onmessage = fnOnMsg;
window.sessionStorage.setItem('aryStrTaskName',
"End," +
"," +
"," +
"," +
"," +
"," +
"," +
"," +
"," +
"");
let objMainMsg = {
"objParam": '',
"bIfContinue": 1,
"strErrorDescription": '',
"strName": 'start'
}
objMainMsg.objParam.nParam = 0;
window.objGlobalParam = new Object();
window.postMessage(objMainMsg);
}
fnMain();