101 lines
1.9 KiB
Vue
101 lines
1.9 KiB
Vue
<template>
|
|
<div class="add">
|
|
<textarea placeholder="请输入" :maxlength="500" v-model="content"></textarea>
|
|
|
|
<div class="answer-btn">
|
|
<div @click="submit">提问</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
appName: '提问',
|
|
|
|
data () {
|
|
return {
|
|
id: '',
|
|
content: ''
|
|
}
|
|
},
|
|
|
|
onLoad (query) {
|
|
if (query.id) {
|
|
this.id = query.id
|
|
|
|
this.getInfo(query.id)
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
getInfo (id) {
|
|
this.$http.post(`/app/applearningquestion/queryDetailById?id=${id}`).then(res => {
|
|
if (res.code == 0) {
|
|
this.content = res.data.content
|
|
}
|
|
})
|
|
},
|
|
|
|
submit () {
|
|
if (!this.content) {
|
|
return this.$u.toast('请输入题目内容')
|
|
}
|
|
|
|
this.$loading()
|
|
this.$http.post(`/app/applearningquestion/addOrUpdate`, {
|
|
content: this.content,
|
|
id: this.id || ''
|
|
}).then(res => {
|
|
if (res.code == 0) {
|
|
this.$u.toast('提交成功')
|
|
uni.$emit('update')
|
|
|
|
setTimeout(() => {
|
|
uni.navigateBack()
|
|
}, 500)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</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>
|