Commit b58dd8ad authored by youjie's avatar youjie

no message

parent cb8efaca
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
} from "vue"; } from "vue";
import navbar from '../../components/navbar.vue' import navbar from '../../components/navbar.vue'
export default { export default {
props: ["CourseCommentTimesList","courseId"], props: ["CourseCommentTimesList","courseId","courseName"],
emits: ['refreshData'], emits: ['refreshData'],
components: { components: {
navbar, navbar,
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
addComments(){ addComments(){
console.log(props.courseId) console.log(props.courseId)
uni.navigateTo({ uni.navigateTo({
url: '/pages/setComments/teacher-commit?courseId=' + props.courseId url: '/pages/setComments/teacher-commit?courseId=' + props.courseId +'&courseName=' + props.courseName
}) })
}, },
showActionHandler(item){ showActionHandler(item){
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
</view> </view>
</view> </view>
</view> </view>
<setComments v-if="Msg.CourseId!=''" :CourseCommentTimesList="courseTimeList" :courseId="Msg.CourseId" @refreshData="getCourseCommentTimes"></setComments> <setComments v-if="Msg.CourseId!=''" :CourseCommentTimesList="courseTimeList" :courseId="Msg.CourseId" :courseName="CourseName" @refreshData="getCourseCommentTimes"></setComments>
</view> </view>
</view> </view>
......
...@@ -17,13 +17,13 @@ ...@@ -17,13 +17,13 @@
<van-cell title="参考作业" :value="showWorkStr" is-link @click="showWorks=homeWorks.length>0" /> <van-cell title="参考作业" :value="showWorkStr" is-link @click="showWorks=homeWorks.length>0" />
<van-cell title="使用模板"> <van-cell title="使用模板">
<view slot=""> <view slot="">
<van-switch :checked="msg.UseTemplate" @change="changeCreateMethod" active-color="#C91727" inactive-color="#282828" size="24px" /> <van-switch :checked="UseTemplate" @change="changeCreateMethod" active-color="#C91727" inactive-color="#282828" size="24px" />
</view> </view>
</van-cell> </van-cell>
<van-cell title="选择模板" v-if="msg.UseTemplate" :value="showTemplateStr" is-link @click="showTemplate=true" /> <van-cell title="选择模板" v-if="UseTemplate" :value="showTemplateStr" is-link @click="showTemplate=true" />
</van-cell-group> </van-cell-group>
<van-cell-group title="评语内容" inset v-if="!msg.UseTemplate"> <van-cell-group title="评语内容" inset v-if="!UseTemplate">
<textarea placeholder="请填写评论内容" class="user-pingyu" v-model="msg.Info"></textarea> <textarea placeholder="请填写评论内容" class="user-pingyu" v-model="msg.Info"></textarea>
</van-cell-group> </van-cell-group>
...@@ -68,14 +68,23 @@ ...@@ -68,14 +68,23 @@
title: '手动创建评语' title: '手动创建评语'
}) })
let data = reactive({ let data = reactive({
actions: [{name:'第一次评论',type:1},{name:'第二次评论',type:2},{name:'第三次评论',type:3}], actions: [
// {name:'第一次评论',type:1},
// {name:'第二次评论',type:2},
// {name:'第三次评论',type:3}
],
UseTemplate:true,
msg:{ msg:{
Title:'', Title:'',
StuId:'', CourseId:0,// 课程编号
CourseId:0, ChooseStuList:[],// 学员信息
UseTemplate:true, Info:'',// 评论类型=1时使用
TemplateId:0, CommentType:2,// 评论类型(1-自定义评价,2-模板评价)
Info:'' IsDefault:'',// 是否默认规则(评论类型=2时使用)
CommentId:'',// 规则编号(评论类型=2时使用)
StartHomeWorkId:'',// 开始作业编号
HomeWorkId:'',// 结束作业编号
HomeWorkIds:[],// 所有的作业编号
}, },
chosenStus:[], chosenStus:[],
StuList:[], StuList:[],
...@@ -87,27 +96,129 @@ ...@@ -87,27 +96,129 @@
chosenHomeWork:[], chosenHomeWork:[],
showTemplate:false, showTemplate:false,
showTemplateStr:'请选择', showTemplateStr:'请选择',
saveLoading:false saveLoading:false,
CourseName:''
}); });
let methods = { let methods = {
saveHandler(){ saveHandler(){
if(data.saveLoading) return if(data.saveLoading) return
data.saveLoading=true
//验证数据
//验证数据
if(!data.msg.CourseId){
uni.showToast({
title: '课程编号不能为空',
icon: 'none',
duration: 1000
})
return;
}
if(!data.msg.Title){
uni.showToast({
title: '请输入评价名称',
icon: 'none',
duration: 1000
})
return;
}
if(data.msg.ChooseStuList.length==0){
uni.showToast({
title: '请选择参与学员',
icon: 'none',
duration: 1000
})
return;
}
if(!data.msg.StartHomeWorkId||!data.msg.HomeWorkId||data.msg.HomeWorkIds.length==0){
uni.showToast({
title: '请选择参考作业',
icon: 'none',
duration: 1000
})
return;
}
if(data.msg.CommentType==1){
data.msg.CommentId = 0
data.msg.IsDefault = 0
if(!data.msg.Info){
uni.showToast({
title: '请输入评论内容',
icon: 'none',
duration: 1000
})
return;
}
}else{
data.msg.Info = ''
if(!data.msg.CommentId||data.msg.IsDefault==''){
uni.showToast({
title: '请选择评语模板',
icon: 'none',
duration: 1000
})
return;
}
}
// console.log(data.msg)
data.saveLoading=true
uni.showLoading() uni.showLoading()
//调用接口 //调用接口
proxy.$request("/Teacher/BatchSetStuComment", data.msg).then(res => {
if (res) {
data.saveLoading = false
uni.hideLoading()
uni.showToast({
title: '操作成功!',
icon: 'none',
duration: 500
})
data.msg = {
Title:'',
CourseId:data.msg.CourseId,// 课程编号
ChooseStuList:[],// 学员信息
Info:'',// 评论类型=1时使用
CommentType:2,// 评论类型(1-自定义评价,2-模板评价)
IsDefault:'',// 是否默认规则(评论类型=2时使用)
CommentId:'',// 规则编号(评论类型=2时使用)
StartHomeWorkId:'',// 开始作业编号
HomeWorkId:'',// 结束作业编号
HomeWorkIds:[],// 所有的作业编号
}
}
})
//状态性显示 //状态性显示
}, },
// 获取模板数据
GetCourseCommentList(){
data.showTemplateList = true
uni.showLoading()
let msg = {
CourseId:data.msg.CourseId,
CourseName:data.CourseName,
}
proxy.$request("/Teacher/GetCourseCommentList", msg).then(res => {
if (res) {
let arr = []
res.Data.forEach(item=>{
let dataContent = {
name: `第${item.Times}次评论`,
IsDefault: item.IsDefault,
Id: item.Id
}
arr.push(dataContent)
})
data.actions = arr
}
uni.hideLoading()
})
},
closeAction(){ closeAction(){
data.showTemplate=false data.showTemplate=false
}, },
selectAction(e){ selectAction(e){
let x=e.detail let x=e.detail
data.msg.TemplateId=x.type data.msg.CommentId=x.Id
data.msg.IsDefault=x.IsDefault
data.showTemplateStr=x.name data.showTemplateStr=x.name
}, },
changeTitle({detail}){ changeTitle({detail}){
...@@ -120,7 +231,14 @@ ...@@ -120,7 +231,14 @@
data.showWorks=false data.showWorks=false
}, },
changeCreateMethod({detail}){ changeCreateMethod({detail}){
data.msg.UseTemplate=detail data.UseTemplate=detail
if(data.UseTemplate){
data.msg.CommentType = 2
that.GetCourseCommentList()
}else{
data.msg.CommentType = 1
data.actions = []
}
}, },
getChosenStus(array) { getChosenStus(array) {
data.chosenStus = array data.chosenStus = array
...@@ -140,9 +258,13 @@ ...@@ -140,9 +258,13 @@
}else{ }else{
data.showStusStr='请选择' data.showStusStr='请选择'
} }
data.msg.StuId=[] data.msg.ChooseStuList=[]
array.forEach(x=>{ array.forEach(x=>{
data.msg.StuId.push(x.StuId) let dataContent = {
StuId: x.StuId,
StuName: x.StuName
}
data.msg.ChooseStuList.push(dataContent)
}) })
methods.closepopup() methods.closepopup()
}, },
...@@ -152,7 +274,6 @@ ...@@ -152,7 +274,6 @@
courseId: data.msg.CourseId courseId: data.msg.CourseId
}; };
proxy.$request("/Teacher/GetCourseStu", stuMsg).then(res => { proxy.$request("/Teacher/GetCourseStu", stuMsg).then(res => {
console.log("res", res);
if (res) { if (res) {
data.StuList = res.Data; data.StuList = res.Data;
data.showStusStr=data.StuList.length>0?`全班(${data.StuList.length}人)`:'暂无可选学员' data.showStusStr=data.StuList.length>0?`全班(${data.StuList.length}人)`:'暂无可选学员'
...@@ -179,20 +300,34 @@ ...@@ -179,20 +300,34 @@
x.checked=arr.find(y=>y.HomeWorkId==x.HomeWorkId)?true:false x.checked=arr.find(y=>y.HomeWorkId==x.HomeWorkId)?true:false
}) })
methods.closepopupWork() methods.closepopupWork()
data.msg.HomeWorkIds = []
if( data.chosenHomeWork.length>0){
let i = data.chosenHomeWork.length-1
data.msg.HomeWorkId = data.chosenHomeWork[i].HomeWorkId
data.chosenHomeWork&&data.chosenHomeWork.forEach((item,index)=>{
if(index===0){
data.msg.StartHomeWorkId = item.HomeWorkId
}
data.msg.HomeWorkIds.push(item.HomeWorkId)
})
}
} }
}; };
let that = methods
return { return {
...toRefs(data), ...toRefs(data),
...methods ...methods
}; };
}, },
onLoad(option) { onLoad(option) {
console.log(option)
this.msg.CourseId = option.courseId; this.msg.CourseId = option.courseId;
this.CourseName = option.courseName;
this.getCourseStu() this.getCourseStu()
this.getCourseHomeWorkList() this.getCourseHomeWorkList()
if(this.UseTemplate){
this.GetCourseCommentList()
}
}, },
onShow() { onShow() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment