123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>试卷列表</title>
- <link rel="apple-touch-icon" href="apple-touch-icon.png">
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1, user-scalable=no">
- <link rel="icon" href="favicon.ico" type="image/x-icon"/>
- <script>
- window.addEventListener('resize', setHtmlFontSize)
- setHtmlFontSize();
- function setHtmlFontSize() {
- // 根据屏幕的宽度来改变根元素的字体大小的值
- // 当前屏幕 / 标准的375屏幕 求得你当前屏幕是标准屏幕的多少倍 * 标准屏幕根元素的字体大小
- // 当前屏幕的宽度 / 375 * 100
- // 假如当前750/375 = 2 * 100 == 200px
- // 1. 当前屏幕的宽度
- var windowWidth = document.documentElement.offsetWidth;
- // 限制最大屏幕 和最小屏幕
- if (windowWidth > 1200) {
- document.querySelector('html').style.fontSize = 10 + 'px';
- return;
- } else if (windowWidth > 750) {
- windowWidth = 750;
- } else if (windowWidth < 375) {
- windowWidth = 375;
- }
- //2. 标准屏幕的宽度
- var StandardWidth = 375;
- // 标准屏幕的html的字体大小
- var StandardHtmlFontSize = 10;
- //3. 当前屏幕需要设置的根元素的字体大小
- var htmlFontSize = windowWidth / StandardWidth * StandardHtmlFontSize;
- //4. 把当前计算的html 字体大小设置到页面的html元素上就可以
- document.querySelector('html').style.fontSize = htmlFontSize + 'px';
- }
- </script>
- <style>
- html, body {
- font-size: 1.6rem;
- }
- html, body {
- padding: 0;
- margin: 0;
- width: 100%;
- height: 100%;
- background: #fff;
- }
- #app {
- position: relative;
- height: 100%;
- max-width: 500px;
- }
- #app .van-cell {
- font-size: 1.6rem;
- }
- .header {
- width: 100%;
- height: 4.6rem;
- position: fixed;
- z-index: 1000;
- }
- .clear-header {
- width: 100%;
- height: 6rem;
- }
- [v-cloak] {
- display: none;
- }
- </style>
- </head>
- <body>
- <div id="app" v-cloak>
- <div class="header" v-if="user != 1">
- <van-nav-bar left-text="返回" left-arrow @click-left="onClickLeft">
- <div slot="title">
- <span v-if="num == 1">正式考试记录</span>
- <span v-if="num == 2">模拟考试记录</span>
- </div>
- </van-nav-bar>
- </div>
- <div class="clear-header" v-if="user != 1">
- </div>
- <div style="padding-bottom: 5rem" v-if="myList.length > 0">
- <van-cell-group>
- <van-cell v-for="(item,index) in myList" @click="goPageFn(item)" :key="index" :title="item.paperName">
- <div slot="default">
- <span style="color: green" v-if="item.totalMark >= item.passScore">{{item.totalMark}}分</span>
- <span style="color: red" v-if="item.totalMark < item.passScore">{{item.totalMark}}分</span>
- </div>
- <div slot="label" style="display: flex;justify-content: space-between">
- <p>{{item.createdTime}}</p>
- </div>
- </van-cell>
- </van-cell-group>
- </div>
- <div v-if="myList.length < 1">
- <p style="margin: 0 auto;text-align: center;margin-top: 5rem;color: #aaa">暂无数据</p>
- </div>
- </div>
- <script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>
- <script src="../../../assets/module/vue.js"></script>
- <script src="../../../assets/libs/jquery/jquery-3.2.1.min.js"></script>
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@2.2/lib/index.css">
- <script src="https://cdn.jsdelivr.net/npm/vant@2.2/lib/vant.min.js"></script>
- <script type="text/javascript" src="../../../assets/js/common.js?v=312"></script>
- <script>
- function getUrlParam(name) {
- var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
- //如果地址栏中出现中文则进行编码
- var r = encodeURI(window.location.search).substr(1).match(reg);
- if (r != null) {
- //将中文编码的字符重新变成中文
- return decodeURI(unescape(r[2]));
- }
- return null;
- }
- var postId = getUrlParam("postId");
- new Vue({
- el: "#app",
- data: {
- num: 1,
- user: '',
- limit: 1000,
- count: 1,
- myList: [],
- },
- mounted() {
- this.num = this.getQueryVariable('num');
- this.user = this.getQueryVariable('user');
- //获取试卷记录列表
- this.recordqueryFn();
- },
- methods: {
- getQueryVariable(variable) {
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i = 0; i < vars.length; i++) {
- var pair = vars[i].split("=");
- if (pair[0] == variable) {
- return pair[1];
- }
- }
- return (false);
- },
- //获取试卷记录列表
- recordqueryFn() {
- let _this = this;
- layui.use(['uParas', 'admin'], () => {
- let admin = layui.admin;
- let uParas = layui.uParas;
- let url = uParas.baseUrl + '/ol/userTestPaper/record/query';
- let paperId = '';
- if (this.num == 2) {
- paperId = this.getQueryVariable('paperId');
- }
- $.ajax({
- type: 'get',
- url: url,
- data: {
- page: 1,
- limit: this.limit,
- paperId: paperId,
- status: this.num,
- },
- headers: {
- 'accept': 'application/json, text/javascript, */*; q=0.01',
- 'Authorization': localStorage.getItem('atoken')
- },
- success: function (res) {
- console.log(res);
- _this.myList = res.data;
- },
- });
- })
- },
- goPageFn(item) {
- if (this.user == 1) {
- let zindex = $(window.parent.document).find('.layui-layer-iframe').css('z-index');
- $(window.parent.document).find('.layui-layer-iframe').css({
- zIndex: zindex,
- width: '90%',
- height: '90%',
- position: 'absolute',
- top: '40px',
- left: '50px',
- })
- }
- location.href = './detail.html?recordId=' + item.recordId;
- },
- onClickLeft() {
- window.history.back(-1);
- },
- }
- })
- </script>
- </body>
- </html>
|