微信小程式留言功能實現
阿新 • • 發佈:2019-02-10
點選我要留言
liuynChange: function (e) {
var that = this;
console.log(e.currentTarget.dataset.id)
that.setData({
llbView: true,
pid: e.currentTarget.dataset.id,
to_user_id: e.currentTarget.dataset.user
})
},
留言點贊
llzanChangeTwo: function (e) { console.log(e) var that = this; wx.request({ url: getApp().data.host + '...', method: "POST", data: { "column": "Reply", "user_id": wx.getStorageSync('user_id'), "id": e.currentTarget.dataset.id }, header: { 'content-type': 'application/x-www-form-urlencoded' }, success: function (res) { var data = that.data.yanlist console.log(data) if (res.data != null) { if (res.data.indexOf(wx.getStorageSync('user_id')) == "-1") { for (var i in data.list) { if (data.list[i]._child) { for (var j in data.list[i]._child) { if (e.currentTarget.dataset.id == data.list[i]._child[j].id) { data.list[i]._child[j].cnmView=true data.list[i]._child[j].like_count = parseInt(data.list[i]._child[j].like_count) + 1 } } } } that.setData({ yanlist: data }) } } else { for (var i in data.list) { if (data.list[i]._child) { for (var j in data.list[i]._child) { if (e.currentTarget.dataset.id == data.list[i]._child[j].id) { data.list[i]._child[j].cnmView = true data.list[i]._child[j].like_count = parseInt(data.list[i]._child[j].like_count) + 1 } } } } that.setData({ yanlist: data }) } } }) },