Ver Fonte

静默登录代码”
git commit -m 静默登录代码”

liujiaxin há 1 semana atrás
pai
commit
f8b9036b1b
6 ficheiros alterados com 358 adições e 122 exclusões
  1. 9 3
      api/living.js
  2. 14 8
      common/request.js
  3. 17 11
      pages_course/components/viewer.vue
  4. 306 97
      pages_course/living.vue
  5. 1 1
      store/index.js
  6. 11 2
      utils/common.js

+ 9 - 3
api/living.js

@@ -26,7 +26,7 @@ const api = {
 	liveGoodsDetail: (productId) => `/app/live/liveGoods/liveGoodsDetail/${productId}`, // 商品详情
 	liveOrderUser: (liveId) => `/app/live/liveOrder/liveOrderUser/${liveId}`, // 正在购买
 	showGoods: (liveId) => `/app/live/liveGoods/showGoods/${liveId}`, // 弹出商品卡片
-	currentActivities: (liveId) => `/app/live/currentActivities?liveId=${liveId}`, // 弹出商品卡片
+	currentActivities: (liveId) => `/liveAPP/app/live/currentActivities?liveId=${liveId}`, // 弹出商品卡片
 	claim: '/app/live/liveLottery/claim', // 抽奖
 	liveLottery: '/app/live/liveLottery/detail', // 抽奖查询
 	getlive: '/app/live/live',
@@ -183,7 +183,7 @@ export function liveInternetTraffic(data) {
 
 // 芳华币
 export function getUserIntegralInfo(data) {
-	return request('/app/live/liveData/getUserIntegralInfo', data, 'GET', 'application/json;charset=UTF-8');
+	return request('/liveAPP/app/live/liveData/getUserIntegralInfo', data, 'GET', 'application/json;charset=UTF-8');
 }
 
 // 我的中奖明细
@@ -222,4 +222,10 @@ export function sendliveGift(data) {
  export function integrallogs(data) {
   	return request('/app/live/completion/integral-logs',data,'GET','application/json;charset=UTF-8');
  }
-
+// 静默登录
+export function loginByMp(data) {
+	return request('/liveAPP/app/wx/courseLogin', data, 'POST', 'application/json;charset=UTF-8');
+}
+export function getUserInfo() {
+	return request('/liveAPP/app/user/getUserInfo', null, 'GET');
+}

+ 14 - 8
common/request.js

@@ -33,8 +33,14 @@ export default class Request {
 		if (router.indexOf("/live/liveData/like") != -1) {
 			path = 'https://im.fhhx.runtzh.com';
 		}
-		
-		
+
+		//静默登录配置
+		if (router.indexOf("/live") !== -1 || router.indexOf("/liveAPP") !== -1) {
+			router = router.replace('/liveAPP', '')
+			type = 4
+			token = uni.getStorageSync('AppToken');
+		}
+
 		// uni.showLoading({
 		// 	title: '加载中'
 		// });
@@ -65,12 +71,12 @@ export default class Request {
 				method: method,
 				success: (res) => {
 					//收到开发者服务器成功返回的回调函数
-					if(type !==0&&(res.data.code == 401 || res.data.code == 4001||res.data.code == 4004)) {
+					if (type !== 0 && (res.data.code == 401 || res.data.code == 4001 || res.data.code == 4004)) {
 						store.commit('setCoureLogin', 2);
 						uni.removeStorageSync("userinfos")
 						uni.removeStorageSync('userInfo');
 						uni.removeStorageSync('TOKEN_WEXIN');
-						if(type==1) {
+						if (type == 1) {
 							uni.removeStorageSync('AppTokenmini_MYCourse')
 						}
 						resolve({ code: 401, data: null });
@@ -78,17 +84,17 @@ export default class Request {
 					}
 					if (res.data.code == 401) { //没有权限直接退出到登录界面
 						let pages = getCurrentPages();
-						pages.forEach(function(element) {
+						pages.forEach(function (element) {
 							if (element != undefined && element.route ==
 								"pages/auth/login") {
 								resolve(res.data)
 								return;
 							}
 						});
-						let url = pages[ pages.length - 1]; //当前页页面实例
+						let url = pages[pages.length - 1]; //当前页页面实例
 						//如果登录界面已打开,自动关闭
-						if(url!=undefined&&url.route=="pages/auth/login"){
-						 	resolve(res.data)
+						if (url != undefined && url.route == "pages/auth/login") {
+							resolve(res.data)
 							return;
 						}
 						uni.navigateTo({

+ 17 - 11
pages_course/components/viewer.vue

@@ -173,22 +173,28 @@ export default {
 		 * 获取用户随机颜色(从父组件传入或本地实现)
 		 */
 		getUserRandomColor(userId) {
-			// 如果父组件传入了方法,可以使用父组件的方法
-			// 否则这里实现一个简单的版本
-			if (this.$parent && this.$parent.getUserRandomColor) {
-				return this.$parent.getUserRandomColor(userId);
-			}
-
-			// 简单的本地实现
+			// 直接实现一个稳定的随机颜色生成方法
 			if (!userId) return '#8978e2';
 
-			const colorPool = ['#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7', '#DDA0DD', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E9'];
+			// 增加更多颜色选项,确保颜色多样性
+			const colorPool = [
+				'#FF6B6B', '#4ECDC4', '#45B7D1', '#96CEB4', '#FFEAA7',
+				'#DDA0DD', '#98D8C8', '#F7DC6F', '#BB8FCE', '#85C1E9',
+				'#F8C471', '#82E0AA', '#F1948A', '#5DADE2', '#D7BDE2',
+				'#3498DB', '#2ECC71', '#E74C3C', '#F39C12', '#9B59B6'
+			];
 
+			// 确保userId是字符串类型
+			const userIdStr = String(userId);
+			
+			// 使用更复杂的种子计算方法,确保不同userId生成不同颜色
 			let seed = 0;
-			for (let i = 0; i < userId.length; i++) {
-				seed = (seed * 31 + userId.charCodeAt(i)) % 1000000;
+			for (let i = 0; i < userIdStr.length; i++) {
+				seed = (seed * 37 + userIdStr.charCodeAt(i)) % 1000000;
 			}
-			return colorPool[seed % colorPool.length];
+			// 对种子进行二次处理,增加随机性
+			seed = (seed * 1103515245 + 12345) % 2147483647;
+			return colorPool[Math.abs(seed) % colorPool.length];
 		},
 
 		/**

+ 306 - 97
pages_course/living.vue

@@ -19,19 +19,20 @@
 							</view>
 						</view>
 						<!-- 积分倒计时 -->
-						<view class="progress-countdown" :class="liveItem.showType==2?' progress-vertical':''"
-							:style="{ 'display':isFocus?'none':''}"
-							v-if="countdownPercentage!=100&&liveItem.completionPointsEnabled&&liveItem.status==2&&!isPreview">
+						<view class="progress-countdown" :class="liveItem.showType == 2 ? ' progress-vertical' : ''"
+							:style="{ 'display': isFocus ? 'none' : '' }"
+							v-if="countdownPercentage != 100 && liveItem.completionPointsEnabled && liveItem.status == 2 && !isPreview">
 							<image class="title" src="/static/images/points_title.png"></image>
 							<view class="progress-bar-bg">
 								<view class="progress-bar-fill" :style="{ width: countdownPercentage + '%' }"></view>
 							</view>
 							<view class="progress-text">
-								倒计时{{ formattedCountdown.hours||'00' }}:{{ formattedCountdown.minutes||'00' }}:{{ formattedCountdown.seconds||'00' }}
+								倒计时{{ formattedCountdown.hours || '00' }}:{{ formattedCountdown.minutes || '00' }}:{{
+									formattedCountdown.seconds ||'00' }}
 							</view>
 						</view>
 					</view>
-					
+
 					<view class="end">
 						<view v-if="Array.isArray(filteredViewers)" class="align-center" @click="toggleViewerList"
 							style="margin-top: 88rpx">
@@ -45,7 +46,7 @@
 							</view>
 							<view class="sum">{{ formattedWatchCount || 0 }}</view>
 						</view>
-						
+
 						<view class="complaint-box" @click="navgetTo('/pages_shopping/live/complaintList')">
 							<image class="image w32 h32 mr10" src="/static/images/complaint.png" mode="widthFix" />
 							<view class="fs26">投诉</view>
@@ -68,8 +69,9 @@
 
 				<!-- 右边的side -->
 				<view v-show="!isFocus" class="side-group" :class="{
-                  'top2': (!isShowRed && !(isShowLottery && countdown)),
-                  'top3': (isShowRed || (isShowLottery && countdown))}">
+					'top2': (!isShowRed && !(isShowLottery && countdown)),
+					'top3': (isShowRed || (isShowLottery && countdown))
+				}">
 					<view class="side-item" @click="onRed()" v-if="isShowRed">
 						<button class="button button-reset" style="height: 70rpx;">
 							<image class="image" style="width: 72rpx;" src="/static/images/redbag.png"
@@ -105,7 +107,7 @@
 				<view class="chat-area-container" :class="{ 'chat-area-focused': isFocus }"
 					:style="{ '--keyboard-height': keyboardHeight + 'rpx' }">
 					<view class="mt20 chat-content"
-						:class="{ 'chat-content-focused': isFocus ,'chat-content-preview':liveItem.status==1}">
+						:class="{ 'chat-content-focused': isFocus, 'chat-content-preview': liveItem.status == 1 }">
 						<view v-if="showPurchasePrompt && orderUser && orderUser.count && liveItem.status == 2"
 							class="shop-prompt f30 mb20">
 							<image class="w32 h32 mr8" src="/static/images/shopping.png" />
@@ -134,12 +136,12 @@
 							:scroll-top="scrollTop" :scroll-into-view="scrollIntoView" @scroll="onScroll"
 							ref="scrollView" scroll-with-animation="true" :scroll-animation-duration="300">
 							<view class="list justify-start" v-for="(item, talkIndex) in talklist || []"
-								:key="item.uniqueId || talkIndex" :id="`list_${item.uniqueId || talkIndex}`"
+								:key="talkIndex" :id="`list_${item.uniqueId || talkIndex}`"
 								v-show="item.cmd != 'red' && item.cmd != 'out' && item.cmd != 'entry'">
 								<view class="talk-list justify-start">
 									<view class="fs30 talk-item" style="max-width: 100%;">
-										<text class="nickname"
-											style="color: #ffda73;">{{ item.nickName || '未命名' }}:</text>
+										<text class="nickname" style="color: #ffda73;">{{ item.nickName || '未命名'
+											}}:</text>
 										<text class="message colorf">{{ item.msg }}</text>
 									</view>
 								</view>
@@ -188,7 +190,8 @@
 					<view class="integral-header">
 						<view class="integral-title">观看视频领积分</view>
 						<image class="integral-background-image"
-							src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/integral_bg.png"  mode="widthFix" />
+							src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/userapp/images/integral_bg.png"
+							mode="widthFix" />
 					</view>
 					<view class="integral-content">
 						<view class="integral-message">积分发放成功</view>
@@ -219,7 +222,7 @@
 					</view>
 					<view class="tip">请填写收货地址,主播将会将奖品发给您</view>
 					<view class="button"
-						@click="navgetTo('/pages_shopping/live/confirmCreateOrder?type=win&productId='+getCurrentUserPrizeProductId+'&liveId='+liveId+'&recordId='+getCurrentUserPrizeRecordId),confirm()">
+						@click="navgetTo('/pages_shopping/live/confirmCreateOrder?type=win&productId=' + getCurrentUserPrizeProductId + '&liveId=' + liveId + '&recordId=' + getCurrentUserPrizeRecordId), confirm()">
 						填写地址
 					</view>
 				</view>
@@ -235,8 +238,9 @@
 				@fill-address="handleFillAddress" />
 
 			<!-- 观众列表弹窗 -->
-			<Viewer ref="viewer" :show="showViewerList" :viewers="liveViewers" :lookAudsCount="lookAudsCount" :loading="viewLoading" :scrollHeight="scrollHeight"
-				@close="closeViewerList" @open="openViewerList" @loadMore="handleViewerLoadMore" />
+			<Viewer ref="viewer" :show="showViewerList" :viewers="liveViewers" :lookAudsCount="lookAudsCount"
+				:loading="viewLoading" :scrollHeight="scrollHeight" @close="closeViewerList" @open="openViewerList"
+				@loadMore="handleViewerLoadMore" />
 
 			<!-- 更多弹窗 -->
 			<u-popup :show="isMore" @close="closeMore" round="20rpx" bgColor="#f3f5f9" zIndex="10076">
@@ -266,11 +270,11 @@
 				<view class="gift">
 					<view class="gift-top">
 						<view class="left">
-							送花给<text class="ml8 orange">{{liveItem.liveName}}</text>
+							送花给<text class="ml8 orange">{{ liveItem.liveName }}</text>
 						</view>
 						<view class="align-center" @click="navgetTo('/pages_shopping/live/integral')">
 							<image class="w32 h32" src="/static/images/coin.png" />
-							<text class="ml6 mr6 f24">{{integralNum}}</text>
+							<text class="ml6 mr6 f24">{{ integralNum }}</text>
 							<image class="w24 h24" src="/static/images/arrow_white.png" />
 						</view>
 					</view>
@@ -286,6 +290,21 @@
 				</view>
 			</u-popup>
 
+			<!-- 微信昵称授权弹窗 -->
+			<u-popup :show="userlogo" mode="bottom" round='12'>
+				<view class="userlogo column">
+					<view class="bold fs36 mt42">授权你的昵称信息</view>
+					<view class=" justify-between align-center  mt42">
+						<view class="button-container">
+							<input type="nickname" class="hidden-input"
+								placeholder-style="color:#ffffff; font-size:32rpx;" @blur="onNickNameInput"
+								placeholder="请点击授权微信昵称" @input="onNickNameInput" />
+						</view>
+					</view>
+					<view class="submitname" @click="confimrname">确定</view>
+				</view>
+			</u-popup>
+
 			<!-- 商品弹窗组件 -->
 			<ShopPopup class="shop" :show="shopping" :searchKeyword="inputInfo" :products="products"
 				:loading="loadingProducts" :boxHeight="boxHeight" @close="closeShop" @search="handleSearchInput"
@@ -356,10 +375,12 @@
 		receivePoints,
 		activeList,
 		sendliveGift,
-		getUserIntegralInfo //芳华币
+		getUserIntegralInfo ,//芳华币
+		loginByMp
 	} from '@/api/living.js'
 	import {
-		getUserInfo
+		getUserInfo,
+		editUser
 	} from '@/api/user'
 	import {
 		generateRandomString
@@ -463,7 +484,7 @@
 				pingTimeoutTimer: null,
 				heartBeatTimer: null,
 				liveViewDataTimer: null,
-				lookAudsCount:0,//更多的观众人数
+				lookAudsCount: 0, //更多的观众人数
 				reconnectTimer: null,
 				scrollTimer: null,
 				lastScrollTime: 0,
@@ -577,7 +598,11 @@
 				userinfo: '',
 				userData: {},
 				diffTotalTime: '',
-				virtualTotal:0,
+				virtualTotal: 0,
+				userlogo: false,
+				user: {},
+				userInfo: '',
+				urlOption: {},
 			}
 		},
 		async onLoad(options) {
@@ -601,35 +626,30 @@
 			if (options.companyId && options.companyUserId) {
 				this.qrFrom = `&companyId=${options.companyId}&companyUserId=${options.companyUserId}`
 			}
+
+			// 保存url参数
+			this.urlOption = options;
+
 			this.userinfo = uni.getStorageSync('userInfo')
 			this.userData = uni.getStorageSync('userData')
 			this.hasSubscribed = uni.getStorageSync('subscribe_status_' + this.liveId) || false;
 			try {
-				const isLogin = await this.utils.isLogin()
+				const isLogin = await this.utils.checkLiveToken();
+				this.hasCheckedLogin = true;
 				if (isLogin) {
-					await this.getUserInfo()
-					this.initTime()
-					if (this.liveId) {
-						const res = await this.getliving(this.liveId)
-						if (res && res.data) {
-							if (res.data.videoFileSize) {
-								this.liveItem.videoFileSize = res.data.videoFileSize
-							}
-							if (res.data.videoDuration) {
-								this.liveItem.videoDuration = res.data.videoDuration
-							}
-						}
-						this.isOnload = true
-						await this.getLiveMsg(this.liveId)
-						await this.getliveViewData()
-					}
+					// 登录后:优先加载直播间信息,然后加载视频资源
+					await this.haveLogin();
+				} else {
+					// 未登录:先登录,登录成功后再加载数据
+					this.goLogin();
 				}
 			} catch (error) {
-				console.error('初始化失败:', error)
+				console.error('初始化失败:', error);
+				this.hasCheckedLogin = true;
 			}
-			
+
 			this.startMemoryMonitor();
-			
+
 			//获取礼物列表
 			this.getActiveList();
 
@@ -693,16 +713,12 @@
 		},
 		async onShow() {
 			try {
-				const isLogin = await this.utils.isLogin()
+				const isLogin = await this.utils.checkLiveToken()
 				if (isLogin) {
-					await this.getUserInfo()
-					this.initTime()
-					if (this.liveId) {
-						await this.getliving(this.liveId)
-						this.isOnload = true
-						await this.getLiveMsg(this.liveItem)
-						await this.getliveViewData()
-					}
+					await this.haveLogin();
+				} else {
+					this.goLogin();
+
 				}
 			} catch (error) {
 				console.error('初始化失败:', error)
@@ -764,7 +780,7 @@
 				this.stayTime = 0
 				this.startTime = 0
 			}
-			
+
 
 			if (this.trafficTimer) {
 				clearInterval(this.trafficTimer)
@@ -810,6 +826,9 @@
 			}
 		},
 		computed: {
+			appid() {
+				return this.$store.state.appid
+			},
 			shouldShowIntegralPopup() {
 				//只有当 showPoints 为 true 且 receiveList 有数据时才显示
 				return this.showPoints;
@@ -914,6 +933,134 @@
 			}
 		},
 		methods: { // 芳华币
+			// 微信昵称授权相关方法
+			shouquan() {
+				if (this.user.nickname == '') {
+					uni.showToast({
+						icon: 'none',
+						title: "请先授权微信昵称",
+					});
+				}
+			},
+			confimrname() {
+				if (this.user.nickname == '') {
+					uni.showToast({
+						icon: 'none',
+						title: "请授权微信昵称",
+					});
+					return
+				}
+				this.editUser();
+				uni.setStorageSync('userInfo', this.userInfo);
+
+				if (this.user.nickname) {
+					this.userlogo = false;
+				}
+			},
+			onNickNameInput(e) {
+				this.user.nickname = e.detail.value;
+			},
+			editUser() {
+				this.user.nickName = this.user.nickname;
+				editUser(this.user).then(
+					res => {
+						if (res.code == 200) {
+							uni.showToast({
+								icon: 'success',
+								title: "修改成功",
+							});
+							this.getUserInfo()
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: res.msg,
+							});
+						}
+					},
+					rej => {}
+				);
+			},
+			// 静默登录
+			goLogin(data) {
+				let provider = 'weixin'
+				uni.login({
+					provider: provider,
+					success: async loginRes => {
+						uni.getUserInfo({
+							provider: provider,
+							success: (infoRes) => {
+								uni.showToast({
+									title: '登录中...',
+									icon: 'loading'
+								});
+								loginByMp({
+									code: loginRes.code,
+									encryptedData: infoRes.encryptedData,
+									iv: infoRes.iv,
+									appId: this.appid
+								}).then(res => {
+									uni.hideLoading();
+									if (res.code == 200) {
+										uni.setStorageSync('AppToken', res
+											.token);
+										uni.setStorageSync('userInfo', JSON
+											.stringify(res
+												.user));
+										this.userInfo = uni.getStorageSync(
+											'userInfo');
+										// uni.setStorageSync('auto_userInfo', JSON.stringify(res.user));
+										// this.user = res.user
+										this.$store.commit('setCoureLogin', 1);
+										this.isLogin = true
+										this.haveLogin()
+										this.userlogo = true
+										// console.log("TOKEN_KEYAuto",TOKEN_KEYAuto)
+										if (this.urlOption.qwUserId) {
+											this.getIsAddKf() //this.getIsAddKf()
+										}
+									} else {
+										uni.showToast({
+											title: res.msg,
+											icon: 'none'
+										});
+									}
+								}).catch(err => {
+									uni.hideLoading();
+									uni.showToast({
+										icon: 'none',
+										title: "登录失败,请重新登录",
+									});
+								});
+							}
+						});
+					}
+				})
+			},
+			async haveLogin() {
+				// 防止重复执行
+				if (this.isOnload) {
+					return;
+				}
+				this.userInfo = uni.getStorageSync('userInfo');
+				if (this.userInfo) {
+					await this.getUserInfo();
+				}
+				if (this.liveId) {
+					// 优先加载直播间信息(包含视频资源URL)
+					this.isOnload = true;
+					await this.getliving(this.liveId);
+					Promise.all([
+						this.getLiveMsg(this.liveItem),
+						this.getliveViewData()
+					]).catch(err => {
+						console.error('加载数据失败:', err);
+					});
+					// 其他非关键数据异步加载
+					this.getCurrentActivities();
+					this.getliveOrder();
+					this.initSocket();
+				}
+			},
 			getUserIntegralInfo() {
 				getUserIntegralInfo().then(res => {
 					if (res.code == 200) {
@@ -2507,7 +2654,7 @@
 					const totalTime = this.calculateTimeDiff(item)
 				}, 1000);
 			},
-			toggleViewerList() {  //加载直播间观众
+			toggleViewerList() { //加载直播间观众
 				const now = Date.now()
 				if (now - this.lastClickTime > this.clickDelay) {
 					this.showViewerList = !this.showViewerList
@@ -2537,10 +2684,10 @@
 				this.$nextTick(() => {
 					const query = uni.createSelectorQuery().in(this)
 					query.select('.view-box').boundingClientRect((data) => {
-							if (data) {
-								this.scrollHeight = data.height - 80
-							}
-						}).exec();
+						if (data) {
+							this.scrollHeight = data.height - 80
+						}
+					}).exec();
 				})
 			},
 			async handleViewerLoadMore(page) {
@@ -2600,52 +2747,54 @@
 			async getliveUser(isLoadMore = false) {
 				if (!isLoadMore) {
 					this.liveViewers = []
+					this.viewPageNum = 1
 				}
 				this.viewLoading = true;
 				try {
 					const res = await watchUserList(this.liveId, this.viewPageSize, this.viewPageNum, false);
-					console.log("qxj watchUserList res",res);
+					console.log("qxj watchUserList res", res);
 					if (res.code === 200) {
 						const newRows = Array.isArray(res.rows) ? res.rows : []
-						
+
 						const newViewers = newRows.map((item) => ({
-								avatar: item.avatar || '',
-								userId: item.userId || '',
-								nickName: item.nickName || '未命名'
+							avatar: item.avatar || '',
+							userId: item.userId || '',
+							nickName: item.nickName || '未命名'
 						}));
 
 						let virtualData = [];
-						let virtualTotal = res.total > 20 ? 20 : res.total;
-						for (let i = 0; i < virtualTotal; i++) {
-							let data = {
-								avatar: '',
-								userId: '8565' + i,
-								nickName: this.generateRandomChineseName()
-							}
-							virtualData.push(data);
-						}
-						
 						if (!isLoadMore) {
+							// 首次加载时,固定生成10条虚拟数据,避免数量跳动
+							let virtualTotal = 10;
+							for (let i = 0; i < virtualTotal; i++) {
+								let data = {
+									avatar: '',
+									userId: '8565' + i,
+									nickName: this.generateRandomChineseName()
+								}
+								virtualData.push(data);
+							}
 							this.liveViewersData = [...newViewers, ...virtualData];
 						}
 
 						// 过滤掉旧列表中的虚拟数据,保留真实用户
-						let currentRealViewers = isLoadMore ? this.liveViewers.filter(v => !String(v.userId).startsWith('8565')) : [];
-						
+						let currentRealViewers = isLoadMore ? this.liveViewers.filter(v => !String(v.userId)
+							.startsWith('8565')) : [];
+
 						// 合并真实用户
 						let allRealViewers = [...currentRealViewers, ...newViewers];
-						
-						// 加上虚拟用户放在最后
-						this.liveViewers = [...allRealViewers, ...virtualData];
-						
-						let hasMore = newRows.length > 0;
+
+						// 加上虚拟用户放在最后(只在首次加载时)
+						this.liveViewers = isLoadMore ? allRealViewers : [...allRealViewers, ...virtualData];
+
+						let hasMore = newRows.length >= this.viewPageSize;
 						if (this.liveViewers.length >= 100) {
 							hasMore = false;
 							this.lookAudsCount = this.liveUserTotal - 100;
 						} else {
 							this.lookAudsCount = 0;
 						}
-						
+
 						if (this.$refs.viewer) {
 							this.$refs.viewer.endSuccess(newRows.length, hasMore);
 						}
@@ -2662,7 +2811,7 @@
 			async getliveUserInit(isLoadMore = false) {
 				try {
 					const res = await watchUserList(this.liveId, this.viewPageSize, 1, false);
-					console.log("qxj watchUserList res",res);
+					console.log("qxj watchUserList res", res);
 					if (res.code === 200) {
 						const userRows = Array.isArray(res.rows) ? res.rows : []
 						let array = userRows.map((item) => ({
@@ -2683,14 +2832,13 @@
 						// 	virtualData.push(data)
 						// }
 						this.liveTopViewersData = [...array];
-					
+
 					}
 				} catch (error) {
 					console.error('获取观众列表失败:', error)
-				} finally {
-				}
+				} finally {}
 			},
-			
+
 			showPurchaseMessage() {
 				if (this.purchasePromptTimer) {
 					clearTimeout(this.purchasePromptTimer)
@@ -3300,12 +3448,12 @@
 							'singleVisible') {} else if (socketMessage.cmd == 'entry') {
 							try {
 								//if (!this.liveUserCalled) {
-									await this.getliveUserInit(false)
-									this.liveUserCalled = true;
+								await this.getliveUserInit(false)
+								this.liveUserCalled = true;
 								//}
 								const userIdToEntry = socketMessage.userId
 								const existingIndex = this.liveViewersData.findIndex((item) => item.userId ===
-userIdToEntry);
+									userIdToEntry);
 								if (existingIndex === -1) {
 									const liveViewers = {
 										userId: socketMessage.userId,
@@ -3315,12 +3463,12 @@ userIdToEntry);
 									this.liveViewersData.push(liveViewers)
 									this.liveUserTotal++
 								}
-								
-								
+
+
 								const userData = JSON.parse(socketMessage.data || '{}')
 								const userId = userData.userId || socketMessage.userId
 								if (!userId) return
-								
+
 								if (!this.shownEntryUsers.has(userId)) {
 									this.inAndOut = socketMessage;
 									this.showWelcomeMessage = true;
@@ -3654,6 +3802,7 @@ userIdToEntry);
 		display: flex;
 		flex-direction: column;
 		justify-content: space-between;
+
 		.progress-countdown {
 			margin-top: 24rpx;
 			z-index: 9000;
@@ -3665,17 +3814,17 @@ userIdToEntry);
 			border-radius: 16rpx;
 			padding: 16rpx;
 			flex-direction: column;
-		
+
 			&.progress-vertical {
 				top: 15%;
 				left: 24rpx;
 			}
-		
+
 			.title {
 				width: 148rpx;
 				height: 28rpx;
 			}
-		
+
 			.progress-bar-bg {
 				width: 148rpx;
 				height: 8rpx;
@@ -3684,7 +3833,7 @@ userIdToEntry);
 				border-radius: 6rpx;
 				overflow: hidden;
 				margin-bottom: 16rpx;
-		
+
 				.progress-bar-fill {
 					height: 100%;
 					background: #face15;
@@ -3692,7 +3841,7 @@ userIdToEntry);
 					transition: width 1s linear;
 				}
 			}
-		
+
 			.progress-text {
 				color: #fff;
 				font-size: 20rpx;
@@ -3763,7 +3912,7 @@ userIdToEntry);
 		}
 	}
 
-	
+
 
 	.side-group {
 		position: absolute;
@@ -4470,4 +4619,64 @@ userIdToEntry);
 	::v-deep .u-icon--right {
 		justify-content: flex-end !important;
 	}
+
+	/* 微信昵称授权弹窗样式 */
+	.userlogo {
+		padding: 36rpx 40rpx;
+		color: #000000;
+
+		.mt42 {
+			margin-top: 42rpx;
+		}
+
+		.boxweixin {
+			width: 44rpx;
+			height: 44rpx;
+			border-radius: 50%;
+			text-align: center;
+			line-height: 34rpx;
+			color: #0a0;
+		}
+
+		.button-container {
+			position: relative;
+			margin: auto;
+
+			.hidden-input {
+				width: calc(100vw - 80rpx);
+				text-align: center;
+				height: 104rpx;
+				background: #07C160;
+				padding: 30rpx 0;
+				box-sizing: border-box;
+				border-radius: 12rpx;
+				font-size: 32rpx !important;
+				color: #FFFFFF !important;
+				/* 输入文字大小 */
+			}
+
+			/* 针对 placeholder 的样式 */
+			.hidden-input::placeholder {
+				font-size: 44rpx !important;
+				color: #FFFFFF !important;
+			}
+
+			/* 兼容微信小程序的 placeholder 样式 */
+			.hidden-input .placeholder {
+				font-size: 44rpx !important;
+				color: #FFFFFF !important;
+			}
+		}
+
+		.submitname {
+			height: 104rpx;
+			line-height: 104rpx;
+			background: #F2F2F2;
+			border-radius: 12rpx;
+			font-size: 32rpx;
+			color: #07C160;
+			margin-top: 32rpx;
+			text-align: center;
+		}
+	}
 </style>

+ 1 - 1
store/index.js

@@ -15,7 +15,7 @@ const store = new Vuex.Store({
 	 uploadFile: 'https://userapp.cqsft.vip',
 	imgpath: 'https://beiliyo-2025.obs.cn-north-4.myhuaweicloud.com',//倍力优图片请求地址
 	logoname:'芳华臻选生活馆',
-	appid:'wx776d6bd6848eec49',
+	appid:'wx4d225cc86cc7885d',
   },
   getters: {
     coureLogin: (state) => state.coureLogin,

+ 11 - 2
utils/common.js

@@ -59,7 +59,14 @@ var  isLoginCourseAuto =  function() {
 		);
 	}); 
 }
-
+//静默登录
+var checkLiveToken = function() {
+	var token = uni.getStorageSync('AppToken');
+	if (token == null || token == undefined || token == "") {
+		return false;
+	}
+	return true;
+}
 var loginOut= function() {
 	  uni.setStorageSync('AppToken',null);
 	  uni.setStorageSync('userInfo',null);
@@ -487,5 +494,7 @@ module.exports = {
 		generateRandomString:generateRandomString,
 		getDomain:getDomain,
 		getConfigKey: getConfigKey,
-		TOKEN_KEYAuto: TOKEN_KEYAuto
+		TOKEN_KEYAuto: TOKEN_KEYAuto,
+	checkLiveToken: checkLiveToken
+
 };