const _Http = getApp().globalData.http; Component({ options: { addGlobalClass: true }, properties: { comments: { type: Array, value: [] }, ownertable: { type: String, value: 'sys_datafollowup' }, ownerid: { type: String }, replyid: { type: [Number, String] }, userid: { type: [Number, String] } }, lifetimes: { attached: function () { getApp().globalData.Language.getLanguagePackage(this) } }, data: { loading: false, comment: '', }, methods: { onInput(e) { this.setData({ comment: e.detail.value }) }, onSend() { this.setData({ loading: true }) _Http.basic({ "id": 20240429161601, "content": { "ownertable": this.data.ownertable, //数据表 "ownerid": this.data.ownerid, "content": this.data.comment, replyid: this.data.replyid } }).then(res => { console.log("发送评论", res) this.setData({ loading: false }) wx.showToast({ title: getApp().globalData.Language.getMapText(res.code == '1' ? '回复成功' : res.msg), icon: "none" }) if (res.code == '1') { this.setData({ comment: "" }) _Http[this.data.ownerid].updateCommentList(); _Http[this.data.ownerid].changeReply() } }) }, reply(e) { let { item } = e.currentTarget.dataset; _Http[this.data.ownerid].changeReply(item.sys_datacommentid) this.setData({ comment: '', replyUser: item }) }, deleteItem(e) { const { item } = e.currentTarget.dataset; wx.showModal({ title: getApp().globalData.Language.getMapText('提示'), content: getApp().globalData.Language.getMapText('是否确定删除该评论'), complete: ({ confirm }) => { if (confirm) _Http.basic({ "id": 20240429161701, "content": { "sys_datacommentid": item.sys_datacommentid } }).then(res => { console.log("删除评论", res) wx.showToast({ title: getApp().globalData.Language.getMapText(res.code == '1' ? '删除成功' : res.msg), icon: "none" }); if (res.code == '1') { _Http[this.data.ownerid].updateCommentList(); } }) } }) }, } })