This commit is contained in:
@fawn-nine
2024-08-09 17:10:39 +08:00
parent c753ab18a3
commit 7c7c96f630
13 changed files with 1674 additions and 314 deletions

View File

@@ -1,7 +1,7 @@
<template>
<view>
<public-module></public-module>
<z-nav-bar title="医案详情"></z-nav-bar>
<z-nav-bar :title="pageType+'详情'"></z-nav-bar>
<!-- <view class="" style="background-color: #f4f7ff; min-height: calc(100vh - 200rpx);"> -->
<view class="mainContent" v-if="thisTask.id">
<view class="" style="height:40rpx;">
@@ -20,6 +20,9 @@
<view class="taskContent" v-html="thisTask.content">
</view>
<view class="editBtn" @click="goEdit" v-if="zuoyeList.length == 0">
<text>修改</text>
</view>
</view>
<!-- 提交记录 -->
<view>
@@ -51,9 +54,16 @@
<view class="">
{{item.content}}
</view>
<view class="date">
{{item.createTime}}
<view class="">
<view class="score" v-if="item.scoreSuccess == 1">
分数{{item.score}}
</view>
<view class="score noscore" v-else>未评分</view>
<view class="date">
{{item.createTime}}
</view>
</view>
</view>
</view>
</view>
@@ -73,7 +83,7 @@
</view>
<view class="图片">
<view class="imgBox flex_box" v-if="fileList1.length > 0">
<view class="itemImg" v-for="(item, index) in fileList1" :key="index">
<view class="item" v-for="(item, index) in fileList1" :key="index">
<image @click="previewImage(item.url)" :src="item.url" mode="widthFix"></image>
</view>
</view>
@@ -85,15 +95,23 @@
<view class="" v-if="curReplay.createUser" style="color: #999;padding: 10rpx 0;">
学员信息{{curReplay.createUser.nickname != null && curReplay.createUser.nickname != '' ? curReplay.createUser.nickname : '匿名用户'}}
/ {{curReplay.createUser.tel}}
</view>
<view class="score" v-show="curReplay.scoreSuccess == 1">
分数{{curReplay.score}}
</view>
<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" >
<uni-easyinput type="number" v-model="form.score" placeholder="请输入分数" />
</uni-forms-item>
</uni-forms>
<view class="score noscore" v-show="curReplay.scoreSuccess == 0">
未评分
</view>
<view class="btn_box"><button @click="onSubmit"> </button></view>
<template v-if="roleCode.includes('4') || roleCode.includes('5')">
<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" >
<uni-easyinput type="number" v-model="form.score" placeholder="请输入分数:0-100分" />
</uni-forms-item>
</uni-forms>
</view>
<view class="btn_box"><button @click="onSubmit"> </button></view>
</template>
</view>
</view>
</u-popup>
@@ -121,20 +139,16 @@
fileList1: [],
pPage: 0,
form: {
score: undefined, //分数
taskId: undefined,
id: undefined,
display: "1", //0不展示1展示
content: "",
img: ""
score: undefined, //分数
id: undefined,
},
ispreviewImage :false,
curReplay: {},
rules: {
content: {
score: {
rules: [{
required: true,
errorMessage: '请输入回答内容',
errorMessage: '请输入分数',
}
]
@@ -142,19 +156,28 @@
},
listDisplay: '1', // 提交记录展示类型 0 全部 1 自己的
roleCode:'',
pageType:''
}
},
onLoad(e) {
uni.hideTabBar();
// this.thisTask = JSON.parse(e.options)
console.log('e', e)
this.roleCode = e.roleCode
if (e.id) {
this.thisTask.id = e.id
this.getTaskInfo()
this.getReplayList()
}
if(e.type == 0){
// this.form.renwuId = e.renwuId
this.pageType = '作业'
}else if(e.type == 1){
this.pageType = '医案'
}else if( e.type == 2){
this.pageType = '心得'
}
// console.log('this.FileList', this.FileList)
// this.TaskId = e.id
this.getUserInfo()
@@ -172,11 +195,12 @@
onShow() {
this.form.taskId = this.thisTask.id
console.log('this.ispreviewImage',this.ispreviewImage);
if(this.ispreviewImage){
if(this.ispreviewImage){
this.showEditBlank = true
this.ispreviewImage = false
}
this.FileList11 = []
this.getTaskInfo()
},
computed: {
...mapState(["userInfo"]),
@@ -224,28 +248,28 @@
closePup() {
this.showEditBlank = false
this.form = {
taskId: undefined,
id: undefined,
display: "1", //0不展示1展示
content: "",
img: ""
score: undefined,
id: undefined,
}
this.curReplay = {}
this.fileList1 = []
setTimeout(()=>{
this.pPage = 0
this.zuoyeList = []
this.getReplayList()
},1000)
},
deletePic(event) {
this.fileList1.splice(event.index, 1)
},
editOrAdd(item) {
console.log('item', item);
if (item) {
console.log('item', item);
this.curReplay = item
this.form = item
this.form = {...item}
if(this.form.scoreSuccess == 0){
this.form.score = undefined
}
this.fileList1 = [...item.fileList]
console.log('fileList4545', item.fileList);
} else {
console.log('form', this.form);
}
this.showEditBlank = true
},
radioChange1(e) {
@@ -331,6 +355,11 @@
})
},
goEdit(){
uni.navigateTo({
url:`/pages/miniClass/addHomeWork?id=${this.thisTask.id}&type=${this.thisTask.type}`
})
},
getUserInfo() {
// 获取个人信息
if (this.userInfo.id != undefined) {
@@ -351,24 +380,28 @@
});
},
onSubmit() {
this.$refs.form.validate().then(res => {
if (this.fileList1.length > 0) {
let _list = this.fileList1
_list = _list.map(item => item.url)
// console.log('this.fileList1',_list);
this.form.img = _list.join(',')
this.$refs.form.validate().then(res => {
if(this.form.score > 100){
uni.showToast({
title:'分数不能大于100',
icon:'none'
})
return
}
var _url = ""
this.form.id ? _url =
'common/class/editClassTaskReply' : _url = 'common/class/addClassTaskReply'
if(this.form.score < 0){
uni.showToast({
title:'分数不能小于0分',
icon:'none'
})
return
}
var _url = "common/class/editScore"
var data = {
"taskId": this.form.id ? undefined : this.form.taskId,
"id": this.form.id,
"display": this.form.display, //0不展示1展示
"content": this.form.content,
"img": this.form.img
"score": this.form.score,
"replyId": this.form.id
}
console.log('data', data);
console.log('data后台提交数据', data);
$http.request({
url: _url,
method: "POST",
@@ -383,13 +416,7 @@
icon: 'success'
})
this.FileList = []
this.closePup()
setTimeout(() => {
this.pPage = 0
this.zuoyeList = []
this.getTaskInfo()
this.getReplayList()
}, 200)
this.closePup()
}).catch(e => {
uni.showToast({
title: '操作失败',
@@ -479,7 +506,10 @@
padding: 8rpx;
margin-top: 10rpx;
}
.editBtn{text-align: center; margin-top: 20rpx;
text{
padding: 4rpx; display: inline-block; width:40%; text-align: center; color: $themeColor; border: 1px solid $themeColor; border-radius: 6rpx;
}}
.zuoyeListBox {
margin-top: 40rpx;
background-color: #fff;
@@ -592,7 +622,10 @@
margin-bottom: 20rpx;
}
.leve2 {}
.leve2 { overflow: hidden;
.score{float: left;}
.date{float: right;}
}
}
}
@@ -606,15 +639,16 @@
text-align: right;
font-size: 26rpx;
}
.score{color: #55aaff; font-size: 30rpx !important; font-weight: bold;;}
.noscore{color: #ffaa7f;}
.imgBox {
flex-wrap: wrap;
.itemImg {
.item {
width: 20%;
margin-right: 10rpx;
border: 1px solid #eee;
padding: 0 !important;
image {
width: 100%;
}