liujiaxin před 2 týdny
rodič
revize
f9bfdcb850
1 změnil soubory, kde provedl 7 přidání a 7 odebrání
  1. 7 7
      pages_course/living.vue

+ 7 - 7
pages_course/living.vue

@@ -720,7 +720,7 @@
 						this.isOnload = true;
 						// 然后获取聊天记录
 						await this.getLiveMsg(this.liveId);
-						await this.getliveViewData(this.liveItem);
+						await this.getliveViewData();
 					}
 				}
 			} catch (error) {
@@ -792,7 +792,7 @@
 				await this.getLiveMsg(this.liveItem);
 			}
 			if (!this.liveViewData) {
-				this.getliveViewData(this.liveItem);
+				this.getliveViewData();
 			}
 			if (!this.userData) {
 				await this.getUserInfo();
@@ -2972,7 +2972,6 @@
 					this.$set(this.liveItem, 'autoplay', res.data.liveType !== 0);
 					this.$set(this.liveItem, 'showType', res.data.showType);
 					this.storeId = res.storeId;
-					//  启动“30秒刷新直播间数据”的定时器
 					this.startLiveViewDataTimer();
 					this.playVideo();
 				} catch (err) {
@@ -3025,8 +3024,8 @@
 			},
 
 			//直播间点赞、关注、在线人数数据
-			getliveViewData(liveItem) {
-				if (!liveItem || !this.liveId) return;
+			getliveViewData() {
+				if ( !this.liveId) return;
 				getLiveViewData(this.liveId).then((res) => {
 					if (res.code == 200) {
 						// 强制响应式更新,确保数据实时显示
@@ -3048,10 +3047,11 @@
 					clearInterval(this.liveViewDataTimer);
 					this.liveViewDataTimer = null;
 				}
+				this.getliveViewData();
 				this.liveViewDataTimer = setInterval(() => {
 					// 安全校验:确保liveItem和liveId存在(避免无效请求)
-					if (this.liveItem && this.liveId) {
-						this.getliveViewData(this.liveItem);
+					if ( this.liveId) {
+						this.getliveViewData();
 					}
 				}, 20000);
 			},