This commit is contained in:
@fawn-nine
2024-08-08 16:41:29 +08:00
parent 784e771fb8
commit c753ab18a3
10 changed files with 1131 additions and 384 deletions

View File

@@ -21,70 +21,78 @@
</view>
</view>
<!-- 提交记录 -->
<view >
<view class="studentListBox" v-if="thisTask.students && thisTask.students.length > 0">
<view class="newBox flex_box" >
<view class="item " v-for="(item, index) in thisTask.students" @click="clickStudents(item)">
<view class="leve1 " >
<view class="userName">
<text v-if="item.nickname != '' && item.nickname != null">匿名用户</text>
<text v-else>匿名用户</text>
</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="">
<view class="" style="padding: 40rpx; max-height: 80vh; overflow-y:scroll">
<view class="anserBox" >
<h3>我的答案</h3>
<uni-forms :modelValue="form" :rules="rules" ref="form">
<view class="input_box">
<uni-forms-item label="" name="content" label-width="0">
<text class="input_tit"><i>*</i>内容:<span
style="font-weight: normal; color: #999; font-size: 26rpx;">(600字以内)</span></text>
<view class="in">
<view class="uni-textarea">
<textarea placeholder-style="font-size:26rpx" v-model="form.content" maxlength="600"
auto-height placeholder="请输入内容" />
<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>
</uni-forms-item>
</view>
<view class="input_box">
<text class="input_tit">上传图片:</text>
<view class="in" style="border: none;" @click="checkPermision">
<u-upload :fileList="fileList1" @afterRead="addPic" @delete="deletePic" multiple
:maxCount="4" width="40" height="40" :previewFullImage="true">
</u-upload>
<!-- <text style="font-size: 24rpx; color: #999;">可上传4张问题截图</text> -->
</view>
<!-- <input type="password" maxlength="8" v-model="confirmPassword" placeholder="请确认密码" /> -->
</view>
<view class="input_box">
<radio-group @change="radioChange" class="flex_box">
<view class="" style="margin-right:20rpx ;">
<radio value="0" :checked="0 == form.display" />他人不可见</label>
<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="">
<radio value="1" :checked="1 == form.display" />他人可见</label>
{{item.content}}
</view>
</radio-group>
<span
style="color: #999; font-size: 28rpx; margin-top: 20rpx; display: block;">不勾选时班级管理员以外的人看不见提交的内容</span>
<view class="date">
{{item.createTime}}
</view>
</view>
</view>
</uni-forms>
</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="">
<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="itemImg" 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="" 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>
<view class="btn_box"><button @click="onSubmit"> </button></view>
</view>
</view>
@@ -94,7 +102,7 @@
</template>
<script>
const taskinfo1 = require('@/data/manTaskInfo.json')
// const taskinfo1 = require('@/data/manTaskInfo.json')
import $http from '@/config/requestConfig.js';
import {
mapState
@@ -102,23 +110,26 @@
export default {
data() {
return {
showEditBlank:false,
studentList:[],
loadFlag:false,
showEditBlank: false,
zuoyeList: [],
loadFlag: false,
thisTask: {},
status: 88,
TaskId: undefined,
userMes: undefined,
FileList11: [],
FileList11: [],
fileList1: [],
pPage: 0,
form: {
score: undefined, //分数
taskId: undefined,
id: undefined,
display: "1", //0不展示1展示
content: "",
img: ""
},
ispreviewImage :false,
curReplay: {},
rules: {
content: {
rules: [{
@@ -131,27 +142,27 @@
},
listDisplay: '1', // 提交记录展示类型 0 全部 1 自己的
}
},
onLoad(e) {
uni.hideTabBar();
// this.thisTask = JSON.parse(e.options)
console.log('e',e)
if(e.id){
this.thisTask.id = e.id
this.getTaskInfo()
this.getstudentList()
}
console.log('e', e)
if (e.id) {
this.thisTask.id = e.id
this.getTaskInfo()
this.getReplayList()
}
// console.log('this.FileList', this.FileList)
// this.TaskId = e.id
this.getUserInfo()
},
onReachBottom() {
if (this.status != 2 && this.status != 3) {
this.getstudentList()
this.getReplayList()
}
},
onPullDownRefresh() {
@@ -159,15 +170,20 @@
uni.stopPullDownRefresh()
},
onShow() {
this.form.taskId = this.thisTask.id
this.form.taskId = this.thisTask.id
console.log('this.ispreviewImage',this.ispreviewImage);
if(this.ispreviewImage){
this.showEditBlank = true
this.ispreviewImage = false
}
},
computed: {
...mapState(["userInfo"]),
},
methods: {
// 获取医案任务详情
getTaskInfo(){
getTaskInfo() {
$http.request({
url: "common/class/getClassTaskInfo",
method: "POST",
@@ -182,8 +198,9 @@
if (res.code == 0) {
// that.isHave = true
// console.log(res)
// this.thisTask = res.classTask
this.thisTask = taskinfo1.classTask
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(',')
@@ -192,8 +209,8 @@
url: item
})
})
}
console.log('thisTask',this.thisTask);
}
console.log('thisTask', this.thisTask);
}
}).catch(e => {
console.log(e, '数据报错')
@@ -204,7 +221,7 @@
})
});
},
closePup(){
closePup() {
this.showEditBlank = false
this.form = {
taskId: undefined,
@@ -218,29 +235,30 @@
deletePic(event) {
this.fileList1.splice(event.index, 1)
},
editOrAdd(item){
editOrAdd(item) {
console.log('item', item);
if(item){
if (item) {
this.curReplay = item
this.form = item
this.fileList1 = [...item.fileList]
console.log('fileList4545',item.fileList);
}
else{
this.fileList1 = [...item.fileList]
console.log('fileList4545', item.fileList);
} else {
console.log('form', this.form);
}
this.showEditBlank = true
},
radioChange1(e){
radioChange1(e) {
this.listDisplay = e.detail.value
console.log('点了',e);
console.log('点了', e);
this.pPage = 0
this.studentList = []
this.getstudentList()
this.zuoyeList = []
this.getReplayList()
},
previewImage(url) {
console.log(url);
this.ispreviewImage = true
this.showEditBlank = false
uni.previewImage({
urls: [url],
longPressActions: {
@@ -251,50 +269,52 @@
},
});
},
getstudentList() {
getReplayList() {
this.status = 1;
if (this.loadFlag) {
console.log("有未完成的进程");
return;
}
uni.showLoading({
title:'加载中'
title: '加载中'
})
this.loadFlag = true;
this.pPage++;
$http.request({
url: 'common/class/getReplyListByTaskIdStudent',
url: 'common/class/getReplyListByTaskId',
method: "POST",
data: {
"limit": 10,
"page": this.pPage,
"taskId": this.thisTask.id,
"myReply": this.listDisplay //0全部作业1我的作业
"taskId": this.thisTask.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res.page.records.length > 0){
if (res.page.records.length > 0) {
var list = res.page.records
list.forEach(item => {
item.fileList = []
if(item.img != ''){
if (item.img != '') {
var _urs = item.img.split(',')
_urs.forEach(item1 => {
item.fileList.push({url:item1})
item.fileList.push({
url: item1
})
})
}
})
this.studentList = this.studentList.concat(list)
console.log('chulihoude ',this.studentList);
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{
} else {
this.status = 3; // 暂无数据
}
this.loadFlag = false;
@@ -306,7 +326,7 @@
// console.log('表单错误信息:', err);
uni.showToast({
title: '获取作业列表失败',
icon:'none'
icon: 'none'
})
})
@@ -339,8 +359,8 @@
this.form.img = _list.join(',')
}
var _url = ""
this.form.id ? _url =
'common/class/editClassTaskReply' : _url = 'common/class/addClassTaskReply'
this.form.id ? _url =
'common/class/editClassTaskReply' : _url = 'common/class/addClassTaskReply'
var data = {
"taskId": this.form.id ? undefined : this.form.taskId,
"id": this.form.id,
@@ -348,7 +368,7 @@
"content": this.form.content,
"img": this.form.img
}
console.log('data',data);
console.log('data', data);
$http.request({
url: _url,
method: "POST",
@@ -363,14 +383,14 @@
icon: 'success'
})
this.FileList = []
this.closePup()
setTimeout(()=>{
this.closePup()
setTimeout(() => {
this.pPage = 0
this.studentList = []
this.zuoyeList = []
this.getTaskInfo()
this.getstudentList()
},200)
}).catch(e => {
this.getReplayList()
}, 200)
}).catch(e => {
uni.showToast({
title: '操作失败',
icon: 'error'
@@ -384,14 +404,14 @@
})
})
},
clickStudents(item){
console.log('item',item);
clickStudents(item) {
console.log('item', item);
},
addPic(e) {
addPic(e) {
let that = this;
console.log("添加图片", that.fileList1);
console.log("添加图片", that.fileList1);
for (var i = 0; i < e.file.length; i++) {
console.log(i,e.file[i].url)
console.log(i, e.file[i].url)
uni.uploadFile({
url: this.$baseUrl + "oss/fileoss",
filePath: e.file[i].url,
@@ -422,14 +442,14 @@
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;
}
@@ -438,18 +458,34 @@
color: red;
padding-right: 20rpx;
}
.noanser{ padding: 20rpx;
text-align: center;
.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;}
.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;
}
.studentListBox{margin-top: 40rpx; background-color: #fff; border-radius: 20rpx;}
.zuoyeListBox {
margin-top: 40rpx;
background-color: #fff;
border-radius: 20rpx;
}
.btn_box {
margin-top: 70rpx;
padding-bottom: 20rpx;
@@ -492,7 +528,7 @@
border-radius: 20rpx;
overflow: hidden;
padding-top: 0;
.anserContent{line-height: 50rpx; padding: 20rpx 0; display: block;}
h3 {
line-height: 80rpx;
width: 50%;
@@ -503,44 +539,81 @@
border-radius: 0 0 20rpx 20rpx;
}
}
.nobg{background: transparent;}
.nobg {
background: transparent;
}
.taskTitle {
font-size: 30rpx;
margin: 20rpx 0;
}
.newBox { justify-content:start; padding:10rpx 10rpx 0 10rpx;
.item { width: 24%; margin: 0 6rpx;
background-color: #fff;
border-radius:8rpx;
box-shadow: none !important;
padding:8rpx; text-align: center;
margin-bottom:16rpx;
border: 1px solid #eee;
// border-bottom: 1px solid #eee;
// border-radius: 0 !important;
.leve1 {
align-items: center;
.userName{ font-size: 26rpx; width: 100%;
text{display: block; width: 100%;}
}
}
.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 {}
}
}
.taskContent {
font-size: 30rpx;
font-size: 30rpx; line-height: 50rpx;
margin-top: 20rpx;
}
.date {
color: #999;
text-align: right;
font-size: 26rpx;
}
.imgBox {
flex-wrap: wrap;
.item {
.itemImg {
width: 20%;
margin-right: 10rpx; border: 1px solid #eee;
margin-right: 10rpx;
border: 1px solid #eee;
image {
width: 100%;