Browse Source
- 新增发布作业页面,包含班级、课程选择和作业内容输入功能 - 新增作业列表页面,展示作业信息和完成率 - 在教练首页添加作业批改入口,可跳转到作业列表页面 - 优化master
4 changed files with 405 additions and 2 deletions
@ -0,0 +1,104 @@ |
|||||
|
<!--发布作业--> |
||||
|
<template> |
||||
|
<view class="main_section"> |
||||
|
<view class="formData"> |
||||
|
<view> |
||||
|
<fui-input required label="班级" borderTop placeholder="请选择班级" v-model="formData.class_name" @click="show_class=true"></fui-input> |
||||
|
<fui-picker layer="1" :linkage="true" :options="options_class_arr" :show="show_class" @change="changeClass" @cancel="show_class=false"></fui-picker> |
||||
|
</view> |
||||
|
|
||||
|
<view> |
||||
|
<fui-input required label="课程" borderTop placeholder="请选择课程" v-model="formData.course_name" @click="show_course=true"></fui-input> |
||||
|
<fui-picker |
||||
|
layer="1" |
||||
|
:linkage="true" |
||||
|
:options="options_course_arr" :show="show_course" @change="changeCourse" @cancel="show_course=false"></fui-picker> |
||||
|
</view> |
||||
|
|
||||
|
<view> |
||||
|
<fui-textarea required flexStart label="作业" placeholder="请输入内容" v-model="formData.homework"></fui-textarea> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<!-- 底部导航--> |
||||
|
<AQTabber/> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import user from '@/api/user.js'; |
||||
|
import AQTabber from "@/components/AQ/AQTabber.vue" |
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
AQTabber, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
show_class:false, |
||||
|
show_course:false, |
||||
|
|
||||
|
|
||||
|
options_class_arr:[ |
||||
|
{ value: 1, text: '班级1' }, |
||||
|
{ value: 2, text: '班级2' }, |
||||
|
{ value: 3, text: '班级3' } |
||||
|
], |
||||
|
options_course_arr:[ |
||||
|
{ value: 1, text: '课程1' }, |
||||
|
{ value: 2, text: '课程2' }, |
||||
|
{ value: 3, text: '课程3' } |
||||
|
], |
||||
|
|
||||
|
formData:{ |
||||
|
class_name:'',//班级(下拉) |
||||
|
class_id:'',//班级(下拉) |
||||
|
course_name:'',//课程(下拉) |
||||
|
course_id:'',//课程(下拉) |
||||
|
homework:'',//作业(文本域) |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
onLoad() { |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
//监听选择器-班级 |
||||
|
changeClass(e) { |
||||
|
console.log('选择器-班级', e); |
||||
|
this.formData.class_id = e.value; // 更新 class_id |
||||
|
this.formData.class_name = e.text; // 更新 class_name |
||||
|
this.show_class = false; // 关闭选择器 |
||||
|
}, |
||||
|
//监听选择器-课程 |
||||
|
changeCourse(e) { |
||||
|
console.log('选择器-课程', e); |
||||
|
this.formData.course_id = e.value; // 更新 course_id |
||||
|
this.formData.course_name = e.text; // 更新 course_name |
||||
|
this.show_course = false; // 关闭选择器 |
||||
|
}, |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="less" scoped> |
||||
|
|
||||
|
.main_section{ |
||||
|
min-height: 100vh; |
||||
|
background: #292929 100%; |
||||
|
padding: 0 24rpx; |
||||
|
padding-top: 40rpx; |
||||
|
padding-bottom: 150rpx; |
||||
|
font-size: 28rpx; |
||||
|
.formData{ |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
gap: 40rpx; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
</style> |
||||
@ -0,0 +1,266 @@ |
|||||
|
<!--作业列表--> |
||||
|
<template> |
||||
|
<view class="main_section"> |
||||
|
|
||||
|
<view class="section_3"> |
||||
|
<view class="ul"> |
||||
|
<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> |
||||
|
<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> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<!-- 底部导航--> |
||||
|
<AQTabber/> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import user from '@/api/user.js'; |
||||
|
import AQTabber from "@/components/AQ/AQTabber.vue" |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
components: { |
||||
|
AQTabber, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
list: [], |
||||
|
likes: 0, |
||||
|
type: 1, |
||||
|
type1: 1, |
||||
|
activity_id: 0, |
||||
|
um_id: 0, |
||||
|
urls: 'http://medication.zeyan.wang/' |
||||
|
} |
||||
|
}, |
||||
|
onLoad() { |
||||
|
const um_id = uni.getStorageSync('um_id'); |
||||
|
this.um_id = um_id |
||||
|
if (um_id == '') { |
||||
|
uni.navigateTo({ |
||||
|
url: '/pages/login/login' |
||||
|
}) |
||||
|
} |
||||
|
this.fetchData(this.um_id) |
||||
|
}, |
||||
|
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' |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
onPullDownRefresh() { |
||||
|
this.fetchData(this.um_id) |
||||
|
}, |
||||
|
publishing() { |
||||
|
uni.navigateTo({ |
||||
|
url: '/pages/index/publishing' |
||||
|
}) |
||||
|
}, |
||||
|
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 { |
||||
|
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 => { |
||||
|
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 { |
||||
|
uni.showToast({ |
||||
|
title: res.msg, |
||||
|
icon: 'none' |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
coninfo(item) { |
||||
|
// user.coninfo({id:id}).then(res => { |
||||
|
// if(res.status == 200){ |
||||
|
uni.setStorageSync('coninfo', item); |
||||
|
uni.navigateTo({ |
||||
|
url: '/pages/index/coninfo' |
||||
|
}) |
||||
|
// }else{ |
||||
|
// uni.showToast({ |
||||
|
// title: res.msg, |
||||
|
// icon: 'none' |
||||
|
// }) |
||||
|
// } |
||||
|
// }); |
||||
|
}, |
||||
|
Comment(id) { |
||||
|
uni.setStorageSync('actid', id); |
||||
|
uni.navigateTo({ |
||||
|
url: '/pages/index/Comment' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="less" scoped> |
||||
|
|
||||
|
.main_section{ |
||||
|
min-height: 100vh; |
||||
|
background: #292929 100%; |
||||
|
padding: 0 24rpx; |
||||
|
padding-top: 40rpx; |
||||
|
padding-bottom: 150rpx; |
||||
|
font-size: 28rpx; |
||||
|
|
||||
|
.section_3{ |
||||
|
margin-top: 36rpx; |
||||
|
color: #fff; |
||||
|
font-size: 24rpx; |
||||
|
.title_box{ |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
.top_box{ |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
align-items: center; |
||||
|
text{ |
||||
|
font-size: 30rpx; |
||||
|
} |
||||
|
} |
||||
|
.line{ |
||||
|
width: 90rpx; |
||||
|
height: 2px; |
||||
|
background: #29D3B4; |
||||
|
} |
||||
|
} |
||||
|
.ul{ |
||||
|
margin-top: 30rpx; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
gap: 20rpx; |
||||
|
.li{ |
||||
|
position: relative; |
||||
|
border-radius: 22rpx; |
||||
|
background: #434544 100%; |
||||
|
padding: 14rpx 0; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
.left_box{ |
||||
|
margin-left: 28rpx; |
||||
|
width: 146rpx; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
gap: 10rpx; |
||||
|
.date_box{ |
||||
|
display: flex; |
||||
|
font-size: 48rpx; |
||||
|
text:nth-child(1){ |
||||
|
color: #29D3B4; |
||||
|
} |
||||
|
} |
||||
|
.ratio{ |
||||
|
color: #AAAAAA; |
||||
|
} |
||||
|
} |
||||
|
.center_box{ |
||||
|
margin-left: 52rpx; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
gap: 10rpx; |
||||
|
} |
||||
|
.right_box{ |
||||
|
.tag{ |
||||
|
position:absolute; |
||||
|
top: 0rpx; |
||||
|
right: 0rpx; |
||||
|
padding: 10rpx; |
||||
|
width: 102rpx; |
||||
|
text-align: center; |
||||
|
font-size: 24rpx; |
||||
|
border-bottom-left-radius: 20rpx; |
||||
|
border-top-right-radius: 20rpx; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
</style> |
||||
Loading…
Reference in new issue