作者 吴孟雨

添加推荐列表点击量

@@ -240,12 +240,25 @@ Page({ @@ -240,12 +240,25 @@ Page({
240 }) 240 })
241 }) 241 })
242 }, 242 },
  243 + //点击量
  244 + hit() {
  245 + let url = '/home/home/hits';
  246 + let params = {
  247 + id: this.data.recommendList[this.data.currentRecommend].id,
  248 + };
  249 + let header = { "XX-Token": wx.getStorageSync('token') };
  250 + app.post(url, params, header).then((res) => {
  251 + console.log('点击量',res);
  252 + })
  253 + },
243 //进入推荐详情 254 //进入推荐详情
244 goRecommendDetail(e) { 255 goRecommendDetail(e) {
245 const current = e.currentTarget.dataset.index; 256 const current = e.currentTarget.dataset.index;
  257 + this.setData({currentRecommend: current});
246 wx.navigateTo({ 258 wx.navigateTo({
247 url: '../service/rentingDetail/rentingDetail?post_id=' + this.data.recommendList[current].id 259 url: '../service/rentingDetail/rentingDetail?post_id=' + this.data.recommendList[current].id
248 - }) 260 + });
  261 + this.hit();
249 }, 262 },
250 /** 263 /**
251 * 生命周期函数--监听页面加载 264 * 生命周期函数--监听页面加载