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

@@ -56,8 +56,9 @@
<text v-if="item.createUser.nickname != '' && item.createUser.nickname != null">匿名用户</text>
<text v-else>匿名用户</text>
</view>
</view>
<view class="editBtn" v-if="listDisplay == '1' && item.scoreSuccess == 0">
</view>
<!-- <view class="editBtn" v-if="listDisplay == '1' && item.scoreSuccess == 0"> -->
<view class="editBtn" v-if="listDisplay == '1' && item.scoreSuccess == 0 && item.scoreInfo == ''">
<text @click="editOrAdd(item)">修改</text>
</view>
</view>
@@ -262,18 +263,58 @@
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.form = res.classTaskAndQuesReply
this.fileList1 = []
if(res.classTaskAndQuesReply.img != ''){
var _imgList = res.classTaskAndQuesReply.img.split(',')
_imgList.forEach(item => {
this.fileList1.push({url:item})
})
}
// this.fileList1 = [...res.classTaskAndQuesReply.fileList]
console.log('fileList4545',this.fileList1);
this.showEditBlank = true
}else{
this.form = {}
}
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
uni.showToast({
title: '获取作业详情失败',
icon:'none'
})
})
},
editOrAdd(item){
console.log('item', item);
if(item){
this.form = item
this.fileList1 = [...item.fileList]
console.log('fileList4545',item.fileList);
this.getHomeWorkDetail(item.id)
}
else{
console.log('form', this.form);
this.showEditBlank = true
}
this.showEditBlank = true
},
radioChange1(e){
@@ -376,22 +417,31 @@
},
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(',')
}else{
this.form.img = ''
}
var _url = ""
this.form.id ? _url =
'common/class/editClassTaskReply' : _url = 'common/class/addClassTaskReply'
'common/class/editClassTaskAndQuesReply' : _url = 'common/class/addClassTaskAndQuesReply'
// this.form.id ? _url =
// 'common/class/editClassTaskReply' : _url = 'common/class/addClassTaskReply'
var data = {
"taskId": this.form.id ? undefined : this.form.taskId,
"relationId": this.form.id ? undefined : this.form.taskId,
"id": this.form.id,
"type": this.thisTask.type == '0' || this.thisTask.type == '1' ? '0' : '1', //类型0任务1课后题
"display": this.form.display, //0不展示1展示
"content": this.form.content,
"img": this.form.img
"img": this.form.img
}
console.log('data',data);
$http.request({
url: _url,