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 0000000..d74b215
Binary files /dev/null and b/static/images/activity.png differ