You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.1 KiB
60 lines
1.1 KiB
6 years ago
|
import { remarkOrReply } from '../../utils/api'
|
||
|
|
||
|
Page({
|
||
|
data: {
|
||
|
textareaValue: '',
|
||
|
topicId: '',
|
||
|
faCommentId: ''
|
||
|
},
|
||
|
onLoad (options) {
|
||
|
const { topicId, faCommentId } = options
|
||
|
this.setData({
|
||
|
topicId,
|
||
|
faCommentId
|
||
|
})
|
||
|
},
|
||
|
onShow () {
|
||
|
|
||
|
},
|
||
|
onReady () {
|
||
|
wx.setNavigationBarTitle({
|
||
|
title: '评论'
|
||
|
})
|
||
|
},
|
||
|
// textarea 双向绑定
|
||
|
bindTextareaValue (e) {
|
||
|
this.setData({
|
||
|
textareaValue: e.detail.value
|
||
|
})
|
||
|
},
|
||
|
publish () {
|
||
|
if (this.data.textareaValue === '') {
|
||
|
wx.showToast({
|
||
|
title: '请输入评论内容',
|
||
|
icon: 'none',
|
||
|
duration: 2000
|
||
|
})
|
||
|
return false
|
||
|
}
|
||
|
const para = {
|
||
|
topicId: this.data.topicId,
|
||
|
faCommentId: this.data.faCommentId,
|
||
|
content: this.data.textareaValue
|
||
|
}
|
||
|
wx.showLoading({
|
||
|
title: '加载中'
|
||
|
})
|
||
|
remarkOrReply(para).then(res => {
|
||
|
wx.hideLoading()
|
||
|
console.log('评论或者回复', res)
|
||
|
wx.showToast({
|
||
|
title: '评论成功',
|
||
|
icon: 'none',
|
||
|
duration: 2000
|
||
|
})
|
||
|
wx.navigateBack()
|
||
|
}).catch(err => {
|
||
|
console.log(err)
|
||
|
})
|
||
|
}
|
||
|
})
|