Rorschach 3 лет назад
Родитель
Сommit
66a65efe51
6 измененных файлов с 52 добавлено и 16 удалено
  1. 9 4
      component/my/my.js
  2. 1 1
      component/my/my.wxml
  3. 14 1
      pages/index/index.js
  4. 11 1
      pages/reading/reading.js
  5. 16 8
      utils/APIClient.js
  6. 1 1
      utils/WXHttpRequest.js

+ 9 - 4
component/my/my.js

@@ -6,7 +6,7 @@ import {
 export const myInit = (that) => {
   console.log(123123123, app.globalData.isIOS)
   that.setData({
-    myData:{
+    myData: {
       isVIP: wx.getStorageSync('vip'),
       price: wx.getStorageSync('price'),
       date: wx.getStorageSync('date')
@@ -22,11 +22,14 @@ export const myInit = (that) => {
       wx.navigateTo({
         url: `../user/myEdit/myEdit?title=修改资料`
       });
+      APIClient.userEvent('MY_INFO');
     },
     that.toMyConcern = e => {
       wx.navigateTo({
         url: `../myconcern/myconcern?title=我的关注`
       });
+      APIClient.userEvent('MY_SUBSCRIBE');
+
     }
   that.toMyRead = e => {
       wx.navigateTo({
@@ -37,6 +40,8 @@ export const myInit = (that) => {
       wx.navigateTo({
         url: `../mycollection/mycollection`
       });
+      APIClient.userEvent('MY_FAVORITES');
+
     },
 
     that.getFollowWorks = (pageNo, pageSize) => {
@@ -53,7 +58,7 @@ export const myInit = (that) => {
           temp.plays = item.userRead.playAmount;
           temp.likes = item.userRead.likeAmount;
           temp.commentAmount = item.userRead.commentAmount ? item.userRead.commentAmount : 0;
-          temp.classId = item.userRead.exampleId ? item.userRead.exampleId :  1605097720036046;
+          temp.classId = item.userRead.exampleId ? item.userRead.exampleId : 1605097720036046;
           temp.img = item.userRead.iconImg;
           temp.id = item.userRead.id;
           temp.title = item.userRead.title;
@@ -92,10 +97,10 @@ export const myInit = (that) => {
 
     },
     /**创建支付订单 */
-    that.moneyBuy = function() {
+    that.moneyBuy = function () {
       // that.messageAuth();
       that.goToPruduct();
 
     }
-    that.getFollowWorks(1, 3);
+  that.getFollowWorks(1, 3);
 }

+ 1 - 1
component/my/my.wxml

@@ -96,7 +96,7 @@
           <image class="btn-icon" src="../../static/image/message.png" bindtap="goToMessage" />
           <view class="btn-title">消息通知</view>
         </view>
-        <button class="btn" open-type="contact" plain="true" hover-class="none" style="border: none;">
+        <button class="btn" bindtap="goToService" open-type="contact" plain="true" hover-class="none" style="border: none;">
             <image class="btn-icon" src="../../static/index/contact.png"></image>
             <view class="btn-title">联系客服</view>
         </button>

+ 14 - 1
pages/index/index.js

@@ -177,6 +177,8 @@ Page({
         isSwiper: false
       }, () => {
         myInit(this);
+        httpRequestApi.userEvent('MY');
+
       })
       return;
     }
@@ -488,7 +490,8 @@ Page({
       };
       // const recommendWorks = [];
       this.formatWorksList(recommendRes);
-    })
+    });
+    httpRequestApi.userEvent('RECOMMEND');
   },
   // 组装list
   formatWorksList(list, notSet) {
@@ -681,10 +684,14 @@ Page({
       url: `../../pages/social/insideMessage/insideMessage`
     });
     const str = 'hotData.unReadMessageNum';
+    httpRequestApi.userEvent('MESSAGE');
     this.setData({
       [str]: 0
     })
   },
+  goToService: function () {
+    httpRequestApi.userEvent('SERVICE');
+  },
   toMyCollage: function (e) {
     if (app.globalData.isIOS) {
       wx.navigateTo({
@@ -706,6 +713,8 @@ Page({
     wx.navigateTo({
       url: `../../pages/social/littleFlower/littleFlower`
     });
+    httpRequestApi.userEvent('INTEGRAL');
+
   },
   signInBtn: function (e) {
     this.setData({
@@ -976,6 +985,7 @@ Page({
       // const videoList = [];
       this.formatWorksList(followData);
     });
+    httpRequestApi.userEvent('SUBSCRIBE');
   },
   // 点击用户头像区域
   headTapHandler: function (e) {
@@ -1004,6 +1014,7 @@ Page({
         console.log(this.data.coursesData)
       })
     })
+    httpRequestApi.userEvent('RESOURCES');
   },
   goToReading: function (e) {
     console.log('去朗读', e)
@@ -1016,6 +1027,8 @@ Page({
     wx.navigateTo({
       url: `../../pages/reading/reading?id=${id}`
     });
+    httpRequestApi.userEvent('REC_READ');
+
   },
   refreshCourseAmount() {
     console.log(this.data.goToCoursesId)

+ 11 - 1
pages/reading/reading.js

@@ -76,7 +76,7 @@ Page({
                 summary: res.data.data.userRead.summary,
                 coverImg: res.data.data.userRead.coverImg,
                 shareImg: res.data.data.userRead.shareImg,
-                isActivityRead: res.data.data.isActivityRead
+                isActivityRead: res.data.data.isActivityRead,
             })
             // 参赛作品,增加数据
             if(res.data.data.isActivityRead){
@@ -285,6 +285,13 @@ Page({
                     console.log('驰声createWsEngine失败', res);
                 })
                 this.videoComplete();
+                if(this.data.btnFlag){
+                    httpRequestApi.userEvent('RERECORDING');
+
+                }else{
+                    httpRequestApi.userEvent('READING');
+
+                }
                 // this.getMicAuth()
                 return;
             }
@@ -544,6 +551,7 @@ Page({
                 console.log('播放记录', res)
             })
         }
+        httpRequestApi.userEvent('EXAMPLE');
     },
     videoComplete: function () {
         this.setData({
@@ -664,6 +672,8 @@ Page({
             });
         })
 
+        httpRequestApi.userEvent('UPLOAD');
+
     },
 
     // 获取本课朗读内容

+ 16 - 8
utils/APIClient.js

@@ -82,7 +82,7 @@ module.exports = {
   getClassRead(data) {
     let url = getBaseUrl(`wx/userRead`);
     return request.getInstance().header({
-      uid:wx.getStorageSync('uid')
+      uid: wx.getStorageSync('uid')
     }).data(data).url(url).send();
   },
   // 作品播放了+1
@@ -94,7 +94,7 @@ module.exports = {
   // },
   // 发布作品
   postWork(data) {
-    console.log('上传数据',data);
+    console.log('上传数据', data);
     let url = getBaseUrl(`wx/userRead`);
     // let url = `https://reader-test.efunbox.cn/userRead`;
     return request.getInstance().header({
@@ -110,7 +110,7 @@ module.exports = {
     }).url(url).data(data).method('PUT').send();
   },
   // 视频评测数据
-  postWorksScore(data){
+  postWorksScore(data) {
     let url = getBaseUrl(`wx/assessment`);
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
@@ -444,13 +444,13 @@ module.exports = {
       uid: wx.getStorageSync('uid')
     }).data(data).url(url).method('POST').send();
   },
-  shareLog(data){
+  shareLog(data) {
     let url = getBaseUrl('wx/shareLog');
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
     }).data(data).url(url).method('POST').send();
   },
-  shareImgLog(data){
+  shareImgLog(data) {
     let url = getBaseUrl('wx/shareLog/saveShareImg');
     return request.getInstance().header({
       uid: wx.getStorageSync('uid')
@@ -480,6 +480,15 @@ module.exports = {
       actionName
     }).url(url).method('POST').send();
   },
+  // 用户行为统计
+  userEvent(code) {
+    let url = getBaseUrl('wx/userEvent/v2');
+    return request.getInstance().header({
+      uid: wx.getStorageSync('uid')
+    }).data({
+      action: code
+    }).url(url).method('POST').send();
+  },
   // 用户播放视频时长统计
   playLogReport(data) {
     let url = getBaseUrl('base/playLog');
@@ -654,7 +663,7 @@ module.exports = {
     }).url(url).method('GET').send();
   },
   // 五一活动,统计打点
-  postActEvent(action){
+  postActEvent(action) {
     let url = getBaseUrl(`wx/activity/event`)
     return request.getInstance().header({
       uid: wx.getStorageSync('uid'),
@@ -662,5 +671,4 @@ module.exports = {
       action
     }).method('POST').send();
   }
-}
-
+}

+ 1 - 1
utils/WXHttpRequest.js

@@ -19,7 +19,7 @@ module.exports = {
 					method: this._method,
 					header: this._header,
 					success: function(res) {
-						this._sucCallback(res);
+						this._sucCallback ? this._sucCallback(res) : null;
 					}.bind(this),
 					fail: function(res) {
 						this._failCallback(res);