From 07f9501c0fa7f81d66521c0c0b2dcac4132982a5 Mon Sep 17 00:00:00 2001
From: bobobobo <1055026847@qq.com>
Date: Tue, 13 Jan 2026 23:43:41 +0800
Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E7=AD=BE=E6=B4=BB=E5=8A=A8?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../TUIChat/message-input-toolbar/index.vue | 10 +-
.../live-stream/apply.vue | 3 +
.../live-stream/index.vue | 64 ++-
pages/anchor/components/activity.nvue | 449 ++++++++++++++++++
pages/anchor/index.nvue | 128 ++---
pages/discover/discover.vue | 1 +
pages/discover/ranking-list.vue | 1 +
pages/my-index/wallet/real-id.vue | 9 +-
static/images/activity.png | Bin 0 -> 2766 bytes
9 files changed, 577 insertions(+), 88 deletions(-)
create mode 100644 pages/anchor/components/activity.nvue
create mode 100644 static/images/activity.png
diff --git a/TUIKit/components/TUIChat/message-input-toolbar/index.vue b/TUIKit/components/TUIChat/message-input-toolbar/index.vue
index 0379c99..8918453 100644
--- a/TUIKit/components/TUIChat/message-input-toolbar/index.vue
+++ b/TUIKit/components/TUIChat/message-input-toolbar/index.vue
@@ -67,13 +67,21 @@
-
+
+
diff --git a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue
index e531117..e3ac6bc 100644
--- a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue
+++ b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply.vue
@@ -7,6 +7,9 @@
onLoad(e => {
stateData.value = Number(e?.type)
+
+
+ console.log(stateData.value, '2222')
})
diff --git a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue
index 2e08180..704794c 100644
--- a/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue
+++ b/TUIKit/components/TUIChat/message-input-toolbar/live-stream/index.vue
@@ -11,10 +11,13 @@
const evaluateIcon = custom
const props = defineProps({
- /** 距离顶部高度 */
groupId: {
type: String,
default: ''
+ },
+ userData: {
+ type: Object,
+ default: () => ({})
}
})
@@ -25,40 +28,51 @@
*/
const stateData = ref(0)
const onDialogShow = async () => {
- const res = await getAnchorDetail()
- if (res?.data) {
- stateData.value = res.data.status
- } else {
- stateData.value = 9
- }
-
- container?.value?.toggleDialogDisplay(false)
- if ([0, 2, 9].includes(stateData.value)) {
- navigateTo(
- '/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply',
- { type: stateData.value }
+ if (
+ ['Owner', 'Admin'].includes(
+ props.userData.groupProfile.selfInfo.role
)
-
- return
- }
- if (stateData.value === 1) {
- // 跳转到开播页面
+ ) {
+ // 管理员跟群主可直接开直播
uni.navigateTo({
url: `/pages/anchor/index?groupId=${encodeURIComponent(
props.groupId
- )}`
+ )}&creatorType=2`
})
- return
- }
- if (stateData.value === 3) {
- showDialog('提示', '您已被封禁,请联系管理员解封', false)
- return
+ } else {
+ const res = await getAnchorDetail()
+ if (res?.data) {
+ stateData.value = res.data.status
+ } else {
+ stateData.value = 9
+ }
+
+ container?.value?.toggleDialogDisplay(false)
+ if ([0, 2, 9].includes(stateData.value)) {
+ navigateTo(
+ '/TUIKit/components/TUIChat/message-input-toolbar/live-stream/apply',
+ { type: stateData.value }
+ )
+ return
+ }
+ if (stateData.value === 1) {
+ // 跳转到开播页面
+ uni.navigateTo({
+ url: `/pages/anchor/index?groupId=${encodeURIComponent(
+ props.groupId
+ )}&creatorType=1`
+ })
+ return
+ }
+ if (stateData.value === 3) {
+ showDialog('提示', '您已被封禁,请联系管理员解封', false)
+ return
+ }
}
}
-
+ import { reactive } from 'vue'
+ import { useUI } from '../../../utils/use-ui'
+ import { TUIGroupService } from '@tencentcloud/chat-uikit-engine-lite'
+ import { useAuthUser } from '../../../composables/useAuthUser'
+
+ const { showToast } = useUI()
+ const { tencentUserSig } = useAuthUser()
+
+ const props = defineProps({
+ modelValue: {
+ type: Boolean,
+ default: false
+ },
+ /**
+ * 创建人类型:1-主播 2-管理员 3-系统
+ */
+ creatorType: {
+ type: String,
+ default: ''
+ },
+ /**
+ * 直播间ID
+ */
+ roomId: {
+ type: String,
+ default: ''
+ },
+ /**
+ * 群 id
+ */
+ groupID: {
+ type: String,
+ default: ''
+ }
+ })
+
+ const emit = defineEmits(['update:modelValue'])
+
+ /**
+ * 根据用户输入的结束时间(分钟)计算开始时间和结束时间,并格式化为 yyyy-MM-dd HH:mm:ss
+ */
+ const calculateTimeRange = endMinutes => {
+ // 获取当前时间(毫秒)
+ const now = new Date().getTime()
+
+ // 计算结束时间(毫秒)
+ const endTimeMs = now + endMinutes * 60 * 1000
+
+ // 创建 Date 对象
+ const startDate = new Date(now)
+ const endDate = new Date(endTimeMs)
+
+ // 格式化函数:将 Date 转为 'yyyy-MM-dd HH:mm:ss'
+ const formatDateTime = date => {
+ const pad = num => num.toString().padStart(2, '0')
+ const year = date.getFullYear()
+ const month = pad(date.getMonth() + 1) // getMonth() 返回 0-11
+ const day = pad(date.getDate())
+ const hours = pad(date.getHours())
+ const minutes = pad(date.getMinutes())
+ const seconds = pad(date.getSeconds())
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
+ }
+
+ return {
+ startTime: formatDateTime(startDate),
+ endTime: formatDateTime(endDate)
+ }
+ }
+
+ const close = () => {
+ emit('update:modelValue', false)
+ }
+
+ const formData = reactive({
+ title: '',
+ // startTime: '',
+ // endTime: '',
+ // 结束时间
+ endTime: '',
+ roomId: '',
+ rewardValue: '',
+ maxParticipants: '',
+ isRepeat: 0
+ })
+
+ const submitForm = async () => {
+ const res = await TUIGroupService.getGroupMemberProfile({
+ groupID: props.groupID,
+ userIDList: [tencentUserSig.value.userId]
+ })
+
+ console.log(res)
+ if (!formData.title) {
+ showToast('请填写标题')
+ return
+ }
+ if (!formData.endTime) {
+ showToast('请填写结束时间')
+ return
+ }
+ if (!formData.rewardValue) {
+ showToast('请填写奖励值')
+ return
+ }
+ if (!formData.maxParticipants) {
+ showToast('请填写参与人数')
+ return
+ }
+ // 参与人数不能为0
+ if (Number(formData.maxParticipants) === 0) {
+ showToast('参与人数不能为0')
+ return
+ }
+ // 参与人数必须是整数
+ if (!Number.isInteger(Number(formData.maxParticipants))) {
+ showToast('参与人数必须是整数')
+ return
+ }
+ // 参与人数不能大于1000
+ if (Number(formData.maxParticipants) > 1000) {
+ showToast('参与人数不能大于1000')
+ return
+ }
+
+ const data = {
+ title: formData.title,
+ startTime: calculateTimeRange(Number(formData.endTime)).startTime,
+ endTime: calculateTimeRange(Number(formData.endTime)).endTime,
+ rewardValue: Number(formData.rewardValue),
+ maxParticipants: Number(formData.maxParticipants),
+ isRepeat: formData.isRepeat,
+ creatorType: props.creatorType,
+ roomId: props.roomId
+ }
+ console.log(data)
+ }
+
+
+
+
+
+
+
+
+
+ 标题
+
+
+
+
+
+
+ 结束时间(分钟)
+
+
+
+
+
+
+ 奖励值(积分)
+
+
+
+
+
+
+ 参与人数
+
+
+
+
+
+
+
+
+
diff --git a/pages/anchor/index.nvue b/pages/anchor/index.nvue
index 8095c66..4b90a67 100644
--- a/pages/anchor/index.nvue
+++ b/pages/anchor/index.nvue
@@ -75,6 +75,10 @@
主播pk
-->
+
+
+ 活动
+
连观众
@@ -86,7 +90,8 @@
-
+
+
@@ -153,6 +158,8 @@
import { useGiftState } from "@/uni_modules/tuikit-atomic-x/state/GiftState";
import { useLiveSummaryState } from '@/uni_modules/tuikit-atomic-x/state/LiveSummaryState'
import ActionSheet from '@/components/ActionSheet.nvue'
+ import Activity from './components/activity.nvue'
+
const dom = uni.requireNativePlugin('dom')
const { loginUserInfo } = useLoginState();
uni.$liveID = `live_${uni.$userID}`
@@ -187,7 +194,8 @@
height: 750,
});
const beforeLivePanelRef = ref();
-
+ // 活动弹框状态
+ const isShowActivity = ref(false);
const isShowUserInfoPanel = ref(false);
const isShowAudienceList = ref(false);
const isShowCoHostPanel = ref(false);
@@ -573,65 +581,65 @@
const roomDataId = ref('')
const startLive = async () => {
- try {
- console.log('点击开始直播')
- const data = {
- coverUrl: coverURL.value,
- roomName: liveTitle.value,
- groupId: groupId.value
- }
- const roomData = await imAddLive(data)
- const roomId = roomData.data.roomId
- uni.$liveID = roomId
- liveID.value = roomId
- const res = await imDataStartLive(roomId)
- console.log(roomData, '========11111')
- console.log(res, '========22222')
- roomDataId.value = roomId
- const params = {
- cursor: "", // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完
- count: 20, // 分页拉取的个数
- };
- joinLive({ liveID: roomId })
- fetchLiveList(params);
- openLocalCamera({ isFront: isFrontCamera.value });
- openLocalMicrophone();
- setLocalVideoMuteImage();
- isStartLive.value = true;
- } catch (err) {
- console.log(err, '====22')
- }
+ // try {
+ // console.log('点击开始直播')
+ // const data = {
+ // coverUrl: coverURL.value,
+ // roomName: liveTitle.value,
+ // groupId: groupId.value
+ // }
+ // const roomData = await imAddLive(data)
+ // const roomId = roomData.data.roomId
+ // uni.$liveID = roomId
+ // liveID.value = roomId
+ // const res = await imDataStartLive(roomId)
+ // console.log(roomData, '========11111')
+ // console.log(res, '========22222')
+ // roomDataId.value = roomId
+ // const params = {
+ // cursor: "", // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完
+ // count: 20, // 分页拉取的个数
+ // };
+ // joinLive({ liveID: roomId })
+ // fetchLiveList(params);
+ // openLocalCamera({ isFront: isFrontCamera.value });
+ // openLocalMicrophone();
+ // setLocalVideoMuteImage();
+ // isStartLive.value = true;
+ // } catch (err) {
+ // console.log(err, '====22')
+ // }
+// ======================原本代码
+ createLive({
+ liveInfo: {
+ liveID: uni?.$liveID,
+ liveName: liveTitle.value,
+ coverURL: coverURL.value,
+ isSeatEnabled: true,
+ seatMode: 'APPLY',
+ maxSeatCount: 0,
+ isPublicVisible: liveMode.value === '公开',
+ keepOwnerOnSeat: true,
+ seatLayoutTemplateID: templateLayout.value,
+ },
+ success: () => {
+ const params = {
+ cursor: "", // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完
+ count: 20, // 分页拉取的个数
+ };
+ fetchLiveList(params);
- // createLive({
- // liveInfo: {
- // liveID: uni?.$liveID,
- // liveName: liveTitle.value,
- // coverURL: coverURL.value,
- // isSeatEnabled: true,
- // seatMode: 'APPLY',
- // maxSeatCount: 0,
- // isPublicVisible: liveMode.value === '公开',
- // keepOwnerOnSeat: true,
- // seatLayoutTemplateID: templateLayout.value,
- // },
- // success: () => {
- // const params = {
- // cursor: "", // 首次拉起传空(不能是null),然后根据回调数据的cursor确认是否拉完
- // count: 20, // 分页拉取的个数
- // };
- // fetchLiveList(params);
-
- // openLocalCamera({ isFront: isFrontCamera.value });
- // openLocalMicrophone();
- // setLocalVideoMuteImage();
- // },
- // fail: (errCode, errMsg) => {
- // uni.showToast({
- // title: '创建直播间失败',
- // });
- // },
- // });
- // isStartLive.value = true;
+ openLocalCamera({ isFront: isFrontCamera.value });
+ openLocalMicrophone();
+ setLocalVideoMuteImage();
+ },
+ fail: (errCode, errMsg) => {
+ uni.showToast({
+ title: '创建直播间失败',
+ });
+ },
+ });
+ isStartLive.value = true;
};
const ShowAnchorViewClickPanel = (userInfo) => {
diff --git a/pages/discover/discover.vue b/pages/discover/discover.vue
index 0145f41..4072a4b 100644
--- a/pages/discover/discover.vue
+++ b/pages/discover/discover.vue
@@ -1,5 +1,6 @@
diff --git a/pages/my-index/wallet/real-id.vue b/pages/my-index/wallet/real-id.vue
index be3ea50..b725233 100644
--- a/pages/my-index/wallet/real-id.vue
+++ b/pages/my-index/wallet/real-id.vue
@@ -114,7 +114,7 @@
const id = await getAnchorDetail()
const data = {
- id: id.data.id,
+ id: id?.data?.id || '',
idCardFront: formData.front,
idCardBack: formData.back,
realName: formData.realName,
@@ -150,7 +150,12 @@
placeholder="请输入联系电话"
>
-
+
diff --git a/static/images/activity.png b/static/images/activity.png
new file mode 100644
index 0000000000000000000000000000000000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