123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- const app = require('../../utils/util.js');
- const tool = require('../../utils/tool.js');
- Page({
- data: {
- checkArr: []
- },
- love(e) {
- console.log(e.currentTarget.dataset.index)
- console.log(e.currentTarget.dataset.id)
- let status=this.data.checkArr[e.currentTarget.dataset.index]
- let statusValue = 'checkArr[' + e.currentTarget.dataset.index + ']'
- console.log(status)
- if (status) {
- this.setData({
- [statusValue]: false
- })
- wx.request({
- url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/unfollow',
- method: "get",
- data:{
- targetId:e.currentTarget.dataset.id
- },
- success: (res) => {
- if (res.data.code == 0) {
- console.log(res, '我取消心动了')
- }
- }
- })
- }else{
- this.setData({
- [statusValue]: true
- })
- wx.request({
- url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.id + '/heartbeat',
- method: "get",
- data:{
- targetId:e.currentTarget.dataset.id
- },
- success: (res) => {
- if (res.data.code == 0) {
- console.log(res, '我心动了')
- }
- }
- })
- }
- },
- async onLoad (options) {
- const getOpenid = await tool.openidStatus();
- this.setData({
- openid: getOpenid[0],
- sessionkey: getOpenid[1],
- activeId:options.id
- })
- // wx.request({
- // url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/sign',
- // method: "get",
- // success: (res) => {
- // if (res.data.code == 0) {
- // console.log(res, '我来到现场了')
- // }
- // }
- // })
- wx.request({
- url: app.globalData.publicUrl + '/wx/actives/' + this.data.openid + '/' + this.data.activeId + '/members',
- method: "get",
- success: (res) => {
- if (res.data.code == 0) {
- console.log(res.data.members, '我获取人员名单')
- this.setData({
- member:res.data.menmbers
- })
- let checkArr1 = [];
- for (let i = 0; i < res.data.members.length; i++) {
- checkArr1[i] = false;
- }
- this.setData({
- checkArr: checkArr1
- })
- }
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|