main
kgdxpr 2 years ago
parent 025b3c8585
commit 5126b04449

@ -195,18 +195,15 @@
$(function () {
var orderId = 1;
if ($.cookie('order_id')) {
orderId = $.cookie('order_id');
} else {
$.cookie('order_id', orderId, { path: '/' });
if (!$.cookie('order_id')) {
$.cookie('order_id', 1, { path: '/' });
}
// 获取一共有多少道题
var queCount = getExamInfo();
//获取题的信息
getQuestionInfo(orderId);
getQuestionInfo();
//获取答题卡信息
getAnswerSheet();
@ -235,10 +232,10 @@
mui.confirm(message, '确认交卷', btnArray, function (e) {
if (e.index == 1) {
$.ajax({
url: "/FengHuang/exam/jiaoJuan",
url: "/FengHuang/exam/jiaoJuan",
type: 'POST',
success: function (res) {
console.log(res);
window.location = "./result.html";
}
});
}
@ -262,31 +259,39 @@
});
document.getElementById("next").addEventListener("tap", function () {
var orderId = $.cookie('order_id');
if (orderId < queCount) {
orderId++;
$.cookie('order_id', orderId, { path: '/' });
getQuestionInfo(orderId);
getQuestionInfo();
}
});
document.getElementById("previous").addEventListener("tap", function () {
var orderId = $.cookie('order_id');
if (orderId > 1) {
orderId--;
$.cookie('order_id', orderId, { path: '/' });
getQuestionInfo(orderId);
getQuestionInfo();
}
});
mui(".mui-content").on("tap", "a", function () {
orderId = this.textContent;
getQuestionInfo(this.textContent);
$.cookie('order_id', this.textContent, { path: '/' });
getQuestionInfo();
offCanvasWrapper.offCanvas('close');
})
// 根据题号获取题的信息
function getQuestionInfo(orderId) {
function getQuestionInfo() {
var orderId = 0;
if ($.cookie('order_id')) {
orderId = $.cookie('order_id');
} else {
orderId = 1;
}
$.ajax({
url: "/FengHuang/exam/getQuestion?order_id=" + orderId,
async: false,
@ -305,8 +310,6 @@
reply += this.value;
}
});
console.log(orderId)
console.log(reply)
saveReply(orderId, reply);
});
@ -315,9 +318,15 @@
$('input[type="radio"]').on('change', function () {
// 获取选中的radio元素的值
var reply = $(this).val();
console.log(orderId)
console.log('选中的值为:' + reply);
saveReply(orderId, reply);
setTimeout(function () {
orderId++;
console.log(orderId);
$.cookie('order_id', orderId, { path: '/' });
getQuestionInfo(orderId);
}, 500);
});
}

@ -65,12 +65,15 @@
<div class="dtime" id="a2"></div>
</div>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.cookie.min.js"></script>
<script src="../js/mui.min.js"></script>
<script src="../js/djs.js"></script>
<script>
$.removeCookie('order_id', { path: '/' });
var loginButton = document.getElementById('login');
@ -83,8 +86,13 @@
tel: $("#tel").val()
},
type: 'post',
success: function (data) {
window.location = "./exam.html";
success: function (res) {
if (res.success) {
window.location = "./exam.html";
} else {
mui.alert('该人员已完成答题,不允许重复答题!', '提示');
}
},
error: function (xhr, type, errorThrown) {
//异常处理;

@ -153,32 +153,18 @@
</script>
</div>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.cookie.min.js"></script>
<script src="../js/jquery.min.js"></script>
<script src="../js/mui.min.js"></script>
<script src="../js/jsrender.min.js"></script>
<script>
$(function () {
var orderId = 1;
if ($.cookie('order_id')) {
orderId = $.cookie('order_id');
} else {
$.cookie('order_id', orderId, { path: '/' });
}
//获取题的信息
getQuestionInfo(orderId);
$(function () {
//获取答题卡信息
getAnswerSheet();
mui(".mui-content").on("tap", "a", function () {
console.log("123");
mui(".mui-content").on("tap", "a", function () {
orderId = this.textContent;
getQuestionInfo(this.textContent);
})

Loading…
Cancel
Save