import { remarkOrReply } from '../../utils/api' Page({ data: { textareaValue: '', faCommentId: '', detailType: 'issue', issueId: '', projectId: '' }, onLoad (options) { if (options.detailType === 'issue') { this.setData({ detailType: 'issue', issueId: options.detailId, faCommentId: options.faCommentId }) } else if (options.detailType === 'project') { this.setData({ detailType: 'project', projectId: options.detailId, faCommentId: options.faCommentId }) } }, onShow () { }, // textarea 双向绑定 bindTextareaValue (e) { this.setData({ textareaValue: e.detail.value }) }, remarkOrReply () { if (!this.data.textareaValue) { wx.showToast({ title: '请输入回复内容', icon: 'none' }) return false } const para = { issueId: this.data.detailType === 'issue' ? this.data.issueId : '', faCommentId: this.data.faCommentId, content: this.data.textareaValue, itemId: this.data.detailType === 'project' ? this.data.projectId : '' } wx.showLoading({ title: '加载中...' }) remarkOrReply(para).then(res => { wx.hideLoading() console.log('评论或回复', res) wx.showToast({ title: '评论成功', icon: 'none', duration: 1000 }) const pages = getCurrentPages() const page = pages[pages.length - 2] if (page.getRemarkList) { page.getRemarkList() } setTimeout(() => { wx.navigateBack() }, 500) }).catch(err => { console.log(err) }) } })