liujiaxin 1 ay önce
ebeveyn
işleme
c1f6a7ac97
2 değiştirilmiş dosya ile 106 ekleme ve 7 silme
  1. 5 5
      api/live.js
  2. 101 2
      pages/home/living.vue

+ 5 - 5
api/live.js

@@ -4,15 +4,15 @@ const api = {
 	liveDataLike: (liveId) => `/app/live/liveData/like/${liveId}`, // 点赞
 	collectStore:(sotreId)=> `/app/live/liveData/collectStore?storeId=${sotreId}`, // 店铺收藏/取消收藏
 	collectGoods:(goodId)=> `/app/live/liveData/collectGoods?goodId=${goodId}`, // 商品收藏/取消收藏
-	store:(storeld,key)=> `/app/live/store/${storeld}?key=${key}`, // 小黄车查询店铺
-	
+	store:(storeld,key,liveId)=> `/app/live/store/${storeld}?key=${key}&liveId=${liveId}`, // 小黄车查询店铺
+
 	queryStore:(storeld,pageSize,pageNum,keywords)=> `/app/live/store?storeId=${storeld}&pageSize=${pageSize}&pageNum=${pageNum}&keywords=${keywords}`, // 查询店铺
 	follow: (liveId) => `/app/live/liveData/follow/${liveId}`, // 关注/取消关注
 	// getRecentLiveViewers: (liveId) => `/app/live/liveData/getRecentLiveViewers/${liveId}`, // 获取直播间用户(展示在线用户)
 	watchUserList: (liveId,pageSize,pageNum,reasonable) => `/app/live/liveWatchUser/watchUserList/?liveId=${liveId}&pageSize=${pageSize}&pageNum=${pageNum}&reasonable=${reasonable}`, // 获取直播间用户(展示在线用户)
 	liveMsg: (liveId,pageSize,pageNum) => `/app/live/liveMsg/list/?liveId=${liveId}&pageSize=${pageSize}&pageNum=${pageNum}`, //获取最近聊天记录
 
-	
+
 	// checkSms: 'api/sms/checkSms',
 	getLiveInfo: (liveId) => `/app/live/${liveId}`, // 获取直播间信息接口
 	getLiveViewData: (liveId) => `/app/live/liveData/getLiveViewData/${liveId}`, // 直播间点赞、关注、在线人数数据
@@ -39,8 +39,8 @@ export function collectGoods(goodId,data= {}) {
 	return request(api.collectGoods(goodId), data, 'POST', 'application/json;charset=UTF-8')
 }
 // 小黄车查询店铺
-export function store(storeld,key,data= {}) {
-	return request(api.store(storeld,key), data, 'GET', 'application/json;charset=UTF-8')
+export function store(storeld,key, liveId,data= {}) {
+	return request(api.store(storeld,key,liveId), data, 'GET', 'application/json;charset=UTF-8')
 }
 // 查询店铺
 export function queryStore(storeld,pageSize,pageNum,keywords,data= {}) {

+ 101 - 2
pages/home/living.vue

@@ -248,11 +248,43 @@
 						</view>
 					</u-popup>
 				</view>
+<<<<<<< HEAD
 			</swiper-item>
 		</swiper>
 		<!-- 预加载指示器 -->
 		<view v-if="preloading" class="preload-indicator">
 			<u-loading mode="circle" color="#ffffff" size="28"></u-loading>
+=======
+
+				<view class="justify-between p24">
+					<view class="u-flex-y-center"
+						style="background:rgba(157, 157, 157, 0.8);padding:18rpx 14rpx 18rpx 32rpx;width: 526rpx;box-sizing:border-box;border-radius:36rpx;">
+						<u-input :placeholder="placeholderText" border="none" customStyle='font-size:24rpx;'
+							v-model="value" shape='circle' color='#fff' placeholderStyle='color:#e7e7e7' class="ml20"
+							@keydown.enter="sendMsg">
+						</u-input>
+						<!-- <image @click="sendMsg" class="w44 h44" src="@/static/images/live/like.png"></image> -->
+					</view>
+					<!-- :disabled='talkdisabled' ></u-input> -->
+					<!-- <view @click="sendMsg" class="colorf center ml10 fs24">发送</view> -->
+					<view class="justify-between mr30  align-center">
+						<!-- <view class="icon-bg ml20" @click="answerbtn=!answerbtn">
+							<image src="/static/images/redbag.png" class="w40 h40"></image>
+						</view> -->
+						<view class="icon-bg ml20" @click="shopping=!shopping">
+							<image src="/static/images/shopping.png" class="w48 h48"></image>
+						</view>
+						<view class="icon-bg ml20" @click="showziliao=!showziliao">
+							<image src="/static/images/more-icon.png" class="w48 h48"></image>
+						</view>
+						<!-- <view class="icon-bg ml20" :class="{ 'zoom-button-active': isZoom }"
+							@touchstart="handleTouchStart" @touchend="handleTouchEnd">
+							<image src="/static/images/dianzan.png" class="w40 h40"></image>
+						</view> -->
+					</view>
+				</view>
+			</view>
+>>>>>>> 57028795d3bcee2e15cce5538d4362a47313f66a
 		</view>
 	</view>
 </template>
@@ -295,9 +327,15 @@
 	} from '@/api/home'
 	// var wsUrl = "ws://192.168.10.166:7114/app/webSocket";
 
+<<<<<<< HEAD
 	// 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.125:7114/app/webSocket"; //涂小龙
+	// var wsUrl = "ws://live.test.ylrztop.com/prod-api/app/webSocket"; //余红奇
+>>>>>>> 57028795d3bcee2e15cce5538d4362a47313f66a
 	// 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"; //陈果
@@ -337,8 +375,6 @@
 				inputInfo: '',
 				searchTimer: null,
 				storeId: null,
-				reconnectCount: 0,
-				maxReconnectAttempts: 3,
 				reconnectTimer: null,
 				isCollect: false,
 				showPurchasePrompt: false,
@@ -393,8 +429,33 @@
 
 		onLoad(options) {
 			this.userinfo = JSON.parse(uni.getStorageSync("userInfo"))
+<<<<<<< HEAD
 			// 初始化直播间列表
 			this.initLiveList(options);
+=======
+			if (options.liveId) {
+				this.liveId = options.liveId; // 仅当 liveId 变化时更新
+			}
+			const platform = uni.getSystemInfoSync().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('当前平台无需显示分享菜单');
+			  }
+>>>>>>> 57028795d3bcee2e15cce5538d4362a47313f66a
 		},
 		onShareAppMessage() {
 			return {
@@ -1190,6 +1251,7 @@ clearAllTimers() {
 			},
 
 			// 查询店铺
+<<<<<<< HEAD
 			async queryCollect() {
 				  const currentLive = this.list[this.currentSwiperIndex];
 				  if (!currentLive || !currentLive.liveId) return;
@@ -1211,6 +1273,25 @@ clearAllTimers() {
 				    } catch (error) {
 				      console.error('获取小黄车商品失败:', error);
 				    }
+=======
+			queryCollect() {
+				if (!this.storeId) return;
+				if (!this.liveId) return;
+				store(this.storeId, this.inputInfo,this.liveId).then(res => {
+						if (res.code == 200) {
+							console.log("查询店铺>>", res)
+							this.products = res.data.goodsList
+							this.store = res.data
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none'
+							});
+						}
+					},
+					rej => {}
+				);
+>>>>>>> 57028795d3bcee2e15cce5538d4362a47313f66a
 			},
 			// 店铺收藏
 			onStoreCollect() {
@@ -1530,6 +1611,7 @@ clearAllTimers() {
 				socketInstance.onMessage((res) => {
 					try {
 						const redata = JSON.parse(res.data);
+<<<<<<< HEAD
 						// 找到对应的直播间并更新数据
 						const targetLive = this.list.find(item => item.liveId === liveId);
 						if (targetLive) {
@@ -1537,6 +1619,18 @@ clearAllTimers() {
 							this.$nextTick(() => {
 								targetLive.scrollIntoView = `list_${targetLive.talklist.length - 1}`;
 							});
+=======
+						
+						if(redata.data.cmd == 'sendMsg'){
+							this.talklist.push(redata.data);
+							this.$nextTick(() => {
+								this.scrollIntoView = `list_${this.talklist.length - 1}`; // 最后一项的id
+							});
+						}
+						else if (redata.data.cmd == 'deleteId') {
+							uni.$emit('deleteId');
+						}
+>>>>>>> 57028795d3bcee2e15cce5538d4362a47313f66a
 
 							// 处理各种消息类型
 							this.handleSocketMessage(redata.data, targetLive);
@@ -1620,8 +1714,13 @@ clearAllTimers() {
 					nickName: this.userinfo.nickName,
 					avatar: this.userinfo.avatar
 				};
+<<<<<<< HEAD
 
 				if (!liveItem.value.trim()) {
+=======
+				console.log(!this.value.trim())
+				if (!this.value.trim()) { // 优化空消息判断
+>>>>>>> 57028795d3bcee2e15cce5538d4362a47313f66a
 					uni.showToast({
 						title: "不能发送空消息",
 						icon: 'none'