exam_history.html 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>试卷列表</title>
  6. <link rel="apple-touch-icon" href="apple-touch-icon.png">
  7. <meta name="viewport" content="initial-scale=1.0, maximum-scale=1, user-scalable=no">
  8. <link rel="icon" href="favicon.ico" type="image/x-icon"/>
  9. <script>
  10. window.addEventListener('resize', setHtmlFontSize)
  11. setHtmlFontSize();
  12. function setHtmlFontSize() {
  13. // 根据屏幕的宽度来改变根元素的字体大小的值
  14. // 当前屏幕 / 标准的375屏幕 求得你当前屏幕是标准屏幕的多少倍 * 标准屏幕根元素的字体大小
  15. // 当前屏幕的宽度 / 375 * 100
  16. // 假如当前750/375 = 2 * 100 == 200px
  17. // 1. 当前屏幕的宽度
  18. var windowWidth = document.documentElement.offsetWidth;
  19. // 限制最大屏幕 和最小屏幕
  20. if(windowWidth > 1200){
  21. document.querySelector('html').style.fontSize = 10 + 'px';
  22. return;
  23. }
  24. else if (windowWidth > 750) {
  25. windowWidth = 750;
  26. } else if (windowWidth < 375) {
  27. windowWidth = 375;
  28. }
  29. //2. 标准屏幕的宽度
  30. var StandardWidth = 375;
  31. // 标准屏幕的html的字体大小
  32. var StandardHtmlFontSize = 10;
  33. //3. 当前屏幕需要设置的根元素的字体大小
  34. var htmlFontSize = windowWidth / StandardWidth * StandardHtmlFontSize;
  35. //4. 把当前计算的html 字体大小设置到页面的html元素上就可以
  36. document.querySelector('html').style.fontSize = htmlFontSize + 'px';
  37. }
  38. </script>
  39. <style>
  40. html,body{
  41. font-size: 1.6rem;
  42. }
  43. html,body {
  44. padding: 0;
  45. margin: 0;
  46. width: 100%;
  47. height: 100%;
  48. background: #fff;
  49. }
  50. #app {
  51. position: relative;
  52. height: 100%;
  53. max-width: 500px;
  54. }
  55. #app .van-cell{
  56. font-size: 1.6rem;
  57. }
  58. .header{
  59. width: 100%;
  60. height: 4.6rem;
  61. position: fixed;
  62. z-index: 1000;
  63. }
  64. .clear-header{
  65. width: 100%;
  66. height: 6rem;
  67. }
  68. [v-cloak] {
  69. display: none;
  70. }
  71. </style>
  72. </head>
  73. <body>
  74. <div id="app" v-cloak>
  75. <div class="header" v-if="user != 1">
  76. <van-nav-bar left-text="返回" left-arrow @click-left="onClickLeft">
  77. <div slot="title">
  78. <span v-if="num == 1">正式考试记录</span>
  79. <span v-if="num == 2">模拟考试记录</span>
  80. </div>
  81. </van-nav-bar>
  82. </div>
  83. <div class="clear-header" v-if="user != 1">
  84. </div>
  85. <div style="padding-bottom: 5rem" v-if="myList.length > 0">
  86. <van-cell-group>
  87. <van-cell v-for="(item,index) in myList" @click="goPageFn(item)" :key="index" :title="item.paperName" >
  88. <div slot="default">
  89. <span style="color: green" v-if="item.totalMark >= item.passScore">{{item.totalMark}}分</span>
  90. <span style="color: red" v-if="item.totalMark < item.passScore">{{item.totalMark}}分</span>
  91. </div>
  92. <div slot="label" style="display: flex;justify-content: space-between">
  93. <p>{{item.createdTime}}</p>
  94. </div>
  95. </van-cell>
  96. </van-cell-group>
  97. </div>
  98. <div v-if="myList.length < 1">
  99. <p style="margin: 0 auto;text-align: center;margin-top: 5rem;color: #aaa">暂无数据</p>
  100. </div>
  101. </div>
  102. <script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
  103. <script src="../../../assets/module/vue.js"></script>
  104. <script src="../../../assets/libs/jquery/jquery-3.2.1.min.js"></script>
  105. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.2/lib/index.css">
  106. <script src="https://cdn.jsdelivr.net/npm/vant@2.2/lib/vant.min.js"></script>
  107. <script type="text/javascript" src="../../../assets/js/common.js?v=312"></script>
  108. <script>
  109. function getUrlParam(name) {
  110. var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
  111. //如果地址栏中出现中文则进行编码
  112. var r = encodeURI(window.location.search).substr(1).match(reg);
  113. if (r != null) {
  114. //将中文编码的字符重新变成中文
  115. return decodeURI(unescape(r[2]));
  116. }
  117. return null;
  118. }
  119. var postId = getUrlParam("postId");
  120. new Vue({
  121. el: "#app",
  122. data: {
  123. num:1,
  124. user:'',
  125. limit:1000,
  126. count:1,
  127. myList:[],
  128. },
  129. mounted(){
  130. this.num = this.getQueryVariable('num');
  131. this.user = this.getQueryVariable('user');
  132. //获取试卷记录列表
  133. this.recordqueryFn();
  134. },
  135. methods:{
  136. getQueryVariable(variable)
  137. {
  138. var query = window.location.search.substring(1);
  139. var vars = query.split("&");
  140. for (var i=0;i<vars.length;i++) {
  141. var pair = vars[i].split("=");
  142. if(pair[0] == variable){return pair[1];}
  143. }
  144. return(false);
  145. },
  146. //获取试卷记录列表
  147. recordqueryFn(){
  148. let _this = this;
  149. layui.use(['uParas','admin'], ()=> {
  150. let admin = layui.admin;
  151. let uParas = layui.uParas;
  152. let url = uParas.baseUrl + '/ol/userTestPaper/record/query';
  153. let paperId = '';
  154. if(this.num == 2){
  155. paperId = this.getQueryVariable('paperId');
  156. }
  157. $.ajax({
  158. type: 'get',
  159. url: url,
  160. data: {
  161. page: 1,
  162. limit: this.limit,
  163. paperId:paperId,
  164. status:this.num,
  165. },
  166. headers: {
  167. 'accept':'application/json, text/javascript, */*; q=0.01',
  168. 'Authorization': localStorage.getItem('atoken')
  169. },
  170. success: function (res) {
  171. console.log(res);
  172. _this.myList = res.data;
  173. },
  174. });
  175. })
  176. },
  177. goPageFn(item){
  178. if(this.user == 1){
  179. let zindex = $(window.parent.document).find('.layui-layer-iframe').css('z-index');
  180. $(window.parent.document).find('.layui-layer-iframe').css({
  181. zIndex: zindex,
  182. width: '90%',
  183. height: '90%',
  184. position: 'absolute',
  185. top: '40px',
  186. left: '50px',
  187. })
  188. }
  189. location.href = './detail.html?recordId='+item.recordId;
  190. },
  191. onClickLeft() {
  192. window.history.back(-1);
  193. },
  194. }
  195. })
  196. </script>
  197. </body>
  198. </html>