Browse Source

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

- 添加 jsGetAssignmentsList 方法获取作业列表数据
- 实现作业列表页面布局和数据展示
- 添加下拉加载更多功能
- 优化页面样式,包括 scroll-view 组件的使用
master
liutong 12 months ago
parent
commit
7372ab1e0d
  1. 9
      api/member.js
  2. 215
      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;
})
},

215
pages/coach/job/list.vue

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

Loading…
Cancel
Save