diff --git a/TUIKit/components/TUIGroup/create-group/index.vue b/TUIKit/components/TUIGroup/create-group/index.vue index a4412e3..e09f9ba 100644 --- a/TUIKit/components/TUIGroup/create-group/index.vue +++ b/TUIKit/components/TUIGroup/create-group/index.vue @@ -165,7 +165,7 @@ import { uploadSingleFile } from '../../../../utils/uploadFile' import { validateGroupNumber } from '../../../../utils/validate' import { useUI } from '../../../../utils/use-ui' -import { getRandomGroup } from '../../../../api' + import { getRandomGroup } from '../../../../api' const { showToast } = useUI() const TUIGroupServer = Server.getInstance() @@ -243,9 +243,7 @@ import { getRandomGroup } from '../../../../api' }) const submitDisabledStatus = computed(() => { - return ( - groupInfo.profile.name === ''&& !groupInfo.isEdit - ) + return groupInfo.profile.name === '' && !groupInfo.isEdit }) const selected = (type: any) => { @@ -306,24 +304,24 @@ import { getRandomGroup } from '../../../../api' // return showToast(isGroupID.message) // } - const id = await getRandomGroup() - - const res = await TUIGroupService.createGroup({ - ...options, - groupID: id.data, - avatar: groupAvatar.value - }) - const { type } = res.data.group - if (type === TUIChatEngine.TYPES.GRP_AVCHATROOM) { - await TUIGroupService.joinGroup({ - groupID: res.data.group.groupID, - applyMessage: '' + getRandomGroup().then(async (id: any) => { + const res = await TUIGroupService.createGroup({ + ...options, + groupID: id.data, + avatar: groupAvatar.value + }) + const { type } = res.data.group + if (type === TUIChatEngine.TYPES.GRP_AVCHATROOM) { + await TUIGroupService.joinGroup({ + groupID: res.data.group.groupID, + applyMessage: '' + }) + } + handleCompleteCreate(res.data.group) + Toast({ + message: TUITranslateService.t('TUIGroup.群组创建成功'), + type: TOAST_TYPE.SUCCESS }) - } - handleCompleteCreate(res.data.group) - Toast({ - message: TUITranslateService.t('TUIGroup.群组创建成功'), - type: TOAST_TYPE.SUCCESS }) } catch (err: any) { if (err.code === 10025) { diff --git a/manifest.json b/manifest.json index b480c9d..eebf727 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "密谈IM", "appid" : "__UNI__D40A151", "description" : "", - "versionName" : "1.1.3", - "versionCode" : 112, + "versionName" : "1.1.4", + "versionCode" : 113, "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/pages/anchor/components/activity.nvue b/pages/anchor/components/activity.nvue index fdbeb94..81bdfdb 100644 --- a/pages/anchor/components/activity.nvue +++ b/pages/anchor/components/activity.nvue @@ -134,6 +134,7 @@ } const res = await addLiveActivity(data) + console.log('=====发送活动====',res.data) sendCustomMessage({ liveID: props.roomId, businessID: LIVE_BUSINESS.SIGN, diff --git a/pages/audience/index.nvue b/pages/audience/index.nvue index dfc35db..7dc202c 100644 --- a/pages/audience/index.nvue +++ b/pages/audience/index.nvue @@ -277,6 +277,8 @@ const { connected: hostConnected } = useCoHostState(uni?.$liveID) import ActivityInfo from './components/activity-info.vue' import { LIVE_BUSINESS } from '@/constants/live-keys' + import { useAuthUser } from '../../composables/useAuthUser' + import { getUserAdminList } from '../../api' const dom = uni.requireNativePlugin('dom') const shareDialog = ref(false) @@ -291,6 +293,8 @@ width: 375, height: 750 }) + /** 当前是否管理员 true: 是管理员,false: 不是管理员*/ + const isAdmin = ref(false) const isShowUserInfoPanel = ref(false) const isShowAudienceList = ref(false) const isShowCoGuestRequestPanel = ref(false) @@ -313,6 +317,7 @@ return hostConnected.value.length > 0 }) + const { tencentUserSig } = useAuthUser() const liveID = ref('') const isFollowed = ref(false) const inputValue = ref('') @@ -379,15 +384,28 @@ ).data } if (newMessages.some(v => v.businessID === LIVE_BUSINESS.SIGN)) { + const list = newMessages.filter( + v => v.businessID === LIVE_BUSINESS.SIGN + ) + activityData.value = { - ...JSON.parse( - newMessages.find(v => v.businessID === LIVE_BUSINESS.SIGN) - ?.data - ), + ...JSON.parse(list[list.length - 1]?.data), isParticipated: false } isShowActivity.value = true } + if (newMessages.some(v => v.businessID === LIVE_BUSINESS.ANCHOR)) { + const list = newMessages.filter( + v => v.businessID === LIVE_BUSINESS.ANCHOR + ) + + const e = list[list.length - 1] + if (e) { + console.log('==管理员状态===', JSON.parse(e.data)) + + isAdmin.value = JSON.parse(e.data).show + } + } } }) @@ -413,6 +431,12 @@ } }) if (liveID.value) { + getUserAdminList(liveID.value).then(res => { + const adminList = res.data.Response?.Admin_Account || [] + isAdmin.value = adminList?.some( + v => v === tencentUserSig.value.userId + ) + }) joinLive({ liveID: liveID.value, success: () => { @@ -769,7 +793,9 @@ } const showAudienceList = () => { - isShowAudienceList.value = true + if (isAdmin.value) { + isShowAudienceList.value = true + } } // 处理连麦按钮点击事件 diff --git a/pages/discover/discover.vue b/pages/discover/discover.vue index 4523d10..383f38e 100644 --- a/pages/discover/discover.vue +++ b/pages/discover/discover.vue @@ -13,7 +13,7 @@ { name: '线上商城', icon: 'mall' }, { name: '我的拼团伙伴', icon: 'team' }, { name: '购买记录', icon: 'shopping' }, - { name: '项目入口', icon: 'project' }, + // { name: '项目入口', icon: 'project' }, { name: '直播列表', icon: 'liveStream' } ] diff --git a/pages/mall/detail.vue b/pages/mall/detail.vue index 00ea219..b16a1b4 100644 --- a/pages/mall/detail.vue +++ b/pages/mall/detail.vue @@ -7,7 +7,7 @@ } from '@/api/mall' import { ref, computed } from 'vue' import { navigateTo, navigateBack } from '@/utils/router' - import { getRemainingTime, parseDateTime } from '../../utils/dateUtils' + import { calculateRemainingTime, parseDateTime } from '../../utils/dateUtils' const viewData = ref({}) const productId = ref('') @@ -27,14 +27,16 @@ viewData.value = res.data if (res.data.groupActivities.length > 0) { const c = await getParticipateList(res.data.groupActivities[0].id) - console.log(c.data, '====') - console.log(getRemainingTime('2026-01-28 23:46:40')) + console.log(calculateRemainingTime('2026-02-10 21:50:40'), '===') pingtuanList.value = c.data.map(v => { + const date = calculateRemainingTime(v.endTime) return { ...v, - showDate: true + showDate: true, + ...date } }) + console.log(pingtuanList.value) isPingTuan.value = c.data.length > 0 } else { isPingTuan.value = false @@ -172,10 +174,10 @@ 距离结束: {{ message?.sender?.userName || message?.sender?.userID }}: - + - {{ getAnchorMessageText(message) }} + {{ getAnchorMessageText(message).count }} + + + {{ getAnchorMessageText(message).title }} {{ message?.textContent || '' }} @@ -185,8 +188,7 @@ /** 主播发送自定义消息显示文本 */ const getAnchorMessageText = (message: any) => { - const data = JSON.parse(message.data) - return data.count + return JSON.parse(message.data) } const handleReceiveGift = { diff --git a/utils/dateUtils.js b/utils/dateUtils.js index a3a835d..320d12f 100644 --- a/utils/dateUtils.js +++ b/utils/dateUtils.js @@ -102,6 +102,49 @@ export const parseDateTime = dateTimeStr => { } } +/** + * 计算当前时间距离目标时间的剩余时、分、秒 + * @param {string} targetTimeStr - 目标时间字符串,格式如 "2026-02-10 21:50:40" + * @returns {Object} 包含hours、minutes、seconds的对象,适配uni-countdown组件 + */ +export const calculateRemainingTime = targetTimeStr => { + // 1. 处理目标时间,转换为时间戳(解决时区问题,手动拆分时间字符串) + const [datePart, timePart] = targetTimeStr.split(' ') + const [year, month, day] = datePart.split('-').map(Number) + const [hour, minute, second] = timePart.split(':').map(Number) + // 注意:月份是0开始的,所以要减1 + const targetTime = new Date( + year, + month - 1, + day, + hour, + minute, + second + ).getTime() + + // 2. 获取当前时间戳 + const currentTime = new Date().getTime() + + // 3. 计算剩余总秒数(如果目标时间已过,剩余时间为0) + let remainingSeconds = Math.max( + 0, + Math.floor((targetTime - currentTime) / 1000) + ) + + // 4. 转换为时、分、秒 + const hours = Math.floor(remainingSeconds / 3600) // 1小时=3600秒 + remainingSeconds = remainingSeconds % 3600 // 剩余的秒数 + const minutes = Math.floor(remainingSeconds / 60) // 1分钟=60秒 + const seconds = remainingSeconds % 60 // 最终剩余的秒数 + + // 5. 返回适配uni-countdown的格式 + return { + hours, + minutes, + seconds + } +} + export const getRemainingTime = endTimeStr => { const now = new Date().getTime() // 当前时间戳(毫秒) const end = new Date(endTimeStr.replace(' ', 'T')).getTime() // 转为 ISO 格式并获取时间戳