黄海 2 years ago
commit 5addf87322

@ -10,6 +10,8 @@
<!--标准mui.css-->
<link rel="stylesheet" href="../css/mui.min.css">
<link rel="stylesheet" type="text/css" href="../css/icons-extra.css" />
<!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="../css/app.css" />
<style>
@ -128,7 +130,12 @@
<header id="header" class="mui-bar mui-bar-nav">
<h1 class="mui-title">党史党建知识问答</h1>
</header>
<div class="mui-content mui-scroll-wrapper">
<div style="margin-left: 10px;margin-top: 10px;"><span class="mui-icon-extra mui-icon-extra-outline"
id="time">123</span></div>
<div class="mui-card" id="examinfo"></div>
<script id="myTemplate" type="text/x-jsrender">
<div class="mui-card-header" style="font-size:18px;line-height: 1.8;">{{:order_id}}、<font style="color:#E73A30;">[{{:type_name}}]</font>&nbsp{{:content}}</div>
@ -187,26 +194,33 @@
<script src="../js/jquery.cookie.min.js"></script>
<script src="../js/mui.min.js"></script>
<script src="../js/jsrender.min.js"></script>
<script src="../js/djs.js"></script>
<script>
tbdTimeCountdown({
id: "time",
alltime: 0,
end: function () {
console.log('完成');
},
});
$(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 +249,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 +276,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 +327,6 @@
reply += this.value;
}
});
console.log(orderId)
console.log(reply)
saveReply(orderId, reply);
});
@ -315,9 +335,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