Sfoglia il codice sorgente

Signed-off-by: 李妹妹 <1639016684@qq.com>

李妹妹 13 ore fa
parent
commit
76e74d5a0d

+ 28 - 19
pages_course/living.vue

@@ -1431,6 +1431,11 @@
 				clearInterval(this.trafficTimer);
 				clearInterval(this.trafficTimer);
 				this.trafficTimer = null;
 				this.trafficTimer = null;
 			}
 			}
+			// 清除直播间数据定时器(防止页面隐藏后继续请求)
+			if (this.liveViewDataTimer) {
+				clearInterval(this.liveViewDataTimer);
+				this.liveViewDataTimer = null;
+			}
 			// 暂停观看时长统计
 			// 暂停观看时长统计
 			this.pauseWatchDurationTracking();
 			this.pauseWatchDurationTracking();
 			// 页面隐藏时清理部分数据,减少内存占用
 			// 页面隐藏时清理部分数据,减少内存占用
@@ -1486,7 +1491,11 @@
 				clearTimeout(this.getlivingTimer);
 				clearTimeout(this.getlivingTimer);
 				this.getlivingTimer = null;
 				this.getlivingTimer = null;
 			}
 			}
-
+            // 显式清除直播间数据定时器(防止页面卸载后继续请求)
+            			if (this.liveViewDataTimer) {
+            				clearInterval(this.liveViewDataTimer);
+            				this.liveViewDataTimer = null;
+            			}
 			// 清除所有定时器(使用增强清理)
 			// 清除所有定时器(使用增强清理)
 			this.clearAllTimersEnhanced();
 			this.clearAllTimersEnhanced();
 
 
@@ -2458,7 +2467,7 @@
 					// 然后加载其他数据(并行执行,不阻塞视频加载)
 					// 然后加载其他数据(并行执行,不阻塞视频加载)
 					Promise.all([
 					Promise.all([
 						this.getLiveMsg(this.liveItem),
 						this.getLiveMsg(this.liveItem),
-						this.getliveViewData()
+						//this.getliveViewData()
 					]).catch(err => {
 					]).catch(err => {
 						console.error('加载数据失败:', err);
 						console.error('加载数据失败:', err);
 					});
 					});
@@ -3782,7 +3791,7 @@
 					// 指数退避算法:基础延迟 * 2^(重连次数-1) + 随机抖动
 					// 指数退避算法:基础延迟 * 2^(重连次数-1) + 随机抖动
 					const baseDelay = 1000;
 					const baseDelay = 1000;
 					const exponentialDelay = baseDelay * Math.pow(2, this.reconnectCount - 1);
 					const exponentialDelay = baseDelay * Math.pow(2, this.reconnectCount - 1);
-					const jitter = Math.random() * 1000; // 随机抖动,避免同时重连
+					const jitter = 10000 + Math.random() * 1000; // 随机抖动,避免同时重连
 					const totalDelay = Math.min(exponentialDelay + jitter, 30000); // 最大30秒
 					const totalDelay = Math.min(exponentialDelay + jitter, 30000); // 最大30秒
 					console.log(
 					console.log(
 						`第${this.reconnectCount}次重连,延迟${Math.round(totalDelay)}ms,网络类型:${this.networkType}`
 						`第${this.reconnectCount}次重连,延迟${Math.round(totalDelay)}ms,网络类型:${this.networkType}`
@@ -4841,7 +4850,7 @@
 							this.liveBeginWatchTime = this.getServerTimeNow();
 							this.liveBeginWatchTime = this.getServerTimeNow();
 						}
 						}
 					}
 					}
-					this.startLiveViewDataTimer();
+					this.getliveViewData();
 					this.completionRecords();
 					this.completionRecords();
 					// 初始化观看时间统计
 					// 初始化观看时间统计
 					this.initWatchTime();
 					this.initWatchTime();
@@ -4960,20 +4969,20 @@
 				});
 				});
 			},
 			},
 			// 30秒刷新一下直播间点赞数
 			// 30秒刷新一下直播间点赞数
-			startLiveViewDataTimer() {
-				// 先清除旧定时器(防止重复创建)
-				if (this.liveViewDataTimer) {
-					clearInterval(this.liveViewDataTimer);
-					this.liveViewDataTimer = null;
-				}
-				this.getliveViewData();
-				this.liveViewDataTimer = setInterval(() => {
-					// 安全校验:确保liveItem和liveId存在(避免无效请求)
-					if (this.liveId) {
-						this.getliveViewData();
-					}
-				}, 20000);
-			},
+			// startLiveViewDataTimer() {
+			// 	// 先清除旧定时器(防止重复创建)
+			// 	if (this.liveViewDataTimer) {
+			// 		clearInterval(this.liveViewDataTimer);
+			// 		this.liveViewDataTimer = null;
+			// 	}
+			// 	this.getliveViewData();
+			// 	this.liveViewDataTimer = setInterval(() => {
+			// 		// 安全校验:确保liveItem和liveId存在(避免无效请求)
+			// 		if (this.liveId) {
+			// 			this.getliveViewData();
+			// 		}
+			// 	}, 20000);
+			// },
 			// 去购买,跳商品详情
 			// 去购买,跳商品详情
 			async goShop(productId, goodsId) {
 			async goShop(productId, goodsId) {
 				if (!this.liveId) return;
 				if (!this.liveId) return;
@@ -5519,7 +5528,7 @@
 							this.isShowCoupon = socketMessage.status === 1;
 							this.isShowCoupon = socketMessage.status === 1;
 							if (this.isShowCoupon) {}
 							if (this.isShowCoupon) {}
 						} else if (socketMessage.cmd == 'likeDetail') {
 						} else if (socketMessage.cmd == 'likeDetail') {
-							this.liveViewData.like = socketMessage.data;
+							this.liveViewData.like = Number(socketMessage.data);
 						} else if (socketMessage.cmd == 'lottery') {
 						} else if (socketMessage.cmd == 'lottery') {
 							const lotteryData = socketMessage.data ? JSON.parse(
 							const lotteryData = socketMessage.data ? JSON.parse(
 								socketMessage.data) : {};
 								socketMessage.data) : {};

+ 1 - 1
pages_shopping/live/storeOrderDetail.vue

@@ -198,7 +198,7 @@
 						</view>
 						</view>
 						<view class="item">
 						<view class="item">
 							<text class="label">应付金额</text>
 							<text class="label">应付金额</text>
-							<text class="text" v-if="order.totalPrice!=null">¥{{order.totalPrice.toFixed(2)}}</text>
+							<text class="text" v-if="order.payPrice!=null">¥{{order.payPrice.toFixed(2)}}</text>
 						</view>
 						</view>
 						<view class="item">
 						<view class="item">
 							<text class="label">支付金额</text>
 							<text class="label">支付金额</text>

+ 1 - 1
pages_user/user/storeOrderDetail.vue

@@ -197,7 +197,7 @@
 						</view>
 						</view>
 						<view   class="item">
 						<view   class="item">
 							<text class="label">支付金额</text>
 							<text class="label">支付金额</text>
-							<text class="text" v-if="order.payPrice!=null">¥{{order.payPrice.toFixed(2)}}</text>
+							<text class="text" v-if="order.payMoney!=null">¥{{order.payMoney.toFixed(2)}}</text>
 						</view>
 						</view>
 						<view class="item">
 						<view class="item">
 							<text class="label">运费</text>
 							<text class="label">运费</text>

+ 1 - 1
store/index.js

@@ -20,7 +20,7 @@ export default new Vuex.Store({
 	// https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop  百域承品图片链接
 	// https://jnlzjk-1323137866.cos.ap-chongqing.myqcloud.com/shop  百域承品图片链接
 	logoname:'百域良品',
 	logoname:'百域良品',
 	appid:'wx9bb2cd1e3afe714e',//百域良品	// logonam百域良品域臻品',
 	appid:'wx9bb2cd1e3afe714e',//百域良品	// logonam百域良品域臻品',
-	//appid:'wxcc2de555e32acb08'
+	//appid:'wx9bb2cd1e3afe714e'
 	
 	
   },
   },
   getters: {
   getters: {