liujiaxin 3 月之前
父節點
當前提交
9358468a6c
共有 47 個文件被更改,包括 2779 次插入456 次删除
  1. 2 2
      common/request.js
  2. 2 2
      core/config/defaultConfig.js
  3. 7 0
      pages.json
  4. 1 0
      pages/auth/login.vue
  5. 2 2
      pages/home/live.vue
  6. 1 4
      pages/home/living - 副本.vue
  7. 310 228
      pages/home/living.vue
  8. 110 42
      pages/list/index.vue
  9. 2251 0
      pages_no/living827.vue
  10. 62 161
      pages_shop/cart.vue
  11. 7 4
      pages_shop/order.vue
  12. 1 0
      pages_shop/paymentOrder.vue
  13. 1 1
      pages_shop/refundOrder.vue
  14. 二進制
      static/images/close.png
  15. 二進制
      static/images/signal.png
  16. 2 1
      unpackage/dist/dev/mp-weixin/app.json
  17. 0 0
      unpackage/dist/dev/mp-weixin/common/assets.js
  18. 1 1
      unpackage/dist/dev/mp-weixin/common/request.js
  19. 0 0
      unpackage/dist/dev/mp-weixin/common/vendor.js
  20. 1 1
      unpackage/dist/dev/mp-weixin/core/config/defaultConfig.js
  21. 0 0
      unpackage/dist/dev/mp-weixin/pages/auth/login.wxss
  22. 0 0
      unpackage/dist/dev/mp-weixin/pages/home/live.js
  23. 0 0
      unpackage/dist/dev/mp-weixin/pages/home/live.wxml
  24. 0 0
      unpackage/dist/dev/mp-weixin/pages/home/living.js
  25. 0 0
      unpackage/dist/dev/mp-weixin/pages/home/living.wxml
  26. 0 0
      unpackage/dist/dev/mp-weixin/pages/home/living.wxss
  27. 1 1
      unpackage/dist/dev/mp-weixin/pages/list/index.js
  28. 3 1
      unpackage/dist/dev/mp-weixin/pages/list/index.json
  29. 1 1
      unpackage/dist/dev/mp-weixin/pages/list/index.wxml
  30. 1 1
      unpackage/dist/dev/mp-weixin/pages/list/index.wxss
  31. 0 0
      unpackage/dist/dev/mp-weixin/pages_no/living827.js
  32. 8 0
      unpackage/dist/dev/mp-weixin/pages_no/living827.json
  33. 0 0
      unpackage/dist/dev/mp-weixin/pages_no/living827.wxml
  34. 0 0
      unpackage/dist/dev/mp-weixin/pages_no/living827.wxss
  35. 0 0
      unpackage/dist/dev/mp-weixin/pages_no/zuizao.js
  36. 0 0
      unpackage/dist/dev/mp-weixin/pages_shop/cart.js
  37. 0 0
      unpackage/dist/dev/mp-weixin/pages_shop/cart.wxss
  38. 0 0
      unpackage/dist/dev/mp-weixin/pages_shop/order.js
  39. 2 1
      unpackage/dist/dev/mp-weixin/pages_shop/order.json
  40. 0 0
      unpackage/dist/dev/mp-weixin/pages_shop/order.wxml
  41. 0 0
      unpackage/dist/dev/mp-weixin/pages_shop/paymentOrder.js
  42. 1 1
      unpackage/dist/dev/mp-weixin/pages_shop/paymentOrder.wxml
  43. 0 0
      unpackage/dist/dev/mp-weixin/pages_shop/refundOrder.js
  44. 1 1
      unpackage/dist/dev/mp-weixin/pages_shop/refundOrder.wxml
  45. 0 0
      unpackage/dist/dev/mp-weixin/pages_shop/storeOrder.js
  46. 二進制
      unpackage/dist/dev/mp-weixin/static/images/close.png
  47. 二進制
      unpackage/dist/dev/mp-weixin/static/images/signal.png

+ 2 - 2
common/request.js

@@ -39,8 +39,8 @@ export default class Request {
   
   
   http(router, data = {}, method, contentType, showLoading = true) {
   http(router, data = {}, method, contentType, showLoading = true) {
     let that = this;
     let that = this;
-    // let path = 'https://live.test.ylrztop.com/live-api'; // 余红奇
-	let path = 'http://192.168.10.166:7114'; // 余红奇
+    let path = 'https://live.test.ylrztop.com/live-api'; // 余红奇
+	// let path = 'http://192.168.10.166:7114'; // 余红奇
     
     
     // 检查是否应该显示loading
     // 检查是否应该显示loading
     const shouldShowLoading = showLoading && 
     const shouldShowLoading = showLoading && 

+ 2 - 2
core/config/defaultConfig.js

@@ -14,10 +14,10 @@ const productionUrl = 'https://wanbei.monvkeji.cn/'
 // 测试环境
 // 测试环境
 const testUrl = 'https://wanbei.monvkeji.cn/'
 const testUrl = 'https://wanbei.monvkeji.cn/'
 // 开发环境
 // 开发环境
-const developUrl = 'http://192.168.10.166:7114/'//余红奇
+// const developUrl = 'http://192.168.10.166:7114/'//余红奇
 // const developUrl = 'http://v56c9b8e.natappfree.cc/'//余红奇
 // const developUrl = 'http://v56c9b8e.natappfree.cc/'//余红奇
 // const developUrl = 'http://nd383294.natappfree.cc/'//余红奇
 // const developUrl = 'http://nd383294.natappfree.cc/'//余红奇
-// const developUrl = 'https://live.test.ylrztop.com/live-api/'//余红奇
+const developUrl = 'https://live.test.ylrztop.com/live-api/'//余红奇
 // const developUrl = 'http://192.168.10.170:7114/'//陈果
 // const developUrl = 'http://192.168.10.170:7114/'//陈果
 export default {
 export default {
 	// 系统名称
 	// 系统名称

+ 7 - 0
pages.json

@@ -135,6 +135,13 @@
 			{
 			{
 				"navigationBarTitleText" : ""
 				"navigationBarTitleText" : ""
 			}
 			}
+		},
+		{
+			"path" : "pages_no/living827",
+			"style" : 
+			{
+				"navigationBarTitleText" : ""
+			}
 		}
 		}
 
 
 
 

+ 1 - 0
pages/auth/login.vue

@@ -634,6 +634,7 @@
 		display: flex;
 		display: flex;
 		flex-direction: column;
 		flex-direction: column;
 		width: 100%;
 		width: 100%;
+		margin-top: 100rpx;
 	}
 	}
 
 
 	.content .head {
 	.content .head {

+ 2 - 2
pages/home/live.vue

@@ -10,12 +10,12 @@
 					:controls='false' :poster='livedata.liveImgUrl' vslide-gesture-in-fullscreen='true'
 					:controls='false' :poster='livedata.liveImgUrl' vslide-gesture-in-fullscreen='true'
 					:show-center-play-btn="false"></video>
 					:show-center-play-btn="false"></video>
 			</view>
 			</view>
-			<view class="popup-video" v-if="!autoplay">
+			<!-- <view class="popup-video" v-if="!autoplay">
 				<view class="fs36 bold" v-if="livedata.status==1">——直播还未开始——</view>
 				<view class="fs36 bold" v-if="livedata.status==1">——直播还未开始——</view>
 				<view class="fs36 bold" v-if="livedata.status==3">——直播已经结束——</view>
 				<view class="fs36 bold" v-if="livedata.status==3">——直播已经结束——</view>
 				<view class="fs28 mtb20">了解更多,点击下方联系老师</view>
 				<view class="fs28 mtb20">了解更多,点击下方联系老师</view>
 				<view class="more" @click="showadd=!showadd">联系老师</view>
 				<view class="more" @click="showadd=!showadd">联系老师</view>
-			</view>
+			</view> -->
 		</view>
 		</view>
 		<view class="justify-between align-center bgf" style="border-bottom: #dedede solid 2rpx;">
 		<view class="justify-between align-center bgf" style="border-bottom: #dedede solid 2rpx;">
 			<u-tabs :list="list1" @click="tabClick" inactiveStyle="color:#888"
 			<u-tabs :list="list1" @click="tabClick" inactiveStyle="color:#888"

+ 1 - 4
pages/home/living - 副本.vue

@@ -1578,10 +1578,7 @@ checkConnectionStatus(liveId) {
 				if (!liveItem || !messageData) return;
 				if (!liveItem || !messageData) return;
 				// 将消息添加到当前直播间的聊天列表
 				// 将消息添加到当前直播间的聊天列表
 				if (messageData.cmd === 'sendMsg') {
 				if (messageData.cmd === 'sendMsg') {
-					this.$set(liveItem, 'talklist', [...liveItem.talklist, messageData]);
-					this.$nextTick(() => {
-						this.$set(liveItem, 'scrollIntoView', `list_${liveItem.talklist.length-1}`);
-					});
+					c
 				}
 				}
 				if (message.cmd == 'red') {
 				if (message.cmd == 'red') {
 					// 领红包
 					// 领红包

+ 310 - 228
pages/home/living.vue

@@ -4,7 +4,6 @@
 			@change="onSwiperChange" :style="{height: '100vh'}" :duration="swiperDuration">
 			@change="onSwiperChange" :style="{height: '100vh'}" :duration="swiperDuration">
 			<swiper-item v-for="(liveItem, index) in list" :key="liveItem.liveId">
 			<swiper-item v-for="(liveItem, index) in list" :key="liveItem.liveId">
 				<view class="container" :class="{active: currentSwiperIndex === index}">
 				<view class="container" :class="{active: currentSwiperIndex === index}">
-					<!-- 原有直播间内容结构保持不变 -->
 					<view class="blackbg"></view>
 					<view class="blackbg"></view>
 					<view class="content">
 					<view class="content">
 						<!-- 页面内容 -->
 						<!-- 页面内容 -->
@@ -42,10 +41,10 @@
 								<image @click="onLike(liveItem)" src="/static/images/live/like.png"></image>
 								<image @click="onLike(liveItem)" src="/static/images/live/like.png"></image>
 								<view>{{liveItem.liveViewData?.like||0}}</view>
 								<view>{{liveItem.liveViewData?.like||0}}</view>
 							</view>
 							</view>
-							<view class="side-item">
+							<!-- <view class="side-item">
 								<image @click="goStore(liveItem)" src="/static/images/live/shop.png"></image>
 								<image @click="goStore(liveItem)" src="/static/images/live/shop.png"></image>
 								<view>店铺</view>
 								<view>店铺</view>
-							</view>
+							</view> -->
 
 
 							<view class="side-item">
 							<view class="side-item">
 								<button open-type="share">
 								<button open-type="share">
@@ -62,7 +61,6 @@
 								人正在去购买</text>
 								人正在去购买</text>
 						</view>
 						</view>
 
 
-						<!-- object-fit:fill; -->
 						<view class="videolist " style="margin: auto 0">
 						<view class="videolist " style="margin: auto 0">
 							<view class="video" style="height:100vh">
 							<view class="video" style="height:100vh">
 								<!-- 修改video组件以支持HLS -->
 								<!-- 修改video组件以支持HLS -->
@@ -117,7 +115,6 @@
 											</view>
 											</view>
 										</view>
 										</view>
 									</view>
 									</view>
-									<!-- v-if="liveItem.showWelcomeMessage" -->
 									<view v-if="liveItem.showWelcomeMessage" class="welcome-message">
 									<view v-if="liveItem.showWelcomeMessage" class="welcome-message">
 										<view class="list justify-start" v-for="(item,talkIndex) in liveItem.talklist"
 										<view class="list justify-start" v-for="(item,talkIndex) in liveItem.talklist"
 											:key="talkIndex" v-show="item.cmd=='entry'||item.cmd=='out'">
 											:key="talkIndex" v-show="item.cmd=='entry'||item.cmd=='out'">
@@ -137,26 +134,44 @@
 
 
 							<view class="justify-between p24">
 							<view class="justify-between p24">
 								<view class="u-flex-y-center"
 								<view class="u-flex-y-center"
-									style="background:rgba(157, 157, 157, 0.8);padding:18rpx 14rpx 18rpx 32rpx;width: 566rpx;box-sizing:border-box;border-radius:36rpx;">
+									style="background:rgba(157, 157, 157, 0.8);padding:10rpx 14rpx 10rpx 32rpx;width: 566rpx;box-sizing:border-box;border-radius:36rpx;">
 									<u-input :placeholder="liveItem.placeholderText" border="none"
 									<u-input :placeholder="liveItem.placeholderText" border="none"
 										customStyle='font-size:24rpx;' v-model="liveItem.value" shape='circle'
 										customStyle='font-size:24rpx;' v-model="liveItem.value" shape='circle'
-										color='#fff' placeholderStyle='color:#e7e7e7' class="ml20"
-										@confirm="sendMsg(liveItem)">
+										color='#fff' placeholderStyle='color:#e7e7e7' class="ml20">
 									</u-input>
 									</u-input>
+									<view class="send" @click="sendMsg(liveItem)">发送</view>
 								</view>
 								</view>
 								<view class="justify-between mr15  align-center">
 								<view class="justify-between mr15  align-center">
-									<view class="icon-bg ml20" @click="openCart(liveItem)">
+									<!-- <view class="icon-bg ml20" @click="openCart(liveItem)">
 										<image src="/static/images/shopping.png" class="w48 h48"></image>
 										<image src="/static/images/shopping.png" class="w48 h48"></image>
-									</view>
+									</view> -->
 									<!-- <view class="icon-bg ml20" @click="liveItem.showziliao=!liveItem.showziliao">
 									<!-- <view class="icon-bg ml20" @click="liveItem.showziliao=!liveItem.showziliao">
 										<image src="/static/images/more-icon.png" class="w48 h48"></image>
 										<image src="/static/images/more-icon.png" class="w48 h48"></image>
 									</view> -->
 									</view> -->
 								</view>
 								</view>
 							</view>
 							</view>
 						</view>
 						</view>
+
+						<!-- 弹出商品 -->
+						<view @click="" class="goods">
+							<view class="item">
+								<view class="top">
+									<view class="">
+										<image class="w30 h30" src="/static/images/signal.png"></image>讲解中
+									</view>
+									<image class="w30 h30" src="/static/images/close.png"></image>
+								</view>
+								<image class="w100 h100" style="width: 70rpx;height: 70rpx;"
+									src="@/static/images/hongbao.png" mode="widthFix"></image>
+								<view class="price"><text class="red">23</text><text class="">26</text></view>
+								<view class="title">新鲜土鸡蛋</view>
+								<view class="button">立即抢购</view>
+							</view>
+						</view>
 					</view>
 					</view>
 
 
-					<!-- 弹窗组件保持不变 -->
+
+
 					<u-popup :show="showadd" @close="close" @open="openViews" round='20rpx' bgColor='#ffffff'>
 					<u-popup :show="showadd" @close="close" @open="openViews" round='20rpx' bgColor='#ffffff'>
 						<view class="view-box">
 						<view class="view-box">
 							<view class="t-c fs30">在线观众</view>
 							<view class="t-c fs30">在线观众</view>
@@ -188,22 +203,22 @@
 							<view class="shoppop-top">
 							<view class="shoppop-top">
 								<u-avatar :src="store.logoUrl" size="36" class="ml16"></u-avatar>
 								<u-avatar :src="store.logoUrl" size="36" class="ml16"></u-avatar>
 								<view class="search-input u-flex-y-center">
 								<view class="search-input u-flex-y-center">
-									<image style="width: 24rpx;height: 24rpx;margin-right: 16rpx;"
-										src="@/static/images/search.png">
+									<image style="width: 24rpx;margin-right: 16rpx;" src="@/static/images/search.png"
+										mode="widthFix">
 									</image>
 									</image>
 									<input placeholder="请搜索商品" v-model="liveItem.inputInfo"
 									<input placeholder="请搜索商品" v-model="liveItem.inputInfo"
 										@input="handleSearchInput" />
 										@input="handleSearchInput" />
 								</view>
 								</view>
 								<view class="t-c search-top" style="margin-right: 48rpx;">
 								<view class="t-c search-top" style="margin-right: 48rpx;">
 									<image @click="onStoreCollect(liveItem)" v-if="store.isFavorite"
 									<image @click="onStoreCollect(liveItem)" v-if="store.isFavorite"
-										style="width: 32rpx;height: 32rpx;" src="@/static/images/collect_select.png">
+										style="width:40rpx;height: 40rpx;" src="@/static/images/collect_select.png">
 									</image>
 									</image>
 									<image v-else @click="onStoreCollect(liveItem)" style="width: 32rpx;height: 32rpx;"
 									<image v-else @click="onStoreCollect(liveItem)" style="width: 32rpx;height: 32rpx;"
 										src="@/static/images/collect.png"></image>
 										src="@/static/images/collect.png"></image>
 									<view>收藏</view>
 									<view>收藏</view>
 								</view>
 								</view>
 								<view class="t-c search-top" @click="goOrderList(liveItem)">
 								<view class="t-c search-top" @click="goOrderList(liveItem)">
-									<image style="width: 32rpx;height: 32rpx;" src="@/static/images/order.png"></image>
+									<image style="width: 40rpx;height: 40rpx;" src="@/static/images/order.png"></image>
 									<view>订单</view>
 									<view>订单</view>
 								</view>
 								</view>
 							</view>
 							</view>
@@ -277,7 +292,7 @@
 		liveOrderList, // 订单列表
 		liveOrderList, // 订单列表
 	} from '@/api/order'
 	} from '@/api/order'
 
 
-	import parse from '../../uni_modules/uview-plus/libs/config/props/parse';
+	import parse from '/uni_modules/uview-plus/libs/config/props/parse';
 	import {
 	import {
 		LiveWS
 		LiveWS
 	} from '@/utils/liveWS.js'
 	} from '@/utils/liveWS.js'
@@ -287,13 +302,10 @@
 		getAnswerlist,
 		getAnswerlist,
 		submitAnswer
 		submitAnswer
 	} from '@/api/home'
 	} from '@/api/home'
-	// var wsUrl = "ws://192.168.10.166:7114/app/webSocket";
 
 
-	var wsUrl = "ws://192.168.10.166:7114/app/webSocket"; //余红奇
-	// var wsUrl = "ws://192.168.10.125:7114/app/webSocket"; //涂小龙
-	// var wsUrl = "wss://live.test.ylrztop.com/ws/live-api/app/webSocket"; //余红奇
 	// var wsUrl = "ws://192.168.10.166:7114/app/webSocket"; //余红奇
 	// var wsUrl = "ws://192.168.10.166:7114/app/webSocket"; //余红奇
 	// var wsUrl = "ws://192.168.10.125:7114/app/webSocket"; //涂小龙
 	// var wsUrl = "ws://192.168.10.125:7114/app/webSocket"; //涂小龙
+	var wsUrl = "wss://live.test.ylrztop.com/ws/live-api/app/webSocket"; //余红奇
 	// var wsUrl = "ws://live.test.ylrztop.com/prod-api/app/webSocket"; //余红奇
 	// var wsUrl = "ws://live.test.ylrztop.com/prod-api/app/webSocket"; //余红奇
 	// var wsUrl = "ws://nd383294.natappfree.cc/app/webSocket"; //余红奇
 	// var wsUrl = "ws://nd383294.natappfree.cc/app/webSocket"; //余红奇
 	// var wsUrl = "ws://v56c9b8e.natappfree.cc/app/webSocket"; //余红奇
 	// var wsUrl = "ws://v56c9b8e.natappfree.cc/app/webSocket"; //余红奇
@@ -307,6 +319,7 @@
 	export default {
 	export default {
 		data() {
 		data() {
 			return {
 			return {
+				connectingLiveId: null, // 记录正在连接的直播间ID
 				swiperDuration: 0, // 初始化为0,首次加载无动画
 				swiperDuration: 0, // 初始化为0,首次加载无动画
 				videoRetryCounts: {}, // 记录每个直播间的视频重试次数,格式: { liveId: 次数 }
 				videoRetryCounts: {}, // 记录每个直播间的视频重试次数,格式: { liveId: 次数 }
 
 
@@ -364,7 +377,7 @@
 				// path: 'http://v56c9b8e.natappfree.cc', //余红奇
 				// path: 'http://v56c9b8e.natappfree.cc', //余红奇
 				// path: 'live.test.ylrztop.com/prod-api', //余红奇
 				// path: 'live.test.ylrztop.com/prod-api', //余红奇
 				// path: 'http://192.168.10.170/dev-api', //陈果
 				// path: 'http://192.168.10.170/dev-api', //陈果
-				value: '',
+				// value: '',
 				talkdisabled: false, //输入框是否禁用
 				talkdisabled: false, //输入框是否禁用
 				autoplay: false, //视频自动播放
 				autoplay: false, //视频自动播放
 				showadd: false,
 				showadd: false,
@@ -397,15 +410,8 @@
 			// 初始化直播间列表
 			// 初始化直播间列表
 			this.initLiveList(options);
 			this.initLiveList(options);
 			this.getliveUser(false); // 调用获取在线用户接口
 			this.getliveUser(false); // 调用获取在线用户接口
-			// this.initLiveList(options).then(() => {
-			// 	// 列表初始化完成后,请求在线用户
-			// 	console.log("开始开始《《")
-			// 	this.resetUserListParams(); // 重置分页参数
-			// 	this.getliveUser(true); // 调用获取在线用户接口
-			// });
 			const platform = uni.getWindowInfo().platform;
 			const platform = uni.getWindowInfo().platform;
 			// 初始化直播间列表
 			// 初始化直播间列表
-			this.initLiveList(options);
 
 
 			if (['mp-weixin', 'mp-alipay', 'mp-baidu', 'mp-toutiao'].includes(platform)) {
 			if (['mp-weixin', 'mp-alipay', 'mp-baidu', 'mp-toutiao'].includes(platform)) {
 				// 确保 API 存在再调用
 				// 确保 API 存在再调用
@@ -455,28 +461,30 @@
 			const currentLive = this.list[this.currentSwiperIndex];
 			const currentLive = this.list[this.currentSwiperIndex];
 			if (currentLive) {
 			if (currentLive) {
 				this.pauseVideo(currentLive);
 				this.pauseVideo(currentLive);
-			}
+			} // 隐藏时关闭所有连接
+			this.closeAllWebSockets();
 		},
 		},
 		onUnload() {
 		onUnload() {
 			// 关闭所有WebSocket连接
 			// 关闭所有WebSocket连接
 			this.closeAllWebSockets();
 			this.closeAllWebSockets();
-
+			this.socketInstances = {}; // 强制清空实例对象
 			// 移除所有全局事件监听
 			// 移除所有全局事件监听
 			this.removeAllEventListeners();
 			this.removeAllEventListeners();
 
 
 			// 清理定时器
 			// 清理定时器
 			this.clearAllTimers();
 			this.clearAllTimers();
 
 
-			// 销毁HLS播放器
+			// 销毁HLS播放器(如果使用了hls.js)
 			if (this.hlsPlayer) {
 			if (this.hlsPlayer) {
 				this.hlsPlayer.destroy();
 				this.hlsPlayer.destroy();
 				this.hlsPlayer = null;
 				this.hlsPlayer = null;
 			}
 			}
+
 			this.list.forEach(liveItem => {
 			this.list.forEach(liveItem => {
 				const videoId = `myVideo_${liveItem.liveId}`;
 				const videoId = `myVideo_${liveItem.liveId}`;
 				const videoContext = uni.createVideoContext(videoId, this);
 				const videoContext = uni.createVideoContext(videoId, this);
 				if (videoContext) {
 				if (videoContext) {
-					videoContext.destroy();
+					videoContext.pause(); // 仅暂停视频即可
 				}
 				}
 			});
 			});
 		},
 		},
@@ -492,7 +500,8 @@
 				immediate: true
 				immediate: true
 			}
 			}
 		},
 		},
-		methods: { // 新增:重置在线用户列表的分页参数
+		methods: {
+			// 重置在线用户列表的分页参数
 			resetUserListParams() {
 			resetUserListParams() {
 				this.viewPageNum = 1; // 重置页码为第一页
 				this.viewPageNum = 1; // 重置页码为第一页
 				this.viewNoMoreData = false; // 重置“没有更多数据”状态
 				this.viewNoMoreData = false; // 重置“没有更多数据”状态
@@ -518,14 +527,14 @@
 
 
 				this.socketInstances = {};
 				this.socketInstances = {};
 				isSocketOpen = false;
 				isSocketOpen = false;
-			}, // 新增:移除所有全局事件监听器
+			}, // 移除所有全局事件监听器
 			removeAllEventListeners() {
 			removeAllEventListeners() {
 				uni.$off('initSocket');
 				uni.$off('initSocket');
 				uni.$off('sendMsg');
 				uni.$off('sendMsg');
 				uni.$off('closeWebSocket');
 				uni.$off('closeWebSocket');
 				uni.$off('refreshOrder');
 				uni.$off('refreshOrder');
 				// 可以根据实际情况添加其他需要移除的事件
 				// 可以根据实际情况添加其他需要移除的事件
-			}, // 新增:清理所有定时器
+			}, // 清理所有定时器
 			clearAllTimers() {
 			clearAllTimers() {
 				if (this.intervalId) {
 				if (this.intervalId) {
 					clearInterval(this.intervalId);
 					clearInterval(this.intervalId);
@@ -562,16 +571,20 @@
 				const currentLive = this.list[this.currentSwiperIndex];
 				const currentLive = this.list[this.currentSwiperIndex];
 				if (!currentLive) return;
 				if (!currentLive) return;
 
 
+				// 设置加载状态
+				currentLive.loading = true;
 
 
-				console.log("initCurrentLiveData:" + currentLive)
 				try {
 				try {
-					// 并行加载,但允许单个失败不阻塞整体
+					// 先初始化WebSocket连接
+					await this.initSocket(currentLive);
+
+					// 然后并行加载其他数据
 					await Promise.allSettled([
 					await Promise.allSettled([
 						this.getLiveMsg(currentLive),
 						this.getLiveMsg(currentLive),
 						this.getliveViewData(currentLive),
 						this.getliveViewData(currentLive),
-						this.getliving(currentLive),
-						this.initSocket(currentLive)
+						this.getliving(currentLive)
 					]);
 					]);
+
 					currentLive.loaded = true;
 					currentLive.loaded = true;
 				} catch (error) {
 				} catch (error) {
 					console.error("初始化直播间数据失败:", error);
 					console.error("初始化直播间数据失败:", error);
@@ -580,6 +593,7 @@
 				}
 				}
 			},
 			},
 
 
+
 			// 初始化直播间列表
 			// 初始化直播间列表
 			async initLiveList(options) {
 			async initLiveList(options) {
 				try {
 				try {
@@ -589,7 +603,7 @@
 						return;
 						return;
 					}
 					}
 
 
-					// 设置初始直播间索引
+					// 设置初始直播间索引(原逻辑保留)
 					if (options.liveId) {
 					if (options.liveId) {
 						const index = this.list.findIndex(item => item.liveId == options.liveId);
 						const index = this.list.findIndex(item => item.liveId == options.liveId);
 						this.currentSwiperIndex = index !== -1 ? index : 0;
 						this.currentSwiperIndex = index !== -1 ? index : 0;
@@ -597,19 +611,33 @@
 						this.currentSwiperIndex = 0;
 						this.currentSwiperIndex = 0;
 					}
 					}
 
 
-					// 延迟设置动画时间,确保首次加载无动画
+
+					// 延迟设置动画时间(原逻辑保留)
 					setTimeout(() => {
 					setTimeout(() => {
-						this.swiperDuration = 300; // 恢复正常动画时间
+						this.swiperDuration = 300;
 					}, 100);
 					}, 100);
 
 
 					// 获取当前直播间的liveItem
 					// 获取当前直播间的liveItem
 					const currentLive = this.list[this.currentSwiperIndex];
 					const currentLive = this.list[this.currentSwiperIndex];
 					if (currentLive) {
 					if (currentLive) {
 						this.liveId = currentLive.liveId;
 						this.liveId = currentLive.liveId;
-						this.initSocket(); // 主动触发连接
-						this.preloadNearbyLives();
-						this.resetUserListParams(); // 重置分页参数
-						this.getliveUser(true); // 调用获取在线用户接口
+
+						// 重置用户列表参数
+						this.resetUserListParams();
+
+						// 预加载相邻直播间(不初始化WebSocket)
+						this.preloadNearbyLives(false);
+
+						// 初始化当前直播间数据(包含WebSocket连接)
+						await this.initCurrentLiveData();
+
+						// 获取在线用户
+						this.getliveUser(true);
+
+						// 延迟播放视频
+						setTimeout(() => {
+							this.playVideo(currentLive);
+						}, 500);
 					}
 					}
 				} catch (error) {
 				} catch (error) {
 					console.error("初始化失败:", error);
 					console.error("初始化失败:", error);
@@ -617,52 +645,43 @@
 			},
 			},
 
 
 			// Swiper切换事件
 			// Swiper切换事件
-			// 修改Swiper切换事件
 			async onSwiperChange(e) {
 			async onSwiperChange(e) {
 				const newIndex = e.detail.current;
 				const newIndex = e.detail.current;
 				const oldIndex = this.currentSwiperIndex;
 				const oldIndex = this.currentSwiperIndex;
-
-				// 如果索引没有变化,直接返回
 				if (newIndex === oldIndex) return;
 				if (newIndex === oldIndex) return;
 
 
-				// 暂停旧视频
+				// 1. 立即关闭旧直播间的WebSocket(同步操作)
 				const oldLive = this.list[oldIndex];
 				const oldLive = this.list[oldIndex];
 				if (oldLive) {
 				if (oldLive) {
 					this.pauseVideo(oldLive);
 					this.pauseVideo(oldLive);
-					this.closeWebSocket(oldLive.liveId);
+					// 强制关闭并删除实例,确保连接被释放
+					if (this.socketInstances[oldLive.liveId]) {
+						try {
+							this.socketInstances[oldLive.liveId].instance.close({
+								code: 1000,
+								reason: '切换直播间'
+							});
+							console.log(`关闭旧直播间 ${oldLive.liveId} WebSocket`);
+						} catch (e) {
+							console.error('关闭旧连接失败:', e);
+						}
+						delete this.socketInstances[oldLive.liveId]; // 彻底删除实例
+					}
 				}
 				}
 
 
-				// 更新当前索引
+				// 2. 处理新直播间(后续逻辑不变)
 				this.currentSwiperIndex = newIndex;
 				this.currentSwiperIndex = newIndex;
 				const newLive = this.list[newIndex];
 				const newLive = this.list[newIndex];
 				if (!newLive) return;
 				if (!newLive) return;
 
 
-				// 更新当前直播ID
 				this.liveId = newLive.liveId;
 				this.liveId = newLive.liveId;
-
-				try {
-					// 并行加载新直播间数据
-					await Promise.all([
-						this.initSocket(newLive),
-						this.getliving(newLive),
-						this.getLiveMsg(newLive),
-						this.getliveViewData(newLive),
-						this.resetUserListParams(), // 重置分页,清空旧数据
-						this.getliveUser(false), // 重新请求新直播间的在线观众
-					]);
-
-					if (oldLive) {
-						this.pauseVideo(oldLive);
-					}
-					// 延迟100ms再播放新视频,避免冲突
-					setTimeout(() => {
-						this.playVideo(newLive);
-					}, 100);
-				} catch (error) {
-					console.error('切换直播间失败:', error);
-				}
+				this.resetUserListParams();
+				await this.initCurrentLiveData();
+				this.getliveUser(false);
+				setTimeout(() => {
+					this.playVideo(newLive);
+				}, 100);
 			},
 			},
-
 			// 获取直播间列表
 			// 获取直播间列表
 			async getList() {
 			async getList() {
 				const data = {
 				const data = {
@@ -728,32 +747,33 @@
 				}
 				}
 			},
 			},
 			// 预加载相邻直播间
 			// 预加载相邻直播间
-			async preloadNearbyLives() {
+			async preloadNearbyLives(includeWebSocket = false) {
 				this.preloading = true;
 				this.preloading = true;
 				const currentIndex = this.currentSwiperIndex;
 				const currentIndex = this.currentSwiperIndex;
 				const preloadIndexes = [];
 				const preloadIndexes = [];
+
+				// 只预加载数据,不初始化WebSocket(强制关闭WebSocket预加载)
+				includeWebSocket = false; // 关键:强制不预加载WebSocket
+
 				if (currentIndex > 0) preloadIndexes.push(currentIndex - 1);
 				if (currentIndex > 0) preloadIndexes.push(currentIndex - 1);
-				if (currentIndex > 1) preloadIndexes.push(currentIndex - 2);
 				if (currentIndex < this.list.length - 1) preloadIndexes.push(currentIndex + 1);
 				if (currentIndex < this.list.length - 1) preloadIndexes.push(currentIndex + 1);
-				if (currentIndex < this.list.length - 2) preloadIndexes.push(currentIndex + 2);
 
 
 				for (const index of preloadIndexes) {
 				for (const index of preloadIndexes) {
 					const liveItem = this.list[index];
 					const liveItem = this.list[index];
 					if (!liveItem || liveItem.loaded || liveItem.loading) continue;
 					if (!liveItem || liveItem.loaded || liveItem.loading) continue;
 
 
-					liveItem.loading = true; // 标记为加载中
+					liveItem.loading = true;
 					try {
 					try {
-						// 等待视频源加载完成
-						await this.getliving(liveItem);
-						// 确保其他必要数据加载
+						// 只加载基础数据,不初始化WebSocket
 						await Promise.all([
 						await Promise.all([
+							this.getliving(liveItem),
 							this.getLiveMsg(liveItem),
 							this.getLiveMsg(liveItem),
 							this.getliveViewData(liveItem)
 							this.getliveViewData(liveItem)
 						]);
 						]);
-						liveItem.loaded = true; // 所有数据加载完成才标记为“已加载”
+						liveItem.loaded = true;
 					} catch (error) {
 					} catch (error) {
 						console.error(`预加载直播间 ${index} 失败:`, error);
 						console.error(`预加载直播间 ${index} 失败:`, error);
-						liveItem.loaded = false; // 加载失败则不标记为已加载
+						liveItem.loaded = false;
 					} finally {
 					} finally {
 						liveItem.loading = false;
 						liveItem.loading = false;
 					}
 					}
@@ -843,22 +863,6 @@
 					this.getliveUser(true); // 加载更多数据
 					this.getliveUser(true); // 加载更多数据
 				}, 1000); // 延迟时间:500毫秒
 				}, 1000); // 延迟时间:500毫秒
 			},
 			},
-			// gettalklist() {
-			// 	if (!this.liveId) return;
-			// 	const param = {
-			// 		id: this.liveId
-			// 	}
-			// 	gettextlist(param).then(res => {
-			// 		if (res.code == 200) {
-			// 			this.talklist = res.data
-			// 			// console.log(res.data);
-			// 			this.$nextTick(() => {
-			// 				this.scrollIntoView = `list_${this.talklist.length-1}`
-			// 			})
-			// 		}
-			// 	})
-			// },
-			// 修改其他方法,增加liveItem参数
 			async getLiveMsg(liveItem) {
 			async getLiveMsg(liveItem) {
 				// 强化校验:确保 liveItem 存在且包含 liveId
 				// 强化校验:确保 liveItem 存在且包含 liveId
 				if (!liveItem || !liveItem.liveId) {
 				if (!liveItem || !liveItem.liveId) {
@@ -1026,6 +1030,8 @@
 					} else if (res.data.liveType === 1) {
 					} else if (res.data.liveType === 1) {
 						// 直播流
 						// 直播流
 						this.$set(liveItem, 'livingUrl', res.data.flvHlsUrl);
 						this.$set(liveItem, 'livingUrl', res.data.flvHlsUrl);
+						console.log("排查中1》》", res.data.flvHlsUrl)
+						console.log("排查中2》》", liveItem.livingUrl)
 						this.$set(liveItem, 'videoUrl', ''); // 清空回放视频
 						this.$set(liveItem, 'videoUrl', ''); // 清空回放视频
 						this.$set(liveItem, 'placeholderText', "说点什么...");
 						this.$set(liveItem, 'placeholderText', "说点什么...");
 					} else {
 					} else {
@@ -1074,7 +1080,7 @@
 				}
 				}
 			},
 			},
 			maskString(str, maskChar = '*') {
 			maskString(str, maskChar = '*') {
-				// 新增:如果str是undefined或null,直接返回空字符串
+				// 如果str是undefined或null,直接返回空字符串
 				if (!str) return '';
 				if (!str) return '';
 				// 确保str是字符串(如果是数字等类型,先转为字符串)
 				// 确保str是字符串(如果是数字等类型,先转为字符串)
 				const strVal = String(str);
 				const strVal = String(str);
@@ -1149,38 +1155,52 @@
 
 
 			// 点赞
 			// 点赞
 			async onLike(liveItem) {
 			async onLike(liveItem) {
+				// 基础校验
 				if (!liveItem || !liveItem.liveId) return;
 				if (!liveItem || !liveItem.liveId) return;
+
+				// 确保liveViewData存在(初始化默认值)
 				if (!liveItem.liveViewData) {
 				if (!liveItem.liveViewData) {
-					await this.getliveViewData(liveItem); // 强制加载数据
-					if (!liveItem.liveViewData) { // 仍未加载成功
+					await this.getliveViewData(liveItem);
+					if (!liveItem.liveViewData) {
 						uni.showToast({
 						uni.showToast({
 							title: "数据加载中,请稍后再试",
 							title: "数据加载中,请稍后再试",
 							icon: 'none'
 							icon: 'none'
 						});
 						});
 						return;
 						return;
 					}
 					}
+					// 初始化点赞数(防止undefined)
+					liveItem.liveViewData.like = liveItem.liveViewData.like || 0;
+				}
+
+				// 限制最多10次点赞
+				const maxLikeCount = 10;
+				if (liveItem.liveViewData.like >= maxLikeCount) {
+					uni.showToast({
+						title: "最多可点赞10次哦~",
+						icon: 'none'
+					});
+					return;
 				}
 				}
 
 
 				try {
 				try {
 					const res = await liveDataLike(liveItem.liveId);
 					const res = await liveDataLike(liveItem.liveId);
 					if (res.code === 200) {
 					if (res.code === 200) {
-						if (res.like) {
-							liveItem.liveViewData.like++;
-						} else {
-							uni.showToast({
-								title: res.msg,
-								icon: 'none'
-							});
-						}
+						// 无论后端是否返回res.like,前端按规则累加(最多到10次)
+						const newLikeCount = Math.min(liveItem.liveViewData.like + 1, maxLikeCount);
+						liveItem.liveViewData.like = newLikeCount;
 
 
 					} else {
 					} else {
 						uni.showToast({
 						uni.showToast({
-							title: res.msg,
+							title: res.msg || "点赞失败",
 							icon: 'none'
 							icon: 'none'
 						});
 						});
 					}
 					}
 				} catch (error) {
 				} catch (error) {
 					console.error('点赞失败:', error);
 					console.error('点赞失败:', error);
+					uni.showToast({
+						title: "网络异常,点赞失败",
+						icon: 'none'
+					});
 				}
 				}
 			},
 			},
 			//直播间点赞、关注、在线人数数据
 			//直播间点赞、关注、在线人数数据
@@ -1189,10 +1209,18 @@
 				try {
 				try {
 					const res = await getLiveViewData(liveItem.liveId);
 					const res = await getLiveViewData(liveItem.liveId);
 					if (res.code == 200) {
 					if (res.code == 200) {
+						// 强制响应式更新,确保数据实时显示
 						this.$set(liveItem, 'liveViewData', res);
 						this.$set(liveItem, 'liveViewData', res);
+						// 打印日志确认数据已加载
+						console.log(`直播间 ${liveItem.liveId} 数据加载完成:`, res);
 					}
 					}
 				} catch (error) {
 				} catch (error) {
 					console.error("获取直播间数据失败:", error);
 					console.error("获取直播间数据失败:", error);
+					// 失败时兜底,避免显示异常
+					this.$set(liveItem, 'liveViewData', {
+						like: 0,
+						watchCount: 0
+					});
 				}
 				}
 			},
 			},
 			// 去购买,跳商品详情
 			// 去购买,跳商品详情
@@ -1404,14 +1432,12 @@
 				// 关闭指定或所有WebSocket连接
 				// 关闭指定或所有WebSocket连接
 				if (liveId) {
 				if (liveId) {
 					// 关闭指定直播间的连接
 					// 关闭指定直播间的连接
-					if (this.socketInstances[liveId]) {
+					if (this.socketInstances[liveId] && this.socketInstances[liveId].instance) {
 						try {
 						try {
-							uni.closeSocket({
-								instance: this.socketInstances[liveId]
-							});
+							this.socketInstances[liveId].instance.close(); // socketTask.close()
 							console.log(`直播间 ${liveId} WebSocket 已安全关闭`);
 							console.log(`直播间 ${liveId} WebSocket 已安全关闭`);
 						} catch (e) {
 						} catch (e) {
-							console.error('关闭 WebSocket 时出错:', e);
+							console.error('关闭失败', e);
 						}
 						}
 						delete this.socketInstances[liveId];
 						delete this.socketInstances[liveId];
 					}
 					}
@@ -1444,31 +1470,41 @@
 				}, 10000);
 				}, 10000);
 
 
 			},
 			},
-			startHeartbeat() {
+			startHeartbeat(liveId) {
 				clearInterval(this.pingpangTimes);
 				clearInterval(this.pingpangTimes);
-
 				this.pingpangTimes = setInterval(() => {
 				this.pingpangTimes = setInterval(() => {
-					if (!isSocketOpen) return;
-
+					const inst = this.socketInstances[liveId];
+					if (!inst || !inst.isOpen || !inst.instance) return;
 					const pingData = {
 					const pingData = {
 						cmd: 'ping',
 						cmd: 'ping',
 						timestamp: Date.now()
 						timestamp: Date.now()
 					};
 					};
-					uni.sendSocketMessage({
-						data: JSON.stringify(pingData),
-						success: () => console.debug('心跳发送成功'),
-						fail: (err) => {
-							console.error('心跳发送失败:', err);
-							this.scheduleReconnect();
-						}
-					});
-				}, 30000); // 30秒心跳间隔
+					try {
+						inst.instance.send({
+							data: JSON.stringify(pingData)
+						});
+					} catch (err) {
+						console.error('心跳发送失败:', err);
+						this.scheduleReconnect(liveId);
+					}
+				}, 30000);
 			},
 			},
-			initSocket() {
-				// 如果没有指定直播间,不初始化
-				if (!this.liveId) return;
+			async initSocket(liveItem) {
+				const currentLive = this.list[this.currentSwiperIndex];
+				if (!currentLive || currentLive.liveId !== liveItem.liveId) {
+					console.log(`拒绝为非活跃直播间 ${liveItem.liveId} 建立WebSocket`);
+					return;
+				}
+				if (!liveItem || !liveItem.liveId) return;
 
 
-				const liveId = this.liveId;
+				const liveId = liveItem.liveId;
+
+				// 检查是否已经是当前连接或正在连接
+				if (this.connectingLiveId === liveId ||
+					(this.socketInstances[liveId] && this.socketInstances[liveId].isOpen)) {
+					console.log(`直播间 ${liveId} 的WebSocket已经连接或正在连接,跳过初始化`);
+					return;
+				}
 
 
 				// 检查是否是当前活跃的直播间
 				// 检查是否是当前活跃的直播间
 				if (this.currentSwiperIndex !== this.list.findIndex(item => item.liveId === liveId)) {
 				if (this.currentSwiperIndex !== this.list.findIndex(item => item.liveId === liveId)) {
@@ -1476,20 +1512,21 @@
 					return;
 					return;
 				}
 				}
 
 
-
 				// 关闭之前的连接(如果存在)
 				// 关闭之前的连接(如果存在)
 				if (this.socketInstances[liveId]) {
 				if (this.socketInstances[liveId]) {
 					this.closeWebSocket(liveId);
 					this.closeWebSocket(liveId);
 				}
 				}
 
 
+				// 设置正在连接的直播间ID
+				this.connectingLiveId = liveId;
+
 				// 防止重复创建
 				// 防止重复创建
-				if (this.socketInstances[liveId]?.isOpen || this.reconnectCount >= this
-					.maxReconnectAttempts) {
+				if (this.reconnectCount >= this.maxReconnectAttempts) {
+					this.connectingLiveId = null;
 					return;
 					return;
 				}
 				}
 
 
 				this.isManualClose = false;
 				this.isManualClose = false;
-				console.log(this.timestamp)
 
 
 				// 生成签名
 				// 生成签名
 				const signature = CryptoJS.HmacSHA256(
 				const signature = CryptoJS.HmacSHA256(
@@ -1511,21 +1548,44 @@
 						},
 						},
 						fail: (err) => {
 						fail: (err) => {
 							console.error('WebSocket 连接失败:', err);
 							console.error('WebSocket 连接失败:', err);
+							this.connectingLiveId = null;
 							this.scheduleReconnect(liveId);
 							this.scheduleReconnect(liveId);
 						}
 						}
 					});
 					});
+
 					socketTask.onOpen((res) => {
 					socketTask.onOpen((res) => {
 						console.log('WebSocket 连接已成功建立', res);
 						console.log('WebSocket 连接已成功建立', res);
 						this.socketInstances[liveId].instance = socketTask;
 						this.socketInstances[liveId].instance = socketTask;
 						this.socketInstances[liveId].isOpen = true;
 						this.socketInstances[liveId].isOpen = true;
-					})
+
+						isSocketOpen = true;
+						this.connectingLiveId = null;
+						this.reconnectCount = 0;
+						// 改用 socketTask 的 send 作为心跳
+						this.startHeartbeat(liveId); // 修改 startHeartbeat 以接受 liveId 并使用 socketTask.send
+					});
+
 					socketTask.onMessage((res) => {
 					socketTask.onMessage((res) => {
 						// 找到对应的直播间并更新数据
 						// 找到对应的直播间并更新数据
 						const targetLive = this.list.find(item => item.liveId === liveId);
 						const targetLive = this.list.find(item => item.liveId === liveId);
-						this.handleSocketMessage(res, targetLive)
-					})
+						if (targetLive) {
+							this.handleSocketMessage(res, targetLive);
+						}
+					});
+
+					socketTask.onError((err) => {
+						console.error('WebSocket 连接错误:', err);
+						this.connectingLiveId = null;
+						this.scheduleReconnect(liveId);
+					});
+
+					socketTask.onClose(() => {
+						console.log(`WebSocket 连接已关闭: ${liveId}`);
+						this.connectingLiveId = null;
+					});
 				} catch (e) {
 				} catch (e) {
 					console.error('创建 WebSocket 异常:', e);
 					console.error('创建 WebSocket 异常:', e);
+					this.connectingLiveId = null;
 					this.scheduleReconnect(liveId);
 					this.scheduleReconnect(liveId);
 				}
 				}
 			},
 			},
@@ -1541,8 +1601,7 @@
 					};
 					};
 					// console.log("messageData是",messageData)
 					// console.log("messageData是",messageData)
 					if (socketMessage.cmd == 'sendMsg') {
 					if (socketMessage.cmd == 'sendMsg') {
-						this.$set(liveItem, 'talklist', [...liveItem.talklist, messageData]);
-						console.log("发消息:", liveItem);
+						// this.$set(liveItem, 'talklist', [...liveItem.talklist, messageData]);
 						this.$nextTick(() => {
 						this.$nextTick(() => {
 							this.$set(liveItem, 'scrollIntoView', `list_${liveItem.talklist.length-1}`);
 							this.$set(liveItem, 'scrollIntoView', `list_${liveItem.talklist.length-1}`);
 						});
 						});
@@ -1597,71 +1656,90 @@
 			},
 			},
 			scheduleReconnect() {
 			scheduleReconnect() {
 				if (this.isManualClose || this.reconnectCount >= this.maxReconnectAttempts) return;
 				if (this.isManualClose || this.reconnectCount >= this.maxReconnectAttempts) return;
-
 				this.reconnectCount++;
 				this.reconnectCount++;
 				const delay = Math.min(3000 * this.reconnectCount, 30000);
 				const delay = Math.min(3000 * this.reconnectCount, 30000);
-
-				console.log(`将在 ${delay}ms 后重连 (尝试 ${this.reconnectCount}/${this.maxReconnectAttempts})`);
-
-				this.reconnectTimer = setInterval(() => {
-					this.initSocket();
+				clearInterval(this.reconnectTimer);
+				this.reconnectTimer = setTimeout(() => {
+					this.initSocket(this.list.find(item => item.liveId === liveId) || {
+						liveId
+					});
 				}, delay);
 				}, delay);
 			},
 			},
 			sendMsg(liveItem) {
 			sendMsg(liveItem) {
-				console.log("sendMsg")
 				if (!liveItem || !liveItem.liveId) return;
 				if (!liveItem || !liveItem.liveId) return;
 
 
+				// 防止连续点击发送两次(短时锁定)
+				if (liveItem.isSending) return;
+				liveItem.isSending = true;
+				setTimeout(() => {
+					liveItem.isSending = false;
+				}, 800); // 800ms 内禁止再次发送
+
+				const text = (liveItem.value || '').trim();
+				if (!text) {
+					uni.showToast({
+						title: "不能发送空消息",
+						icon: 'none'
+					});
+					return;
+				}
+
 				const liveId = liveItem.liveId;
 				const liveId = liveItem.liveId;
 				const socketItem = this.socketInstances[liveId];
 				const socketItem = this.socketInstances[liveId];
 
 
-				// 检查连接是否存在且已打开
+				// 乐观更新:立即把消息加入到本地聊天列表并清空输入(更好的体验)
+				const localMsg = {
+					cmd: 'sendMsg',
+					msg: text,
+					nickName: this.userinfo.nickName,
+					avatar: this.userinfo.avatar,
+					userId: this.userinfo.userId,
+					local: true, // 标记为本地消息(可用于样式或后续差异处理)
+					ts: Date.now()
+				};
+				this.$set(liveItem, 'talklist', [...(liveItem.talklist || []), localMsg]);
+				this.$set(liveItem, 'value', ''); // 立即清空输入
+
 				if (!socketItem || !socketItem.instance || !socketItem.isOpen) {
 				if (!socketItem || !socketItem.instance || !socketItem.isOpen) {
-					// 尝试重新连接
+					// 如果 socket 未连接,尝试建立连接(但不要阻塞用户)
 					this.initSocket(liveItem);
 					this.initSocket(liveItem);
-
-					// 显示提示并延迟重试
 					uni.showToast({
 					uni.showToast({
-						title: "连接未建立,正在重试...",
+						title: "连接未建立,正在重连",
 						icon: 'none'
 						icon: 'none'
 					});
 					});
 					return;
 					return;
 				}
 				}
 
 
 				const data = {
 				const data = {
-					liveId: liveId,
+					liveId,
 					userId: this.userinfo.userId,
 					userId: this.userinfo.userId,
 					userType: 0,
 					userType: 0,
 					cmd: "sendMsg",
 					cmd: "sendMsg",
-					msg: liveItem.value,
+					msg: text,
 					nickName: this.userinfo.nickName,
 					nickName: this.userinfo.nickName,
 					avatar: this.userinfo.avatar
 					avatar: this.userinfo.avatar
 				};
 				};
-				if (!liveItem?.value.trim()) {
-					console.log(!this.value.trim())
-					if (!this.value.trim()) { // 优化空消息判断
-						uni.showToast({
-							title: "不能发送空消息",
-							icon: 'none'
-						});
-						return;
-					}
+
+				try {
+					socketItem.instance.send({
+						data: JSON.stringify(data),
+						success: () => {
+							// 成功后可以移除 local 标记(可选)
+							// 比如找到最后一条 local 消息并标记为 sent
+						},
+						fail: (err) => {
+							console.error("发送失败:", err);
+							uni.showToast({
+								title: "发送失败,请重试",
+								icon: 'none'
+							});
+							// 可选择回滚本地显示(此处简单提示即可)
+						}
+					});
+				} catch (err) {
+					console.error('socket send 异常', err);
 				}
 				}
-				socketItem.instance.send({
-					data: JSON.stringify(data),
-					success: () => {
-						console.log("发送成功");
-						// liveItem.value = ''; // 清空当前直播间的输入框
-						this.$set(liveItem, 'value', '');
-					},
-					fail: (err) => {
-						console.error("发送失败:", err);
-						uni.showToast({
-							title: "发送失败,请重试",
-							icon: 'none'
-						});
-					}
-				});
-			},
+			}
 		}
 		}
 	};
 	};
 </script>
 </script>
@@ -1782,6 +1860,13 @@
 		}
 		}
 	}
 	}
 
 
+	.send {
+		background-color: #4b4b4b;
+		border-radius: 28rpx;
+		padding: 14rpx 16rpx;
+		color: #fff;
+	}
+
 	// .container {
 	// .container {
 	// 	position: relative;
 	// 	position: relative;
 	// 	width: 100%;
 	// 	width: 100%;
@@ -1887,59 +1972,56 @@
 
 
 	.videolist {
 	.videolist {
 		position: relative;
 		position: relative;
-	}
 
 
-	.video {
-		height: 100vh;
-		/* 占屏幕高度的80% */
-		width: 100%;
-		background-color: rgba(57, 57, 57, 0.4);
-	}
+		.video {
+			height: 100vh;
+			/* 占屏幕高度的80% */
+			width: 100%;
+			background-color: rgba(57, 57, 57, 0.4);
+
+			.videotop {
+				width: 100%;
+				height: 100%;
+			}
+
+			.video_row {
+				width: 100%;
+				max-height: 500rpx;
+				overflow: hidden;
+				margin-top: 360rpx;
+			}
+		}
 
 
-	.videotop {
-		width: 100%;
-		height: 100%;
 	}
 	}
 
 
-	.video_row {
-		width: 100%;
-		max-height: 500rpx;
+	.goods {
+		position: fixed;
+		bottom: 120rpx;
+		right: 0rpx;
+		z-index: 5;
+		background-color: #fff;
+		border-radius: 20rpx;
 		overflow: hidden;
 		overflow: hidden;
-		margin-top: 360rpx;
+		width: 200rpx;
+		height: 350rpx;
+
+		.top {}
 	}
 	}
 
 
-	.popup-video {
-		position: absolute;
-		top: 30%;
-		height: 500rpx;
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-		width: 100%;
-		color: #fff;
-		z-index: 9;
 
 
-		.more {
-			background-color: #3280fe;
-			border-radius: 80rpx;
-			width: 280rpx;
-			text-align: center;
-			height: 60rpx;
-			line-height: 60rpx;
-		}
-	}
 
 
-	.icon-bg {
-		background-color: rgba(157, 157, 157, 0.8);
-		border-radius: 50%;
-		width: 72rpx;
-		height: 72rpx;
-		display: flex;
-		justify-content: center;
-		align-items: center;
-		transition: transform 0.2s ease;
-	}
+
+
+	// .icon-bg {
+	// 	background-color: rgba(157, 157, 157, 0.8);
+	// 	border-radius: 50%;
+	// 	width: 72rpx;
+	// 	height: 72rpx;
+	// 	display: flex;
+	// 	justify-content: center;
+	// 	align-items: center;
+	// 	transition: transform 0.2s ease;
+	// }
 
 
 	.list {
 	.list {
 		width: 80%;
 		width: 80%;
@@ -2100,7 +2182,7 @@
 			}
 			}
 
 
 			.search-top {
 			.search-top {
-				font-size: 18rpx;
+				font-size: 20rpx;
 				color: #222222;
 				color: #222222;
 			}
 			}
 		}
 		}

+ 110 - 42
pages/list/index.vue

@@ -1,15 +1,17 @@
 <template>
 <template>
 	<view class=" content ">
 	<view class=" content ">
-		<view class="list">
-			<view class="list-item" @click="goLive(item)" v-for="(item,index) in list" :key="index">
-				<image :src="item.liveImgUrl"></image>
-				<view class="info">
-					<text>{{item.liveName}}</text>
+		<mescroll-body bottom="0" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
+			:down="downOption" :up="upOption">
+			<view class="list">
+				<view class="list-item" @click="goLive(item)" v-for="(item,index) in list" :key="index">
+					<image :src="item.liveImgUrl"></image>
+					<view class="info">
+						<text>{{item.liveName}}</text>
+					</view>
 				</view>
 				</view>
-			</view>
-
-		</view>
 
 
+			</view>
+		</mescroll-body>
 	</view>
 	</view>
 
 
 </template>
 </template>
@@ -17,54 +19,120 @@
 	import {
 	import {
 		liveList
 		liveList
 	} from '@/api/list'
 	} from '@/api/list'
+	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 	// import { LiveWS } from '@/utils/liveWS'
 	// import { LiveWS } from '@/utils/liveWS'
 	// import { login,loginByWeChat,getUserInfo,loginByApple } from '@/api/user'
 	// import { login,loginByWeChat,getUserInfo,loginByApple } from '@/api/user'
 	export default {
 	export default {
+		mixins: [MescrollMixin], // 使用mixin
 		data() {
 		data() {
 			return {
 			return {
-				list: null,
-				liveId:null
+				list: [],
+				liveId: null, // mescroll配置
+				downOption: {
+					use: true,
+					auto: false // 是否在初始化后自动执行下拉回调
+				},
+				upOption: {
+					use: true,
+					auto: true, // 是否在初始化时自动执行上拉回调
+					page: {
+						num: 0, // 当前页码
+						size: 10 // 每页数据条数
+					},
+					noMoreSize: 5, // 如果列表已无数据,可设置列表的总数量要大于等于5条才显示无更多数据
+					empty: {
+						icon: '/static/images/empty.png', // 可配置空状态图片
+						tip: '暂无订单数据' // 空状态提示文字
+					}
+				},
+				mescroll: null // mescroll实例
 			}
 			}
 		},
 		},
-		onLoad(option) {
-			this.getList()
-		},
 		methods: {
 		methods: {
 			goLive(item) {
 			goLive(item) {
 				this.liveId = item.liveId
 				this.liveId = item.liveId
 				console.log("要传的liveId", this.liveId)
 				console.log("要传的liveId", this.liveId)
 				uni.navigateTo({
 				uni.navigateTo({
 					url: `/pages/home/living?liveId=${item.liveId}&immediate=true`
 					url: `/pages/home/living?liveId=${item.liveId}&immediate=true`
-					// url: `/pages/home/living?liveId=${encodeURIComponent(JSON.stringify(liveId))}`
 				});
 				});
 			},
 			},
-			getList() {
-				const data = {
-					page: 1,
-					page_size: 10,
-				};
-				uni.showLoading({
-					title: "处理中..."
-				});
-				liveList(data)
-					.then(res => {
-						if (res.code == 200) {
-							this.list = res.rows; // 直接赋值给 this.list
-							console.log("list>>", this.list); // ✅ 打印已定义的 this.list
-						} else {
-							uni.showToast({
-								title: res.msg,
-								icon: 'none'
-							});
+			// mescroll初始化
+			mescrollInit(mescroll) {
+				this.mescroll = mescroll;
+			},
+			// 下拉刷新回调
+			downCallback(mescroll) {
+				// 重置列表数据
+				this.list = [];
+				mescroll.resetUpScroll();
+			},
+			// 上拉加载回调
+			upCallback(mescroll) {
+				const pageNum = mescroll.num;
+				const pageSize = mescroll.size;
+
+				let data = {
+					pageSize: pageSize,
+					page: pageNum,
+				}
+				liveList(data).then(res => {
+					if (res.code == 200) {
+						// 请求成功,处理数据
+						let curPageData = res.rows || [];
+						let curPageLen = curPageData.length;
+						let totalSize = res.total || 0;
+
+						// 如果是第一页,直接赋值
+						if (pageNum === 1) {
+							this.list = [];
 						}
 						}
-					})
-					.catch(rej => {
-						console.log("请求失败:", JSON.stringify(rej));
-					})
-					.finally(() => {
-						uni.hideLoading();
-					});
-			}
+
+						// 追加新数据
+						this.list = this.list.concat(curPageData);
+
+						mescroll.endBySize(curPageLen, totalSize);
+
+					} else {
+						// 请求失败
+						mescroll.endErr();
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						});
+					}
+				}).catch(err => {
+					// 请求异常
+					mescroll.endErr();
+					console.log("请求异常:" + JSON.stringify(err));
+				});
+			},
+			// getList() {
+			// 	const data = {
+			// 		page: 1,
+			// 		page_size: 10,
+			// 	};
+			// 	uni.showLoading({
+			// 		title: "处理中..."
+			// 	});
+			// 	liveList(data)
+			// 		.then(res => {
+			// 			if (res.code == 200) {
+			// 				this.list = res.rows; // 直接赋值给 this.list
+			// 				console.log("list>>", this.list); // ✅ 打印已定义的 this.list
+			// 			} else {
+			// 				uni.showToast({
+			// 					title: res.msg,
+			// 					icon: 'none'
+			// 				});
+			// 			}
+			// 		})
+			// 		.catch(rej => {
+			// 			console.log("请求失败:", JSON.stringify(rej));
+			// 		})
+			// 		.finally(() => {
+			// 			uni.hideLoading();
+			// 		});
+			// }
 		}
 		}
 	}
 	}
 </script>
 </script>
@@ -84,7 +152,7 @@
 				border-radius: 16rpx;
 				border-radius: 16rpx;
 				width: 340rpx;
 				width: 340rpx;
 				height: 600rpx;
 				height: 600rpx;
-				background-color: #0082f4;
+				background-color: #0d0d0d;
 				margin-right: 10rpx;
 				margin-right: 10rpx;
 				margin-bottom: 24rpx;
 				margin-bottom: 24rpx;
 				overflow: hidden;
 				overflow: hidden;
@@ -106,4 +174,4 @@
 		}
 		}
 
 
 	}
 	}
-</style>
+</style>

+ 2251 - 0
pages_no/living827.vue

@@ -0,0 +1,2251 @@
+<template>
+	<view class="swiper-wrapper">
+		<swiper class="swiper-container" :current="currentSwiperIndex" :circular="false" vertical
+			@change="onSwiperChange" :style="{height: '100vh'}" :duration="swiperDuration">
+			<swiper-item v-for="(liveItem, index) in list" :key="liveItem.liveId">
+				<view class="container" :class="{active: currentSwiperIndex === index}">
+					<view class="blackbg"></view>
+					<view class="content">
+						<!-- 页面内容 -->
+						<view style=" position: fixed;top: 0;z-index: 5;" class="content-top">
+							<view class="u-flex-y-center">
+								<image @click="goBack" style="width: 60rpx;height: 64rpx;margin-right: 26rpx;"
+									src="@/static/images/live/return.png"></image>
+								<view class=" align-center"
+									style="padding: 6rpx 4rpx;height: 64rpx;background: rgba(0,0,0,0.5);border-radius: 32rpx;">
+									<u-avatar :src="liveItem.liveImgUrl||$img.logo" size="32"></u-avatar>
+									<view class="colorf ml10 mr6">
+										<view>{{liveItem.liveName?truncateString(liveItem.liveName,5):"未命名"}}</view>
+									</view>
+								</view>
+							</view>
+							<view class="u-flex-end align-center" @click="showadd=!showadd" style="margin-top: 100rpx;">
+								<image class="w52 h52 mr4" v-for="(item,viewerIndex) in filteredViewers"
+									:key="viewerIndex" style="border-radius: 26rpx;" :src="item.avatar||$img.logo">
+								</image>
+								<view class="sum">{{liveUserTotal||0}}</view>
+							</view>
+						</view>
+
+						<!-- 页面内容 -->
+						<view style=" position: fixed;top:120rpx;left: 0rpx; z-index: 5;" class="content-top">
+							<view class="u-flex-y-center">
+								<image @click="onRed(liveItem)" v-if="liveItem.redInfo?.redStatus==1"
+									style="width: 70rpx;height: 70rpx;" src="@/static/images/hongbao.png"></image>
+							</view>
+						</view>
+
+						<!-- 右边的 -->
+						<view :class=" liveItem.showType==1 ? 'siderow-group' : 'side-group'">
+							<view class="side-item">
+								<image @click="onLike(liveItem)" src="/static/images/live/like.png"></image>
+								<view>{{liveItem.liveViewData?.like||0}}</view>
+							</view>
+							<view class="side-item">
+								<image @click="goStore(liveItem)" src="/static/images/live/shop.png"></image>
+								<view>店铺</view>
+							</view>
+
+							<view class="side-item">
+								<button open-type="share">
+									<image src="/static/images/live/share.png" mode="widthFix"></image>
+								</button>
+								<view>分享</view>
+							</view>
+						</view>
+
+						<view class="shop-prompt u-flex-y-center" v-if="showPurchasePrompt&&orderUser?.count">
+							<image class="w32 h32 mr8" src="/static/images/live/shopping.png"></image>
+							<text> {{orderUser.userName ? maskString(orderUser.userName) : ''}} 等
+								{{orderUser.count || 0}}
+								人正在去购买</text>
+						</view>
+
+						<view class="videolist " style="margin: auto 0">
+							<view class="video" style="height:100vh">
+								<!-- 修改video组件以支持HLS -->
+								<!-- showType 1 横屏   2 竖屏 -->
+								<video v-if="liveItem.livingUrl" :id="'myVideo_' + liveItem.liveId"
+									:class="liveItem.showType == 1 ? 'video_row' : 'videotop'" :src="liveItem.livingUrl"
+									:autoplay="currentSwiperIndex === index" :controls='false' object-fit='contain'
+									:custom-cache="false" :enable-progress-gesture="false"
+									vslide-gesture-in-fullscreen='true' :show-center-play-btn="false"
+									:http-cache="false" @error="videoError">
+								</video>
+
+								<video v-if="liveItem.videoUrl"
+									:class="liveItem.showType == 1 ? 'video_row' : 'videotop'" :src="liveItem.videoUrl"
+									:autoplay="currentSwiperIndex === index" :controls='false' object-fit='contain'
+									:custom-cache="false" :enable-progress-gesture="false"
+									vslide-gesture-in-fullscreen='true' :show-center-play-btn="false"
+									:http-cache="false" loop @error="videoError">
+								</video>
+
+								<!-- 加载提示 -->
+								<view v-if="liveItem.loading" class="loading-tip">
+									<u-loading mode="circle" color="#ffffff" size="36"></u-loading>
+									<text class="loading-text">加载中...</text>
+								</view>
+							</view>
+						</view>
+						<view class="pb40  mt90" style="position: fixed;bottom: 0;width: 100%;">
+							<view class="w100 h300 mt20">
+								<scroll-view enable-flex scroll-y="true" class="talk p20 scrolly flex-1 column"
+									style="width: calc(100% - 40rpx);height: calc(100% - 40rpx);"
+									:scroll-into-view="liveItem.scrollIntoView">
+									<view>
+										<view class="list justify-start" v-for="(item,talkIndex) in liveItem.talklist"
+											:key="talkIndex" v-show="item.cmd=='announcement'">
+											<view class="talk-list ml16 justify-start">
+												<view class="fs24">
+													<text class='fs24 colorf'>
+														{{item.msg}}直播间{{liveItem.messageContent}}</text>
+												</view>
+											</view>
+										</view>
+									</view>
+
+									<view class="list justify-start" v-for="(item,talkIndex) in liveItem.talklist"
+										:key="talkIndex" :id="`list_${talkIndex}`"
+										v-show="item.cmd!='red'&&item.cmd!='out'&&item.cmd!='entry'">
+										<view class="talk-list ml16 justify-start">
+											<view class="fs24">
+												<text style="color: #FFDA73;">{{item.nickName}}:</text>
+												<text class='fs24 colorf'>{{item.msg}}</text>
+											</view>
+										</view>
+									</view>
+									<view v-if="liveItem.showWelcomeMessage" class="welcome-message">
+										<view class="list justify-start" v-for="(item,talkIndex) in liveItem.talklist"
+											:key="talkIndex" v-show="item.cmd=='entry'||item.cmd=='out'">
+											<view class="talk-list ml16 justify-start">
+												<view class="fs24">
+													<text style="color: #ff89d6;">{{item.nickName}} </text>
+													<!-- <text class='fs24 colorf'>
+														{{item.msg}}直播间{{liveItem.messageContent}}</text> -->
+													<text class='fs24 colorf'>
+														{{item.msg}}直播间{{liveItem.messageContent}}</text>
+												</view>
+											</view>
+										</view>
+									</view>
+								</scroll-view>
+							</view>
+
+							<view class="justify-between p24">
+								<view class="u-flex-y-center"
+									style="background:rgba(157, 157, 157, 0.8);padding:10rpx 14rpx 10rpx 32rpx;width: 566rpx;box-sizing:border-box;border-radius:36rpx;">
+									<u-input :placeholder="liveItem.placeholderText" border="none"
+										customStyle='font-size:24rpx;' v-model="liveItem.value" shape='circle'
+										color='#fff' placeholderStyle='color:#e7e7e7' class="ml20"
+										>
+										<!-- @confirm="sendMsg(liveItem)" -->
+									</u-input>
+									<view class="send" @click="sendMsg(liveItem)">发送</view>
+								</view>
+								<view class="justify-between mr15  align-center">
+									<view class="icon-bg ml20" @click="openCart(liveItem)">
+										<image src="/static/images/shopping.png" class="w48 h48"></image>
+									</view>
+									<!-- <view class="icon-bg ml20" @click="liveItem.showziliao=!liveItem.showziliao">
+										<image src="/static/images/more-icon.png" class="w48 h48"></image>
+									</view> -->
+								</view>
+							</view>
+						</view>
+					</view>
+
+					<!-- 弹窗组件保持不变 -->
+					<u-popup :show="showadd" @close="close" @open="openViews" round='20rpx' bgColor='#ffffff'>
+						<view class="view-box">
+							<view class="t-c fs30">在线观众</view>
+							<scroll-view scroll-y class="scroll-content" :style="{height: scrollHeight + 'px'}"
+								@scrolltolower="handleScrollToLower">
+								<view class="fs24 u-flex-y-center mb20" v-for="(item,index) in liveViewers"
+									:key="index">
+									<view
+										:style="{color: index === 0 ? '#FF3B30' : index === 1 ? '#FF9500' : index === 2 ? '#FFCC00' :  '#8E8E93',fontWeight: index < 3 ? 'bold' : 'normal',width: '50rpx'}"
+										class="mr10">{{index+1}}</view>
+									<u-avatar :src="item.avatar||$img.logo" size="32"></u-avatar>
+									<text class="ml16">{{item.nickName||"未命名"}}</text>
+								</view>
+								<view class="no-more" v-if="viewNoMoreData && liveViewers.length > 0">
+									<text>没有更多了</text>
+								</view>
+							</scroll-view>
+							<!-- <view class="fs24 u-flex-y-center bottom">
+								<view class="mr10" style="width:50rpx">我</view>
+								<u-avatar :src="livedata.liveImgUrl||$img.logo" size="32"></u-avatar>
+								<text class="ml16">{{livedata.liveName||"未命名"}}</text>
+							</view> -->
+						</view>
+					</u-popup>
+
+					<u-popup :show="liveItem.shopping" @close="closeShop" @open="openShop" round='20rpx'
+						bgColor='f3f5f9'>
+						<view class="shoppop">
+							<view class="shoppop-top">
+								<u-avatar :src="store.logoUrl" size="36" class="ml16"></u-avatar>
+								<view class="search-input u-flex-y-center">
+									<image style="width: 24rpx;margin-right: 16rpx;" src="@/static/images/search.png"
+										mode="widthFix">
+									</image>
+									<input placeholder="请搜索商品" v-model="liveItem.inputInfo"
+										@input="handleSearchInput" />
+								</view>
+								<view class="t-c search-top" style="margin-right: 48rpx;">
+									<image @click="onStoreCollect(liveItem)" v-if="store.isFavorite"
+										style="width:40rpx;height: 40rpx;" src="@/static/images/collect_select.png">
+									</image>
+									<image v-else @click="onStoreCollect(liveItem)" style="width: 32rpx;height: 32rpx;"
+										src="@/static/images/collect.png"></image>
+									<view>收藏</view>
+								</view>
+								<view class="t-c search-top" @click="goOrderList(liveItem)">
+									<image style="width: 40rpx;height: 40rpx;" src="@/static/images/order.png"></image>
+									<view>订单</view>
+								</view>
+							</view>
+
+							<scroll-view enable-flex scroll-y class="shop-list" :style="{ height: boxHeight + 'px' }">
+								<view class="list-item " v-for="(item,index) in products" :key="index">
+									<view class="goods-img">
+										<image :src="item.imgUrl" mode="widthFix"></image>
+										<view class="goods-label">{{index+1}}</view>
+									</view>
+									<view class="goods-right">
+										<view class="goods-title">{{item.productName}}</view>
+										<view class="goods-people">{{item.sales}} 人已购</view>
+										<view class="goods-shop">
+											<text class="nummber"><text
+													style="font-size: 20rpx;font-weight: 600;">¥</text><text
+													style="font-size: 36rpx;font-weight: bold;">{{Math.trunc(item.price)}}</text>.{{getPureDecimal(item.price)?getPureDecimal(item.price):'00'}}/日</text>
+											<view class="btn-group  u-flex-y-center">
+												<view class="collect-btn">
+													<image v-if="item.isFavorite" @click="onGoodsCollect(item)"
+														style="width: 32rpx;height: 32rpx;"
+														src="/static/images/collect_select.png">
+													</image>
+													<image v-else @click="onGoodsCollect(item)"
+														style="width: 32rpx;height: 32rpx;"
+														src="/static/images/collect.png">
+													</image>
+												</view>
+												<view v-if="item.status==1" class="shop-btn"
+													@click="goShop(item.productId,item.goodsId)">去购买
+												</view>
+												<view v-else-if="item.status==0" @click="goShop(item.productId)"
+													class="shop-btn">
+													已下架</view>
+											</view>
+										</view>
+									</view>
+								</view>
+							</scroll-view>
+						</view>
+					</u-popup>
+				</view>
+			</swiper-item>
+		</swiper>
+	</view>
+</template>
+
+<script>
+	import Hls from 'hls.js';
+	import CryptoJS from 'crypto-js'
+	import {
+		liveList
+	} from '@/api/list'
+	import {
+		liveRed, // 点击领红包
+		liveDataLike, // 点赞
+		collectStore, // 店铺收藏/取消收藏
+		collectGoods, // 商品收藏/取消收藏
+		store, // 查询店铺
+		// follow, // 关注/取消关注
+		watchUserList, //获取直播间用户(展示在线用户)
+		liveMsg, //获取最近聊天记录
+		// 小黄车
+		liveStore, //店铺展示,
+		// liveGoodsDetail, //商品详情,
+		liveOrderUser, //正在购买
+		getLiveInfo, //获取直播间信息接口
+		getLiveViewData //直播间点赞、关注、在线人数数据
+	} from '@/api/live'
+	import {
+		liveOrderList, // 订单列表
+	} from '@/api/order'
+
+	import parse from '/uni_modules/uview-plus/libs/config/props/parse';
+	import {
+		LiveWS
+	} from '@/utils/liveWS.js'
+	import {
+		getlive,
+		// gettextlist,
+		getAnswerlist,
+		submitAnswer
+	} from '@/api/home'
+
+	// var wsUrl = "ws://192.168.10.166:7114/app/webSocket"; //余红奇
+	// var wsUrl = "ws://192.168.10.125:7114/app/webSocket"; //涂小龙
+	var wsUrl = "wss://live.test.ylrztop.com/ws/live-api/app/webSocket"; //余红奇
+	// var wsUrl = "ws://live.test.ylrztop.com/prod-api/app/webSocket"; //余红奇
+	// var wsUrl = "ws://nd383294.natappfree.cc/app/webSocket"; //余红奇
+	// var wsUrl = "ws://v56c9b8e.natappfree.cc/app/webSocket"; //余红奇
+	// var wsUrl = "ws://192.168.10.170:7114/app/webSocket"; //陈果
+	// var wsUrl = "ws://live.ylrzcloud.com/socket/app/webSocket";
+	var pingpangTimes = null;
+	var initTimes = null;
+	var isSocketOpen = false;
+	var socket = null;
+
+	export default {
+		data() {
+			return {
+				connectingLiveId: null, // 记录正在连接的直播间ID
+				swiperDuration: 0, // 初始化为0,首次加载无动画
+				videoRetryCounts: {}, // 记录每个直播间的视频重试次数,格式: { liveId: 次数 }
+
+
+				socketInstances: {}, // 改为对象存储多个socket实例
+				currentSwiperIndex: 0, // 当前swiper索引
+				list: [], // 直播间列表
+				preloading: false, // 预加载状态
+
+
+				liveUserTotal: null,
+				viewPageSize: 10, // 每页数量
+				viewPageNum: 1, // 当前页码
+				viewLoading: false, // 是否正在加载
+				viewNoMoreData: false, // 是否没有更多数据
+				scrollHeight: 0,
+				scrollTimer: null, // 滚动防抖定时器
+
+
+				socketInstance: null, // 统一管理 socket 实例
+				reconnectCount: 0,
+				maxReconnectAttempts: 3,
+				isManualClose: false, // 标记是否手动关闭
+
+				showRed: true,
+				// redInfo: {},
+				// inputInfo: '',
+				searchTimer: null,
+				// storeId: null,
+				reconnectTimer: null,
+				isCollect: false,
+				showPurchasePrompt: false,
+				purchasePromptTimer: null,
+				prevOrderCount: 0, // 用于记录上一次的购买人数
+				videoUrl: null,
+				showType: 1, //横屏1 竖屏2
+				boxHeight: 300, //小黄车高度
+				// isFollow: false,
+				// liveViewData: {},
+				liveViewers: [], //观众
+				likeName: 0,
+				hlsPlayer: null, // HLS播放器实例,
+				livingUrl: "",
+				products: {},
+				store: {},
+				orderUser: {}, //正在购买
+				userType: 0,
+				timestamp: '',
+				liveId: null,
+				// userId: uni.getStorageSync("userInfo.userId"),
+
+				isZoom: false, //点赞按钮控制是否放大
+				userinfo: '', //用户信息
+				// path: 'http://192.168.10.166/dev-api', //余红奇
+				// path: 'http://v56c9b8e.natappfree.cc', //余红奇
+				// path: 'live.test.ylrztop.com/prod-api', //余红奇
+				// path: 'http://192.168.10.170/dev-api', //陈果
+				// value: '',
+				talkdisabled: false, //输入框是否禁用
+				autoplay: false, //视频自动播放
+				showadd: false,
+				// talklist: [],
+				scrollIntoView: '',
+				videoContext: '',
+				thistime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss'),
+				// showWelcomeMessage: false,
+				isSubmit: false,
+				messageContent: "",
+				showziliao: false,
+				isScreen: true,
+				// shopping: false, //小黄车弹窗
+				scrollTop: 0, //弹幕
+				old: {
+					scrollTop: 0
+				},
+				livedata: {}, //直播间点赞、关注、在线人数数据
+
+			};
+		},
+
+
+		onLoad(options) {
+			this.initTime();
+			if (options.liveId) {
+				this.liveId = options.liveId; // 仅当 liveId 变化时更新
+			}
+			this.userinfo = JSON.parse(uni.getStorageSync("userInfo"))
+			// 初始化直播间列表
+			this.initLiveList(options);
+			this.getliveUser(false); // 调用获取在线用户接口
+			const platform = uni.getWindowInfo().platform;
+			// 初始化直播间列表
+
+			if (['mp-weixin', 'mp-alipay', 'mp-baidu', 'mp-toutiao'].includes(platform)) {
+				// 确保 API 存在再调用
+				if (uni.showShareMenu) {
+					uni.showShareMenu({
+						withShareTicket: true, // 可选参数,根据需求配置
+						success: () => {
+							console.log('分享菜单显示成功');
+						},
+						fail: (err) => {
+							console.error('分享菜单显示失败:', err);
+						}
+					});
+				} else {
+					console.warn('当前平台不支持 uni.showShareMenu');
+				}
+			} else {
+				console.log('当前平台无需显示分享菜单');
+			}
+		},
+		onReady() {},
+		onShareAppMessage() {
+			return {
+				// title: this.product.title,
+				title: this.livedata.liveName,
+				path: '/pages/home/living',
+				imageUrl: this.products.image,
+				success(res) {
+					console.log("分享成功", res);
+				},
+				fail(err) {
+					console.error("分享失败", err);
+				}
+			};
+		},
+		computed: {
+			filteredViewers() {
+				if (!this.liveViewers) {
+					return
+				} else {
+					return this.liveViewers.slice(0, 3);
+				}
+
+			}
+		},
+		onHide() {
+			const currentLive = this.list[this.currentSwiperIndex];
+			if (currentLive) {
+				this.pauseVideo(currentLive);
+			}
+		},
+		onUnload() {
+			// 关闭所有WebSocket连接
+			this.closeAllWebSockets();
+
+			// 移除所有全局事件监听
+			this.removeAllEventListeners();
+
+			// 清理定时器
+			this.clearAllTimers();
+
+			// 销毁HLS播放器(如果使用了hls.js)
+			if (this.hlsPlayer) {
+				this.hlsPlayer.destroy();
+				this.hlsPlayer = null;
+			}
+
+			this.list.forEach(liveItem => {
+				const videoId = `myVideo_${liveItem.liveId}`;
+				const videoContext = uni.createVideoContext(videoId, this);
+				if (videoContext) {
+					videoContext.pause(); // 仅暂停视频即可
+				}
+			});
+		},
+		watch: {
+			// 监听orderUser.count的变化
+			'orderUser.count': {
+				handler(newVal, oldVal) {
+					if (newVal !== this.prevOrderCount) {
+						this.prevOrderCount = newVal;
+						this.showPurchaseMessage();
+					}
+				},
+				immediate: true
+			}
+		},
+		methods: {
+			// 重置在线用户列表的分页参数
+			resetUserListParams() {
+				this.viewPageNum = 1; // 重置页码为第一页
+				this.viewNoMoreData = false; // 重置“没有更多数据”状态
+				this.liveViewers = []; // 清空现有列表
+			},
+			closeAllWebSockets() {
+				this.isManualClose = true;
+
+				// 关闭所有连接
+				Object.keys(this.socketInstances).forEach(liveId => {
+					try {
+						if (this.socketInstances[liveId] && this.socketInstances[liveId].instance) {
+							this.socketInstances[liveId].instance.close({
+								code: 1000,
+								reason: '页面关闭'
+							});
+							console.log(`直播间 ${liveId} WebSocket 已关闭`);
+						}
+					} catch (e) {
+						console.error(`关闭直播间 ${liveId} WebSocket 时出错:`, e);
+					}
+				});
+
+				this.socketInstances = {};
+				isSocketOpen = false;
+			}, // 移除所有全局事件监听器
+			removeAllEventListeners() {
+				uni.$off('initSocket');
+				uni.$off('sendMsg');
+				uni.$off('closeWebSocket');
+				uni.$off('refreshOrder');
+				// 可以根据实际情况添加其他需要移除的事件
+			}, // 清理所有定时器
+			clearAllTimers() {
+				if (this.intervalId) {
+					clearInterval(this.intervalId);
+					this.intervalId = null;
+				}
+
+				if (this.pingpangTimes) {
+					clearInterval(this.pingpangTimes);
+					this.pingpangTimes = null;
+				}
+
+				if (this.reconnectTimer) {
+					clearInterval(this.reconnectTimer);
+					this.reconnectTimer = null;
+				}
+
+				if (this.scrollTimer) {
+					clearTimeout(this.scrollTimer);
+					this.scrollTimer = null;
+				}
+
+				if (this.searchTimer) {
+					clearTimeout(this.searchTimer);
+					this.searchTimer = null;
+				}
+
+				if (this.purchasePromptTimer) {
+					clearTimeout(this.purchasePromptTimer);
+					this.purchasePromptTimer = null;
+				}
+			},
+			// 初始化当前直播间数据
+			async initCurrentLiveData() {
+				const currentLive = this.list[this.currentSwiperIndex];
+				if (!currentLive) return;
+
+				// 设置加载状态
+				currentLive.loading = true;
+
+				try {
+					// 先初始化WebSocket连接
+					await this.initSocket(currentLive);
+
+					// 然后并行加载其他数据
+					await Promise.allSettled([
+						this.getLiveMsg(currentLive),
+						this.getliveViewData(currentLive),
+						this.getliving(currentLive)
+					]);
+
+					currentLive.loaded = true;
+				} catch (error) {
+					console.error("初始化直播间数据失败:", error);
+				} finally {
+					currentLive.loading = false;
+				}
+			},
+
+
+			// 初始化直播间列表
+			async initLiveList(options) {
+				try {
+					await this.getList(); // 先加载直播间列表
+					if (this.list.length === 0) {
+						console.error("直播间列表为空,无法初始化");
+						return;
+					}
+
+					// 设置初始直播间索引(原逻辑保留)
+					if (options.liveId) {
+						const index = this.list.findIndex(item => item.liveId == options.liveId);
+						this.currentSwiperIndex = index !== -1 ? index : 0;
+					} else {
+						this.currentSwiperIndex = 0;
+					}
+
+
+					// 延迟设置动画时间(原逻辑保留)
+					setTimeout(() => {
+						this.swiperDuration = 300;
+					}, 100);
+
+					// 获取当前直播间的liveItem
+					const currentLive = this.list[this.currentSwiperIndex];
+					if (currentLive) {
+						this.liveId = currentLive.liveId;
+
+						// 重置用户列表参数
+						this.resetUserListParams();
+
+						// 预加载相邻直播间(不初始化WebSocket)
+						this.preloadNearbyLives(false);
+
+						// 初始化当前直播间数据(包含WebSocket连接)
+						await this.initCurrentLiveData();
+
+						// 获取在线用户
+						this.getliveUser(true);
+
+						// 延迟播放视频
+						setTimeout(() => {
+							this.playVideo(currentLive);
+						}, 500);
+					}
+				} catch (error) {
+					console.error("初始化失败:", error);
+				}
+			},
+
+			// Swiper切换事件
+			async onSwiperChange(e) {
+				const newIndex = e.detail.current;
+				const oldIndex = this.currentSwiperIndex;
+
+				// 如果索引没有变化,直接返回
+				if (newIndex === oldIndex) return;
+
+				// 暂停旧视频
+				const oldLive = this.list[oldIndex];
+				if (oldLive) {
+					this.pauseVideo(oldLive);
+					this.closeWebSocket(oldLive.liveId);
+				}
+
+				// 更新当前索引
+				this.currentSwiperIndex = newIndex;
+				const newLive = this.list[newIndex];
+				if (!newLive) return;
+
+				// 更新当前直播ID
+				this.liveId = newLive.liveId;
+
+				try {
+					// 重置用户列表参数
+					this.resetUserListParams();
+
+					// 初始化新直播间数据(包含WebSocket连接)
+					await this.initCurrentLiveData();
+
+					// 获取新直播间的在线用户
+					this.getliveUser(false);
+
+					// 播放新视频
+					setTimeout(() => {
+						this.playVideo(newLive);
+					}, 100);
+				} catch (error) {
+					console.error('切换直播间失败:', error);
+				}
+			},
+			// 获取直播间列表
+			async getList() {
+				const data = {
+					page: 1,
+					page_size: 20
+				};
+				try {
+					const res = await liveList(data);
+					if (res.code === 200) {
+						this.list = res.rows.map(item => ({
+							...item,
+							talklist: [],
+							loading: false,
+							loaded: false,
+							shopping: false,
+							inputInfo: '',
+							showWelcomeMessage: false,
+							redInfo: {}
+							// 其他初始化字段...
+						}));
+						console.log("直播间列表加载成功,数量:", this.list.length); // 确认数量是否 > 0
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: "none"
+						});
+						this.list = []; // 接口失败时清空列表,避免后续错误
+					}
+				} catch (error) {
+					console.error("获取直播间列表失败:", error);
+					this.list = []; // 异常时清空列表
+				}
+			},
+			// 播放视频
+			playVideo(liveItem) {
+				if (!liveItem) return;
+
+				try {
+					const videoId = `myVideo_${liveItem.liveId}`;
+					const videoContext = uni.createVideoContext(videoId, this);
+					if (videoContext) {
+						videoContext.pause(() => {
+							// 暂停完成后再播放
+							videoContext.play();
+						});
+					}
+				} catch (error) {
+					console.error("播放视频失败:", error);
+				}
+			},
+
+			pauseVideo(liveItem) {
+				if (!liveItem) return;
+
+				try {
+					const videoId = `myVideo_${liveItem.liveId}`;
+					const videoContext = uni.createVideoContext(videoId, this);
+					if (videoContext) {
+						videoContext.pause();
+					}
+				} catch (error) {
+					console.error("暂停视频失败:", error);
+				}
+			},
+			// 预加载相邻直播间
+			async preloadNearbyLives(includeWebSocket = false) {
+				this.preloading = true;
+				const currentIndex = this.currentSwiperIndex;
+				const preloadIndexes = [];
+
+				if (currentIndex > 0) preloadIndexes.push(currentIndex - 1);
+				if (currentIndex > 1) preloadIndexes.push(currentIndex - 2);
+				if (currentIndex < this.list.length - 1) preloadIndexes.push(currentIndex + 1);
+				if (currentIndex < this.list.length - 2) preloadIndexes.push(currentIndex + 2);
+
+				for (const index of preloadIndexes) {
+					const liveItem = this.list[index];
+					if (!liveItem || liveItem.loaded || liveItem.loading) continue;
+
+					liveItem.loading = true;
+					try {
+						// 只加载视频和基本信息,不初始化WebSocket
+						await Promise.all([
+							this.getliving(liveItem),
+							this.getLiveMsg(liveItem),
+							this.getliveViewData(liveItem)
+						]);
+
+						// 只有当明确要求时才初始化WebSocket
+						if (includeWebSocket) {
+							await this.initSocket(liveItem);
+						}
+
+						liveItem.loaded = true;
+					} catch (error) {
+						console.error(`预加载直播间 ${index} 失败:`, error);
+						liveItem.loaded = false;
+					} finally {
+						liveItem.loading = false;
+					}
+				}
+				this.preloading = false;
+			},
+
+
+			openViews() {
+				// 计算scroll-view高度
+				this.$nextTick(() => {
+					const query = uni.createSelectorQuery().in(this);
+					query.select('.view-box').boundingClientRect(data => {
+						if (data) {
+							// 减去标题和底部固定区域的高度
+							this.scrollHeight = data.height - 80 - 120; // 80是标题高度,120是底部高度
+						}
+					}).exec();
+				});
+			},
+			// 重置直播间数据
+			resetLiveData() {
+				// 保留不需要重置的数据(如用户信息等)
+				const keepData = {
+					userinfo: this.userinfo,
+					list: this.list,
+					currentSwiperIndex: this.currentSwiperIndex
+				};
+
+				// 重置其他直播间特定数据
+				this.liveUserTotal = null;
+				// this.liveViewData = {};
+				this.liveViewers = [];
+				this.livingUrl = "";
+				this.videoUrl = null;
+				this.products = {};
+				this.store = {};
+				this.orderUser = {};
+				this.talklist = [];
+				this.livedata = {};
+				// this.isFollow = false;
+				this.shopping = false;
+				this.inputInfo = ''
+
+				// 恢复需要保留的数据
+				Object.assign(this, keepData);
+			},
+
+			// 获取直播间用户
+			async getliveUser(isLoadMore = false) {
+				// 强制使用当前 liveId,避免使用旧值
+				const currentLiveId = this.liveId;
+				if (!currentLiveId) return;
+				// if (this.viewLoading || this.viewNoMoreData) return;
+				this.viewLoading = true;
+				try {
+					const res = await watchUserList(currentLiveId, this.viewPageSize, this.viewPageNum, false);
+					if (res.code === 200) {
+						// 若请求期间已切换直播间,忽略旧数据
+						if (this.liveId !== currentLiveId) return;
+						this.liveUserTotal = res.total;
+						if (res.rows.length === 0) {
+							this.viewNoMoreData = true;
+							return;
+						}
+
+						this.liveViewers = isLoadMore ? [...this.liveViewers, ...res.rows] :
+							res.rows; // 首次加载/切换直播间时重置数据
+						this.viewPageNum++;
+						// console.log("在线观众", this.liveViewers)
+					}
+				} catch (error) {
+					console.error('获取观众列表失败:', error);
+				} finally {
+					this.viewLoading = false;
+				}
+			},
+			// 滚动到底部触发
+			handleScrollToLower() {
+				// 清除上一次未执行的定时器,避免重复请求
+				if (this.scrollTimer) {
+					clearTimeout(this.scrollTimer);
+				}
+
+				// 延迟0.5秒(500毫秒)执行接口请求
+				this.scrollTimer = setTimeout(() => {
+					this.getliveUser(true); // 加载更多数据
+				}, 1000); // 延迟时间:500毫秒
+			},
+			async getLiveMsg(liveItem) {
+				// 强化校验:确保 liveItem 存在且包含 liveId
+				if (!liveItem || !liveItem.liveId) {
+					console.error('getLiveMsg 错误:无效的 liveItem', {
+						liveItem: liveItem,
+						currentIndex: this.currentSwiperIndex,
+						listLength: this.list.length
+					});
+					return; // 直接返回,不执行后续逻辑
+				}
+
+				try {
+					const res = await liveMsg(liveItem.liveId, 30, 1);
+					if (res.code == 200) {
+						// 确保使用响应式更新
+						this.$set(liveItem, 'talklist', [...res.rows]);
+						this.$nextTick(() => {
+							this.$set(liveItem, 'scrollIntoView', `list_${liveItem.talklist.length-1}`);
+						});
+					}
+				} catch (error) {
+					console.error("获取聊天记录失败:", error);
+				}
+			},
+
+			// 点击红包
+			onRed(item) {
+				// console.log("点了this.liveId", item)
+				if (!item.liveId) return;
+				// console.log("点了this.liveId", this.liveId)
+				if (!item.redInfo?.redId) return;
+				// console.log("点了this.redInfo?.redId", this.redInfo.redId)
+				// console.log("点了this.userinfo.userId", this.userinfo.userId)
+				let data = {
+					liveId: item.liveId,
+					userId: this.userinfo.userId,
+					redId: item.redInfo.redId,
+				}
+				console.log("点了this.liveId", data)
+				liveRed(data).then(res => {
+						if (res.code == 200) {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						}
+					},
+					rej => {}
+				);
+			},
+			handleSearchInput() {
+				// 使用防抖优化性能,避免频繁请求
+				clearTimeout(this.searchTimer);
+				this.searchTimer = setTimeout(() => {
+					this.queryCollect();
+				}, 500); // 500毫秒延迟
+			},
+			// 显示购买提示信息
+			showPurchaseMessage() {
+				// 清除之前的定时器
+				if (this.purchasePromptTimer) {
+					clearTimeout(this.purchasePromptTimer);
+				}
+
+				// 显示提示
+				this.showPurchasePrompt = true;
+
+				// 2秒后自动隐藏
+				this.purchasePromptTimer = setTimeout(() => {
+					this.showPurchasePrompt = false;
+				}, 2000);
+			},
+			truncateString(str, maxLength) {
+				return str.length > maxLength ? str.slice(0, maxLength) + '...' : str;
+			},
+			goStore(item) {
+				console.log("带过去storeId", item)
+				if (!item.storeId) {
+					uni.showToast({
+						title: "当前直播间暂未开通店铺",
+						icon: 'none'
+					});
+					return;
+				}
+
+				uni.navigateTo({
+					url: '/pages_shop/store?liveId=' + item.liveId + "&storeId=" + item.storeId
+				})
+			},
+			// 去订单列表
+			goOrderList() {
+				uni.navigateTo({
+					url: "/pages_shop/order"
+				})
+			},
+
+			// 初始化HLS播放器
+			initHlsPlayer() {
+				if (Hls.isSupported() && this.livingUrl) {
+					const video = document.getElementById('myVideo');
+					if (video) {
+						this.hlsPlayer = new Hls();
+						this.hlsPlayer.loadSource(this.livingUrl);
+						this.hlsPlayer.attachMedia(video);
+						this.hlsPlayer.on(Hls.Events.MANIFEST_PARSED, () => {
+							video.play();
+						});
+					}
+				}
+			},
+
+			// 视频错误处理
+			videoError(e, liveItem) {
+				// 检查是否是当前直播间,避免处理非活跃直播间的错误
+				if (!liveItem || liveItem.liveId !== this.liveId) return;
+
+				// 限制重试次数
+				if (this.videoRetryCounts[liveItem.liveId] >= 3) {
+					console.error(`直播间 ${liveItem.liveId} 视频加载失败`);
+					return;
+				}
+
+				this.videoRetryCounts[liveItem.liveId]++;
+
+				// 延迟重试,避免与切换操作冲突
+				setTimeout(() => {
+					if (liveItem.liveId === this.liveId) {
+						this.playVideo(liveItem);
+					}
+				}, 2000);
+			},
+
+			// 修改获取直播信息方法
+			async getliving(liveItem) {
+				if (!liveItem || !liveItem.liveId) return;
+				// console.log("获取直播信息:", liveItem.liveId);
+				const param = {
+					id: liveItem.liveId
+				};
+
+				try {
+					const res = await getlive({
+						id: liveItem.liveId
+					});
+					if (res.code !== 200) {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						});
+						return;
+					}
+
+					// 强制更新视频源(覆盖旧值)
+					if (res.data.liveType === 2) {
+						// 回放视频
+						this.$set(liveItem, 'videoUrl', res.data.videoUrl);
+						this.$set(liveItem, 'livingUrl', ''); // 清空直播流
+						this.$set(liveItem, 'placeholderText', "说点什么...");
+
+					} else if (res.data.liveType === 1) {
+						// 直播流
+						this.$set(liveItem, 'livingUrl', res.data.flvHlsUrl);
+						console.log("排查中1》》",res.data.flvHlsUrl)
+						console.log("排查中2》》",liveItem.livingUrl)
+						this.$set(liveItem, 'videoUrl', ''); // 清空回放视频
+						this.$set(liveItem, 'placeholderText', "说点什么...");
+					} else {
+						// 未开播
+						this.$set(liveItem, 'livingUrl', '');
+						this.$set(liveItem, 'videoUrl', '');
+					}
+
+					// 更新其他直播信息
+					// 仅当是当前激活的直播间时,才允许自动播放
+					const isCurrentLive = this.currentSwiperIndex === this.list.findIndex(item => item.liveId ===
+						liveItem.liveId);
+					this.$set(liveItem, 'autoplay', isCurrentLive && res.data.liveType !== 0);
+					this.$set(liveItem, 'showType', res.data.showType);
+					this.$set(liveItem, 'storeId', res.storeId);
+					this.queryCollect();
+				} catch (err) {
+					console.error("获取直播信息失败:", err);
+					uni.showToast({
+						title: "获取直播信息失败",
+						icon: 'none'
+					});
+				}
+			}, // 设置视频播放
+			setupVideoPlayback(liveItem, liveData) {
+				if (!liveItem.livingUrl) return;
+
+				// H5 平台:使用 HLS.js 处理 .m3u8 流
+				// #ifdef H5
+				if (liveItem.livingUrl.includes('.m3u8')) {
+					this.initHlsPlayer(liveItem);
+					return;
+				}
+				// #endif
+
+				// 小程序/App 平台:直接使用 video 组件
+				const videoId = `myVideo_${liveItem.liveId}`;
+				const videoContext = uni.createVideoContext(videoId, this);
+
+				if (liveData.liveType === 1) {
+					// 回放:跳转到指定位置
+					videoContext.seek(liveData.nowDuration || 0);
+				} else {
+					// 直播:直接播放
+					videoContext.play();
+				}
+			},
+			maskString(str, maskChar = '*') {
+				// 如果str是undefined或null,直接返回空字符串
+				if (!str) return '';
+				// 确保str是字符串(如果是数字等类型,先转为字符串)
+				const strVal = String(str);
+				return strVal.split('').map((char, index) => (index === 0 ? char : maskChar)).join('');
+			},
+
+			getPureDecimal(num, precision = 6) {
+				const decimalPart = Math.abs(num).toFixed(precision).split('.')[1];
+				return decimalPart?.replace(/0+$/, '') || ''; // 移除末尾多余的0
+			},
+
+			// 返回上一个页面并关闭WebSocket
+			goBack() {
+				// 暂停当前视频
+				const currentLive = this.list[this.currentSwiperIndex];
+				if (currentLive) {
+					this.pauseVideo(currentLive);
+				}
+
+				// 关闭所有WebSocket连接
+				this.closeWebSocket();
+
+				// 导航返回
+				const pages = getCurrentPages();
+				if (pages.length > 1) {
+					uni.navigateBack();
+				} else {
+					uni.reLaunch({
+						url: '/pages/list/index'
+					});
+				}
+			},
+
+			//正在购买
+			async getliveOrder() {
+				const currentLiveId = this.liveId;
+				if (!currentLiveId) return;
+
+				try {
+					const res = await liveOrderUser(currentLiveId);
+					if (res.code === 200) {
+						// 绑定到当前 liveItem
+						const currentLive = this.list[this.currentSwiperIndex];
+						if (currentLive) {
+							this.$set(currentLive, 'orderUser', res);
+							this.orderUser = res; // 同步全局变量
+						}
+					}
+				} catch (error) {
+					console.error('获取正在购买用户失败:', error);
+				}
+			},
+
+			// 获取直播间信息接口
+			getLiveinformation() {
+				if (!this.liveId) return;
+				getLiveInfo(this.liveId).then(res => {
+						if (res.code == 200) {
+							console.log("获取直播间信息接口>>>>", res)
+							this.livingUrl = res.livingUrl
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						}
+					},
+					rej => {}
+				);
+			},
+
+
+			// 点赞
+			async onLike(liveItem) {
+				if (!liveItem || !liveItem.liveId) return;
+				if (!liveItem.liveViewData) {
+					await this.getliveViewData(liveItem); // 强制加载数据
+					if (!liveItem.liveViewData) { // 仍未加载成功
+						uni.showToast({
+							title: "数据加载中,请稍后再试",
+							icon: 'none'
+						});
+						return;
+					}
+				}
+
+				try {
+					const res = await liveDataLike(liveItem.liveId);
+					if (res.code === 200) {
+						if (res.like) {
+							liveItem.liveViewData.like=res.like;
+						}
+						else{
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						}
+
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						});
+					}
+				} catch (error) {
+					console.error('点赞失败:', error);
+				}
+			},
+			//直播间点赞、关注、在线人数数据
+			async getliveViewData(liveItem) {
+				if (!liveItem || !liveItem.liveId) return;
+				try {
+					const res = await getLiveViewData(liveItem.liveId);
+					if (res.code == 200) {
+						// 强制响应式更新,确保数据实时显示
+						this.$set(liveItem, 'liveViewData', res);
+						// 打印日志确认数据已加载
+						console.log(`直播间 ${liveItem.liveId} 数据加载完成:`, res);
+					}
+				} catch (error) {
+					console.error("获取直播间数据失败:", error);
+					// 失败时兜底,避免显示异常
+					this.$set(liveItem, 'liveViewData', {
+						like: 0,
+						watchCount: 0
+					});
+				}
+			},
+			// 去购买,跳商品详情
+			goShop(productId, goodsId) {
+				const currentLive = this.list[this.currentSwiperIndex];
+				if (!currentLive || !currentLive.liveId) return;
+				// console.log("拿现在的item", currentLive)
+
+				uni.navigateTo({
+					url: '/pages_shop/goods?productId=' + productId + '&liveId=' + currentLive.liveId +
+						'&goodsId=' +
+						goodsId + '&storeId=' + currentLive.storeId
+				})
+			},
+
+			// 查询店铺
+			async queryCollect() {
+				const currentLive = this.list[this.currentSwiperIndex];
+				if (!currentLive || !currentLive.liveId) return;
+
+				const {
+					storeId
+				} = currentLive;
+				// console.log("小黄车数据>>>", currentLive)
+				if (!storeId) return;
+				try {
+					const res = await store(currentLive.storeId, currentLive.inputInfo, currentLive.liveId);
+					if (res.code === 200) {
+						// 数据绑定到当前 liveItem,避免全局污染
+						this.$set(currentLive, 'products', res.data.goodsList);
+						this.$set(currentLive, 'store', res.data);
+						// 同步更新全局变量(供弹窗使用)
+						this.products = res.data.goodsList;
+						this.store = res.data;
+					}
+				} catch (error) {
+					console.error('获取小黄车商品失败:', error);
+				}
+			},
+
+			// 店铺收藏
+			onStoreCollect(liveItem) {
+				console.log("店铺收藏", liveItem)
+				if (!liveItem.storeId) return;
+				collectStore(liveItem.storeId).then(res => {
+						if (res.code == 200) {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+							liveItem.store.isFavorite = !liveItem.store.isFavorite
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						}
+					},
+					rej => {}
+				);
+			},
+			// 商品收藏
+			onGoodsCollect(item) {
+				console.log("商品收藏", item)
+				if (!item || item.length === 0 || !item.goodsId) {
+					return;
+				}
+				collectGoods(item.goodsId).then(res => {
+						if (res.code == 200) {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+							item.isFavorite = !item.isFavorite
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						}
+					},
+					rej => {}
+				);
+			},
+			// 关注
+			// async onFollow(liveItem) {
+			// 	if (!liveItem || !liveItem.liveId) return;
+
+			// 	try {
+			// 		const res = await follow(liveItem.liveId);
+			// 		liveItem.isFollow = !liveItem.isFollow;
+			// 		uni.showToast({
+			// 			title: res.msg,
+			// 			icon: 'none'
+			// 		});
+			// 	} catch (error) {
+			// 		console.error("关注操作失败:", error);
+			// 	}
+			// },
+			// 时间戳
+			initTime() {
+				const now = new Date();
+				this.timestamp = now.getTime(); // 例如:'2023-04-01 12:00:00'
+			},
+			// initWebSocket() {
+			//       const liveWS = new LiveWS('ws://your-server.com', 123, 456);
+
+			//       // 从 URL 中解析 timestamp
+			//       const urlParams = new URL(liveWS.url).searchParams;
+			//       this.timestamp = urlParams.get('timestamp');
+			//       // console.log('Timestamp:', timestamp);
+			//     },
+
+			// 弹幕滚动
+			lowerChat: function(e) {
+				console.log(e)
+			},
+			scroll: function(e) {
+				console.log(e)
+				this.old.scrollTop = e.detail.scrollTop
+			},
+
+
+			loadmore() {
+				// for (let i = 0; i < 30; i++) {
+				//   this.indexList.push({
+				//     url: this.shopList[uni.$u.random(0, this.shopList.length - 1)],
+				//   });
+				// }
+			},
+
+			openShop() {
+
+			},
+			openViews() {
+				this.$nextTick(() => {
+					const query = uni.createSelectorQuery().in(this);
+					query.select('.view-box').boundingClientRect(data => {
+						if (data) {
+							this.scrollHeight = data.height - 80 - 120;
+						}
+					}).exec();
+				});
+			},
+			openCart(liveItem) {
+				if (!liveItem.storeId) {
+					uni.showToast({
+						title: "当前直播间暂未开通店铺",
+						icon: 'none'
+					});
+					return;
+				}
+				liveItem.shopping = !liveItem.shopping
+			},
+			close() {
+				this.showadd = !this.showadd
+			},
+			closes() {
+				this.showziliao = !this.showziliao
+			},
+			closest() {
+				this.showAnswer = !this.showAnswer
+			},
+			closestred() {
+				this.showAnswerred = !this.showAnswerred
+			},
+			closeanswer() {
+				this.answerbtn = !this.answerbtn
+			},
+			// 关闭小黄车
+			closeShop() {
+				// 通过当前swiper索引获取当前直播间实例
+				const currentLive = this.list[this.currentSwiperIndex];
+				if (currentLive) {
+					// 使用响应式更新修改shopping属性
+					this.$set(currentLive, 'shopping', !currentLive.shopping);
+				}
+			},
+			// 关闭红包
+			closeRed() {
+				this.showRed = !this.showRed
+			},
+			// 触摸结束
+			handleTouchEnd() {
+				this.isZoom = false; // 恢复原状
+			},
+			getEWechatSdk() {
+				// 只在H5平台执行
+				// #ifdef H5
+				let eWechatSdk = '';
+				if (/(Android)/i.test(navigator.userAgent)) {
+					eWechatSdk = 'jWeixin';
+				} else if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
+					eWechatSdk = 'wx';
+				} else {
+					eWechatSdk = 'jWeixin';
+				}
+				uni.setStorageSync("wxSdk", eWechatSdk);
+				// #endif
+			},
+			// 修改关闭WebSocket方法
+			closeWebSocket(liveId = null) {
+				this.isManualClose = true;
+
+				// 清除所有定时器
+				clearInterval(this.pingpangTimes);
+				clearInterval(this.reconnectTimer);
+
+				// 关闭指定或所有WebSocket连接
+				if (liveId) {
+					// 关闭指定直播间的连接
+					if (this.socketInstances[liveId] && this.socketInstances[liveId].instance) {
+					  try {
+					    this.socketInstances[liveId].instance.close(); // socketTask.close()
+					    console.log(`直播间 ${liveId} WebSocket 已安全关闭`);
+					  } catch (e) { console.error('关闭失败', e); }
+					  delete this.socketInstances[liveId];
+					}
+				} else {
+					// 关闭所有连接
+					Object.keys(this.socketInstances).forEach(liveId => {
+						try {
+							uni.closeSocket({
+								instance: this.socketInstances[liveId]
+							});
+							console.log(`直播间 ${liveId} WebSocket 已安全关闭`);
+						} catch (e) {
+							console.error('关闭 WebSocket 时出错:', e);
+						}
+					});
+					this.socketInstances = {};
+				}
+
+				isSocketOpen = false;
+			},
+			reConnect() {
+				var that = this;
+				try {
+					uni.closeSocket();
+				} catch (e) {
+
+				}
+				setTimeout(function() {
+					that.initSocket();
+				}, 10000);
+
+			},
+			startHeartbeat(liveId) {
+			  clearInterval(this.pingpangTimes);
+			  this.pingpangTimes = setInterval(() => {
+			    const inst = this.socketInstances[liveId];
+			    if (!inst || !inst.isOpen || !inst.instance) return;
+			    const pingData = { cmd: 'ping', timestamp: Date.now() };
+			    try {
+			      inst.instance.send({ data: JSON.stringify(pingData) });
+			    } catch (err) {
+			      console.error('心跳发送失败:', err);
+			      this.scheduleReconnect(liveId);
+			    }
+			  }, 30000);
+			},
+			async initSocket(liveItem) {
+				if (!liveItem || !liveItem.liveId) return;
+
+				const liveId = liveItem.liveId;
+
+				// 检查是否已经是当前连接或正在连接
+				if (this.connectingLiveId === liveId ||
+					(this.socketInstances[liveId] && this.socketInstances[liveId].isOpen)) {
+					console.log(`直播间 ${liveId} 的WebSocket已经连接或正在连接,跳过初始化`);
+					return;
+				}
+
+				// 检查是否是当前活跃的直播间
+				if (this.currentSwiperIndex !== this.list.findIndex(item => item.liveId === liveId)) {
+					console.log(`不初始化非当前直播间 ${liveId} 的WebSocket`);
+					return;
+				}
+
+				// 关闭之前的连接(如果存在)
+				if (this.socketInstances[liveId]) {
+					this.closeWebSocket(liveId);
+				}
+
+				// 设置正在连接的直播间ID
+				this.connectingLiveId = liveId;
+
+				// 防止重复创建
+				if (this.reconnectCount >= this.maxReconnectAttempts) {
+					this.connectingLiveId = null;
+					return;
+				}
+
+				this.isManualClose = false;
+
+				// 生成签名
+				const signature = CryptoJS.HmacSHA256(
+					`${liveId}${this.userinfo.userId}${this.userType}${this.timestamp}`,
+					this.timestamp.toString()
+				).toString(CryptoJS.enc.Hex);
+
+				// 初始化实例状态
+				this.socketInstances[liveId] = {
+					instance: null,
+					isOpen: false
+				};
+
+				try {
+					const socketTask = uni.connectSocket({
+						url: `${wsUrl}?userId=${this.userinfo.userId}&liveId=${liveId}&userType=${this.userType}&timestamp=${this.timestamp}&signature=${signature}`,
+						success: () => {
+							console.log('WebSocket API 调用成功,正在建立连接...');
+						},
+						fail: (err) => {
+							console.error('WebSocket 连接失败:', err);
+							this.connectingLiveId = null;
+							this.scheduleReconnect(liveId);
+						}
+					});
+
+					socketTask.onOpen((res) => {
+						console.log('WebSocket 连接已成功建立', res);
+						this.socketInstances[liveId].instance = socketTask;
+						this.socketInstances[liveId].isOpen = true;
+						
+						isSocketOpen = true;
+						  this.connectingLiveId = null;
+						  this.reconnectCount = 0;
+						  // 改用 socketTask 的 send 作为心跳
+						  this.startHeartbeat(liveId); // 修改 startHeartbeat 以接受 liveId 并使用 socketTask.send
+					});
+
+					socketTask.onMessage((res) => {
+						// 找到对应的直播间并更新数据
+						const targetLive = this.list.find(item => item.liveId === liveId);
+						if (targetLive) {
+							this.handleSocketMessage(res, targetLive);
+						}
+					});
+
+					socketTask.onError((err) => {
+						console.error('WebSocket 连接错误:', err);
+						this.connectingLiveId = null;
+						this.scheduleReconnect(liveId);
+					});
+
+					socketTask.onClose(() => {
+						console.log(`WebSocket 连接已关闭: ${liveId}`);
+						this.connectingLiveId = null;
+					});
+				} catch (e) {
+					console.error('创建 WebSocket 异常:', e);
+					this.connectingLiveId = null;
+					this.scheduleReconnect(liveId);
+				}
+			},
+			// 处理Socket消息
+			handleSocketMessage(message, liveItem) {
+				let data = JSON.parse(message.data)
+				const socketMessage = data.data
+				// console.log("处理",data)
+				if (data.code == 200) {
+					const messageData = {
+						...socketMessage, // 原数据(可能包含部分字段)
+						cmd: socketMessage.cmd || '' // 强制添加cmd,确保存在(默认空字符串)
+					};
+					// console.log("messageData是",messageData)
+					if (socketMessage.cmd == 'sendMsg') {
+						// this.$set(liveItem, 'talklist', [...liveItem.talklist, messageData]);
+						this.$nextTick(() => {
+							this.$set(liveItem, 'scrollIntoView', `list_${liveItem.talklist.length-1}`);
+						});
+					} else if (socketMessage.cmd == 'red') {
+						// 领红包
+						this.$set(liveItem, 'redInfo', JSON.parse(socketMessage.data));
+						console.log("红包是liveItem.redInfo", liveItem)
+						// liveItem.redInfo = JSON.parse(message.data.data);
+
+					} else if (socketMessage.cmd == 'sendRedPacketQuestion') {
+						const list = JSON.parse(message.data.data);
+						// 处理红包答题逻辑
+					} else if (socketMessage.cmd == 'entry') {
+						// console.log("进入:", liveItem);
+						console.log("在线人数进入:");
+						this.$set(liveItem, 'talklist', [...liveItem.talklist, messageData]);
+						// 先重置为 false(避免残留状态)
+						this.$set(liveItem, 'showWelcomeMessage', false);
+						// 立即设为 true(触发 DOM 更新)
+						this.$set(liveItem, 'showWelcomeMessage', true);
+						this.getliveUser(false); // 调用获取在线用户接口
+						console.log("开启欢迎消息:", liveItem.showWelcomeMessage);
+						if (liveItem.welcomeTimer) {
+							clearTimeout(liveItem.welcomeTimer);
+						}
+						// 存储定时器到 liveItem 中(避免引用丢失)
+						liveItem.welcomeTimer = setTimeout(() => {
+							this.$set(liveItem, 'showWelcomeMessage', false);
+							console.log("关闭欢迎消息:", liveItem.showWelcomeMessage);
+						}, 1000); // 1秒后隐藏
+					} else if (socketMessage.cmd == 'live_start') {
+						// 直播开始
+					} else if (socketMessage.cmd == 'live_end') {
+						// 直播结束
+					} else if (socketMessage.data.cmd == 'deleteId') {
+						uni.$emit('deleteId');
+					} else if (socketMessage.data.cmd == 'sendRedPacketQuestion') {
+						// const list = JSON.parse(socketMessage)
+						// liveItem.redanswerAll = [...liveItem.redanswerAll, ...list]
+						// if (liveItem.redanswerAll[1].randomAmount !== null) {
+						// 	liveItem.redanswertips = JSON.parse(liveItem.redanswerAll[0]
+						// 		.randomAmount)
+						// }
+					}
+				} else {
+					uni.showToast({
+						title: data.msg,
+						icon: 'none'
+					});
+				}
+
+			},
+			scheduleReconnect() {
+				  if (this.isManualClose || this.reconnectCount >= this.maxReconnectAttempts) return;
+				  this.reconnectCount++;
+				  const delay = Math.min(3000 * this.reconnectCount, 30000);
+				  clearInterval(this.reconnectTimer);
+				  this.reconnectTimer = setTimeout(() => {
+				    this.initSocket(this.list.find(item => item.liveId === liveId) || { liveId });
+				  }, delay);
+			},
+			sendMsg(liveItem) {
+			  if (!liveItem || !liveItem.liveId) return;
+			
+			  // 防止连续点击发送两次(短时锁定)
+			  if (liveItem.isSending) return;
+			  liveItem.isSending = true;
+			  setTimeout(() => { liveItem.isSending = false; }, 800); // 800ms 内禁止再次发送
+			
+			  const text = (liveItem.value || '').trim();
+			  if (!text) {
+			    uni.showToast({ title: "不能发送空消息", icon: 'none' });
+			    return;
+			  }
+			
+			  const liveId = liveItem.liveId;
+			  const socketItem = this.socketInstances[liveId];
+			
+			  // 乐观更新:立即把消息加入到本地聊天列表并清空输入(更好的体验)
+			  const localMsg = {
+			    cmd: 'sendMsg',
+			    msg: text,
+			    nickName: this.userinfo.nickName,
+			    avatar: this.userinfo.avatar,
+			    userId: this.userinfo.userId,
+			    local: true, // 标记为本地消息(可用于样式或后续差异处理)
+			    ts: Date.now()
+			  };
+			  this.$set(liveItem, 'talklist', [...(liveItem.talklist || []), localMsg]);
+			  this.$set(liveItem, 'value', ''); // 立即清空输入
+			
+			  if (!socketItem || !socketItem.instance || !socketItem.isOpen) {
+			    // 如果 socket 未连接,尝试建立连接(但不要阻塞用户)
+			    this.initSocket(liveItem);
+			    uni.showToast({ title: "连接未建立,正在重连", icon: 'none' });
+			    return;
+			  }
+			
+			  const data = {
+			    liveId,
+			    userId: this.userinfo.userId,
+			    userType: 0,
+			    cmd: "sendMsg",
+			    msg: text,
+			    nickName: this.userinfo.nickName,
+			    avatar: this.userinfo.avatar
+			  };
+			
+			  try {
+			    socketItem.instance.send({
+			      data: JSON.stringify(data),
+			      success: () => {
+			        // 成功后可以移除 local 标记(可选)
+			        // 比如找到最后一条 local 消息并标记为 sent
+			      },
+			      fail: (err) => {
+			        console.error("发送失败:", err);
+			        uni.showToast({ title: "发送失败,请重试", icon: 'none' });
+			        // 可选择回滚本地显示(此处简单提示即可)
+			      }
+			    });
+			  } catch (err) {
+			    console.error('socket send 异常', err);
+			  }
+			}
+		}
+	};
+</script>
+
+<style scoped lang="scss">
+	.swiper-wrapper {
+		position: relative;
+		width: 100%;
+		height: 100vh;
+		overflow: hidden;
+		background-color: #000000;
+	}
+
+	.swiper-container {
+		width: 100%;
+		height: 100vh;
+	}
+
+	.container {
+		width: 100%;
+		height: 100%;
+		position: relative;
+
+		// 添加渐变过渡效果
+		transition: opacity 0.3s ease;
+
+		&.active {
+			opacity: 1;
+		}
+
+		// 非活动项半透明显示
+		// &:not(.active) {
+		// 	opacity: 0.7;
+		// }
+	}
+
+	.loading-tip {
+		position: absolute;
+		top: 50%;
+		left: 50%;
+		transform: translate(-50%, -50%);
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		z-index: 10;
+
+		.loading-text {
+			color: #ffffff;
+			font-size: 28rpx;
+			margin-top: 20rpx;
+		}
+	}
+
+	.loading-more,
+	.no-more {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		padding: 20rpx 0;
+		color: #999;
+		font-size: 24rpx;
+	}
+
+	.loading-more {
+		flex-direction: column;
+	}
+
+	.preload-indicator {
+		position: absolute;
+		top: 50%;
+		right: 30rpx;
+		transform: translateY(-50%);
+		z-index: 100;
+		background: rgba(0, 0, 0, 0.5);
+		border-radius: 50%;
+		padding: 16rpx;
+	}
+
+	/* button自带样式清除 */
+	.student-orther-icon button::after {
+		border: none !important;
+		padding: 0 !important;
+		margin: 0 !important;
+	}
+
+	.student-orther-icon button {
+		background-color: transparent !important;
+		padding: 0 !important;
+		line-height: inherit !important;
+		margin: 0 !important;
+		width: auto !important;
+		font-weight: 500 !important;
+		border-radius: none !important;
+	}
+
+	.welcome-message {
+		position: fixed;
+		width: 100%;
+		bottom: 460rpx;
+		left: 50%;
+		transform: translateX(-50%);
+		color: white;
+		padding: 10px 20px;
+		border-radius: 20px;
+		// animation: fadeOut 1s ease 1s forwards;
+		z-index: 1000;
+		transition: opacity 0.3s ease;
+	}
+
+	@keyframes fadeOut {
+		from {
+			opacity: 1;
+		}
+
+		to {
+			opacity: 0;
+		}
+	}
+.send{
+	background-color: #4b4b4b;
+	border-radius:28rpx;
+	padding: 14rpx 16rpx;
+	color: #fff;
+}
+	// .container {
+	// 	position: relative;
+	// 	width: 100%;
+	// 	height: 100vh;
+	// 	overflow: hidden;
+	// }
+
+	// .talktext {
+	// 	border-radius: 8rpx;
+	// 	background-color: rgba(255, 255, 255, 0.1);
+
+	// 	view {
+	// 		width: 100%;
+	// 	}
+	// }
+
+	.talk-list {
+		border-radius: 30rpx;
+		background-color: rgba(33, 33, 33, 0.5);
+		padding: 10rpx 30rpx;
+	}
+
+	// .zoom-button-active {
+	// 	transform: scale(1.5);
+	// }
+
+	// .background-image {
+	// 	position: absolute;
+	// 	top: 0;
+	// 	left: -40rpx;
+	// 	width: 110%;
+	// 	height: 110%;
+	// 	object-fit: cover;
+	// 	filter: blur(20px);
+	// 	z-index: 0;
+	// }
+
+	// .background-images {
+	// 	position: absolute;
+	// 	top: 0;
+	// 	left: -40rpx;
+	// 	width: 110%;
+	// 	height: 110%;
+	// 	object-fit: cover;
+	// 	filter: blur(20px);
+	// 	z-index: 6;
+	// }
+
+	// .blackbg {
+	// 	position: absolute;
+	// 	top: 0;
+	// 	left: 0;
+	// 	width: 100%;
+	// 	height: 100%;
+	// 	background: rgba(0, 0, 0, 0.7);
+	// 	object-fit: cover;
+	// 	filter: blur(10px);
+	// 	z-index: 1;
+	// }
+
+	.content {
+		position: relative;
+		z-index: 2;
+		height: 100%;
+		width: 100%;
+		top: 0;
+		left: 0;
+		display: flex;
+		flex-direction: column;
+		justify-content: space-between;
+
+		.content-top {
+			width: 100%;
+			margin-top: 68rpx;
+			display: flex;
+			// align-items: center;
+			justify-content: space-between;
+			padding: 0 24rpx;
+			box-sizing: border-box;
+
+			.sum {
+				width: 80rpx;
+				height: 52rpx;
+				background: rgba(0, 0, 0, 0.5);
+				border-radius: 26rpx 26rpx 26rpx 26rpx;
+				font-size: 24rpx;
+				color: #FFFFFF;
+				text-align: center;
+				line-height: 52rpx;
+
+			}
+		}
+
+		.follow-btn {
+			padding: 8rpx 16rpx;
+			background: linear-gradient(270deg, #FF5C03 0%, #FFAC64 100%);
+			border-radius: 26rpx;
+			font-weight: 500;
+			font-size: 26rpx;
+			color: #FFFFFF;
+		}
+	}
+
+	.videolist {
+		position: relative;
+	}
+
+	.video {
+		height: 100vh;
+		/* 占屏幕高度的80% */
+		width: 100%;
+		background-color: rgba(57, 57, 57, 0.4);
+	}
+
+	.videotop {
+		width: 100%;
+		height: 100%;
+	}
+
+	.video_row {
+		width: 100%;
+		max-height: 500rpx;
+		overflow: hidden;
+		margin-top: 360rpx;
+	}
+
+	.popup-video {
+		position: absolute;
+		top: 30%;
+		height: 500rpx;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		width: 100%;
+		color: #fff;
+		z-index: 9;
+
+		.more {
+			background-color: #3280fe;
+			border-radius: 80rpx;
+			width: 280rpx;
+			text-align: center;
+			height: 60rpx;
+			line-height: 60rpx;
+		}
+	}
+
+	.icon-bg {
+		background-color: rgba(157, 157, 157, 0.8);
+		border-radius: 50%;
+		width: 72rpx;
+		height: 72rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		transition: transform 0.2s ease;
+	}
+
+	.list {
+		width: 80%;
+		margin-bottom: 20rpx;
+		animation: xxxawdawd .2s;
+	}
+
+	@keyframes xxxawdawd {
+		from {
+			margin-top: 0rpx;
+			opacity: 0;
+		}
+
+		to {
+			margin-top: 20rpx;
+			opacity: 1;
+		}
+	}
+
+	.shop-prompt {
+		position: absolute;
+		bottom: 600rpx;
+		left: 24rpx;
+		padding: 6rpx 20rpx;
+		background: rgba(230, 154, 34, 0.7);
+		border-radius: 24rpx;
+		z-index: 9;
+		font-weight: 500;
+		font-size: 26rpx;
+		color: #FFFFFF;
+		transition: opacity 0.3s ease;
+	}
+
+	.siderow-group {
+		position: absolute;
+		top: 65%;
+		right: 30rpx;
+		z-index: 9;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+
+		.side-item {
+			font-weight: 500;
+			font-size: 24rpx;
+			color: #FFFFFF;
+			margin-bottom: 32rpx;
+			text-align: center;
+
+			button {
+				background-color: transparent;
+				margin: 0;
+				line-height: 1;
+				padding: 0;
+			}
+
+			image {
+				width: 72rpx;
+				height: 72rpx;
+			}
+		}
+	}
+
+	.side-group {
+		position: absolute;
+		// top: 30%;
+		top: 65%;
+		right: 30rpx;
+		z-index: 9;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+
+		.side-item {
+			font-weight: 500;
+			font-size: 24rpx;
+			color: #FFFFFF;
+			margin-bottom: 32rpx;
+			text-align: center;
+
+			button {
+				background-color: transparent;
+				margin: 0;
+				line-height: 1;
+				padding: 0;
+			}
+
+			image {
+				width: 72rpx;
+				height: 72rpx;
+			}
+		}
+
+
+	}
+
+	.red-box {
+		.button {
+			margin: 0 auto;
+			width: 80%;
+			line-height: 88rpx;
+			height: 88rpx;
+			background: linear-gradient(90deg, #FF5701 0%, #FFB501 100%);
+			box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(238, 124, 80, 0.2);
+			border-radius: 44rpx 44rpx 44rpx 44rpx;
+			font-weight: 600;
+			font-size: 32rpx;
+			color: #FFFFFF;
+			text-align: center;
+		}
+	}
+
+	.view-box {
+		position: relative;
+		height: 40vh;
+		/* 设置弹出层高度为视窗高度的70% */
+		padding: 40rpx 0rpx 120rpx;
+		box-sizing: border-box;
+		display: flex;
+		flex-direction: column;
+
+		.scroll-content {
+			flex: 1;
+			overflow-y: auto;
+			padding: 0 40rpx;
+		}
+
+		.bottom {
+			padding: 20rpx 40rpx;
+			position: absolute;
+			bottom: 0;
+			width: 100%;
+			box-shadow: 0rpx -4rpx 10rpx 0rpx rgba(195, 195, 195, 0.3);
+			background: #fff;
+		}
+	}
+
+	.shoppop {
+		padding: 22rpx 16rpx;
+
+		.shoppop-top {
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			padding: 0 16rpx 22rpx;
+
+			.search-input {
+				width: 414rpx;
+				height: 76rpx;
+				background: #FFFFFF;
+				border-radius: 36rpx;
+				margin-left: 20rpx;
+				padding: 0 32rpx;
+				box-sizing: border-box;
+				font-size: 24rpx;
+				margin-right: 24rpx;
+
+			}
+
+			.search-top {
+				font-size: 20rpx;
+				color: #222222;
+			}
+		}
+
+
+		.shop-list {
+			overflow: hidden;
+
+			.list-item {
+				display: flex;
+				align-items: center;
+				padding: 20rpx 16rpx;
+				background: #FFFFFF;
+				border-radius: 16rpx;
+				margin-bottom: 16rpx;
+
+				.goods-img {
+					width: 200rpx;
+					height: 200rpx;
+					border-radius: 16rpx;
+					overflow: hidden;
+					position: relative;
+					margin-right: 24rpx;
+
+					image {
+						width: 100%;
+						height: 100%;
+					}
+
+					.goods-label {
+						position: absolute;
+						top: 0;
+						width: 64rpx;
+						height: 40rpx;
+						background: rgba(0, 0, 0, 0.5);
+						border-radius: 16rpx 0rpx 16rpx 0rpx;
+						text-align: center;
+						font-weight: 500;
+						font-size: 28rpx;
+						color: #FFFFFF;
+					}
+				}
+
+				.goods-right {
+					flex: 1;
+
+					.goods-title {
+						font-weight: 500;
+						font-size: 28rpx;
+						color: #000000;
+
+					}
+
+					.goods-details {
+						font-size: 24rpx;
+						color: #999999;
+						margin: 10rpx 0 20rpx;
+					}
+
+					.goods-people {
+						font-size: 22rpx;
+						color: #E69A22;
+						height: 56rpx;
+					}
+
+					.goods-shop {
+						display: flex;
+						justify-content: space-between;
+
+						.nummber {
+							color: #FF5C03;
+							font-size: 22rpx;
+							font-weight: 500;
+						}
+
+						.btn-group {
+							text-align: center;
+							line-height: 56rpx;
+
+							.collect-btn {
+								width: 72rpx;
+								background: #F5F7FA;
+								border-radius: 8rpx 0rpx 0rpx 8rpx;
+
+							}
+
+							.shop-btn {
+								width: 152rpx;
+								background: linear-gradient(270deg, #FF5C03 0%, #FFAC64 100%);
+								border-radius: 0rpx 8rpx 8rpx 0rpx;
+								font-weight: 500;
+								font-size: 26rpx;
+								color: #FFFFFF;
+
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	:deep(.u-list-item) {
+		width: 100%;
+		display: flex;
+		align-items: center;
+	}
+
+	:deep(.u-safe-area-inset-bottom) {
+		padding-bottom: 0
+	}
+</style>

+ 62 - 161
pages_shop/cart.vue

@@ -1,27 +1,18 @@
 <template>
 <template>
 	<view class="content">
 	<view class="content">
 		<!-- 商品列表 -->
 		<!-- 商品列表 -->
-		<!-- <view class="shopbox" v-for="(shop,idx) in shopList" :key="idx"> -->
-		<!-- <view class="shopbox-name" v-if="shop.storeName && shop.storeName != 'null'">
-				<label style="margin-right: 30upx;">
-					<checkbox :value="shop.checked" :checked="shop.checked" @click="checkShopChange(shop)" />
-				</label>
-				<text>{{shop.storeName}}</text>
-			</view> -->
 		<view class="shopbox" v-if="shopList.length !== 0">
 		<view class="shopbox" v-if="shopList.length !== 0">
-			<view class="goods-list" >
+			<view class="goods-list">
 				<view class="item" v-for="(item,index) in shopList" :key="index">
 				<view class="item" v-for="(item,index) in shopList" :key="index">
 					<label style="margin-right: 30upx;">
 					<label style="margin-right: 30upx;">
-						<checkbox :value="item.checked" :checked="item.checked" @click="checkChange(item,shop)" />
+						<checkbox :value="item.checked" :checked="item.checked" @click="checkChange(item)" />
 					</label>
 					</label>
 					<image class="goods-img" @click="showProduct(item)" :src="item.imgUrl" mode="aspectFit"></image>
 					<image class="goods-img" @click="showProduct(item)" :src="item.imgUrl" mode="aspectFit"></image>
 					<view class="info-box">
 					<view class="info-box">
 						<view>
 						<view>
 							<view class="title-box">
 							<view class="title-box">
-								<!-- <view class="tag">{{utils.getDictLabelName("storeProductType",item.productType)}}</view> -->
 								<view class="title ellipsis">{{ item.productName }}</view>
 								<view class="title ellipsis">{{ item.productName }}</view>
 							</view>
 							</view>
-							<!-- <view class="intro ellipsis">{{item.productAttrName}}</view> -->
 						</view>
 						</view>
 						<view class="price-num">
 						<view class="price-num">
 							<view class="price">
 							<view class="price">
@@ -69,72 +60,50 @@
 				<view class="btn" @click="submit">结算</view>
 				<view class="btn" @click="submit">结算</view>
 			</view>
 			</view>
 		</view>
 		</view>
-
 	</view>
 	</view>
 </template>
 </template>
 
 
 <script>
 <script>
 	import {
 	import {
-		queryLiveCartList, // 查询购物车列表
-		exportLiveCartList, // 导出购物车列表
-		liveCartDetails, //获取购物车详情
-		// addLiveCart, //新增购物车 
-		modifyLiveCart, //修改购物车
-		delLiveCart, // 删除购物车
-		liveOrderKey // 生成订单key
+		queryLiveCartList,
+		modifyLiveCart,
+		delLiveCart,
+		liveOrderKey
 	} from "@/api/order.js"
 	} from "@/api/order.js"
-	// import {getCarts,cartNum,delCart} from '@/api/product'
-	// import likeProduct from './components/likeProduct.vue'
+
 	export default {
 	export default {
-		// components: {
-		// 	likeProduct
-		// },
 		data() {
 		data() {
 			return {
 			return {
 				shopList: [],
 				shopList: [],
 				totalMoney: 0.00,
 				totalMoney: 0.00,
-				// carts: [],
 				checkAll: false,
 				checkAll: false,
+				orderKey: ""
 			}
 			}
 		},
 		},
 		onLoad() {
 		onLoad() {
-			// this.getCarts();
-
-		},
-
-		onReachBottom() {
-			// this.$refs.product.getGoodsProducts();
-		},
-		mounted() {
 			this.queryLiveCart();
 			this.queryLiveCart();
-			this.computedMoney();
 		},
 		},
 		methods: {
 		methods: {
 			// 获得key
 			// 获得key
 			getKey() {
 			getKey() {
 				liveOrderKey().then(res => {
 				liveOrderKey().then(res => {
-						if (res.code == 200) {
-							console.log("下订单的key>>>>", res)
-							this.orderKey = res.orderKey
-							console.log("key>>>>", this.orderKey)
-
-							uni.navigateTo({
-								url: '/pages_shop/confirmCreateOrder?type=cart&orderKey=' + this.orderKey
-							});
-						} else {
-							uni.showToast({
-								title: res.msg,
-								icon: 'none'
-							});
-						}
-					},
-					rej => {}
-				);
+					if (res.code == 200) {
+						this.orderKey = res.orderKey
+						uni.navigateTo({
+							url: '/pages_shop/confirmCreateOrder?type=cart&orderKey=' + this.orderKey
+						});
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none'
+						});
+					}
+				});
 			},
 			},
 			// 修改购物车
 			// 修改购物车
 			modifyLiveCart(item) {
 			modifyLiveCart(item) {
 				let data = {
 				let data = {
-					checked: item.checked == true ? 1 : 0,
+					checked: item.checked ? 1 : 0,
 					cartId: item.cartId,
 					cartId: item.cartId,
 					cartNum: item.cartNum
 					cartNum: item.cartNum
 				};
 				};
@@ -142,66 +111,37 @@
 					res => {
 					res => {
 						if (res.code == 200) {
 						if (res.code == 200) {
 							this.computedMoney();
 							this.computedMoney();
-
 						} else {
 						} else {
-
 							uni.showToast({
 							uni.showToast({
 								icon: 'none',
 								icon: 'none',
 								title: res.msg,
 								title: res.msg,
 							});
 							});
 						}
 						}
-					},
-					rej => {}
+					}
 				);
 				);
 			},
 			},
-
-
-
-			// modifyLiveCartList() {
-			// 	modifyLiveCart().then(
-			// 		res => {
-			// 			if (res.code == 200) {
-			// 				this.shopList = res.rows;
-			// 				console.log(this.shopList)
-			// 				console.log(res.rows)
-			// 				this.shopList.forEach(item => {
-			// 					item.checked == 1 ? true : false
-			// 				});
-
-			// 				// this.computedMoney();
-			// 			} else {
-			// 				uni.showToast({
-			// 					icon: 'none',
-			// 					title: "请求失败",
-			// 				});
-			// 			}
-			// 		},
-			// 		rej => {}
-			// 	);
-			// },
 			// 查询购物车列表
 			// 查询购物车列表
 			queryLiveCart() {
 			queryLiveCart() {
-			    queryLiveCartList().then(
-			        res => {
-			            if (res.code == 200) {
-			                this.shopList = res.rows;
-			                this.shopList.forEach(item => {
-			                    item.checked = item.checked == 1 ? true : false; // 这里改为赋值
-			                });
-			                this.computedMoney(); // 数据加载完成后再计算价格
-			            } else {
-			                uni.showToast({
-			                    icon: 'none',
-			                    title: "请求失败",
-			                });
-			            }
-			        },
-			        rej => {}
-			    );
+				queryLiveCartList().then(
+					res => {
+						if (res.code == 200) {
+							this.shopList = res.rows;
+							this.shopList.forEach(item => {
+								item.checked = item.checked == 1;
+							});
+							this.updateCheckAllState();
+							this.computedMoney();
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: "请求失败",
+							});
+						}
+					}
+				);
 			},
 			},
 			// 删除购物车
 			// 删除购物车
 			delCart() {
 			delCart() {
-				// 直接过滤已选商品
 				const data = this.shopList
 				const data = this.shopList
 					.filter(item => item.checked)
 					.filter(item => item.checked)
 					.map(item => item.cartId);
 					.map(item => item.cartId);
@@ -219,7 +159,7 @@
 							icon: 'success',
 							icon: 'success',
 							title: "操作成功"
 							title: "操作成功"
 						});
 						});
-						this.queryLiveCart(); // 重新加载数据
+						this.queryLiveCart();
 					} else {
 					} else {
 						uni.showToast({
 						uni.showToast({
 							icon: 'none',
 							icon: 'none',
@@ -230,24 +170,33 @@
 			},
 			},
 			// 计算价格
 			// 计算价格
 			computedMoney() {
 			computedMoney() {
-			    this.totalMoney = this.shopList.reduce((total, item) => {
-			        return total + (item.checked ? item.price * item.cartNum : 0);
-			    }, 0);
+				this.totalMoney = this.shopList.reduce((total, item) => {
+					return total + (item.checked ? item.price * item.cartNum : 0);
+				}, 0);
+			},
+			// 更新全选状态
+			updateCheckAllState() {
+				if (this.shopList.length === 0) {
+					this.checkAll = false;
+					return;
+				}
+				this.checkAll = this.shopList.every(item => item.checked);
 			},
 			},
 			// 全选
 			// 全选
 			handleCheckAll() {
 			handleCheckAll() {
-			    this.checkAll = !this.checkAll;
-			    this.shopList.forEach(item => {
-			        item.checked = this.checkAll;
-			        this.modifyLiveCart(item);
-			    });
-			    this.computedMoney(); // 全选后重新计算
+				this.checkAll = !this.checkAll;
+				this.shopList.forEach(item => {
+					item.checked = this.checkAll;
+					this.modifyLiveCart(item);
+				});
+				this.computedMoney();
 			},
 			},
 			//选择
 			//选择
-			checkChange(item, shop) {
-			    item.checked = !item.checked;
-			    this.computedMoney(); // 这里去掉参数
-			    this.modifyLiveCart(item)
+			checkChange(item) {
+				item.checked = !item.checked;
+				this.updateCheckAllState();
+				this.computedMoney();
+				this.modifyLiveCart(item);
 			},
 			},
 			// 改数量
 			// 改数量
 			changeNum(e, item) {
 			changeNum(e, item) {
@@ -268,7 +217,6 @@
 				}
 				}
 				this.modifyLiveCart(item)
 				this.modifyLiveCart(item)
 			},
 			},
-
 			// 购物车减法
 			// 购物车减法
 			delNum(item) {
 			delNum(item) {
 				if (item.cartNum <= 1) {
 				if (item.cartNum <= 1) {
@@ -283,7 +231,6 @@
 				if (item.cartNum < 1) {
 				if (item.cartNum < 1) {
 					item.cartNum = 1
 					item.cartNum = 1
 				}
 				}
-
 				this.modifyLiveCart(item)
 				this.modifyLiveCart(item)
 			},
 			},
 			// 购物车加法
 			// 购物车加法
@@ -305,10 +252,7 @@
 					});
 					});
 					return;
 					return;
 				}
 				}
-
-
 				this.getKey()
 				this.getKey()
-
 			},
 			},
 			showProduct(item) {
 			showProduct(item) {
 				uni.navigateTo({
 				uni.navigateTo({
@@ -339,20 +283,7 @@
 			align-items: center;
 			align-items: center;
 		}
 		}
 
 
-		.shopbox-name {
-			padding: 30rpx 30rpx 0 30rpx;
-			font-family: PingFang SC, PingFang SC;
-			font-weight: 400;
-			font-size: 30rpx;
-			color: #111;
-			overflow: hidden;
-			white-space: nowrap;
-			text-overflow: ellipsis;
-		}
-
 		.goods-list {
 		.goods-list {
-		
-
 			.item {
 			.item {
 				box-sizing: border-box;
 				box-sizing: border-box;
 				height: 221upx;
 				height: 221upx;
@@ -387,20 +318,6 @@
 						display: flex;
 						display: flex;
 						align-items: center;
 						align-items: center;
 
 
-						.tag {
-							padding: 0 6upx;
-							height: 30upx;
-							line-height: 30upx;
-							font-size: 22upx;
-							font-family: PingFang SC;
-							font-weight: bold;
-							color: #FFFFFF;
-							background: linear-gradient(90deg, #66b2ef 0%, #0bb3f2 100%);
-							border-radius: 4upx;
-							margin-right: 10upx;
-							flex-shrink: 0;
-						}
-
 						.title {
 						.title {
 							flex: 1;
 							flex: 1;
 							font-size: 28upx;
 							font-size: 28upx;
@@ -411,15 +328,6 @@
 						}
 						}
 					}
 					}
 
 
-					.intro {
-						font-size: 24upx;
-						font-family: PingFang SC;
-						font-weight: 500;
-						color: #999999;
-						margin-top: 22upx;
-						line-height: 1;
-					}
-
 					.price-num {
 					.price-num {
 						display: flex;
 						display: flex;
 						align-items: center;
 						align-items: center;
@@ -454,7 +362,6 @@
 							.img-box {
 							.img-box {
 								width: 60upx;
 								width: 60upx;
 								height: 60upx;
 								height: 60upx;
-								// border-radius: 4upx;
 								border: 1px solid #dddddd;
 								border: 1px solid #dddddd;
 								display: flex;
 								display: flex;
 								align-items: center;
 								align-items: center;
@@ -474,11 +381,9 @@
 								font-family: PingFang SC;
 								font-family: PingFang SC;
 								font-weight: 500;
 								font-weight: 500;
 								color: #111111;
 								color: #111111;
-								// border-radius: 4upx;
 								border-top: 1px solid #dddddd;
 								border-top: 1px solid #dddddd;
 								border-bottom: 1px solid #dddddd;
 								border-bottom: 1px solid #dddddd;
 								text-align: center;
 								text-align: center;
-								// margin: 0 16upx;
 							}
 							}
 						}
 						}
 					}
 					}
@@ -486,10 +391,6 @@
 			}
 			}
 		}
 		}
 
 
-		.like-product {
-			padding-bottom: 120upx;
-		}
-
 		.btn-foot {
 		.btn-foot {
 			box-sizing: border-box;
 			box-sizing: border-box;
 			width: 100%;
 			width: 100%;

+ 7 - 4
pages_shop/order.vue

@@ -40,13 +40,13 @@
 							</view>
 							</view>
 							<view class="button-group">
 							<view class="button-group">
 								<view v-if="item.status == 1" @click="cancel(item)" class="button cancel ">取消订单</view>
 								<view v-if="item.status == 1" @click="cancel(item)" class="button cancel ">取消订单</view>
-								<view v-if="item.status !== -1 && item.status !== -3" @click="refund(item)"
+								<view v-if="item.status !== -1 && item.status !== -3&& item.status !== 1&& item.status !==-2" @click="refund(item)"
 									class="button cancel">申请售后</view>
 									class="button cancel">申请售后</view>
 								<view v-if="item.status ==3 ||item.status ==5 " class="button cancel"
 								<view v-if="item.status ==3 ||item.status ==5 " class="button cancel"
 									@click.stop="showDelivery(item)">查看物流</view>
 									@click.stop="showDelivery(item)">查看物流</view>
 								<view v-if="item.status == 1" @click="pay(item)" class="button pay">去支付</view>
 								<view v-if="item.status == 1" @click="pay(item)" class="button pay">去支付</view>
 								<view v-if="item.status == 3" @click="confirmReceipt(item)" class="button pay">确认收货</view>
 								<view v-if="item.status == 3" @click="confirmReceipt(item)" class="button pay">确认收货</view>
-								<view v-if="item.status == 4" @click="evaluate(item)" class="button pay">评价</view>
+								<!-- <view v-if="item.status == 4" @click="evaluate(item)" class="button pay">评价</view> -->
 							</view>
 							</view>
 						</view>
 						</view>
 					</view>
 					</view>
@@ -241,12 +241,15 @@
 			// 查看物流
 			// 查看物流
 			showDelivery(item) {
 			showDelivery(item) {
 				uni.navigateTo({
 				uni.navigateTo({
-					url: './storeOrderDelivery?orderId='+item.orderId
+					url: `./storeOrderDelivery?orderId=${item.orderId}`
 				})
 				})
 			},
 			},
 			// 支付
 			// 支付
 			pay(item) {
 			pay(item) {
-				// 支付逻辑
+				console.log("去支付",item)
+				uni.navigateTo({
+					url: `./paymentOrder?orderList=${encodeURIComponent(JSON.stringify(item))}`
+				})
 			},
 			},
 			// 评价
 			// 评价
 			evaluate(item) {
 			evaluate(item) {

+ 1 - 0
pages_shop/paymentOrder.vue

@@ -217,6 +217,7 @@
 			// this.liveId = options.liveId
 			// this.liveId = options.liveId
 			// this.productId=options.productId
 			// this.productId=options.productId
 			// console.log("支付订单",options)
 			// console.log("支付订单",options)
+			
 		if (options.orderList) {
 		if (options.orderList) {
 		    try {
 		    try {
 		      const decoded = decodeURIComponent(options.orderList);
 		      const decoded = decodeURIComponent(options.orderList);

+ 1 - 1
pages_shop/refundOrder.vue

@@ -13,7 +13,7 @@
 						<view class="info">
 						<view class="info">
 							<view class="top">
 							<view class="top">
 								<view class="title ellipsis2">{{ JSON.parse(item.jsonInfo).productName}}</view>
 								<view class="title ellipsis2">{{ JSON.parse(item.jsonInfo).productName}}</view>
-								<view class="spec">{{JSON.parse(item.jsonInfo).sku}}</view>
+								<!-- <view class="spec">{{JSON.parse(item.jsonInfo).sku}}</view> -->
 							</view>
 							</view>
 							<view class="price-num">
 							<view class="price-num">
 								<view class="price-box">
 								<view class="price-box">

二進制
static/images/close.png


二進制
static/images/signal.png


+ 2 - 1
unpackage/dist/dev/mp-weixin/app.json

@@ -10,7 +10,8 @@
     "pages/auth/h5WxLogin",
     "pages/auth/h5WxLogin",
     "pages/auth/loginIndex",
     "pages/auth/loginIndex",
     "pages/auth/register",
     "pages/auth/register",
-    "pages_no/zuizao"
+    "pages_no/zuizao",
+    "pages_no/living827"
   ],
   ],
   "subPackages": [
   "subPackages": [
     {
     {

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/common/assets.js


+ 1 - 1
unpackage/dist/dev/mp-weixin/common/request.js

@@ -1 +1 @@
-"use strict";var m=Object.defineProperty;var k=(a,e,t)=>e in a?m(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var u=(a,e,t)=>(k(a,typeof e!="symbol"?e+"":e,t),t);const d=require("./vendor.js"),n=class n{static addExcludePath(e){this.excludePaths.push(e)}static addExcludePage(e){this.excludePages.push(e)}static isCurrentPageExcluded(){const e=getCurrentPages();if(e.length===0)return!1;const t=e[e.length-1],s=t.route||t.__route__;return this.excludePages.some(o=>s.includes(o)||o.includes(s))}static isPathExcluded(e){return this.excludePaths.some(t=>t instanceof RegExp?t.test(e):e.includes(t)||t.includes(e))}http(e,t={},s,o,x=!0){let f="http://192.168.10.166:7114";const r=x&&!n.isPathExcluded(e)&&!n.isCurrentPageExcluded();return r&&n.loadingCount===0&&d.index.showLoading({title:"加载中",mask:!0}),r&&n.loadingCount++,new Promise((l,C)=>{let P=d.index.getStorageSync("AppToken");var g="application/x-www-form-urlencoded";o!=null&&(g=o),d.index.request({header:{"Content-Type":g,AppToken:P},url:`${f}${e}`,data:t,method:s,success:i=>{if(i.code==401){let h=getCurrentPages(),p=h[h.length-1];if(p!=null&&p.route=="/pages/home/index"){l(i.data);return}d.index.reLaunch({url:"/pages/home/index"});return}i.token&&d.index.setStorageSync("AppToken",i.token),l(i.data)},fail:i=>{C(i)},complete:i=>{r&&(n.loadingCount--,n.loadingCount<=0&&(d.index.hideLoading(),n.loadingCount=0))}})})}};u(n,"loadingCount",0),u(n,"excludePaths",[]),u(n,"excludePages",[]);let c=n;exports.Request=c;
+"use strict";var P=Object.defineProperty;var k=(a,e,t)=>e in a?P(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var u=(a,e,t)=>(k(a,typeof e!="symbol"?e+"":e,t),t);const d=require("./vendor.js"),n=class n{static addExcludePath(e){this.excludePaths.push(e)}static addExcludePage(e){this.excludePages.push(e)}static isCurrentPageExcluded(){const e=getCurrentPages();if(e.length===0)return!1;const t=e[e.length-1],s=t.route||t.__route__;return this.excludePages.some(o=>s.includes(o)||o.includes(s))}static isPathExcluded(e){return this.excludePaths.some(t=>t instanceof RegExp?t.test(e):e.includes(t)||t.includes(e))}http(e,t={},s,o,x=!0){let f="https://live.test.ylrztop.com/live-api";const r=x&&!n.isPathExcluded(e)&&!n.isCurrentPageExcluded();return r&&n.loadingCount===0&&d.index.showLoading({title:"加载中",mask:!0}),r&&n.loadingCount++,new Promise((l,m)=>{let C=d.index.getStorageSync("AppToken");var g="application/x-www-form-urlencoded";o!=null&&(g=o),d.index.request({header:{"Content-Type":g,AppToken:C},url:`${f}${e}`,data:t,method:s,success:i=>{if(i.code==401){let h=getCurrentPages(),p=h[h.length-1];if(p!=null&&p.route=="/pages/home/index"){l(i.data);return}d.index.reLaunch({url:"/pages/home/index"});return}i.token&&d.index.setStorageSync("AppToken",i.token),l(i.data)},fail:i=>{m(i)},complete:i=>{r&&(n.loadingCount--,n.loadingCount<=0&&(d.index.hideLoading(),n.loadingCount=0))}})})}};u(n,"loadingCount",0),u(n,"excludePaths",[]),u(n,"excludePages",[]);let c=n;exports.Request=c;

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/common/vendor.js


+ 1 - 1
unpackage/dist/dev/mp-weixin/core/config/defaultConfig.js

@@ -1 +1 @@
-"use strict";const t="http://192.168.10.166:7114/",e={name:"签约",apiUrl:t};exports.defaultConfig=e;
+"use strict";const t="https://live.test.ylrztop.com/live-api/",e={name:"签约",apiUrl:t};exports.defaultConfig=e;

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/auth/login.wxss


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/home/live.js


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/home/live.wxml


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/home/living.js


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/home/living.wxml


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages/home/living.wxss


+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/list/index.js

@@ -1 +1 @@
-"use strict";const e=require("../../common/vendor.js"),a=require("../../api/list.js"),d={data(){return{list:null,liveId:null}},onLoad(i){this.getList()},methods:{goLive(i){this.liveId=i.liveId,console.log("要传的liveId",this.liveId),e.index.navigateTo({url:`/pages/home/living?liveId=${i.liveId}&immediate=true`})},getList(){const i={page:1,page_size:10};e.index.showLoading({title:"处理中..."}),a.liveList(i).then(t=>{t.code==200?(this.list=t.rows,console.log("list>>",this.list)):e.index.showToast({title:t.msg,icon:"none"})}).catch(t=>{console.log("请求失败:",JSON.stringify(t))}).finally(()=>{e.index.hideLoading()})}}};function c(i,t,g,v,n,l){return{a:e.f(n.list,(o,s,h)=>({a:o.liveImgUrl,b:e.t(o.liveName),c:e.o(_=>l.goLive(o),s),d:s}))}}const r=e._export_sfc(d,[["render",c],["__scopeId","data-v-7bd28468"]]);wx.createPage(r);
+"use strict";const o=require("../../common/vendor.js"),a=require("../../api/list.js"),d=require("../../uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js"),m={mixins:[d.MescrollMixin],data(){return{list:[],liveId:null,downOption:{use:!0,auto:!1},upOption:{use:!0,auto:!0,page:{num:0,size:10},noMoreSize:5,empty:{icon:"/static/images/empty.png",tip:"暂无订单数据"}},mescroll:null}},methods:{goLive(e){this.liveId=e.liveId,console.log("要传的liveId",this.liveId),o.index.navigateTo({url:`/pages/home/living?liveId=${e.liveId}&immediate=true`})},mescrollInit(e){this.mescroll=e},downCallback(e){this.list=[],e.resetUpScroll()},upCallback(e){const n=e.num;let c={pageSize:e.size,page:n};a.liveList(c).then(l=>{if(l.code==200){let t=l.rows||[],i=t.length,s=l.total||0;n===1&&(this.list=[]),this.list=this.list.concat(t),e.endBySize(i,s)}else e.endErr(),o.index.showToast({title:l.msg,icon:"none"})}).catch(l=>{e.endErr(),console.log("请求异常:"+JSON.stringify(l))})}}};Array||o.resolveComponent("mescroll-body")();const u=()=>"../../uni_modules/mescroll-uni/components/mescroll-body/mescroll-body.js";Math||u();function p(e,n,r,c,l,t){return{a:o.f(l.list,(i,s,g)=>({a:i.liveImgUrl,b:o.t(i.liveName),c:o.o(v=>t.goLive(i),s),d:s})),b:o.sr("mescrollRef","7bd28468-0"),c:o.o(t.mescrollInit),d:o.o(t.downCallback),e:o.o(t.upCallback),f:o.p({bottom:"0",down:l.downOption,up:l.upOption})}}const _=o._export_sfc(m,[["render",p],["__scopeId","data-v-7bd28468"]]);wx.createPage(_);

+ 3 - 1
unpackage/dist/dev/mp-weixin/pages/list/index.json

@@ -1,5 +1,7 @@
 {
 {
   "navigationBarTitleText": "直播列表",
   "navigationBarTitleText": "直播列表",
   "navigationBarTextStyle": "black",
   "navigationBarTextStyle": "black",
-  "usingComponents": {}
+  "usingComponents": {
+    "mescroll-body": "../../uni_modules/mescroll-uni/components/mescroll-body/mescroll-body"
+  }
 }
 }

+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/list/index.wxml

@@ -1 +1 @@
-<view class="content data-v-7bd28468"><view class="list data-v-7bd28468"><view wx:for="{{a}}" wx:for-item="item" wx:key="d" class="list-item data-v-7bd28468" bindtap="{{item.c}}"><image class="data-v-7bd28468" src="{{item.a}}"></image><view class="info data-v-7bd28468"><text class="data-v-7bd28468">{{item.b}}</text></view></view></view></view>
+<view class="content data-v-7bd28468"><mescroll-body wx:if="{{f}}" class="r data-v-7bd28468" u-s="{{['d']}}" u-r="mescrollRef" bindinit="{{c}}" binddown="{{d}}" bindup="{{e}}" u-i="7bd28468-0" bind:__l="__l" u-p="{{f}}"><view class="list data-v-7bd28468"><view wx:for="{{a}}" wx:for-item="item" wx:key="d" class="list-item data-v-7bd28468" bindtap="{{item.c}}"><image class="data-v-7bd28468" src="{{item.a}}"></image><view class="info data-v-7bd28468"><text class="data-v-7bd28468">{{item.b}}</text></view></view></view></mescroll-body></view>

+ 1 - 1
unpackage/dist/dev/mp-weixin/pages/list/index.wxss

@@ -1 +1 @@
-.content.data-v-7bd28468{background-color:#111;min-height:100vh;padding:24rpx}.content .list.data-v-7bd28468{display:flex;justify-content:space-between;flex-wrap:wrap}.content .list .list-item.data-v-7bd28468{border-radius:16rpx;width:340rpx;height:600rpx;background-color:#0082f4;margin-right:10rpx;margin-bottom:24rpx;overflow:hidden;position:relative}.content .list .list-item .info.data-v-7bd28468{position:absolute;left:20rpx;bottom:14rpx;color:#fff}.content .list .list-item image.data-v-7bd28468{width:100%;height:100%}
+.content.data-v-7bd28468{background-color:#111;min-height:100vh;padding:24rpx}.content .list.data-v-7bd28468{display:flex;justify-content:space-between;flex-wrap:wrap}.content .list .list-item.data-v-7bd28468{border-radius:16rpx;width:340rpx;height:600rpx;background-color:#0d0d0d;margin-right:10rpx;margin-bottom:24rpx;overflow:hidden;position:relative}.content .list .list-item .info.data-v-7bd28468{position:absolute;left:20rpx;bottom:14rpx;color:#fff}.content .list .list-item image.data-v-7bd28468{width:100%;height:100%}

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_no/living827.js


+ 8 - 0
unpackage/dist/dev/mp-weixin/pages_no/living827.json

@@ -0,0 +1,8 @@
+{
+  "navigationBarTitleText": "",
+  "usingComponents": {
+    "u-avatar": "../uni_modules/uview-plus/components/u-avatar/u-avatar",
+    "u-input": "../uni_modules/uview-plus/components/u-input/u-input",
+    "u-popup": "../uni_modules/uview-plus/components/u-popup/u-popup"
+  }
+}

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_no/living827.wxml


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_no/living827.wxss


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_no/zuizao.js


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_shop/cart.js


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_shop/cart.wxss


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_shop/order.js


+ 2 - 1
unpackage/dist/dev/mp-weixin/pages_shop/order.json

@@ -2,6 +2,7 @@
   "navigationBarTitleText": "我的订单",
   "navigationBarTitleText": "我的订单",
   "navigationBarTextStyle": "black",
   "navigationBarTextStyle": "black",
   "usingComponents": {
   "usingComponents": {
-    "u-tabs": "../uni_modules/uview-plus/components/u-tabs/u-tabs"
+    "u-tabs": "../uni_modules/uview-plus/components/u-tabs/u-tabs",
+    "mescroll-body": "../uni_modules/mescroll-uni/components/mescroll-body/mescroll-body"
   }
   }
 }
 }

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_shop/order.wxml


文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_shop/paymentOrder.js


+ 1 - 1
unpackage/dist/dev/mp-weixin/pages_shop/paymentOrder.wxml

@@ -1 +1 @@
-<view class="content"><view class="inner"><view class="time-price"><text class="time">请在{{a}}前完成支付</text><view class="price-box"><text class="unit">¥</text><text class="num">{{b}}</text></view></view><view class="pay-type"><view class="title">支付方式</view><radio-group bindchange="{{e}}"><view class="item"><view class="left"><image src="{{c}}" mode=""></image><text class="text">微信支付</text></view><label><radio value="{{1}}" checked="{{d}}"/></label></view></radio-group></view><view class="order-info"><view class="title">订单信息</view><view class="item"><text class="label">订单编号</text><view class="sn-box"><view><view class="text">{{f}}</view></view></view></view><view class="item"><text class="label">下单时间</text><text class="text">{{g}}</text></view><view class="item"><text class="label">订单金额</text><text wx:if="{{h}}" class="text">{{i}}</text></view></view></view><view class="btn-box"><view class="btn" bindtap="{{j}}">去支付</view></view></view>
+<view class="content"><view class="inner"><view class="time-price"><text class="time">待支付</text><view class="price-box"><text class="unit">¥</text><text class="num">{{a}}</text></view></view><view class="pay-type"><view class="title">支付方式</view><radio-group bindchange="{{d}}"><view class="item"><view class="left"><image src="{{b}}" mode=""></image><text class="text">微信支付</text></view><label><radio value="{{1}}" checked="{{c}}"/></label></view></radio-group></view><view class="order-info"><view class="title">订单信息</view><view class="item"><text class="label">订单编号</text><view class="sn-box"><view><view class="text">{{e}}</view></view></view></view><view class="item"><text class="label">下单时间</text><text class="text">{{f}}</text></view><view class="item"><text class="label">订单金额</text><text wx:if="{{g}}" class="text">{{h}}</text></view></view></view><view class="btn-box"><view class="btn" bindtap="{{i}}">去支付</view></view></view>

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_shop/refundOrder.js


+ 1 - 1
unpackage/dist/dev/mp-weixin/pages_shop/refundOrder.wxml

@@ -1 +1 @@
-<view class="content"><view class="inner"><view class="drug-list"><view class="item"><block wx:if="{{a}}"><view wx:for="{{b}}" wx:for-item="item" wx:key="f" class="drug-info"><view class="img-box"><image src="{{item.a}}" mode="aspectFit"></image></view><view class="info"><view class="top"><view class="title ellipsis2">{{item.b}}</view><view class="spec">{{item.c}}</view></view><view class="price-num"><view class="price-box"><text class="unit">¥</text><text class="price">{{item.d}}</text></view><view class="num">x{{item.e}}</view></view></view></view></block><view wx:if="{{c}}" class="drug-info"><view class="img-box"><image src="{{d}}" mode="aspectFit"></image></view><view class="info"><view class="top"><view class="title ellipsis2"><view class="tag">套餐</view>{{e}}</view><view class="spec">{{f}}</view></view></view></view></view></view><view class="reason-apply"><view class="title-box"><text class="label">退款金额</text><input class="money" type="text" disabled placeholder="退款金额" placeholder-class="form-input" value="{{g}}" bindinput="{{h}}"/></view><view class="title-box"><text class="label">申请原因</text><picker bindchange="{{k}}" value="{{l}}" range-key="dictLabel" range="{{m}}"><view class="chose-box"><text class="text">{{i}}</text><image src="{{j}}" mode=""></image></view></picker></view><view class="textarea-box"><block wx:if="{{r0}}"><textarea placeholder="请描述申请售后服务的具体原因" placeholder-class="textarea-place" value="{{n}}" bindinput="{{o}}"/></block></view></view><view class="btn-box"><view class="sub-btn" bindtap="{{p}}">申请售后</view></view></view></view>
+<view class="content"><view class="inner"><view class="drug-list"><view class="item"><block wx:if="{{a}}"><view wx:for="{{b}}" wx:for-item="item" wx:key="e" class="drug-info"><view class="img-box"><image src="{{item.a}}" mode="aspectFit"></image></view><view class="info"><view class="top"><view class="title ellipsis2">{{item.b}}</view></view><view class="price-num"><view class="price-box"><text class="unit">¥</text><text class="price">{{item.c}}</text></view><view class="num">x{{item.d}}</view></view></view></view></block><view wx:if="{{c}}" class="drug-info"><view class="img-box"><image src="{{d}}" mode="aspectFit"></image></view><view class="info"><view class="top"><view class="title ellipsis2"><view class="tag">套餐</view>{{e}}</view><view class="spec">{{f}}</view></view></view></view></view></view><view class="reason-apply"><view class="title-box"><text class="label">退款金额</text><input class="money" type="text" disabled placeholder="退款金额" placeholder-class="form-input" value="{{g}}" bindinput="{{h}}"/></view><view class="title-box"><text class="label">申请原因</text><picker bindchange="{{k}}" value="{{l}}" range-key="dictLabel" range="{{m}}"><view class="chose-box"><text class="text">{{i}}</text><image src="{{j}}" mode=""></image></view></picker></view><view class="textarea-box"><block wx:if="{{r0}}"><textarea placeholder="请描述申请售后服务的具体原因" placeholder-class="textarea-place" value="{{n}}" bindinput="{{o}}"/></block></view></view><view class="btn-box"><view class="sub-btn" bindtap="{{p}}">申请售后</view></view></view></view>

文件差異過大導致無法顯示
+ 0 - 0
unpackage/dist/dev/mp-weixin/pages_shop/storeOrder.js


二進制
unpackage/dist/dev/mp-weixin/static/images/close.png


二進制
unpackage/dist/dev/mp-weixin/static/images/signal.png


部分文件因文件數量過多而無法顯示