beforeunload 이벤트 발생시 ajax 오류로 학습종료버튼 클릭 또는 beforeunload 이벤트 발생시

ajax : async: false 동기로 호출 하게 변경
관련함수 async 옵션추가
function golog(false, true, false, false);
function capp(url, p, callback, getpost, autoMsg, noBG, jsislayer2, hideBG, noerror, async)
This commit is contained in:
lch 2021-06-11 01:39:16 +00:00
parent df8be46927
commit 3b83ffd094
4 changed files with 23 additions and 9 deletions

View File

@ -121,6 +121,13 @@
$("#video1").css("max-height", window.innerHeight - 120); $("#video1").css("max-height", window.innerHeight - 120);
} }
} }
function closestudy() {
if (!_passunload && _istaste != 1 && !_islogout) {
golog(false, true, false, false);
_passunload = true;
}
self.close();
}
$(window).load(function () { $(window).load(function () {
if (@Model.status == 0) { if (@Model.status == 0) {
_passunload = true; _passunload = true;
@ -352,11 +359,12 @@
resizeme(); resizeme();
//} //}
} }
function golog(ispaging, isunload, isinning) { function golog(ispaging, isunload, isinning, async) {
ispaging = ispaging || false; ispaging = ispaging || false;
isunload = isunload || false; isunload = isunload || false;
isinning = isinning || false; isinning = isinning || false;
async = async || true;
_tsec++; _tsec++;
if (!ispaging && !isunload && !isinning) { if (!ispaging && !isunload && !isinning) {
_sec++; _sec++;
@ -379,7 +387,7 @@
_psecond = getint($("#video1")[0].currentTime); _psecond = getint($("#video1")[0].currentTime);
} }
} catch (e) { } } catch (e) { }
capp("/focommon/studylog", { logno: _logno, lectno: @Model.lip.lectno, cmino: @Model.lip.cmino, cpno: _cpno, studysec: _sec, ispc: ismobile() ? 0 : 1, nextcpno: ispaging ? _nextcpno : 0, getiframe: @(Model.CMInning.ismenu == 1 && Model.CMInning.ctype == 2 ? 1 : 0), issample: @Model.istaste, psec: _psecond }, "cbstudylog" + (ispaging ? "page" : "") + (isunload ? "unload" : "") + (isinning ? "inning" : ""), null, null, true, null, true); capp("/focommon/studylog", { logno: _logno, lectno: @Model.lip.lectno, cmino: @Model.lip.cmino, cpno: _cpno, studysec: _sec, ispc: ismobile() ? 0 : 1, nextcpno: ispaging ? _nextcpno : 0, getiframe: @(Model.CMInning.ismenu == 1 && Model.CMInning.ctype == 2 ? 1 : 0), issample: @Model.istaste, psec: _psecond }, "cbstudylog" + (ispaging ? "page" : "") + (isunload ? "unload" : "") + (isinning ? "inning" : ""), null, null, true, null, true, async));
} else if (_mtime > 0 && !_okmid && _tsec >= _mtime && _mtimesec < 1) { } else if (_mtime > 0 && !_okmid && _tsec >= _mtime && _mtimesec < 1) {
//clearInterval(_timerlog); //clearInterval(_timerlog);
_mtimesec = 1; _mtimesec = 1;
@ -540,8 +548,8 @@
//else { //else {
//if (opener && (opener._cdmsisopenning || 0) == 0) { //if (opener && (opener._cdmsisopenning || 0) == 0) {
opener.location.href = opener.location.href.replace(/#/gi, ''); opener.location.href = opener.location.href.replace(/#/gi, '');
//} //}
golog(false, true); golog(false, true, false, false);
//} //}
} }
} }

View File

@ -130,6 +130,13 @@
$("#video1").css("max-height", window.innerHeight - 120); $("#video1").css("max-height", window.innerHeight - 120);
} }
} }
function closestudy() {
if (!_passunload && _istaste != 1 && !_islogout) {
golog(false, true);
_passunload = true;
}
self.close();
}
$(window).load(function () { $(window).load(function () {
if (@Model.status == 0) { if (@Model.status == 0) {
_passunload = true; _passunload = true;

View File

@ -20,9 +20,6 @@
if (@Model.status == 0) { if (@Model.status == 0) {
self.close(); self.close();
} }
}); });
function closestudy() {
self.close();
}
</script> </script>
} }

View File

@ -602,10 +602,11 @@ function cap(url, formid, callback, getpost, autoMsg, noBG, jsislayer2) {
console.log("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요."); console.log("다른 작업을 처리중입니다. 잠시후 다시 작업해주세요.");
} }
} }
function capp(url, p, callback, getpost, autoMsg, noBG, jsislayer2,hideBG, noerror) { function capp(url, p, callback, getpost, autoMsg, noBG, jsislayer2, hideBG, noerror, async) {
_jsislayer2 = jsislayer2 || false; _jsislayer2 = jsislayer2 || false;
_noerror = noerror || false; _noerror = noerror || false;
_hideBG = hideBG || false; _hideBG = hideBG || false;
_async = async || true;
if (!isCaping) { if (!isCaping) {
isAutoMsg = autoMsg || false; isAutoMsg = autoMsg || false;
_bging = noBG || false; _bging = noBG || false;
@ -624,6 +625,7 @@ function capp(url, p, callback, getpost, autoMsg, noBG, jsislayer2,hideBG, noerr
type: getpost || "post", type: getpost || "post",
url: url, url: url,
data: p, data: p,
async: _async,
success: function (r) { success: function (r) {
isCaping = false; isCaping = false;
capResult = r; capResult = r;