You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
253 lines
8.7 KiB
253 lines
8.7 KiB
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
|
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
|
|
<!--标准mui.css-->
|
|
<link rel="stylesheet" href="../css/mui.min.css">
|
|
<!--App自定义的css-->
|
|
<link rel="stylesheet" type="text/css" href="../css/app.css" />
|
|
<style>
|
|
.flex-container {
|
|
display: -webkit-box;
|
|
display: -webkit-flex;
|
|
display: flex;
|
|
-webkit-flex-flow: row wrap;
|
|
justify-content: space-between;
|
|
text-align: center;
|
|
}
|
|
|
|
.mui-content-padded {
|
|
padding: 10px;
|
|
}
|
|
|
|
.mui-content-padded a {
|
|
margin: 10px;
|
|
width: 35px;
|
|
height: 35px;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
background-color: #fff;
|
|
border: 1px solid #ddd;
|
|
border-radius: 25px;
|
|
background-clip: padding-box;
|
|
}
|
|
|
|
.mui-content-padded a .mui-icon {
|
|
margin-top: 12px;
|
|
}
|
|
|
|
.mui-spinner,
|
|
.mui-spinner-white {
|
|
margin-top: 12px
|
|
}
|
|
|
|
.active .mui-spinner-indicator {
|
|
background: #007AFF;
|
|
}
|
|
|
|
.mui-content a {
|
|
color: #8F8F94;
|
|
}
|
|
|
|
.mui-content a.already {
|
|
color: #fff;
|
|
border: 1px solid #E73A30;
|
|
background-color: #E73A30;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- 侧滑导航根容器 -->
|
|
<div id="offCanvasWrapper" class="mui-off-canvas-wrap mui-draggable">
|
|
|
|
<!-- 菜单容器 -->
|
|
<aside class="mui-off-canvas-left">
|
|
<div class="mui-scroll-wrapper">
|
|
<div class="mui-scroll">
|
|
<div class="mui-content">
|
|
<div class="mui-content-padded">
|
|
<p style="text-align: center;">答题卡</p>
|
|
<div class="flex-container">
|
|
<a class="already">1</a>
|
|
<a class="already">2</a>
|
|
<a class="already">3</a>
|
|
<a class="already">4</a>
|
|
<a class="already">5</a>
|
|
<a>6</a>
|
|
<a>7</a>
|
|
<a>8</a>
|
|
<a>9</a>
|
|
<a class="already">10</a>
|
|
</div>
|
|
</div>
|
|
<div class="mui-content-padded">
|
|
<div class="flex-container"><a class="already"></a>已做</div>
|
|
<div class="flex-container"><a></a>未做</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- 菜单具体展示内容 -->
|
|
<button id="closeMenu" type="button" class="mui-btn mui-btn-danger mui-btn-block"
|
|
style="padding: 5px 20px;">关闭侧滑菜单</button>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
|
|
<!-- 主页面容器 -->
|
|
<div class="mui-inner-wrap">
|
|
<!-- 主页面标题 -->
|
|
<header id="header" class="mui-bar mui-bar-nav">
|
|
<h1 class="mui-title">党史党建知识问答</h1>
|
|
</header>
|
|
<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;line-height: 1.8;">{{:order_id}}、<font style="color:#E73A30;">[{{:type_name}}]</font> {{:content}}</div>
|
|
<div class="mui-card-content" style="font-size:16px">
|
|
<div class="mui-card-content-inner mui-input-group">
|
|
{{for xuanxiang}}
|
|
<div class="mui-input-row mui-checkbox mui-left">
|
|
<label>{{:key}}. {{:value}}</label>
|
|
{{if checked}}
|
|
<input name="checkbox" value="{{:key}}" type="checkbox" checked>
|
|
{{else}}
|
|
<input name="checkbox" value="{{:key}}" type="checkbox">
|
|
{{/if}}
|
|
</div>
|
|
{{/for}}
|
|
</div>
|
|
</div>
|
|
</script>
|
|
</div>
|
|
|
|
<nav class="mui-bar mui-bar-tab">
|
|
|
|
<a class="mui-tab-item" href="#" id="showMenu">
|
|
<span class="mui-icon mui-icon-bars"></span>
|
|
<span class="mui-tab-label">答题卡</span>
|
|
</a>
|
|
<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="next">
|
|
<span class="mui-icon mui-icon-arrowthinright"></span>
|
|
<span class="mui-tab-label">下一题</span>
|
|
</a>
|
|
</nav>
|
|
<!-- 遮罩 -->
|
|
<div class="mui-off-canvas-backdrop"></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<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, { path: '/' });
|
|
}
|
|
|
|
// 获取一共有多少道题
|
|
var queCount = getExamInfo();
|
|
|
|
getQuestionInfo(orderId);
|
|
|
|
// 右上角增加提交按钮
|
|
var header = document.getElementById("header");
|
|
var submitBtn = document.createElement('button');
|
|
submitBtn.className = 'mui-btn mui-btn-blue mui-btn-link mui-pull-right';
|
|
submitBtn.innerText = '提交';
|
|
header.appendChild(submitBtn);
|
|
submitBtn.addEventListener('tap', function () {
|
|
//提交的事件
|
|
});
|
|
|
|
// 侧边栏对象
|
|
var offCanvasWrapper = mui('#offCanvasWrapper');
|
|
|
|
document.getElementById("showMenu").addEventListener("tap", function () {
|
|
offCanvasWrapper.offCanvas('show');
|
|
});
|
|
|
|
document.getElementById("closeMenu").addEventListener("tap", function () {
|
|
offCanvasWrapper.offCanvas('close');
|
|
});
|
|
|
|
document.getElementById("next").addEventListener("tap", function () {
|
|
if (orderId < queCount) {
|
|
orderId++;
|
|
$.cookie('order_id', orderId, { path: '/' });
|
|
getQuestionInfo(orderId);
|
|
}
|
|
});
|
|
|
|
document.getElementById("previous").addEventListener("tap", function () {
|
|
if (orderId > 1) {
|
|
orderId--;
|
|
$.cookie('order_id', orderId, { path: '/' });
|
|
getQuestionInfo(orderId);
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
// 根据题号获取题的信息
|
|
function getQuestionInfo(orderId) {
|
|
$.ajax({
|
|
url: "/FengHuang/exam/getQuestion?order_id=" + orderId,
|
|
async: false,
|
|
type: 'GET',
|
|
success: function (res) {
|
|
var template = $.templates('#myTemplate');
|
|
var htmlOutput = template.render(res);
|
|
$('#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;
|
|
}
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
</body>
|
|
|
|
</html> |