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.
110 lines
2.6 KiB
110 lines
2.6 KiB
4 days ago
|
<template>
|
||
|
<view class="page">
|
||
|
<view v-if="practices.length" class="list">
|
||
|
<view v-for="(item, i) in practices" :key="i" class="item" @click="toDetail(item)">
|
||
|
<view class="c-name">{{ item.projectName }}</view>
|
||
|
<view class="line">得分:{{ item.score }}  耗时:{{ item.timeSum }}min</view>
|
||
|
<view class="line">练习开始时间:{{ item.startTime }}</view>
|
||
|
<view class="line">练习结束时间:{{ item.submitTime }}</view>
|
||
|
<view class="btn">成绩报告</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import { practiceByStudentDetail } from '@/apis/modules/course.js'
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
cid: '',
|
||
|
projectId: '',
|
||
|
paperId: '',
|
||
|
practices: [],
|
||
|
reachBottom: 0, // 是否是上拉加载。0->否,1->是,-1->加载完所有数据
|
||
|
status: 'more', // 上拉加载状态 more|loading|noMore
|
||
|
page: 1,
|
||
|
pageSize: 10,
|
||
|
}
|
||
|
},
|
||
|
// 下拉刷新
|
||
|
onPullDownRefresh() {
|
||
|
this.initList()
|
||
|
setTimeout(() => {
|
||
|
uni.stopPullDownRefresh()
|
||
|
}, 1500)
|
||
|
},
|
||
|
// 上拉加载
|
||
|
onReachBottom() {
|
||
|
if (this.reachBottom >= 0) {
|
||
|
this.reachBottom = 1
|
||
|
this.status = 'loading'
|
||
|
this.getList()
|
||
|
}
|
||
|
},
|
||
|
onShow() {
|
||
|
const pages = getCurrentPages()
|
||
|
const { options } = pages[pages.length - 1]
|
||
|
this.cid = options.cid
|
||
|
this.projectId = options.projectId
|
||
|
this.paperId = options.paperId
|
||
|
this.getList()
|
||
|
},
|
||
|
methods: {
|
||
|
// 练习成绩
|
||
|
async getList () {
|
||
|
const { data } = await practiceByStudentDetail({
|
||
|
page: this.page,
|
||
|
pageSize: this.pageSize,
|
||
|
projectId: this.projectId,
|
||
|
paperId: this.paperId,
|
||
|
cid: this.cid
|
||
|
})
|
||
|
this.practices = this.reachBottom > 0 ? [...this.practices, ...data.records] : data.records
|
||
|
this.page++ // 每次获取了数据后page+1
|
||
|
const noMore = this.practices.length === data.total // 是否加载完所有数据
|
||
|
this.status = noMore ? 'noMore' : 'more' // 加载完了则设置为noMore
|
||
|
this.reachBottom = noMore ? -1 : 0 // 加载完了则设置为-1
|
||
|
},
|
||
|
// 跳转
|
||
|
toDetail(row) {
|
||
|
// this.$util.to(path)
|
||
|
},
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style scoped lang="scss">
|
||
|
.page {
|
||
|
padding: 10rpx 30rpx;
|
||
|
background-color: #fff;
|
||
|
}
|
||
|
.list {
|
||
|
.item {
|
||
|
position: relative;
|
||
|
padding: 20rpx 0;
|
||
|
border-bottom: 1px solid #e6e6e6;
|
||
|
}
|
||
|
.c-name {
|
||
|
font-size: 32rpx;
|
||
|
font-weight: 600;
|
||
|
color: #333;
|
||
|
}
|
||
|
.line {
|
||
|
margin-top: 14rpx;
|
||
|
font-size: 26rpx;
|
||
|
color: #828282;
|
||
|
}
|
||
|
.btn {
|
||
|
position: absolute;
|
||
|
bottom: 20rpx;
|
||
|
right: 0;
|
||
|
padding: 10rpx 30rpx;
|
||
|
font-size: 28rpx;
|
||
|
color: #fff;
|
||
|
background-color: #007EFF;
|
||
|
border-radius: 36rpx;
|
||
|
}
|
||
|
}
|
||
|
</style>
|