This commit is contained in:
@fawn-nine
2024-08-19 14:34:32 +08:00
parent 28067d851d
commit 6d8629ff4f
9 changed files with 251 additions and 57 deletions

View File

@@ -37,28 +37,28 @@
:src="item.createUser.avatar" mode="aspectFit"></image>
<image v-else src="/static/icon/morenAvavter.png" mode="aspectFit"></image>
</view>
<view class="userName flex_box">
<view class="userName flex_box">
<text
v-if="item.createUser.nickname != '' && item.createUser.nickname != null">匿名用户</text>
v-if="item.createUser.nickname != '' && item.createUser.nickname != null">{{item.createUser.nickname}}</text>
<text v-else>匿名用户</text>
</view>
</view>
</view>
<view class="leve2">
<!-- <view class="imgBox flex_box" v-if="item.fileList.length > 0">
<view class="itemImg" v-for="(item, index) in item.fileList" :key="index">
<image @click="previewImage(item.url)" :src="item.url" mode="widthFix"></image>
</view>
</view> -->
<view class="leve2">
<view class="">
{{item.content}}
</view>
<view class="">
<view class="" style="margin-top: 20rpx;">
<view class="score" v-if="item.scoreSuccess == 1">
分数{{item.score}}
</view>
<view class="score noscore" v-else>未评分</view>
<view class="score noscore" v-else-if="item.scoreInfo != ''">
<text v-show="item.scoreInfos < 2 && item.haveGiveScore">等待另一名评分员评分</text>
<text v-show="item.scoreInfos < 2 && !item.haveGiveScore">请您评分</text>
<button v-show="item.scoreInfos >= 2" class="getScore" @click.stop="getRealScore(item.id)" >生成成绩</button>
</view>
<view class="score noscore" v-else>未开始评分</view>
<view class="date">
{{item.createTime}}
</view>
@@ -92,7 +92,7 @@
<view class="date">
日期{{curReplay.createTime}}
</view>
<view class="" v-if="curReplay.createUser" style="color: #999;padding: 10rpx 0;">
<view class="" v-if="curReplay.createUser" style="color: #999;padding: 10rpx 0; font-size: 26rpx;">
学员信息{{curReplay.createUser.nickname != null && curReplay.createUser.nickname != '' ? curReplay.createUser.nickname : '匿名用户'}}
/ {{curReplay.createUser.tel}}
</view>
@@ -102,7 +102,7 @@
<view class="score noscore" v-show="curReplay.scoreSuccess == 0">
未评分
</view>
<template v-if="roleCode.includes('4') || roleCode.includes('5')">
<template v-if="roleCode.includes('4') && curReplay.scoreSuccess != 1 || roleCode.includes('5') && curReplay.scoreSuccess != 1">
<view class="" style="background-color: beige; padding: 10rpx 10rpx; margin-top: 20rpx;">
<uni-forms :modelValue="form" :rules="rules" ref="form">
<uni-forms-item label="分数" name="score" >
@@ -110,7 +110,9 @@
</uni-forms-item>
</uni-forms>
</view>
<view class="btn_box"><button @click="onSubmit"> </button></view>
<view class="btn_box ">
<button class="submit" @click="onSubmit"> </button>
</view>
</template>
</view>
</view>
@@ -189,6 +191,9 @@
}
},
onPullDownRefresh() {
this.pPage = 0
this.zuoyeList = []
this.getReplayList()
// this.getTaskInfo()
uni.stopPullDownRefresh()
},
@@ -206,6 +211,47 @@
...mapState(["userInfo"]),
},
methods: {
// 生成成绩
getRealScore(id){
uni.showLoading({
title:'正在处理'
})
$http.request({
url: "common/class/generateScore",
method: "POST",
data: {
"replyId": id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
uni.showToast({
title: '成绩已生成',
icon: 'success'
})
}
setTimeout(()=>{
this.closePup()
this.pPage = 0
this.zuoyeList = []
this.getReplayList()
uni.hideLoading()
},500)
}).catch(e => {
uni.hideLoading()
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title: '成绩生成失败',
icon: 'error'
})
});
},
// 获取医案任务详情
getTaskInfo() {
$http.request({
@@ -258,15 +304,67 @@
deletePic(event) {
this.fileList1.splice(event.index, 1)
},
getHomeWorkDetail(id){
uni.showLoading({
title:"加载中"
})
$http.request({
url: 'common/class/getClassTaskAndQuesReplyInfo',
method: "POST",
data: {
"replyId":id, //0全部作业1我的作业
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res.classTaskAndQuesReply){
console.log('作业详情res',res);
this.curReplay = res.classTaskAndQuesReply
this.form.id = res.classTaskAndQuesReply.id
this.fileList1 = []
if(res.classTaskAndQuesReply.img != ''){
var _imgList = res.classTaskAndQuesReply.img.split(',')
_imgList.forEach(item => {
this.fileList1.push({url:item})
})
}
if(res.classTaskAndQuesReply.scoreInfo != ''){
this.curReplay.scoreInfo = JSON.parse(res.classTaskAndQuesReply.scoreInfo)
}else{
this.curReplay.scoreInfo = {}
}
if(this.curReplay.scoreInfo != {}){
for (let k in this.curReplay.scoreInfo){
console.log(k)
if(k == this.userInfo.id){
this.form.score = this.curReplay.scoreInfo[k]
this.form.hasGiveScore = true
break
}
// console.log(this.curReplay.scoreInfo[k])
}
}
console.log('this.curReplay.scoreInfo',this.curReplay.scoreInfo);
this.showEditBlank = true
}else{
this.curReplay = {}
this.closePup()
}
uni.hideLoading()
}).catch(e => {
this.showEditBlank = false
uni.hideLoading()
uni.showToast({
title: '获取数据失败',
icon:'none'
})
})
},
editOrAdd(item) {
console.log('item', item);
this.curReplay = item
this.form = {...item}
if(this.form.scoreSuccess == 0){
this.form.score = undefined
}
this.fileList1 = [...item.fileList]
this.showEditBlank = true
// console.log('item', item);
this.getHomeWorkDetail(item.id)
},
radioChange1(e) {
this.listDisplay = e.detail.value
@@ -317,6 +415,8 @@
if (res.page.records.length > 0) {
var list = res.page.records
list.forEach(item => {
item.scoreInfos = 0
item.haveGiveScore = false
item.fileList = []
if (item.img != '') {
var _urs = item.img.split(',')
@@ -326,7 +426,22 @@
})
})
}
console.log('item.scoreInfo',item.scoreInfo);
if(item.scoreInfo != ""){
var i = 0
for(var kk in JSON.parse(item.scoreInfo)){
console.log(kk);
if(kk == this.userInfo.id){
item.haveGiveScore = true
}
i++
}
item.scoreInfos = i
}
console.log('item.scoreInfos',item.scoreInfos, item.haveGiveScore);
})
this.zuoyeList = this.zuoyeList.concat(list)
console.log('chulihoude ', this.zuoyeList);
if (res.page.pages > this.pPage) {
@@ -479,6 +594,14 @@
<style lang="scss" scoped>
@import "@/style/mixin.scss";
::v-deep .uni-forms-item{margin-bottom: 0 !important;}
// .btn_box{ justify-content: space-between;
// button{display: block; width: 46%;}
// }
.getScore{
display: inline-block; font-weight: normal; color: #fff; padding: 4rpx 10rpx; height: 60rpx;
line-height: 50rpx; font-size: 28rpx;
background-color: #ffaa7f !important;
}
.flexbox {
display: flex;
}