Rorschach пре 3 година
родитељ
комит
439caf82ed

+ 17 - 3
pages/activity/index/index.js

@@ -48,6 +48,10 @@ Page({
         })
       }
     })
+    // 统计数据
+    httpRequestApi.postActEvent('ACTIVITY_PAGE').success(res => {
+      console.log('活动页', res)
+    })
   },
 
   /**
@@ -84,7 +88,7 @@ Page({
         })
       }
     })
-    if(this.data.fromReading){
+    if (this.data.fromReading) {
       this.setData({
         selectInd: 1
       })
@@ -386,7 +390,7 @@ Page({
       url: `../strategy/strategy`
     });
   },
-  getPrice(){
+  getPrice() {
     wx.navigateTo({
       url: `../priceList/priceList`
     });
@@ -440,4 +444,14 @@ Page({
       }
     })
   }
-})
+})
+
+/* 
+费用 买入一万元 3年卖出
+A:                 C:
+购买费率: 10       0
+管理:    50*3       50*3
+托管      10*3       10*3
+销售      0          20*3 
+卖出      5           0
+*/

+ 6 - 1
pages/activity/rule/rule.js

@@ -1,4 +1,6 @@
 // pages/activity/rule/rule.js
+import httpRequestApi from '../../../utils/APIClient';
+
 Page({
 
   /**
@@ -12,7 +14,10 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+       // 统计数据
+       httpRequestApi.postActEvent('REGULATION').success(res => {
+        console.log('规则页', res)
+      })
   },
 
   /**

+ 5 - 1
pages/activity/strategy/strategy.js

@@ -1,4 +1,6 @@
 // pages/activity/strategy/strategy.js
+import httpRequestApi from '../../../utils/APIClient';
+
 Page({
 
   /**
@@ -28,7 +30,9 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
+    httpRequestApi.postActEvent('HOT_STRATEGY').success(res => {
+      console.log('攻略页', res)
+    })
   },
 
   /**

+ 61 - 56
pages/index/index.js

@@ -268,7 +268,7 @@ Page({
       let optionsStr = decodeURIComponent(options.scene);
       let optionsArr = optionsStr.split('&');
       // 暂时这样写
-      if (optionsArr[0].split("=")[0] === "type"){
+      if (optionsArr[0].split("=")[0] === "type") {
         console.log('我是团购分享')
         options.type = optionsArr[0].split("=")[1];
         options.sid = optionsArr[1].split("=")[1];
@@ -351,11 +351,11 @@ Page({
     this.uid = wx.getStorageSync('uid');
     if (options.sid) {
       httpRequestApi.getUserRec(options.sid).success(res => {
-          options.uid = res.data.data;
-          this.shareGetPage(options)
+        options.uid = res.data.data;
+        this.shareGetPage(options)
       })
     } else {
-        this.shareGetPage(options)
+      this.shareGetPage(options)
     }
     // if (!this.uid || !grade) {
     //   this.setData({
@@ -394,21 +394,21 @@ Page({
   },
   // 封装分享方法之后跳到页面方法
   shareGetPage(options) {
-    console.log(this.uid,  options.uid ,this.uid !== options.uid)
-    if(options.type && options.type === 'iphone' && !app.globalData.isIOS && this.uid !== options.uid) {
-        this.setData({
-          helpPayHide: false,
-          tipsType: 'helpPay',
-          helpPayImg: 'http://reader-wx.ai160.com/images/reader/pay/buy.png',
-        })
+    console.log(this.uid, options.uid, this.uid !== options.uid)
+    if (options.type && options.type === 'iphone' && !app.globalData.isIOS && this.uid !== options.uid) {
+      this.setData({
+        helpPayHide: false,
+        tipsType: 'helpPay',
+        helpPayImg: 'http://reader-wx.ai160.com/images/reader/pay/buy.png',
+      })
     }
-    if(options.type && options.type === 'ios' && this.uid !== options.uid) {
-        this.setData({
-          helpPayHide: false,
-          tipsType: 'helpPay',
-          helpPayImg: 'http://reader-wx.ai160.com/images/reader/pay/help.png',
-        })
-        console.log(options.uid)
+    if (options.type && options.type === 'ios' && this.uid !== options.uid) {
+      this.setData({
+        helpPayHide: false,
+        tipsType: 'helpPay',
+        helpPayImg: 'http://reader-wx.ai160.com/images/reader/pay/help.png',
+      })
+      console.log(options.uid)
     }
     const recOsType = options.type === 'iphone' ? 'ANDROID' : (options.type === 'ios' && 'IOS');
     if (options.type && options.uid) {
@@ -418,7 +418,7 @@ Page({
       }).success(res => {
         console.log(res)
       })
-    } 
+    }
   },
   onShow: function () {
     let grade = wx.getStorageSync('grade');
@@ -1115,6 +1115,9 @@ Page({
    * 跳转到活动页
    */
   goToActivity() {
+    httpRequestApi.postActEvent('BANNER').success(res => {
+      console.log('活动banner', res)
+    })
     wx.navigateTo({
       url: `../activity/index/index`
     });
@@ -1122,35 +1125,36 @@ Page({
   /**
    * banner点击
    */
-   bannerTap() {
+  bannerTap() {
     if (!this.data.isLogin) {
       wx.navigateTo({
         url: `../../pages/login/login?index=0`
       });
       return;
     }
-    if(this.data.isIos || this.data.isVip) {
+    if (this.data.isIos || this.data.isVip) {
       this.myPlase();
     } else {
       this.messageAuth();
     }
-   },
+  },
   /**活动改版 */
   myPlase() {
-    if(!wx.getStorageSync('message')) {
+    if (!wx.getStorageSync('message')) {
       wx.requestSubscribeMessage({
         tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
-          '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'],
-        success: (res) => { 
+          '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'
+        ],
+        success: (res) => {
           console.log(res)
           if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
-              console.log('用户不同意订阅')
-              // 用户不同意订阅
-              wx.setStorageSync('message', false)
-          } else if(res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
-              console.log('订阅成功')
-              // 用户点击统一订阅
-              wx.setStorageSync('message', true)
+            console.log('用户不同意订阅')
+            // 用户不同意订阅
+            wx.setStorageSync('message', false)
+          } else if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
+            console.log('订阅成功')
+            // 用户点击统一订阅
+            wx.setStorageSync('message', true)
           }
           wx.navigateTo({
             url: `../vipActivity/vipActivity`
@@ -1162,7 +1166,7 @@ Page({
           });
         }
       })
-    }else {
+    } else {
       wx.navigateTo({
         url: `../vipActivity/vipActivity`
       });
@@ -1199,14 +1203,14 @@ Page({
           })
         }
       })
-    }else{
+    } else {
       // 去支付需要获取权限
       this.messageAuth();
     }
 
   },
   // 去产品页
-  goToPruduct(){
+  goToPruduct() {
     wx.navigateTo({
       url: `../product/product?price=${this.data.myData.price}`
     });
@@ -1216,15 +1220,16 @@ Page({
     if (!wx.getStorageSync('message')) {
       wx.requestSubscribeMessage({
         tmplIds: ['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY',
-          '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'],
-        success: (res) => { 
+          '-2ZZpWFoyKvAtX1HwEIQLQ92LnN8cryamB94LqLGo98'
+        ],
+        success: (res) => {
           console.log(res)
           if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'reject') {
-              console.log('用户不同意订阅')
-              wx.setStorageSync('message', false)
-          } else if(res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
-              console.log('订阅成功')
-              wx.setStorageSync('message', true)
+            console.log('用户不同意订阅')
+            wx.setStorageSync('message', false)
+          } else if (res['KJ0YtcAacJNSXDBsE27JXqoaFrcJ1-N6Jcu85yTtQuY'] === 'accept') {
+            console.log('订阅成功')
+            wx.setStorageSync('message', true)
           }
           this.order();
         },
@@ -1237,7 +1242,7 @@ Page({
     }
   },
   // 支付
-  order () {
+  order() {
     // 渠道id
     const productId = wx.getStorageSync('productId');
     httpRequestApi.createOrder(productId).success(res => {
@@ -1261,22 +1266,22 @@ Page({
           }
           httpRequestApi.getAuthActivity().success(res => {
             if (!res.data.data) {
-                wx.setStorageSync('vip', false)
-                wx.setStorageSync('date', '')
+              wx.setStorageSync('vip', false)
+              wx.setStorageSync('date', '')
             } else {
-                wx.setStorageSync('vip', true)
-                wx.setStorageSync('date', res.data.data)
-                this.setData({
-                  ['myData.isVIP']: true,
-                  ['myData.date']: res.data.data
-                })
-                this.showGift();
+              wx.setStorageSync('vip', true)
+              wx.setStorageSync('date', res.data.data)
+              this.setData({
+                ['myData.isVIP']: true,
+                ['myData.date']: res.data.data
+              })
+              this.showGift();
             }
-            }).fail(error => {
-                console.log(error)
-            })
+          }).fail(error => {
+            console.log(error)
+          })
         },
-        fail (res) { }
+        fail(res) {}
       })
     })
   },

+ 6 - 0
pages/reading/reading.js

@@ -78,6 +78,12 @@ Page({
                 shareImg: res.data.data.userRead.shareImg,
                 isActivityRead: res.data.data.isActivityRead
             })
+            // 参赛作品,增加数据
+            if(res.data.data.isActivityRead){
+                httpRequestApi.postActEvent('LESSON').success(res=>{
+                    console.log('示范朗读页',res)
+                })
+            }
             this.getReadInfo(id)
             httpRequestApi.userIntoPage('pages/reading/reading', '朗读页面').success((res) => {
 

+ 9 - 0
utils/APIClient.js

@@ -652,6 +652,15 @@ module.exports = {
     return request.getInstance().header({
       uid: wx.getStorageSync('uid'),
     }).url(url).method('GET').send();
+  },
+  // 五一活动,统计打点
+  postActEvent(action){
+    let url = getBaseUrl(`wx/activity/event`)
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid'),
+    }).url(url).data({
+      action
+    }).method('POST').send();
   }
 }