Files
dvcp_v2_wxcp_app/library/project/fd/AppAnswer/answerAdd.vue

117 lines
2.3 KiB
Vue
Raw Normal View History

2023-01-10 11:35:04 +08:00
<template>
<div class="answerAdd">
2023-01-10 14:36:10 +08:00
<div class="input_box">
2023-01-11 14:10:31 +08:00
<u-input v-model="form.content" type="textarea" height="580" maxlength="10000"
2023-01-10 14:36:10 +08:00
:clearable="false" placeholder="请输入回答内容" :auto-height="true" placeholder-style="color: '#AAAAAA';font-size: 16px" />
</div>
<div class="upload">
<h4>图片上传<span>(最多9张)</span></h4>
2023-01-11 14:10:31 +08:00
<AiUploader :def.sync="form.files" multiple placeholder="上传图片" :limit="9" action="/admin/file/add2"></AiUploader>
2023-01-10 14:36:10 +08:00
</div>
<div class="submitBtn">
2023-01-11 14:10:31 +08:00
<div class="btn" @click="submit">提交</div>
2023-01-10 14:36:10 +08:00
</div>
2023-01-10 11:35:04 +08:00
</div>
</template>
<script>
export default {
name: "answerAdd",
appName: "进行回答",
data() {
return {
2023-01-10 14:36:10 +08:00
form: {
2023-01-11 14:10:31 +08:00
qid: '',
content: '',
files: []
},
flag: false,
2023-01-10 11:35:04 +08:00
}
},
methods: {
2023-01-11 14:10:31 +08:00
submit() {
if(this.flag) return
if(!this.form.content) {
return this.$u.toast('请输入回答内容')
}
this.flag = true
2023-01-11 14:48:37 +08:00
this.$loading()
2023-01-11 14:10:31 +08:00
this.$http.post(`/app/applearningquestion/addOrUpdateAnswer`, {
...this.form
}).then(res=> {
if(res?.code==0) {
this.$u.toast('提交成功!')
2023-01-11 14:48:37 +08:00
uni.$emit('update')
2023-01-11 14:10:31 +08:00
setTimeout(()=> {
uni.navigateBack()
}, 500)
}
})
}
},
onLoad(o) {
if(o.qid) {
this.form.qid = o?.qid
}
if(o.data) {
this.form = JSON.parse(o?.data)
}
2023-01-10 11:35:04 +08:00
},
}
</script>
<style lang="scss" scoped>
.answerAdd {
2023-01-10 14:36:10 +08:00
padding: 32px 32px 130px 32px;
box-sizing: border-box;
.input_box,
.upload {
width: 100%;
background: #FFF;
border-radius: 32px;
padding: 16px;
box-sizing: border-box;
}
2023-01-10 11:35:04 +08:00
2023-01-10 14:36:10 +08:00
.upload {
margin-top: 24px;
h4 {
font-weight: 400;
font-size: 32px;
color: #666666;
margin-bottom: 24px;
span {
color: #999999;
font-size: 28px;
}
}
}
.submitBtn {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 120px;
background: #F3F5F9;
padding: 16px 32px;
box-sizing: border-box;
z-index: 9;
.btn {
background: #3975C6;
width: 100%;
border-radius: 44px;
height: 88px;
line-height: 88px;
text-align: center;
color: #FFFFFF;
font-size: 34px;
}
}
2023-01-10 11:35:04 +08:00
}
</style>