This commit is contained in:
bobobobo
2026-02-10 22:58:31 +08:00
parent 89b7566aa1
commit 9245fefc9a
8 changed files with 113 additions and 41 deletions

View File

@@ -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) {

View File

@@ -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" : {

View File

@@ -134,6 +134,7 @@
}
const res = await addLiveActivity(data)
console.log('=====发送活动====',res.data)
sendCustomMessage({
liveID: props.roomId,
businessID: LIVE_BUSINESS.SIGN,

View File

@@ -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
}
}
// 处理连麦按钮点击事件

View File

@@ -13,7 +13,7 @@
{ name: '线上商城', icon: 'mall' },
{ name: '我的拼团伙伴', icon: 'team' },
{ name: '购买记录', icon: 'shopping' },
{ name: '项目入口', icon: 'project' },
// { name: '项目入口', icon: 'project' },
{ name: '直播列表', icon: 'liveStream' }
]

View File

@@ -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 @@
<view class="count-down">
<text>距离结束:</text>
<uni-countdown
:day="parseDateTime(item.endTime).day"
:hour="parseDateTime(item.endTime).hour"
:minute="parseDateTime(item.endTime).minute"
:second="parseDateTime(item.endTime).second"
:show-day="false"
:hour="item.hours"
:minute="item.minutes"
:second="item.seconds"
:show-colon="false"
@timeup="
() => {

View File

@@ -23,9 +23,12 @@
<view class="nickname-content-wrapper">
<text class="chat-nickname"
numberOfLines="1">{{ message?.sender?.userName || message?.sender?.userID }}</text>
<!-- 主播发送消息 -->
<!-- 主播发送消息 -->
<text v-if="message?.businessID == 'anchor'" class="chat-content">
{{ getAnchorMessageText(message) }}
{{ getAnchorMessageText(message).count }}
</text>
<text v-if="message?.businessID == 'sign'" class="chat-content">
{{ getAnchorMessageText(message).title }}
</text>
<text v-else class="chat-content">
{{ 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 = {

View File

@@ -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 格式并获取时间戳