Selaa lähdekoodia

新增视频学习日志和平台来源

xuqiaoying 3 vuotta sitten
vanhempi
commit
6a0d4ec969

+ 31 - 1
components/course/courseChapter.vue

@@ -126,6 +126,11 @@ export default {
     sectionMaxNum: {
       default: undefined,
     },
+    // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播	
+    goodsType: {
+      type: [Number, String],
+      default: 0,
+    }, 
   },
   components: {
     courseSection,
@@ -229,6 +234,25 @@ export default {
           });
       });
     },
+    // 新增用户视频学习日志
+    studyLog() {
+      this.$http({
+        url: '/user/study/log',
+        method: 'post',
+        data: {
+          goodsId: this.goodsId,
+          courseId: this.courseId,
+					moduleId: this.menuItem.moduleId || 0,
+					chapterId: this.menuItem.chapterId || 0,
+          sectionId: this.menuItem.sectionId || this.menuItem.menuId,
+          fromPlat: 1, //来源平台 1小程序 2PC网站
+          goodsType: this.goodsType, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
+          orderGoodsId: this.orderGoodsId,
+        }
+      }).then((res) => {
+        console.log('考试的用户学习日志:', res)
+      })
+    },
     /**
      * 去做题
      */
@@ -270,6 +294,7 @@ export default {
                 "&orderGoodsId=" +
                 this.orderGoodsId,
             });
+            this.studyLog()
             //没有答题次数限制
           } else if (item.answerNum == 0) {
             uni.navigateTo({
@@ -289,6 +314,7 @@ export default {
                 "&orderGoodsId=" +
                 this.orderGoodsId,
             });
+            this.studyLog()
           } else {
             uni.showToast({
               icon: "none",
@@ -360,6 +386,7 @@ export default {
                 "&orderGoodsId=" +
                 this.orderGoodsId,
             });
+            this.studyLog()
             //没有答题次数限制
           } else if (item.answerNum == 0) {
             uni.navigateTo({
@@ -379,6 +406,7 @@ export default {
                 "&orderGoodsId=" +
                 this.orderGoodsId,
             });
+            this.studyLog()
           } else {
             uni.showToast({
               icon: "none",
@@ -416,6 +444,7 @@ export default {
               "&orderGoodsId=" +
               this.orderGoodsId,
           });
+          this.studyLog()
           //没有答题次数限制
         } else if (item.answerNum == 0) {
           uni.navigateTo({
@@ -435,6 +464,7 @@ export default {
               "&orderGoodsId=" +
               this.orderGoodsId,
           });
+          this.studyLog()
         } else {
           uni.showToast({
             icon: "none",
@@ -462,7 +492,7 @@ export default {
       });
     },
     openChapter(item) {
-      console.log(this.menuItem);
+      console.log('张咋还能工作职责',this.menuItem);
       this.down = !this.down;
       if (!this.down && this.list.length == 0) {
         console.log(item.id, 69);

+ 0 - 1
components/course/courseSection.vue

@@ -547,7 +547,6 @@ export default {
 				// 	console.log('playend1')
 				// 	this.$emit('playEnd',{isRebuild:this.isRebuild})
 				// })
-				console.log(888)
 			
 			}
 		}

+ 35 - 1
pages/webview/index.vue

@@ -19,6 +19,12 @@ export default {
       },
       options: {},
       optObj: {},
+      goodsId: 0,
+      chapterId: 0,
+      moduleId: 0,
+      courseId: 0,
+      sectionId: 0,
+      orderGoodsId: 0,
     };
   },
   onLoad(option) {
@@ -39,6 +45,13 @@ export default {
       this.getParam()
     } else {
       this.url = decodeURIComponent(this.options.url);
+      let index = this.options.url.indexOf('?')
+      let paramArr = this.options.url.slice(index + 1).split('&')
+      let paramObj = {}
+      for (let i = 0; i < paramArr.length; i++) {
+          paramObj[paramArr[i].split('=')[0]] = paramArr[i].split('=')[1]
+      }
+      this.studyLog(paramObj)
     }
   },
   computed: {
@@ -61,19 +74,40 @@ export default {
           let item = res.data.data
           let moduleId = item.moduleId || 0
           let chapterId = item.chapterId || 0
-          let sectionId = item.sectionId || item.menuId
+          let sectionId = item.sectionId
           let uuid = new Date().valueOf() + ""
           // buyCourse 是否购买课程:1是 0否
           this.url = WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
           +item.channelId+'&gradeId='+0+'&courseId='+item.courseId+'&goodsId='+item.goodsId+'&orderGoodsId='+item.orderGoodsId+'&sectionId='+sectionId
           +'&chapterId='+chapterId+'&moduleId='+moduleId+'&buyCourse='+item.buyCourse+'&ident='+uuid
           console.log('url:', this.url)
+
+          this.studyLog(item)
         } else {
           this.$u.toast(res.data.msg)
         }
       })
 
     },
+    // 新增用户视频学习日志
+    studyLog(item) {
+      this.$http({
+        url: '/user/study/log',
+        method: 'post',
+        data: {
+          goodsId: item.goodsId,
+          courseId: item.courseId,
+					moduleId: item.moduleId || 0,
+					chapterId: item.chapterId || 0,
+          sectionId: item.sectionId || 0,
+          fromPlat: 1, //来源平台 1小程序 2PC网站
+          goodsType: 6, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
+          orderGoodsId: item.orderGoodsId,
+        }
+      }).then((res) => {
+        console.log('直播的用户学习日志:', res)
+      })
+    },
   },
 };
 </script>

+ 26 - 0
pages2/bank/question_detail.vue

@@ -167,13 +167,34 @@ export default {
 				
 			})
 		},
+		// 新增用户视频学习日志
+		studyLog(goodsId, courseId, moduleId, chapterId, examId) {
+			this.$http({
+				url: '/user/study/log',
+				method: 'post',
+				data: {
+					goodsId: goodsId,
+					courseId: courseId,
+					moduleId: moduleId || 0,
+					chapterId: chapterId || 0,
+					sectionId: examId || 0,
+					fromPlat: 1, //来源平台 1小程序 2PC网站
+					goodsType: 2, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
+					orderGoodsId: this.orderGoodsId,
+				}
+			}).then((res) => {
+				console.log('题库的用户学习日志:', res)
+			})
+		},
 		/**
 		 * 继续做题
 		 */
 		continueDo(recordId,examId,goodsId,chapterId = 0,moduleId = 0) {
+			// examId-试卷id,chapterId =>chapterExamId-章卷ID, moduleId =>majorId-主ID/模块id
 			uni.navigateTo({
 				url:'/pages2/bank/questionBankContinue?orderGoodsId='+this.orderGoodsId+'&recordId=' +recordId +'&id=' +examId +'&goodsid=' +goodsId +'&chapterId='+chapterId+'&moduleId='+moduleId
 			})
+			this.studyLog(goodsId, 0, moduleId, chapterId, examId)
 		},
 		/**
 		 * 重做
@@ -203,6 +224,7 @@ export default {
 						uni.navigateTo({
 							url:'/pages2/bank/questionBank?orderGoodsId='+this.orderGoodsId+'&id=' +examId +'&goodsid=' +goodsId +'&moduleId='+moduleId+'&chapterId=' +chapterExamId
 						})
+
 			        } else if (res.cancel) {
 						uni.navigateTo({
 							url:'/pages2/bank/questionBankAllExplain?id=' + examId +
@@ -217,6 +239,7 @@ export default {
 			        }
 			    }
 			});
+			this.studyLog(goodsId, 0, moduleId, chapterExamId, examId)
 		},
 		/**
 		 * 获取课程目录
@@ -227,6 +250,8 @@ export default {
 				goodsId: this.id
 			}).then(res => {
 				this.bankList = res.data.data;
+				console.log('---banklist:', this.bankList)
+				console.log('')
 				if(this.firstEnter) {
 					this.showAllCharpter();
 					this.firstEnter = false;
@@ -283,6 +308,7 @@ export default {
 			uni.navigateTo({
 				url: '/pages2/bank/questionBank?orderGoodsId='+this.orderGoodsId+'&id=' + id + '&goodsid=' + goodsId + '&moduleId=' + moduleId + '&chapterId=' + chapterId + ''
 			});
+			this.studyLog(goodsId, 0, moduleId, chapterId, id)
 		},
 
 		/**

+ 31 - 4
pages3/live/detail.vue

@@ -155,6 +155,7 @@
                 :isBuy="true"
                 :menuItem="item"
                 :levelId="'0-' + item.menuId"
+                :goodsType='6'
               ></courseChapter
             ></view>
             <!--节 -->
@@ -678,7 +679,6 @@ export default {
     ...mapGetters(["userInfo", "playSectionId", "playChannelId", "playVID"]),
   },
   onLoad(option) {
-    console.log('option====', option)
     this.courseId = Number(option.courseId);
     this.goodsId = Number(option.goodsId);
 		// this.gradeId = option.gradeId || 0
@@ -1533,6 +1533,7 @@ export default {
       }
       let self = this;
       let data = {
+        fromPlat: 1, //来源平台 1小程序 2网站	
         photo: self.ossAvatarUrl,
         sectionId: parseInt(sectionId),
         goodsId: parseInt(self.goodsId),
@@ -1731,7 +1732,27 @@ export default {
       clearTimeout(this.toastTimer);
       this.videoToastShow = false;
     },
+    // 新增用户视频学习日志
+    studyLog() {
+      this.$http({
+        url: '/user/study/log',
+        method: 'post',
+        data: {
+          goodsId: this.goodsId,
+          courseId: this.courseId,
+					moduleId: this.moduleId || 0,
+					chapterId: this.chapterId || 0,
+          sectionId: this.playSectionId || 0,
+          fromPlat: 1, //来源平台 1小程序 2PC网站
+          goodsType: 6, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
+          orderGoodsId: this.orderGoodsId,
+        }
+      }).then((res) => {
+        console.log('直播的用户学习日志:', res)
+      })
+    },
     onStateChange(newstate, oldstate) {
+      console.log('直播视频的开始播放事件', newstate.detail.newstate,this.needSeek)
       if (newstate.detail.newstate == "playing") {
         if (this.needSeek) {
           var polyvPlayerContext = this.selectComponent("#playerVideo");
@@ -1752,12 +1773,15 @@ export default {
 
           polyvPlayerContext.play();
           this.needSeek = false;
+          // 新增用户视频学习日志
+          this.studyLog()
         }
         //开始播放
         if (this.timer) {
           clearInterval(this.timer);
         }
         this.timer = setInterval(this.timeEvent, 1000); //定时器
+        
       }
       if (newstate.detail.newstate == "pause") {
         clearInterval(this.timer);
@@ -1926,8 +1950,9 @@ export default {
       }
     },
     getGoodsDetail() {
+      console.log('goodsDetail(------')
       let self = this;
-      // app/common/goods/'+ data
+      // goods/'+ data
       this.$api.goodsDetail(this.goodsId).then((res) => {
         self.goodsData = res.data.data;
         console.log(self.gradeId, "班级ID");
@@ -1974,7 +1999,7 @@ export default {
         });
     },
     getMenuList() {
-      let self = this;
+      // let self = this;
       this.$api
         .reMenuList({ courseId: this.courseId, gradeId: this.gradeId,orderGoodsId: this.orderGoodsId, })
         .then((res) => {
@@ -1986,7 +2011,7 @@ export default {
               item.name = item.menuName;
               item.menuType = item.type;
             }
-            self.menuList = res.data.rows;
+            this.menuList = res.data.rows;
 
             for (let i = 0; i < res.data.rows.length; i++) {
               if (res.data.rows[i].type == 1) {
@@ -1997,6 +2022,8 @@ export default {
                 break;
               }
             }
+
+            console.log('--this.menuList:-', this.menuList)
           }
         });
     },

+ 29 - 1
pages3/polyv/detail.vue

@@ -155,6 +155,7 @@
                 :isBuy="true"
                 :menuItem="item"
                 :levelId="'0-' + item.menuId"
+                :goodsType='1'
               ></courseChapter
             ></view>
             <!--节 -->
@@ -672,6 +673,7 @@ export default {
     ...mapGetters(["userInfo", "playSectionId", "playChannelId", "playVID"]),
   },
   onLoad(option) {
+    console.log('===option', option)
     this.courseId = Number(option.id);
     this.goodsId = Number(option.goodsId);
     this.orderGoodsId = Number(option.orderGoodsId) || '';
@@ -720,6 +722,7 @@ export default {
 			  this.getAnswerList();
 			}, 5000);
 			let noteSecond = Number(this.option.noteSecond);
+      console.log('noteSecondnoteSecond:', noteSecond)
 			if (noteSecond > 0) {
 			  //我的消息跳过来,播放节
 			  let item = {
@@ -884,6 +887,7 @@ export default {
 				console.log(res,'couse')
 				if(res.data.data) {
 					if(res.data.data.sectionType == 1) { //录播
+          console.log('录播录播录播')
 					this.$store.commit("setPlaySectionId", { playSectionId: res.data.data.sectionId });
 					this.$store.commit("setPlayVID", { playVID: res.data.data.recordingUrl });
 					this.sectionItem = res.data.data;
@@ -1648,7 +1652,7 @@ export default {
     },
     //正常播放视频
     async playVideo(item) {
-      console.log(item,'222');
+      console.log(item,'222', this.vid);
       if (this.timer) {
         clearInterval(this.timer);
       }
@@ -1662,6 +1666,7 @@ export default {
       }
       this.recordObj = null;
       this.recordObj = await this.getRecordLast();
+      console.log('this.recordObj:', this.recordObj)
       this.needSeek = true; //跳转到播放记录
       this.startStatus = true;
 
@@ -1893,6 +1898,7 @@ export default {
       }
       let self = this;
       let data = {
+        fromPlat: 1, //来源平台 1小程序 2网站	
         photo: self.ossAvatarUrl,
         sectionId: parseInt(sectionId),
         goodsId: parseInt(self.goodsId),
@@ -2090,7 +2096,27 @@ export default {
       clearTimeout(this.toastTimer);
       this.videoToastShow = false;
     },
+    // 新增用户视频学习日志
+    studyLog() {
+      this.$http({
+        url: '/user/study/log',
+        method: 'post',
+        data: {
+          goodsId: this.goodsId,
+          courseId: this.courseId,
+					moduleId: this.moduleId || 0,
+					chapterId: this.chapterId || 0,
+          sectionId: this.playSectionId || 0,
+          fromPlat: 1, //来源平台 1小程序 2PC网站
+          goodsType: 1, // 商品类型 1视频2题库 3补考 4前培 5虚拟赠送题库 6直播
+          orderGoodsId: this.orderGoodsId,
+        }
+      }).then((res) => {
+        console.log('直播的用户学习日志:', res)
+      })
+    },
     onStateChange(newstate, oldstate) {
+      console.log('视频的开始播放事件', newstate.detail.newstate, this.needSeek)
       if (newstate.detail.newstate == "playing") {
         if (this.needSeek) {
           var polyvPlayerContext = this.selectComponent("#playerVideo");
@@ -2109,6 +2135,8 @@ export default {
 
           polyvPlayerContext.play();
           this.needSeek = false;
+          // 新增用户视频学习日志
+          this.studyLog()
         }
         //开始播放
         if (this.timer) {