main
kgdxpr 2 years ago
parent 69c6496b93
commit e16a1fb412

File diff suppressed because one or more lines are too long

@ -0,0 +1,2 @@
/*! jquery.cookie v1.4.1 | MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)}(function(a){function b(a){return h.raw?a:encodeURIComponent(a)}function c(a){return h.raw?a:decodeURIComponent(a)}function d(a){return b(h.json?JSON.stringify(a):String(a))}function e(a){0===a.indexOf('"')&&(a=a.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return a=decodeURIComponent(a.replace(g," ")),h.json?JSON.parse(a):a}catch(b){}}function f(b,c){var d=h.raw?b:e(b);return a.isFunction(c)?c(d):d}var g=/\+/g,h=a.cookie=function(e,g,i){if(void 0!==g&&!a.isFunction(g)){if(i=a.extend({},h.defaults,i),"number"==typeof i.expires){var j=i.expires,k=i.expires=new Date;k.setTime(+k+864e5*j)}return document.cookie=[b(e),"=",d(g),i.expires?"; expires="+i.expires.toUTCString():"",i.path?"; path="+i.path:"",i.domain?"; domain="+i.domain:"",i.secure?"; secure":""].join("")}for(var l=e?void 0:{},m=document.cookie?document.cookie.split("; "):[],n=0,o=m.length;o>n;n++){var p=m[n].split("="),q=c(p.shift()),r=p.join("=");if(e&&e===q){l=f(r,g);break}e||void 0===(r=f(r))||(l[q]=r)}return l};h.defaults={},a.removeCookie=function(b,c){return void 0===a.cookie(b)?!1:(a.cookie(b,"",a.extend({},c,{expires:-1})),!a.cookie(b))}});

@ -97,7 +97,7 @@
<!-- 菜单具体展示内容 -->
<button id="offCanvasHide" type="button" class="mui-btn mui-btn-danger mui-btn-block"
<button id="closeMenu" type="button" class="mui-btn mui-btn-danger mui-btn-block"
style="padding: 5px 20px;">关闭侧滑菜单</button>
</div>
</div>
@ -112,7 +112,7 @@
<div class="mui-content mui-scroll-wrapper">
<div class="mui-card" id="examinfo"></div>
<script id="myTemplate" type="text/x-jsrender">
<div class="mui-card-header" style="font-size:18px">{{: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>
<div class="mui-card-content" style="font-size:16px">
<div class="mui-card-content-inner mui-input-group">
{{for xuanxiang}}
@ -121,7 +121,7 @@
<input name="checkbox" value="{{:key}}" type="checkbox">
</div>
{{/for}}
</div>
</div>
</div>
</script>
</div>
@ -130,13 +130,13 @@
<a class="mui-tab-item" href="#" id="showMenu">
<span class="mui-icon mui-icon-bars"></span>
<span class="mui-tab-label"></span>
<span class="mui-tab-label">答题卡</span>
</a>
<a class="mui-tab-item" href="#" id="next">
<a class="mui-tab-item" href="#" id="previous">
<span class="mui-icon mui-icon-arrowthinleft"></span>
<span class="mui-tab-label">上一题</span>
</a>
<a class="mui-tab-item" href="#" id="previous">
<a class="mui-tab-item" href="#" id="next">
<span class="mui-icon mui-icon-arrowthinright"></span>
<span class="mui-tab-label">下一题</span>
</a>
@ -148,18 +148,25 @@
<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/jsrender.min.js"></script>
<script>
$(function () {
var orderId = 1;
if ($.cookie('order_id')) {
orderId = $.cookie('order_id');
} else {
$.cookie('order_id', orderId);
}
getExamInfo(2);
// 获取一共有多少道题
var queCount = getExamInfo();
getQuestionInfo(orderId);
// 右上角增加提交按钮
var header = document.getElementById("header");
@ -168,20 +175,37 @@
submitBtn.innerText = '提交';
header.appendChild(submitBtn);
submitBtn.addEventListener('tap', function () {
offCanvasWrapper.offCanvas('show');
//提交的事件
});
// 侧边栏对象
var offCanvasWrapper = mui('#offCanvasWrapper');
document.getElementById('showMenu').addEventListener('tap', function () {
$("#showMenu").click(function () {
offCanvasWrapper.offCanvas('show');
});
document.getElementById('offCanvasHide').addEventListener('tap', function () {
$("#closeMenu").click(function () {
offCanvasWrapper.offCanvas('close');
});
$("#next").click(function () {
if (orderId < queCount) {
orderId++;
$.cookie('order_id', orderId);
getQuestionInfo(orderId);
}
});
$("#previous").click(function () {
if (orderId > 1) {
orderId--;
$.cookie('order_id', orderId);
getQuestionInfo(orderId);
}
});
function getExamInfo(orderId) {
// 根据题号获取题的信息
function getQuestionInfo(orderId) {
$.ajax({
url: "/FengHuang/exam/getQuestion?order_id=" + orderId,
async: false,
@ -192,9 +216,19 @@
$('#examinfo').html(htmlOutput);
}
});
};
function getExamInfo() {
var queCount = 0;
$.ajax({
url: "/FengHuang/exam/getExamInfo",
async: false,
type: 'GET',
success: function (res) {
queCount = res.allCount;
}
});
return queCount;
}
});

Loading…
Cancel
Save