Browse Source

feat(coach): 教练端新增作业列表功能

- 添加 jsGetAssignmentsList 方法获取作业列表数据
- 实现作业列表页面布局和数据展示
- 添加下拉加载更多功能
- 优化页面样式,包括 scroll-view 组件的使用
master
liutong 12 months ago
parent
commit
7372ab1e0d
  1. 9
      api/member.js
  2. 197
      pages/coach/job/list.vue

9
api/member.js

@ -234,6 +234,15 @@ export default {
})
},
//教练端-作业列表
jsGetAssignmentsList(data = {}) {
let url = '/member/get_assignments_list'
return http.get(url, data).then(res => {
return res;
})
},

197
pages/coach/job/list.vue

@ -2,54 +2,38 @@
<template>
<view class="main_section">
<view class="section_3">
<scroll-view
class="section_3"
scroll-y="true"
:lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData"
style="height: 80vh;"
>
<view class="ul">
<view class="li">
<view class="li" v-for="(v,k) in tableList" :key="k" @click="openViewWorkDetails(v)">
<view class="left_box">
<view class="date_box">
<text>12</text>
<text>{{v.wc_count}}</text>
<text>/</text>
<text>24</text>
<text>{{v.student_count}}</text>
</view>
<view class="ratio">
完成率80%
完成率{{v.rate}}%
</view>
</view>
<view class="center_box">
<view>班级少年班</view>
<view>时间2020-05-25 15:30 - 17:30</view>
<view>课程篮球少儿课
<view>班级{{v.class_name}}</view>
<view>时间{{v.send_time}}</view>
<view>课程{{v.courses_name}}
</view>
</view>
<view class="right_box">
<!-- <view class="tag" style="background:#fad24e;">上课中</view>-->
<view class="tag" style="background:#1cd188;">待批改</view>
</view>
</view>
<view class="li">
<view class="left_box">
<view class="date_box">
<text>12</text>
<text>/</text>
<text>24</text>
</view>
<view class="ratio">
完成率80%
</view>
</view>
<view class="center_box">
<view>班级少年班</view>
<view>时间2020-05-25 15:30 - 17:30</view>
<view>课程篮球少儿课
</view>
</view>
<view class="right_box">
<!-- <view class="tag" style="background:#fad24e;">上课中</view>-->
<view class="tag" style="background:#1cd188;">待批改</view>
</view>
<view class="tag" v-if="v.dpg_count == 0" style="background:#1cd188;">待批改</view>
</view>
</view>
</view>
</scroll-view>
<!-- 底部导航-->
<AQTabber/>
@ -57,7 +41,7 @@
</template>
<script>
// import user from '@/api/user.js';
import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue"
@ -67,110 +51,89 @@ export default {
},
data() {
return {
list: [],
likes: 0,
type: 1,
type1: 1,
activity_id: 0,
um_id: 0,
urls: 'http://medication.zeyan.wang/'
}
loading:false,//
lowerThreshold: 100,//
isReachedBottom: false,//|true=|false=
//
filteredData:{
page:1,//
limit:10,//
total:10,//
},
onLoad() {
const um_id = uni.getStorageSync('um_id');
this.um_id = um_id
if (um_id == '') {
uni.navigateTo({
url: '/pages/login/login'
})
tableList:[],//
}
this.fetchData(this.um_id)
},
onLoad() {},
onShow() {
this.init()
},
methods: {
fetchData(um_id) {
user.activity_index({
um_id: um_id
}).then(res => {
console.log(res)
if (res.status == 200) {
if (res.data == null) {
this.list = []
} else {
this.list = res.data
}
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
});
async init(){
this.getList()
},
onPullDownRefresh() {
this.fetchData(this.um_id)
//()
loadMoreData() {
//
if (!this.isReachedBottom) {
this.isReachedBottom = true;//
this.getList();
}
},
publishing() {
uni.navigateTo({
url: '/pages/index/publishing'
})
//
async resetFilteredData() {
this.isReachedBottom = false; // 便
this.filteredData.page = 1//
this.filteredData.limit = 10//
this.filteredData.total = 10//
},
like(id, um_id) {
user.activity_like({um_id: um_id, activity_id: id, type: 1}).then(res => {
if (res.status == 200) {
user.activity_index({
um_id: um_id
}).then(res => {
console.log(res)
if (res.status == 200) {
this.list = res.data
}
});
this.type = res.data.type
this.activity_id = res.data.activity_id
} else {
//
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: res.msg,
title: '暂无更多',
icon: 'none'
})
return
}
});
},
collection(id, um_id) {
user.activity_like({um_id: um_id, activity_id: id, type: 2}).then(res => {
if (res.status == 200) {
console.log(res)
this.fetchData(this.um_id)
this.type1 = res.data.type
this.activity_id = res.data.activity_id
} else {
if(data.page == 1){
this.tableList = []
}
let res = await memberApi.jsGetAssignmentsList(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
});
this.tableList = this.tableList.concat(res.data.data); // 使 concat
console.log('列表',this.tableList)
this.filteredData.total = res.data.total
this.filteredData.page++
},
coninfo(item) {
// user.coninfo({id:id}).then(res => {
// if(res.status == 200){
uni.setStorageSync('coninfo', item);
//-
openViewWorkDetails(item){
let id = item.id
uni.navigateTo({
url: '/pages/index/coninfo'
url: `/pages/coach/student/work_details?id=${id}`
})
// }else{
// uni.showToast({
// title: res.msg,
// icon: 'none'
// })
// }
// });
},
Comment(id) {
uni.setStorageSync('actid', id);
uni.navigateTo({
url: '/pages/index/Comment'
})
}
}
}
</script>

Loading…
Cancel
Save