订单,视频通话需要开发

This commit is contained in:
cbb
2026-02-07 17:44:59 +08:00
parent 101ddcb0c1
commit 20b6be5dfb
13 changed files with 259 additions and 120 deletions

View File

@@ -33,7 +33,7 @@
<view class="action-btn-image-container">
<image
class="action-btn-image"
v-if="userInfo?.isMessageDisabled"
v-if="isMessageDisabled"
src="/static/images/unmute-speak.png"
mode="aspectFit"
/>
@@ -46,12 +46,32 @@
</view>
<text
class="action-btn-content"
v-if="userInfo?.isMessageDisabled"
v-if="isMessageDisabled"
>
解除禁言
</text>
<text class="action-btn-content" v-else>禁言</text>
</view>
<view v-if="!adminType" class="action-btn" @tap="onDdmini">
<view class="action-btn-image-container">
<image
v-if="isAdminShow"
class="action-btn-image"
src="/static/images/no-administrator.png"
mode="aspectFit"
/>
<image
v-else
class="action-btn-image"
src="/static/images/administrator.png"
mode="aspectFit"
/>
</view>
<text v-if="isAdminShow" class="action-btn-content">撤销管理员</text>
<text v-else class="action-btn-content">设置管理员</text>
</view>
<view class="action-btn" @tap="kickOut">
<view class="action-btn-image-container">
<image
@@ -62,17 +82,6 @@
</view>
<text class="action-btn-content">踢出房间</text>
</view>
<view class="action-btn" @tap="onDdmini">
<view class="action-btn-image-container">
<image
class="action-btn-image"
src="/static/images/administrator.png"
mode="aspectFit"
/>
</view>
<text class="action-btn-content">设置管理员</text>
</view>
</view>
<!-- <view class="divider-line-container">
<view class="divider-line"></view>
@@ -83,13 +92,13 @@
</template>
<script setup>
import { ref, computed } from 'vue'
import { ref, computed, onMounted, reactive } from 'vue'
import { useLiveListState } from '@/uni_modules/tuikit-atomic-x/state/LiveListState'
import { useLiveAudienceState } from '@/uni_modules/tuikit-atomic-x/state/LiveAudienceState'
import { useUI } from '../../../../utils/use-ui'
import { getUserBanList, getUserAdminList } from '../../../../api'
const { showLoading, hideLoading } = useUI()
const { showLoading, hideLoading, showToast, showDialog } = useUI()
const { currentLive } = useLiveListState()
const {
setAdministrator,
@@ -108,12 +117,24 @@
userInfo: {
type: Object
},
adminType: {
type: Boolean,
default: false
},
liveID: {
type: String
}
})
const emit = defineEmits(['update:modelValue', 'update:userInfo'])
/** 禁言,管理员列表 */
const listData = reactive({
/** 禁言列表 */
tabooList: [],
/** 管理员列表 */
adminList: []
})
const userData = computed({
get() {
@@ -123,21 +144,37 @@
emit('update:userInfo', value)
}
})
/** 是否禁止发言状态 */
const isMessageDisabled = computed(() => {
return listData.tabooList?.some(v => v?.Member_Account === userData.value.userID)
})
/** 是否管理员状态 */
const isAdminShow = computed(() => {
return listData.adminList?.some(v => v === userData.value.userID)
})
const close = () => {
emit('update:modelValue', false)
}
/** 获取禁言列表 */
const getBanList = async () => {
try {
showLoading()
const res = await getUserBanList(uni?.$liveID)
console.log('禁言列表=====', res)
hideLoading()
} catch (err) {
hideLoading()
}
/** 获取对应列表state1 显示禁止提示框 2 管理员显示提示框 */
const getListData = async (state) => {
const apiList = [
getUserBanList(uni?.$liveID),
getUserAdminList(uni?.$liveID)
]
Promise.all(apiList).then((res) => {
listData.tabooList = res[0].data.Response?.MutedAccountList || []
listData.adminList = res[1].data.Response?.Admin_Account || []
if (state === 1) {
showToast(`${isMessageDisabled.value ? '禁止' : '恢复'}成功`, 'success')
}
if (state === 2) {
showToast(`${isAdminShow.value ? '设置' : '撤销'}成功`, 'success')
}
})
}
/** 获取管理员列表 */
@@ -153,65 +190,37 @@
}
/** 设置为管理员 */
const onDdmini = () => {
console.log('====', userData.value)
uni.showModal({
title: `提示`,
content: `确认设置该用户为管理员?`,
success: c => {
if (c.confirm) {
uni.showLoading({
title: '加载中...',
mask: true // 防止穿透点击
})
setAdministrator({
liveID: uni?.$liveID,
userID: props?.userInfo?.userID,
success: () => {
uni.hideLoading()
uni.showToast({
title: '设置成功',
icon: 'success',
mask: true
})
close()
},
fail: () => {
uni.hideLoading()
}
})
}
}
})
}
const muteSpeak = () => {
console.log(
`${uni?.$liveID} === mute or unMute speak, liveID: ${props.liveID}, isMessageDisabled: ${props?.userInfo?.isMessageDisabled}`
)
getBanList()
const isShow = props?.userInfo?.isMessageDisabled
uni.showModal({
title: `提示`,
content: isShow ? `确认禁止用户发言?` : `确认恢复用户发言?`,
success: c => {
if (c.confirm) {
const params = {
liveID: uni?.$liveID,
userID: props?.userInfo?.userID,
isDisable: !props?.userInfo?.isMessageDisabled
}
if (isShow) {
disableSendMessage(params)
} else {
disableSendMessage(params)
}
const onDdmini = async () => {
const show = await showDialog('提示', `确认${isAdminShow.value ? '撤销' : '设置'}管理员?`)
if (show) {
showLoading()
const api = isAdminShow.value ? revokeAdministrator : setAdministrator
api({
liveID: uni?.$liveID,
userID: userData.value.userID,
success: () =>{
getListData(2)
close()
}
})
}
}
const muteSpeak = async () => {
const show = await showDialog('提示', `确认${isMessageDisabled.value ? '恢复' : '禁止'}用户发言?`)
if (show) {
showLoading()
disableSendMessage({
liveID: uni?.$liveID,
userID: userData.value.userID,
isDisable: !isMessageDisabled.value,
success: () => {
getListData(1)
close()
}
})
}
})
}
const kickOut = () => {
@@ -250,6 +259,9 @@
})
}
onMounted(() => {
getListData()
})
</script>
<style>

View File

@@ -21,7 +21,7 @@
<text class="tag-text">{{ audience.tag }}</text>
</view>
</view>
<view class="audience-more" v-if="loginUserInfo?.userID === currentLive.liveOwner.userID"
<view class="audience-more" v-if="loginUserInfo?.userID === currentLive.liveOwner.userID || isAdminState"
@tap="audienceOperator(audience)">
<text class="more-text">···</text>
</view>
@@ -40,7 +40,7 @@
</view>
</view>
<AudienceActionPanel v-model="isShowAudienceActionPanel" :userInfo="selectedAudience" :liveID="liveID">
<AudienceActionPanel v-model="isShowAudienceActionPanel" :userInfo="selectedAudience" :liveID="liveID" :adminType="isAdminState">
</AudienceActionPanel>
</view>
@@ -49,10 +49,11 @@
<script setup>
import {
ref,
onMounted
onMounted,
watch
} from 'vue';
import AudienceActionPanel from '@/uni_modules/tuikit-atomic-x/components/LiveAudienceList/AudienceActionPanel.nvue';
import { getUserAdminList } from '../../../../api'
import {
useLiveAudienceState
} from "@/uni_modules/tuikit-atomic-x/state/LiveAudienceState";
@@ -62,6 +63,7 @@
import {
useLiveListState
} from "@/uni_modules/tuikit-atomic-x/state/LiveListState";
import { useAuthUser } from '../../../../composables/useAuthUser';
const {
currentLive
} = useLiveListState();
@@ -69,6 +71,7 @@
loginUserInfo
} = useLoginState();
const {tencentUserSig } = useAuthUser()
const {
audienceList,
audienceListCursor
@@ -80,6 +83,8 @@
const scrollTop = ref(0);
const isShowAudienceActionPanel = ref(false);
const selectedAudience = ref(null);
/** 是否管理员身份 */
const isAdminState = ref(false)
const safeArea = ref({
left: 0,
right: 0,
@@ -107,6 +112,17 @@
const close = () => {
emit('update:modelValue', false);
};
watch(() => props.modelValue, (v) => {
if (v) {
getUserAdminList(uni?.$liveID).then(res => {
const adminList = res.data.Response?.Admin_Account || []
console.log('===管理员列表', adminList)
isAdminState.value = adminList?.some(v => v === tencentUserSig.value.userId)
console.log('===状态', isAdminState.value)
})
}
})
// 初始化加载
onMounted(() => {