123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <template>
- <view>
- <!--#ifdef APP-PLUS-->
- <view class="lz-status_bar">
- <view class="lz-top_view"></view>
- </view>
- <!--#endif-->
- <!-- #ifndef MP-WEIXIN -->
- <view class="kaoshi-head">
- <view class="kaoshi-head-top">
- <view class="kaoshi-head-left" @tap="$navigateBack">
- <view class="iconfont icon-zuojiantou"></view>
- </view>
- <view class="kaoshi-head-m">考试记录</view>
- </view>
- </view>
- <!--#endif-->
- <view>
- <view class="index-content">
- <view class="index-tiku">
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
- :down="downOption" :up="upOption">
- <block v-for="(item, index) in list" :key="index">
- <view class="index-tiku-box">
- <view class="index-tiku-content">
- <view class="index-tiku-content-flex">
- <view class="index-tiku-content-top">
- <view>{{item.exam_name}}</view>
- </view>
- <view class="pub-orange">{{item.score}}分</view>
- </view>
- <view class="index-tiku-content-flex">
- <view class="index-tiku-content-bottom">
- <view class="pub-gray">考试时间:{{item.up_time}}</view>
- </view>
- <view class="record-type" v-if="item.type == 2">模拟考试</view>
- <view class="record-type" v-if="item.type == 1">正式考试</view>
- </view>
- </view>
- <view class="index-tiku-content-b">
- <view class="index-tiku-content-flex">
- <view class="index-tiku-content-bottom">
- <view class="pub-s-gray">排名</view>
- <view class="kt-r"
- @tap="$openrul('/pages/my/recording/list?exam_id=' + item.exam_id + '&begin_time=' + item.begin_time + '&score=' + item.score)">
- 查看排行榜</view>
- </view>
- <view class="pub-s-gray">第{{item.pm}}名</view>
- </view>
- </view>
- </view>
- </block>
- </mescroll-body>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex'
- import WucTab from '@/components/wuc-tab/wuc-tab.vue';
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- order_sort: [{
- name: '模拟考试',
- goods_type: '1'
- },
- {
- name: '正式考试',
- goods_type: '2'
- }
- ],
- current_id: '0',
- current_index: 0,
- mescroll: null, // mescroll实例对象 (此行可删,mixins已默认)
- // 下拉刷新的配置(可选, 绝大部分情况无需配置)
- downOption: {
- use: true, // 是否启用下拉刷新; 默认true
- auto: false, // 是否在初始化完毕之后自动执行下拉刷新的回调; 默认true
- native: false // 启用系统自带的下拉组件,默认false;仅mescroll-body生效,mescroll-uni无效(native: true, 则需在pages.json中配置"enablePullDownRefresh":true)
- },
- // 上拉加载的配置(可选, 绝大部分情况无需配置)
- upOption: {
- page: {
- num: 0,
- size: 10 // 每页数据的数量,默认10
- },
- noMoreSize: 5, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
- empty: {
- tip: '暂无相关数据'
- }
- },
- // 列表数据
- list: [],
- }
- },
- onShow() {},
- mounted() {
- },
- computed: {
- ...mapState(['subject']),
- },
- components: {
- WucTab
- },
- methods: {
- async upCallback(page) {
- let pageNum = page.num; // 页码, 默认从1开始
- let pageSize = page.size; // 页长, 默认每页10条
- let res = await this.$myHttp.post({
- url: this.$myHttp.urlMap.record,
- data: {
- subject_id: this.subject.id,
- page: pageNum,
- limit: pageSize
- },
- needLogin: true
- })
- if (res.code == 1) {
- // 接口返回的当前页数据列表 (数组)
- let curPageData = res.data.data;
- // 接口返回的当前页数据长度 (如列表有26个数据,当前页返回8个,则curPageLen=8)
- let curPageLen = curPageData.length;
- // 接口返回的总页数 (如列表有26个数据,每页10条,共3页; 则totalPage=3)
- // let totalPage = data.xxx;
- // 接口返回的总数据量(如列表有26个数据,每页10条,共3页; 则totalSize=26)
- let totalSize = res.data.total;
- for (let index in curPageData) {
- curPageData[index].up_time = this.$myUtils.$common.formatDate(
- curPageData[index].up_time * 1000,
- "Y年M月D日 h:m:s"
- );
- }
- this.mescroll.endBySize(curPageLen, totalSize);
- if (page.num == 1) this.list = []; //如果是第一页需手动置空列表
- this.list = this.list.concat(curPageData); //追加新数据
- } else {
- this.mescroll.endErr()
- }
- // 此处仍可以继续写其他接口请求...
- // 调用其他方法...
- },
- }
- }
- </script>
- <style>
- page {
- background: #f6f6f6;
- }
- .index-tiku {
- width: 98%;
- margin: 0 auto;
- }
- .index-tiku-title {
- width: 92%;
- margin: 0 auto;
- padding: 15px 0 8px 0;
- font-weight: bold;
- font-size: 18px;
- }
- .index-tiku-box{
- background: #fff;
- margin: 14px 8px;
- border-radius: 10px;
- box-shadow: 2px 4px 10px rgb(0 0 0 / 8%);
- }
- .index-tiku-content {
- width: 92%;
- margin: 0 auto;
- display: flex;
- flex-direction: column;
- font-size: 16px;
- padding: 14px 0;
- border-bottom: solid 1px #f5f5f5;
- }
- .index-tiku-content-flex {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- .index-tiku-content .index-tiku-content-flex:first-child {
- padding-bottom: 6px;
- }
- .index-tiku-content .index-tiku-content-flex:last-child {
- font-size: 14px;
- }
- .index-tiku-content-top {
- display: flex;
- align-items: center;
- }
- .index-tiku-content-top img {
- width: 20px;
- height: 22px;
- margin-right: 10px;
- }
- .index-tiku-content-bottom {
- display: flex;
- align-items: center;
- font-size: 12px;
- }
- .icon-jiantou8 {
- color: #a5a5a5;
- font-size: 15px;
- }
- .index-tiku-content-b {
- width: 100%;
- font-size: 14px;
- }
- .index-tiku-content-b .index-tiku-content-flex {
- padding: 12px 0;
- width: 92%;
- line-height: 17px;
- margin: 0 auto;
- }
- .index-tiku-content-b-border {
- border-bottom: solid 14px #efeff4;
- }
- .kt-r {
- border: solid 1px #fd850a;
- color: #fd850a;
- font-size: 12px;
- padding:4px 9px;
- border-radius: 4px;
- margin-left: 10px;
- }
- .record-type {
- background: #ececec;
- color: #3c7bfc;
- padding: 5px 12px;
- font-size: 12px;
- margin-left: 8px;
- border-radius: 14px 14px 14px 0;
- }
- </style>
|