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

101 lines
1.9 KiB
Vue
Raw Normal View History

2023-01-10 14:19:26 +08:00
<template>
<div class="add">
2023-01-11 09:58:04 +08:00
<textarea placeholder="请输入" :maxlength="500" v-model="content"></textarea>
2023-01-10 14:19:26 +08:00
<div class="answer-btn">
2023-01-11 09:58:04 +08:00
<div @click="submit">提问</div>
2023-01-10 14:19:26 +08:00
</div>
</div>
</template>
<script>
export default {
appName: '提问',
data () {
return {
2023-01-11 10:05:43 +08:00
id: '',
2023-01-11 09:58:04 +08:00
content: ''
}
},
2023-01-11 10:05:43 +08:00
onLoad (query) {
if (query.id) {
this.id = query.id
this.getInfo(query.id)
}
},
2023-01-11 09:58:04 +08:00
methods: {
2023-01-11 10:05:43 +08:00
getInfo (id) {
this.$http.post(`/app/applearningquestion/queryDetailById?id=${id}`).then(res => {
if (res.code == 0) {
this.content = res.data.content
}
})
},
2023-01-11 09:58:04 +08:00
submit () {
if (!this.content) {
return this.$u.toast('请输入题目内容')
}
this.$loading()
this.$http.post(`/app/applearningquestion/addOrUpdate`, {
2023-01-11 10:05:43 +08:00
content: this.content,
id: this.id || ''
2023-01-11 09:58:04 +08:00
}).then(res => {
if (res.code == 0) {
this.$u.toast('提交成功')
uni.$emit('update')
2023-01-10 14:19:26 +08:00
2023-01-11 09:58:04 +08:00
setTimeout(() => {
2023-01-11 11:31:07 +08:00
uni.navigateBack()
2023-01-11 09:58:04 +08:00
}, 500)
}
})
2023-01-10 14:19:26 +08:00
}
}
}
</script>
<style lang="scss" scoped>
.add {
padding-top: 32px;
textarea {
width: 718px;
height: 640px;
margin: 0 auto;
padding: 32px 16px;
font-size: 32px;
color: #333;
border-radius: 32px;
background: #fff;
box-sizing: border-box;
}
.answer-btn {
position: fixed;
bottom: 0;
left: 0;
z-index: 11;
width: 100%;
padding: 16px 32px;
text-align: center;
box-sizing: border-box;
background: #F3F5F9;
div {
height: 88px;
line-height: 88px;
background: #3975C6;
border-radius: 44px;
font-size: 34px;
color: #FFFFFF;
}
}
}
</style>