Files
medicine_app/pages/miniClass/taskDetailForMan.vue
@fawn-nine 28067d851d 暂存
2024-08-12 16:07:24 +08:00

697 lines
16 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<public-module></public-module>
<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;">
</view>
<view class="taskBox">
<h3>题目内容</h3>
<view class="taskTitle">
{{thisTask.title}}
</view>
<view class="imgBox flex_box" v-if="FileList11.length > 0">
<view class="item" v-for="(item, index) in FileList11" :key="index">
<image @click="previewImage(item.url)" :src="item.url" mode="widthFix"></image>
</view>
</view>
<view class="taskContent" v-html="thisTask.content">
</view>
<view class="editBtn" @click="goEdit" v-if="zuoyeList.length == 0">
<text>修改</text>
</view>
</view>
<!-- 提交记录 -->
<view>
<uni-section class="mb-10 nobg" title="提交记录" type="line"></uni-section>
<view class="zuoyeListBox" v-if="zuoyeList.length > 0">
<view class="newBox">
<view class="item " v-for="(item, index) in zuoyeList" @click="editOrAdd(item)">
<view class="leve1 flex_box" style="justify-content: space-between;">
<view class="flex_box" style="justify-items: center;">
<view class="classmateImg">
<image v-if="item.createUser.avatar != null && item.createUser.avatar != ''"
:src="item.createUser.avatar" mode="aspectFit"></image>
<image v-else src="/static/icon/morenAvavter.png" mode="aspectFit"></image>
</view>
<view class="userName flex_box">
<text
v-if="item.createUser.nickname != '' && item.createUser.nickname != null">匿名用户</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="">
{{item.content}}
</view>
<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>
</view>
<u-divider v-show="status == 2" text="已加载全部"></u-divider>
<u-divider v-show="status == 3" text="暂无数据"></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider>
</view>
</view>
<u-popup key="1" :show="showEditBlank" :round="10" @close="closePup" ref="" z-index="998" overlay-style="z-index:998">
<view class="" style="padding: 40rpx; max-height: 80vh; overflow-y:scroll">
<view class="anserBox">
<h3>提交的内容</h3>
<view class="" style="border-bottom: 1px solid #eee; padding-bottom: 20rpx; margin-bottom: 20rpx;">
<view class="anserContent" v-html="curReplay.content">
</view>
<view class="图片">
<view class="imgBox flex_box" v-if="fileList1.length > 0">
<view class="item" v-for="(item, index) in fileList1" :key="index">
<image @click="previewImage(item.url)" :src="item.url" mode="widthFix"></image>
</view>
</view>
</view>
</view>
<view class="date">
日期{{curReplay.createTime}}
</view>
<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="score noscore" v-show="curReplay.scoreSuccess == 0">
未评分
</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-2.5分" />
</uni-forms-item>
</uni-forms>
</view>
<view class="btn_box"><button @click="onSubmit"> </button></view>
</template>
</view>
</view>
</u-popup>
<z-navigation></z-navigation>
</view>
</template>
<script>
// const taskinfo1 = require('@/data/manTaskInfo.json')
import $http from '@/config/requestConfig.js';
import {
mapState
} from "vuex";
export default {
data() {
return {
showEditBlank: false,
zuoyeList: [],
loadFlag: false,
thisTask: {},
status: 88,
TaskId: undefined,
userMes: undefined,
FileList11: [],
fileList1: [],
pPage: 0,
form: {
score: undefined, //分数
id: undefined,
},
// ispreviewImage :false,
curReplay: {},
rules: {
score: {
rules: [{
required: true,
errorMessage: '请输入分数',
}
]
},
},
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.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()
},
onReachBottom() {
if (this.status != 2 && this.status != 3) {
this.getReplayList()
}
},
onPullDownRefresh() {
// this.getTaskInfo()
uni.stopPullDownRefresh()
},
onShow() {
this.form.taskId = this.thisTask.id
// console.log('this.ispreviewImage',this.ispreviewImage);
// if(this.ispreviewImage){
// this.showEditBlank = true
// this.ispreviewImage = false
// }
this.FileList11 = []
this.getTaskInfo()
},
computed: {
...mapState(["userInfo"]),
},
methods: {
// 获取医案任务详情
getTaskInfo() {
$http.request({
url: "common/class/getClassTaskInfo",
method: "POST",
data: {
"taskId": this.thisTask.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
// that.isHave = true
// console.log(res)
this.thisTask = res.result.classTask
// this.zuoyeList = res.result.userList
// this.thisTask = taskinfo1.classTask
this.fileList11 = []
if (this.thisTask.img != '') {
var imgs = this.thisTask.img.split(',')
imgs = imgs.forEach((item, index) => {
this.FileList11.push({
url: item
})
})
}
console.log('thisTask', this.thisTask);
}
}).catch(e => {
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title: e.msg,
icon: 'error'
})
});
},
closePup() {
this.showEditBlank = false
this.form = {
score: undefined,
id: undefined,
}
this.curReplay = {}
this.fileList1 = []
},
deletePic(event) {
this.fileList1.splice(event.index, 1)
},
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
},
radioChange1(e) {
this.listDisplay = e.detail.value
console.log('点了', e);
this.pPage = 0
this.zuoyeList = []
this.getReplayList()
},
previewImage(url) {
console.log(url);
// this.ispreviewImage = true
// this.showEditBlank = false
uni.previewImage({
urls: [url],
longPressActions: {
itemList: ["很抱歉,暂不支持保存图片到本地"],
success: function(res) {
// console.log(res,'+++++')
},
},
});
},
getReplayList() {
this.status = 1;
if (this.loadFlag) {
console.log("有未完成的进程");
return;
}
uni.showLoading({
title: '加载中'
})
this.loadFlag = true;
this.pPage++;
$http.request({
url: 'common/class/getReplyListByTaskId',
method: "POST",
data: {
"limit": 10,
"page": this.pPage,
"taskId": this.thisTask.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.page.records.length > 0) {
var list = res.page.records
list.forEach(item => {
item.fileList = []
if (item.img != '') {
var _urs = item.img.split(',')
_urs.forEach(item1 => {
item.fileList.push({
url: item1
})
})
}
})
this.zuoyeList = this.zuoyeList.concat(list)
console.log('chulihoude ', this.zuoyeList);
if (res.page.pages > this.pPage) {
this.status = 0;
} else {
this.status = 2;
}
} else {
this.status = 3; // 暂无数据
}
this.loadFlag = false;
console.log('res', res);
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
this.loadFlag = false;
// console.log('表单错误信息:', err);
uni.showToast({
title: '获取作业列表失败',
icon: 'none'
})
})
},
goEdit(){
uni.navigateTo({
url:`/pages/miniClass/addHomeWork?id=${this.thisTask.id}&type=${this.thisTask.type}`
})
},
getUserInfo() {
// 获取个人信息
if (this.userInfo.id != undefined) {
this.$http.post("common/user/getUserInfo").then((res) => {
this.userMes = res.result
}).catch(e => {
uni.showToast({
title: '获取用户信息失败',
icon: 'none'
})
});
}
},
// 跳转
onPageJump(url, id, modeType) {
uni.navigateTo({
url: `${url}?id=${id}&type=${modeType}`
});
},
onSubmit() {
this.$refs.form.validate().then(res => {
if(this.form.score > 2.5){
uni.showToast({
title:'分数不能大于2.5',
icon:'none'
})
return
}
if(this.form.score < 0){
uni.showToast({
title:'分数不能小于0分',
icon:'none'
})
return
}
var _url = "common/class/editScore"
var data = {
"score": this.form.score,
"replyId": this.form.id
}
console.log('data后台提交数据', data);
$http.request({
url: _url,
method: "POST",
data,
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
uni.showToast({
title: '操作成功!',
icon: 'success'
})
this.FileList = []
setTimeout(()=>{
this.closePup()
this.pPage = 0
this.zuoyeList = []
this.getReplayList()
},1000)
}).catch(e => {
uni.showToast({
title: '操作失败',
icon: 'error'
})
});
}).catch(err => {
console.log('表单错误信息:', err);
uni.showToast({
title: '页面有未填写的内容哦',
icon: 'none'
})
})
},
clickStudents(item) {
console.log('item', item);
},
addPic(e) {
let that = this;
console.log("添加图片", that.fileList1);
for (var i = 0; i < e.file.length; i++) {
console.log(i, e.file[i].url)
uni.uploadFile({
url: this.$baseUrl + "oss/fileoss",
filePath: e.file[i].url,
//files:e.file,
name: "file",
formData: {},
success: (res) => {
// console.log("添加图片", this.fileList1);
that.fileList1.push({
url: JSON.parse(res.data).url,
});
console.log(that.fileList1, "that.uploadPicLIst");
},
fail: (error) => {
console.log("上传失败", error);
},
});
}
},
async checkPermision() {
var result = await permission.premissionCheck("CAMERA_EXTERNAL_STORAGE")
if (result != 1) {
return false
}
},
radioChange(e) {
this.form.display = e.detail.value
console.log('点了', this.form.display, e);
}
}
}
</script>
<style lang="scss" scoped>
@import "@/style/mixin.scss";
::v-deep .uni-forms-item{margin-bottom: 0 !important;}
.flexbox {
display: flex;
}
i {
color: red;
padding-right: 20rpx;
}
.noanser {
padding: 20rpx;
text-align: center;
// border-bottom: 1px solid #eee;
.btn {
display: inline-block;
border-radius: 20rpx;
padding: 10rpx 20rpx;
background-color: $themeColor;
color: #fff;
}
}
.in {
border: 1rpx solid #eeeeee;
border-radius: 8rpx;
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;
border-radius: 20rpx;
}
.btn_box {
margin-top: 70rpx;
padding-bottom: 20rpx;
button {
font-size: 32rpx;
@include theme('btn_bg') color: #fff;
height: 80rpx;
line-height: 80rpx;
border-radius: 50rpx;
}
}
.fabBox {}
.taskBox {
border: 4rpx dotted #bad7f0;
padding: 20rpx;
padding-top: 0;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
h3 {
line-height: 80rpx;
width: 50%;
margin: 0 auto;
text-align: center;
color: #fff;
border-radius: 0 0 20rpx 20rpx;
background-color: $themeColor;
}
}
.anserBox {
border: 4rpx dotted #2bb447;
margin-top: 30rpx;
padding: 20rpx;
background-color: #fff;
border-radius: 20rpx;
overflow: hidden;
padding-top: 0;
.anserContent{line-height: 50rpx; padding: 20rpx 0; display: block;}
h3 {
line-height: 80rpx;
width: 50%;
margin: 0 auto;
text-align: center;
color: #fff;
background-color: #2bb447;
border-radius: 0 0 20rpx 20rpx;
}
}
.nobg {
background: transparent;
}
.taskTitle {
font-size: 30rpx;
margin: 20rpx 0;
}
.redBorder {
border: 1px solid #ff8f8f !important;
}
.blueBorder {
border: 1px solid #9111aa !important;
}
.greenBorder {
border: 1px solid #55aa00 !important;
}
.newBox {
justify-content: start;
padding: 10rpx 10rpx 0 10rpx;
.classmateImg {
width: 60rpx !important;
height: 60rpx !important;
margin-right: 20rpx;
image {
width: 60rpx !important;
height: 60rpx;
}
}
.item {
background-color: #fff;
border-radius: 20rpx;
box-shadow: none !important;
padding: 20rpx;
margin-bottom: 30rpx;
// border-bottom: 1px solid #eee;
// border-radius: 0 !important;
.leve1 {
align-items: center;
border-bottom: 1px dashed #eee;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
}
.leve2 { overflow: hidden;
.score{float: left;}
.date{float: right;}
}
}
}
.taskContent {
font-size: 30rpx; line-height: 50rpx;
margin-top: 20rpx;
}
.date {
color: #999;
text-align: right;
font-size: 26rpx;
}
.score{color: #55aaff; font-size: 30rpx !important; font-weight: bold;;}
.noscore{color: #ffaa7f;}
.imgBox {
flex-wrap: wrap;
.item {
width: 20%;
margin-right: 10rpx;
border: 1px solid #eee;
padding: 0 !important;
image {
width: 100%;
}
}
}
.manBtnBox {
justify-content: center;
text {
width: 30%;
font-size: 28rpx;
padding: 20rpx 0;
border-radius: 10rpx;
display: block;
margin: 0 20rpx;
color: #fff;
}
.edit {
background-color: $themeColor;
}
.del {
background-color: #ffa4a6;
}
.set {
background-color: #ffca7e;
}
}
.mainContent {
display: block;
color: #333;
padding: 0 20rpx;
padding-bottom: 120rpx;
background-image: linear-gradient(30deg, #d4eaf0 0%, #d4eaf0 50%, #fdf0ed 100%);
min-height: 100vh;
}
</style>