黄海 2 years ago
commit 5addf87322

@ -10,6 +10,8 @@
<!--标准mui.css--> <!--标准mui.css-->
<link rel="stylesheet" href="../css/mui.min.css"> <link rel="stylesheet" href="../css/mui.min.css">
<link rel="stylesheet" type="text/css" href="../css/icons-extra.css" />
<!--App自定义的css--> <!--App自定义的css-->
<link rel="stylesheet" type="text/css" href="../css/app.css" /> <link rel="stylesheet" type="text/css" href="../css/app.css" />
<style> <style>
@ -128,7 +130,12 @@
<header id="header" class="mui-bar mui-bar-nav"> <header id="header" class="mui-bar mui-bar-nav">
<h1 class="mui-title">党史党建知识问答</h1> <h1 class="mui-title">党史党建知识问答</h1>
</header> </header>
<div class="mui-content mui-scroll-wrapper"> <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> <div class="mui-card" id="examinfo"></div>
<script id="myTemplate" type="text/x-jsrender"> <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> <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/jquery.cookie.min.js"></script>
<script src="../js/mui.min.js"></script> <script src="../js/mui.min.js"></script>
<script src="../js/jsrender.min.js"></script> <script src="../js/jsrender.min.js"></script>
<script src="../js/djs.js"></script>
<script> <script>
tbdTimeCountdown({
id: "time",
alltime: 0,
end: function () {
console.log('完成');
},
});
$(function () { $(function () {
var orderId = 1;
if ($.cookie('order_id')) {
orderId = $.cookie('order_id'); if (!$.cookie('order_id')) {
} else { $.cookie('order_id', 1, { path: '/' });
$.cookie('order_id', orderId, { path: '/' });
} }
// 获取一共有多少道题 // 获取一共有多少道题
var queCount = getExamInfo(); var queCount = getExamInfo();
//获取题的信息 //获取题的信息
getQuestionInfo(orderId); getQuestionInfo();
//获取答题卡信息 //获取答题卡信息
getAnswerSheet(); getAnswerSheet();
@ -235,10 +249,10 @@
mui.confirm(message, '确认交卷', btnArray, function (e) { mui.confirm(message, '确认交卷', btnArray, function (e) {
if (e.index == 1) { if (e.index == 1) {
$.ajax({ $.ajax({
url: "/FengHuang/exam/jiaoJuan", url: "/FengHuang/exam/jiaoJuan",
type: 'POST', type: 'POST',
success: function (res) { success: function (res) {
console.log(res); window.location = "./result.html";
} }
}); });
} }
@ -262,31 +276,39 @@
}); });
document.getElementById("next").addEventListener("tap", function () { document.getElementById("next").addEventListener("tap", function () {
var orderId = $.cookie('order_id');
if (orderId < queCount) { if (orderId < queCount) {
orderId++; orderId++;
$.cookie('order_id', orderId, { path: '/' }); $.cookie('order_id', orderId, { path: '/' });
getQuestionInfo(orderId); getQuestionInfo();
} }
}); });
document.getElementById("previous").addEventListener("tap", function () { document.getElementById("previous").addEventListener("tap", function () {
var orderId = $.cookie('order_id');
if (orderId > 1) { if (orderId > 1) {
orderId--; orderId--;
$.cookie('order_id', orderId, { path: '/' }); $.cookie('order_id', orderId, { path: '/' });
getQuestionInfo(orderId); getQuestionInfo();
} }
}); });
mui(".mui-content").on("tap", "a", function () { mui(".mui-content").on("tap", "a", function () {
orderId = this.textContent; $.cookie('order_id', this.textContent, { path: '/' });
getQuestionInfo(this.textContent); getQuestionInfo();
offCanvasWrapper.offCanvas('close'); offCanvasWrapper.offCanvas('close');
}) })
// 根据题号获取题的信息 // 根据题号获取题的信息
function getQuestionInfo(orderId) { function getQuestionInfo() {
var orderId = 0;
if ($.cookie('order_id')) {
orderId = $.cookie('order_id');
} else {
orderId = 1;
}
$.ajax({ $.ajax({
url: "/FengHuang/exam/getQuestion?order_id=" + orderId, url: "/FengHuang/exam/getQuestion?order_id=" + orderId,
async: false, async: false,
@ -305,8 +327,6 @@
reply += this.value; reply += this.value;
} }
}); });
console.log(orderId)
console.log(reply)
saveReply(orderId, reply); saveReply(orderId, reply);
}); });
@ -315,9 +335,15 @@
$('input[type="radio"]').on('change', function () { $('input[type="radio"]').on('change', function () {
// 获取选中的radio元素的值 // 获取选中的radio元素的值
var reply = $(this).val(); var reply = $(this).val();
console.log(orderId)
console.log('选中的值为:' + reply);
saveReply(orderId, 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 class="dtime" id="a2"></div>
</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/mui.min.js"></script>
<script src="../js/djs.js"></script> <script src="../js/djs.js"></script>
<script> <script>
$.removeCookie('order_id', { path: '/' });
var loginButton = document.getElementById('login'); var loginButton = document.getElementById('login');
@ -83,8 +86,13 @@
tel: $("#tel").val() tel: $("#tel").val()
}, },
type: 'post', type: 'post',
success: function (data) { success: function (res) {
window.location = "./exam.html"; if (res.success) {
window.location = "./exam.html";
} else {
mui.alert('该人员已完成答题,不允许重复答题!', '提示');
}
}, },
error: function (xhr, type, errorThrown) { error: function (xhr, type, errorThrown) {
//异常处理; //异常处理;

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

Loading…
Cancel
Save