From e4f0862bd8af0ac1c7aab59904b69dd071526aff Mon Sep 17 00:00:00 2001
From: inleft <inleft@qq.com>
Date: Fri, 12 Aug 2022 23:59:41 +0800
Subject: [PATCH] 视频模块添加播放历史

---
 src/components/mini/box16-videoDetail.vue |   46 +++++++++++++++++++++++++++++++++++-----------
 1 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/src/components/mini/box16-videoDetail.vue b/src/components/mini/box16-videoDetail.vue
index 8874d56..d093711 100644
--- a/src/components/mini/box16-videoDetail.vue
+++ b/src/components/mini/box16-videoDetail.vue
@@ -1,12 +1,12 @@
 <template>
 	<div>
-		<div class="boxMain">
-			<videoPlayBox ref="videoPlayBox"></videoPlayBox>
+		<div class="boxMain ">
+			<videoPlayBox ref="videoPlayBox" @swichPlay="swichPlay"></videoPlayBox>
 		</div>
-		<div style="padding: 20px 20px 5px;" class="myShadow">
+		<div style="padding: 20px 20px 5px;margin-bottom: 20px;" class="myShadow fadeInLeft">
 			<pre>{{introduce}}</pre>
 		</div>
-		<div class="articleComment">
+		<div class="articleComment fadeInRight">
 			<comment ref="myComment" :articleId="articleId" :isAllowedComment="isAllowedComment" :foldReply="true" />
 		</div>
 	</div>
@@ -57,19 +57,36 @@
 				videoData: {
 					img: "http://t.inleft.com/share/media_photo/idea_beijing.jpg",
 					url: "",
-					type: "normal"
+					type: "normal",
+					title: "",
+					introduce: "",
+					id: ""
 				}
 			}
 		},
 		methods: {
+			swichPlay(videoData) {
+				this.introduce = videoData.introduce;
+				this.$refs.myComment.updateCommentList(videoData.id);
+			},
 			showVideo(item) {
+				//防止重复加载
 				this.lastArticleId = this.articleId;
 				this.articleId = item.id
-				this.isAllowedComment = item.isAllowedComment
-				this.introduce = item.introduce
-				this.loadData()
+
+				if (this.articleId == this.lastArticleId) {
+					return
+				}
+
+				this.isAllowedComment = item.isAllowedComment;
+				this.introduce = item.introduce;
+				this.loadData();
 			},
 			loadData() {
+
+				if (this.$refs.videoPlayBox.isPlaying) {
+					this.$message.info("上个视频正在播放中")
+				}
 
 				if (this.myLock) {
 					this.$message.info("正在努力加载中..", 3)
@@ -81,7 +98,7 @@
 					id: this.articleId,
 					authWord: this.secret == "" ? null : md5(this.secret)
 				}).then((res) => {
-					this.myLock = true;
+					this.myLock = !this.myLock;
 
 					if (res.code != 200) {
 
@@ -104,6 +121,11 @@
 					this.isAllowedComment = res.data.isAllowedComment;
 					this.videoData.url = res.data.articleFileURL;
 					this.videoData.img = res.data.coverFileURL;
+					this.videoData.title = res.data.title;
+					this.videoData.introduce = res.data.introduce;
+					this.videoData.id = res.data.id;
+
+
 					if (res.data.articleFileURL != null &&
 						res.data.articleFileURL != "" &&
 						res.data.articleFileURL.endsWith("m3u8")) {
@@ -112,9 +134,10 @@
 						this.videoData.type = "normal";
 					}
 
-					this.myLock = false;
+					this.myLock = !this.myLock;
 					if (this.lastArticleId != this.articleId) {
-						_this.$refs.videoPlayBox.changePlay(this.videoData)
+						let tempParam = JSON.parse(JSON.stringify(this.videoData))
+						_this.$refs.videoPlayBox.startPlay(tempParam)
 					}
 				})
 
@@ -133,6 +156,7 @@
 	}
 
 	.boxMain {
+		user-select: none;
 		display: flex;
 		justify-content: center;
 		padding: 5px 20px;

--
Gitblit v1.9.1