123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>exam</title>
- <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">
- <link rel="stylesheet" href="../css/iconfont.css">
- <link rel="stylesheet" href="../css/mui.min.css">
- <script src="../js/mui.min.js"></script>
- <script src="../js/app.js"></script>
- <script src="../js/service.js"></script>
- <style>
- html,
- body {
- background-color: #efeff4;
- }
- .my-shouceng-pos {
- margin-right: 15px !important;
- }
- .my-biji-pos {
- margin-right: 30px !important;
- }
- .my-table-cell-jiexi:after {
- content: "" !important;
- background-color: white !important;
- }
- .my-table-cell-jiexi21:before {
- position: absolute;
- right: 0;
- top: 0;
- left: 15px;
- height: 1px;
- content: '';
- background-color: #c8c7cc !important;
- }
- </style>
- </head>
- <body>
- <header class="mui-bar mui-bar-nav">
- <a id="back" class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
- <a id="shoucang" data-section-id="" data-name="收藏本" data-href="" class="my-shouceng-pos mui-pull-right">
- <i class="mui-icon icon iconfont icon-shoucang2"></i>
- </a>
- <a id="biji" data-section-id="" data-name="笔记" data-href="" class="my-biji-pos mui-pull-right">
- <span class="mui-icon mui-icon-compose"></span>
- </a>
- <h1 id="title" class="mui-title">试题解析</h1>
- </header>
- <footer class="mui-bar mui-bar-footer">
- <ul class="mui-pager" style="margin-top: 5px;">
- <li id="pre-id" class="mui-disabled">
- <a> 上 一 题 </a>
- </li>
- <li id="next-id" style="margin-left: 50px;">
- <a> 下 一 题 </a>
- </li>
- </ul>
- </footer>
- <div class="mui-content">
- <div class="my-pagination" style="margin-top: 20px;margin-bottom: 20px;" id="list">
- </div>
- </div>
- <script type="text/html" id="template-question-id">
- <li class="mui-table-view-cell">
- <b style="color: blue;">{indexed}/{pageSize}({type})</b>: {name}
- </li>
- </script>
- <script type="text/html" id="template-option-id">
- <li class="mui-table-view-cell mui-{inputType} mui-left">
- <input class="question" name="{inputName}" type="{inputType}" disabled data-checked="false" {checked} data-label="{label}">{label}:{name}
- </li>
- </script>
- <script type="text/html" id="template-resolution-id">
- <li class="mui-table-view-cell my-table-cell-jiexi">解析:</li>
- <li class="mui-table-view-cell">{name}</li>
- </script>
- <script type="text/html" id="template-correct-id">
- <li class="mui-table-view-cell" style="color: {isOkStyle};">你的答案:{userAnswer},正确答案:{questionAnswer}</li>
- </script>
- <script type="text/html" id="template-material-id">
- <li class="mui-table-view-cell">{name}</li>
- </script>
- <script type="text/html" id="template-fanyi-id">
- <li class="mui-table-view-cell">{fanyi}</li>
- </script>
- <script>
- function preAndNextEvent() {
- var preDom = document.getElementById("pre-id");
- preDom.addEventListener('tap', function() {
- prev();
- });
- var nextDom = document.getElementById("next-id");
- nextDom.addEventListener('tap', function() {
- next();
- });
- }
- var childPagination = null;
- function hideAll() {
- for (var i = 0; i < childPagination.length; i++) {
- var child = childPagination[i];
- child.style.display = 'none';
- }
- }
- function showFirst() {
- childPagination[0].style.display = 'block';
- }
- window.currentNo = 0;
- function show(idx) {
- hideAll();
- window.currentNo = idx;
- for (var i = 0; i < childPagination.length; i++) {
- if (i == idx) {
- var child = childPagination[i];
- child.style.display = 'block';
- }
- }
- if (window.currentNo == 0) {
- document.getElementById("pre-id").classList.add('mui-disabled');
- } else {
- document.getElementById("pre-id").classList.remove('mui-disabled');
- }
- if (window.currentNo == (childPagination.length - 1)) {
- document.getElementById("next-id").classList.add('mui-disabled');
- } else {
- document.getElementById("next-id").classList.remove('mui-disabled');
- }
- }
- function preBtnEffect() {
- if (window.currentNo <= 1) {
- document.getElementById("pre-id").classList.add('mui-disabled');
- }
- if (window.currentNo < childPagination.length) {
- document.getElementById("next-id").classList.remove('mui-disabled');
- }
- }
- function nextBtnEffect() {
- if (window.currentNo >= 0) {
- document.getElementById("pre-id").classList.remove('mui-disabled');
- }
- if (window.currentNo >= (childPagination.length - 2)) {
- document.getElementById("next-id").classList.add('mui-disabled');
- }
- }
- function prev() {
- preBtnEffect();
- if (window.currentNo) {
- window.currentNo = window.currentNo - 1;
- show(window.currentNo);
- var _self = childPagination[currentNo]
- var _questionId = _self.getAttribute("data-id");
- var questionAll = window.serviceObj.getQuestion(_questionId);
- updateBookmarkIco(questionAll);
- updateNoteIco(questionAll);
- }
- }
- function next() {
- nextBtnEffect();
- if (window.currentNo < (childPagination.length - 1)) {
- window.currentNo = window.currentNo + 1;
- show(window.currentNo);
- var _self2 = childPagination[currentNo]
- var _questionId2 = _self2.getAttribute("data-id");
- var questionAll = window.serviceObj.getQuestion(_questionId2);
- updateBookmarkIco(questionAll);
- updateNoteIco(questionAll);
- return false;
- } else {
- return true;
- }
- }
- window.addEventListener("swiperight", prev);
- window.addEventListener("swipeleft", next);
- //更新收藏图标,显示当前题是否被收藏
- function updateBookmarkIco(questionAll) {
- var questionId = questionAll.question.id;
- var hasCollect = questionAll.hasCollect;
- var shoucangDom = document.getElementById("shoucang");
- shoucangDom.setAttribute("data-question-id", questionId);
- if (hasCollect) {
- shoucangDom.style.color = "red";
- } else {
- shoucangDom.style.color = "white";
- }
- }
-
- function updateNoteIco(questionAll){
- var questionId = questionAll.question.id;
- var bijiDom = document.getElementById("biji");
- bijiDom.setAttribute('data-question-id',questionId);
- }
- //点击收藏,收藏此试题
- function collectEvent() {
- document.getElementById('shoucang').addEventListener('tap', function() {
- var _questionId = this.getAttribute('data-question-id');
- var questionAll = window.serviceObj.getQuestion(_questionId);
- if (questionAll.hasCollect) {
- mui.toast('已取消收藏');
- } else {
- mui.toast('已添加收藏');
- }
- window.serviceObj.updateBookMark(questionAll);
- updateBookmarkIco(questionAll);
- });
- }
- /**
- * 元数据配置
- */
- var questionMetadata = {
- '单选题': ["materialName", "question", "answer", "option", "resolution", "materialFanyi"],
- '填空题': ["materialName", "question", "answer", "option", "resolution", "materialFanyi"],
- '英译汉': ["question", "resolution"],
- '作文': ["question", "materialName"]
- };
-
- mui.plusReady(function() {
- var self = plus.webview.currentWebview();
- window.sectionId = self.sectionId;
- window.isFromLoginPage = self.isFromLoginPage;
- window.serviceObj = minix(self.serviceObj);
- if (window.serviceObj.questionList.length <= 1) {
- var footer = document.getElementsByTagName("footer")[0];
- footer.parentElement.removeChild(footer);
- }
- initDom();
- eventBiji();
- collectEvent();
- updateBookmarkIco(window.serviceObj.questionList[0]);
- updateNoteIco(window.serviceObj.questionList[0]);
- childPagination = document.getElementsByClassName("my-pagination")[0].children;
- hideAll();
- showFirst();
- var indexed = self.indexed; //点击解析上的具体哪个试题获取到的试题的题号
- if (indexed) {
- show(indexed - 1);
- }
- preAndNextEvent();
- });
- var old_back = mui.back;
- mui.back = function() {
- if (window.isFromLoginPage) {
- var wv = plus.webview;
- var sectionId = window.sectionId;
- console.log(sectionId);
- wv.close('login-win-' + sectionId);
- wv.close('resolution-win-' + sectionId);
- wv.show('submit-win-' + sectionId);
- } else {
- old_back();
- }
- };
-
- /**
- * 给收藏按钮添加事件
- */
- function eventBiji(){
- document.getElementById("biji").addEventListener('tap',function(evt){
- var questionId = this.getAttribute('data-question-id');
- mui.openWindow({
- id: 'biji-win-' + questionId,
- url: 'note.html',
- waiting: {
- autoShow: false
- },
- extras: {
- questionId:questionId
- }
- });
- });
- }
- </script>
- </body>
- </html>
|