Browse Source

feat(student): 优化课后作业页面

- 重新设计页面布局,增加滚动视图功能
- 动态加载作业列表,支持分页加载更多数据
- 添加作业完成状态标记和提交时间显示
- 优化作业内容展示,支持富文本格式
-调整样式,提升页面视觉效果
master
liutong 1 year ago
parent
commit
350b379ea4
  1. 195
      pages/student/index/job_list.vue

195
pages/student/index/job_list.vue

@ -3,55 +3,124 @@
<view class="after-class-title">
<view class="after-class-title-left">课后作业</view>
</view>
<view>
<view class="con-list">
<view class="con-list-img">
<image class="pic" src="@/static/images/index/img.jpg"></image>
</view>
<view class="con" style="margin-top: 20rpx;">
时间2020.05:25 15:30
</view>
<view class="con" style="margin-bottom: 20rpx;">
作业描述作业描述作业描述作业描述作业描述作业描述作业描述作业描述作业描述
</view>
<view class="mark" v-if="true">
<image class="check_mark" src="@/static/images/index/check_mark.png"></image>
</view>
<view class="assignment">
班级作业
</view>
</view>
<view class="con-list">
<view class="con-list-img">
<video class="pic" style="width: 100%;border-radius: 15rpx;"></video>
</view>
<view class="con" style="margin-top: 20rpx;">
时间2020.05:25 15:30
</view>
<view class="con" style="margin-bottom: 20rpx;">
作业描述作业描述作业描述作业描述作业描述作业描述作业描述作业描述作业描述
</view>
<view class="mark" v-if="false">
<image class="check_mark" src="@/static/images/index/check_mark.png"></image>
</view>
<view class="assignment">
个人作业
</view>
</view>
</view>
<scroll-view
class="table_list"
scroll-y="true"
:lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData"
style="height: 100vh;"
>
<view class="con-list" v-for="(v,k) in tableList" :key="k">
<view class="con-list-img" v-if="v.student_file">
<video v-if="v.student_file_type == 2" class="pic" style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)"></video>
<image v-else style="width: 100%;border-radius: 15rpx;" :src="$util.img(v.student_file)" mode="aspectFit"></image>
</view>
<view class="date_box">
<view class="describe" style="margin-top: 20rpx;">
时间{{v.submit_time}}
</view>
<!--是否已经完成作业-->
<view class="mark" v-if="v.status == 2">
<image class="check_mark" src="@/static/images/index/check_mark.png"></image>
</view>
</view>
<!--作业描述-->
<view class="con" style="margin-bottom: 20rpx; color:#fff;" v-html="v.content_text"></view>
<view class="assignment">
<view>{{v.type == 1 ? '班级作业' : '个人作业'}}</view>
</view>
</view>
</scroll-view>
</view>
</template>
<script>
import memberApi from '@/api/member.js';
export default {
data() {
return {
loading:false,//
lowerThreshold: 100,//
isReachedBottom: false,//|true=|false=
//
filteredData:{
page:1,//
limit:10,//
total:10,//
status: '',//1=,2=,3=
},
tableList:[],//
}
},
onShow(){
this.init()//
},
methods: {
}
//
async init(){
await this.getList();
},
//()
loadMoreData() {
//
if (!this.isReachedBottom) {
this.isReachedBottom = true;//
this.getList();
}
},
//
loadData() {
setTimeout(() => {
this.isReachedBottom = false; // 便
}, 1000);
},
//
async getList(){
this.loading = true
let data = {...this.filteredData}
//
if(this.filteredData.page * this.filteredData.limit > this.filteredData.total){
this.loading = false
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
let res = await memberApi.assignmentsList(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.tableList = res.data.data
console.log('列表',this.tableList)
this.filteredData.total = res.data.total
this.filteredData.page++
},
},
}
</script>
@ -61,6 +130,10 @@
height: 100vh;
background: #292929;
overflow: auto;
.table_list{
padding-bottom: 150rpx;
}
}
.after-class-title {
width: 92%;
@ -79,7 +152,16 @@
padding: 30rpx;
margin-top: 20rpx;
border-bottom: 2rpx #fff solid;
position: relative;
.date_box{
padding-top: 30rpx;
display: flex;
justify-content: space-between;
align-items: center;
.describe{
width: 75%;
color: #fff;
}
}
}
.con-list-img{
width: 100%;
@ -87,6 +169,16 @@
display: flex;
align-items: center;
justify-content: center;
video{
width: 100%;
height: 280rpx;
}
image{
width: 100%;
height: 280rpx;
}
}
.pic{
width: 85%;
@ -98,9 +190,6 @@
padding-top: 30rpx;
}
.mark{
position: absolute;
right: 8%;
bottom: 23%;
width: 70rpx;
height: 70rpx;
border-radius: 100%;
@ -114,14 +203,16 @@
height: 80%;
}
.assignment{
position: absolute;
right: 3%;
bottom: 10%;
width: 150rpx;
text-align: center;
border-radius: 10rpx;
padding: 6rpx 12rpx;
color: #6b9d53;
border: 2rpx #6b9d53 solid;
display: flex;
justify-content: flex-end;
align-items: center;
view{
padding: 6rpx 12rpx;
color: #6b9d53;
border: 2rpx #6b9d53 solid;
border-radius: 10rpx;
width: 150rpx;
text-align: center;
}
}
</style>

Loading…
Cancel
Save