修复已知问题
This commit is contained in:
@@ -84,6 +84,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||||
|
// #endif
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
onMounted,
|
onMounted,
|
||||||
@@ -121,6 +124,7 @@
|
|||||||
// @Start uniapp use Chat only
|
// @Start uniapp use Chat only
|
||||||
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||||
import { initChat, logout } from './entry-chat-only.ts'
|
import { initChat, logout } from './entry-chat-only.ts'
|
||||||
|
import { navigateTo } from '../../../utils/router.js'
|
||||||
|
|
||||||
// 返回状态
|
// 返回状态
|
||||||
const backStatusName = ref('')
|
const backStatusName = ref('')
|
||||||
@@ -357,6 +361,23 @@
|
|||||||
)
|
)
|
||||||
currentConversationID.value = conversationID
|
currentConversationID.value = conversationID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
CallLib.init({})
|
||||||
|
CallLib.onCallReceived(res => {
|
||||||
|
console.log(
|
||||||
|
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
|
||||||
|
res.data
|
||||||
|
)
|
||||||
|
if (res.data.targetId) {
|
||||||
|
navigateTo('/pages/room/incom', {
|
||||||
|
type: res.data.extra,
|
||||||
|
userID: res.data.targetId
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// #endif
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss" src="./style/index.scss"></style>
|
<style scoped lang="scss" src="./style/index.scss"></style>
|
||||||
|
|||||||
@@ -1,108 +1,70 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index.esm'
|
import ToolbarItemContainer from '../toolbar-item-container/index.vue'
|
||||||
import ToolbarItemContainer from '../toolbar-item-container/index.vue'
|
import custom from '../../../../assets/icon/telephone-icon.svg'
|
||||||
import custom from '../../../../assets/icon/telephone-icon.svg'
|
import videoIcon from '../../../../assets/icon/video-icon.svg'
|
||||||
import videoIcon from '../../../../assets/icon/video-icon.svg'
|
import { isUniFrameWork } from '../../../../utils/env'
|
||||||
import { isUniFrameWork } from '../../../../utils/env'
|
import { computed, ref } from 'vue'
|
||||||
import { computed, ref } from 'vue'
|
import { type IConversationModel } from '@tencentcloud/chat-uikit-engine-lite'
|
||||||
import { type IConversationModel } from '@tencentcloud/chat-uikit-engine-lite'
|
import { navigateTo } from '../../../../../utils/router'
|
||||||
|
|
||||||
// CallLib.init({});
|
const props = withDefaults(
|
||||||
|
defineProps<{
|
||||||
|
/** 通话状态: 0 语音 1 视频 */
|
||||||
|
type?: '0' | '1'
|
||||||
|
/** 信息数据 */
|
||||||
|
currentConversation?: IConversationModel
|
||||||
|
}>(),
|
||||||
|
{
|
||||||
|
type: '0',
|
||||||
|
currentConversation: () => ({} as IConversationModel)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const props = withDefaults(
|
/** 语音通话状态 */
|
||||||
defineProps<{
|
const isType = computed(() => props.type === '0')
|
||||||
/** 通话状态: 0 语音 1 视频 */
|
|
||||||
type?: '0' | '1'
|
const evaluateIcon = isType.value ? custom : videoIcon
|
||||||
/** 信息数据 */
|
|
||||||
currentConversation?: IConversationModel
|
const emits = defineEmits(['onDialogPopupShowOrHide'])
|
||||||
}>(),
|
|
||||||
{
|
const container = ref()
|
||||||
type: '0',
|
const closeDialog = () => {
|
||||||
currentConversation: () => ({} as IConversationModel)
|
container?.value?.toggleDialogDisplay(false)
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
/** 语音通话状态 */
|
const onDialogShow = () => {
|
||||||
const isType = computed(() => props.type === '0')
|
console.log('弹出窗口', props.currentConversation)
|
||||||
|
const data = props.currentConversation.userProfile
|
||||||
|
emits('onDialogPopupShowOrHide', true)
|
||||||
|
|
||||||
const evaluateIcon = isType.value ? custom : videoIcon
|
if (isType.value) {
|
||||||
|
navigateTo('/pages/room/incom', {
|
||||||
|
type: 'call',
|
||||||
|
userID: data.userID
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
navigateTo('/pages/room/room')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const emits = defineEmits(['onDialogPopupShowOrHide'])
|
const onDialogClose = () => {
|
||||||
|
console.log('关闭窗口')
|
||||||
|
emits('onDialogPopupShowOrHide', false)
|
||||||
|
}
|
||||||
|
|
||||||
const container = ref()
|
const onDial = () => {
|
||||||
const closeDialog = () => {
|
const data = props.currentConversation.userProfile
|
||||||
container?.value?.toggleDialogDisplay(false)
|
// data.userID
|
||||||
}
|
// CallLib.enableMicrophone(true)
|
||||||
|
// CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
|
||||||
const onDialogShow = () => {
|
}
|
||||||
console.log('弹出窗口', isType.value)
|
|
||||||
console.log('弹出窗口', props.currentConversation)
|
|
||||||
let targetId = props.currentConversation.userProfile.userID
|
|
||||||
// emits('onDialogPopupShowOrHide', true)
|
|
||||||
callOut('single', isType.value ? 'audio' : 'video', targetId)
|
|
||||||
}
|
|
||||||
|
|
||||||
function callOut(callSelect, mediaSelect, targetId) {
|
|
||||||
console.log('callSelect: ', callSelect)
|
|
||||||
console.log('mediaSelect: ', mediaSelect)
|
|
||||||
console.log('targetId: ', targetId)
|
|
||||||
//单聊音频
|
|
||||||
if (callSelect === 'single' && mediaSelect === 'audio') {
|
|
||||||
if (targetId === '') {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入对方ID',
|
|
||||||
icon: 'error',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
callMsg(mediaSelect, targetId, callSelect)
|
|
||||||
} else if (callSelect === 'single' && mediaSelect === 'video') {
|
|
||||||
if (targetId === '') {
|
|
||||||
uni.showToast({
|
|
||||||
title: '请输入对方ID',
|
|
||||||
icon: 'error',
|
|
||||||
duration: 2000
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
//单聊视频
|
|
||||||
callMsg(mediaSelect, targetId, callSelect)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function callMsg(mediaSelect, targetId, callSelect) {
|
|
||||||
console.log(targetId)
|
|
||||||
console.log(mediaSelect)
|
|
||||||
uni.setStorageSync('room-parameters', {
|
|
||||||
callType: 'out',
|
|
||||||
mediaType: mediaSelect,
|
|
||||||
targetId: targetId,
|
|
||||||
callSelect: callSelect
|
|
||||||
})
|
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/room/room'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const onDialogClose = () => {
|
|
||||||
console.log('关闭窗口')
|
|
||||||
emits('onDialogPopupShowOrHide', false)
|
|
||||||
}
|
|
||||||
|
|
||||||
const onDial = () => {
|
|
||||||
const data = props.currentConversation.userProfile
|
|
||||||
// data.userID
|
|
||||||
CallLib.enableMicrophone(true)
|
|
||||||
CallLib.startSingleCall(data.userID, 0, '邀请您进行语音通话')
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<!-- needBottomPopup -->
|
||||||
<ToolbarItemContainer
|
<ToolbarItemContainer
|
||||||
ref="container"
|
ref="container"
|
||||||
needBottomPopup
|
|
||||||
:iconFile="evaluateIcon"
|
:iconFile="evaluateIcon"
|
||||||
:iconWidth="isUniFrameWork ? '34px' : '20px'"
|
:iconWidth="isUniFrameWork ? '34px' : '20px'"
|
||||||
:iconHeight="isUniFrameWork ? '34px' : '20px'"
|
:iconHeight="isUniFrameWork ? '34px' : '20px'"
|
||||||
@@ -110,7 +72,7 @@
|
|||||||
@onDialogShow="onDialogShow"
|
@onDialogShow="onDialogShow"
|
||||||
@onDialogClose="onDialogClose"
|
@onDialogClose="onDialogClose"
|
||||||
>
|
>
|
||||||
<view class="box-index">
|
<!-- <view class="box-index">
|
||||||
<view class="top-icon">
|
<view class="top-icon">
|
||||||
<uni-icons
|
<uni-icons
|
||||||
type="back"
|
type="back"
|
||||||
@@ -132,7 +94,18 @@
|
|||||||
>
|
>
|
||||||
接听
|
接听
|
||||||
</button>
|
</button>
|
||||||
</view>
|
|
||||||
|
<button
|
||||||
|
@click.stop="
|
||||||
|
() => {
|
||||||
|
CallLib.enableMicrophone(true)
|
||||||
|
CallLib.hangup()
|
||||||
|
}
|
||||||
|
"
|
||||||
|
>
|
||||||
|
挂点
|
||||||
|
</button>
|
||||||
|
</view> -->
|
||||||
</ToolbarItemContainer>
|
</ToolbarItemContainer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ export const useAuthUser = () => {
|
|||||||
const tokenStore = useTokenStore()
|
const tokenStore = useTokenStore()
|
||||||
|
|
||||||
// 响应式状态(state & getters)
|
// 响应式状态(state & getters)
|
||||||
const { userInfo, tencentUserSig, fontSizeData, integralData } = storeToRefs(userStore)
|
const { imEngine, userInfo, tencentUserSig, fontSizeData, integralData } = storeToRefs(userStore)
|
||||||
const { token } = storeToRefs(tokenStore)
|
const { token } = storeToRefs(tokenStore)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
imEngine,
|
||||||
integralData,
|
integralData,
|
||||||
userInfo,
|
userInfo,
|
||||||
tencentUserSig,
|
tencentUserSig,
|
||||||
|
|||||||
31
pages.json
31
pages.json
@@ -39,14 +39,14 @@
|
|||||||
{
|
{
|
||||||
"path": "TUIKit/components/TUIChat/video-play",
|
"path": "TUIKit/components/TUIChat/video-play",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "腾讯云 IM",
|
"navigationBarTitleText": "",
|
||||||
"navigationBarBackgroundColor": "#EBF0F6"
|
"navigationBarBackgroundColor": "#EBF0F6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "TUIKit/components/TUIChat/web-view",
|
"path": "TUIKit/components/TUIChat/web-view",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "腾讯云 IM",
|
"navigationBarTitleText": "",
|
||||||
"navigationBarBackgroundColor": "#EBF0F6"
|
"navigationBarBackgroundColor": "#EBF0F6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -340,7 +340,7 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/shop-together/index",
|
"path": "pages/shop-together/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "拼团"
|
"navigationBarTitleText": "购买记录"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -441,17 +441,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path" : "pages/room/room",
|
"path": "pages/room/room",
|
||||||
"style" :
|
"style": {
|
||||||
{
|
"navigationBarTitleText": "拨打电话",
|
||||||
"navigationBarTitleText": "Room",
|
"navigationStyle": "custom"
|
||||||
"enablePullDownRefresh": false,
|
}
|
||||||
"navigationStyle":"custom",
|
},
|
||||||
"gestureBack":"NO"
|
{
|
||||||
}
|
"path": "pages/room/incom",
|
||||||
|
"style": {
|
||||||
},
|
"navigationBarTitleText": "拨打视频",
|
||||||
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
|||||||
{ name: '公司介绍', icon: 'company' },
|
{ name: '公司介绍', icon: 'company' },
|
||||||
{ name: '朋友圈', icon: 'circle' },
|
{ name: '朋友圈', icon: 'circle' },
|
||||||
{ name: '线上商城', icon: 'mall' },
|
{ name: '线上商城', icon: 'mall' },
|
||||||
{ name: '我的拼团伙伴', icon: 'team' },
|
{ name: '购买记录', icon: 'team' },
|
||||||
{ name: '项目入口', icon: 'project' },
|
{ name: '项目入口', icon: 'project' },
|
||||||
{ name: '直播列表', icon: 'liveStream' }
|
{ name: '直播列表', icon: 'liveStream' }
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -160,7 +160,10 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
onLoad(async e => {
|
onLoad(async e => {
|
||||||
|
// groupId
|
||||||
groupId.value = e?.groupId || ''
|
groupId.value = e?.groupId || ''
|
||||||
|
console.log(e?.groupId, '===')
|
||||||
|
formData.startGroup = !!e?.groupId
|
||||||
await getData(e.productId)
|
await getData(e.productId)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
@@ -267,6 +270,7 @@
|
|||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view
|
<view
|
||||||
|
v-if="groupId"
|
||||||
class="pay-way-item"
|
class="pay-way-item"
|
||||||
@click="formData.startGroup = !formData.startGroup"
|
@click="formData.startGroup = !formData.startGroup"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -184,7 +184,7 @@
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<button
|
<!-- <button
|
||||||
v-if="item.showDate"
|
v-if="item.showDate"
|
||||||
@click="
|
@click="
|
||||||
navigateTo('/pages/mall/confirm-order', {
|
navigateTo('/pages/mall/confirm-order', {
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
"
|
"
|
||||||
>
|
>
|
||||||
去拼单
|
去拼单
|
||||||
</button>
|
</button> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -12,9 +12,11 @@
|
|||||||
} from '@/api/my-index'
|
} from '@/api/my-index'
|
||||||
import { useUI } from '@/utils/use-ui'
|
import { useUI } from '@/utils/use-ui'
|
||||||
import { useAuthUser } from '@/composables/useAuthUser'
|
import { useAuthUser } from '@/composables/useAuthUser'
|
||||||
|
import { useUserStore } from '../../stores/user'
|
||||||
|
|
||||||
const { showToast, showDialog } = useUI()
|
const { showToast, showDialog } = useUI()
|
||||||
const { integralData } = useAuthUser()
|
const { integralData } = useAuthUser()
|
||||||
|
const { getIntegral } = useUserStore()
|
||||||
|
|
||||||
const tixian = ref(null)
|
const tixian = ref(null)
|
||||||
const popup = ref(null)
|
const popup = ref(null)
|
||||||
@@ -120,6 +122,7 @@
|
|||||||
}
|
}
|
||||||
tixian.value.close()
|
tixian.value.close()
|
||||||
await addUserWithdraw(data)
|
await addUserWithdraw(data)
|
||||||
|
await getIntegral()
|
||||||
await showToast(`提现成功`, 'success')
|
await showToast(`提现成功`, 'success')
|
||||||
navigateBack()
|
navigateBack()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
402
pages/room/incom.vue
Normal file
402
pages/room/incom.vue
Normal file
@@ -0,0 +1,402 @@
|
|||||||
|
<script setup>
|
||||||
|
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||||
|
import { ref, watch } from 'vue'
|
||||||
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
|
import { TUIUserService } from '@tencentcloud/chat-uikit-engine-lite'
|
||||||
|
import { useUI } from '../../utils/use-ui'
|
||||||
|
import { navigateBack } from '../../utils/router'
|
||||||
|
|
||||||
|
CallLib.init({})
|
||||||
|
const { showLoading, hideLoading } = useUI()
|
||||||
|
const callBackground = ref('/static/images/public/random2.png')
|
||||||
|
/** 呼叫用户信息 */
|
||||||
|
const callerInfo = ref({})
|
||||||
|
/** 通话状态 */
|
||||||
|
const isRinging = ref(true)
|
||||||
|
/** 控制按钮状态 */
|
||||||
|
const activeBtn = ref(null)
|
||||||
|
/**
|
||||||
|
* 拨打状态
|
||||||
|
* call: 发起呼叫
|
||||||
|
* answer: 接听
|
||||||
|
* dialogue: 对话中
|
||||||
|
*/
|
||||||
|
const callState = ref('')
|
||||||
|
|
||||||
|
CallLib.onCallReceived(res => {
|
||||||
|
console.log(
|
||||||
|
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
|
||||||
|
res.data.targetId
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
CallLib.onCallOutgoing(res => {
|
||||||
|
console.log(
|
||||||
|
'主叫端拨出电话后,通过回调 onCallOutgoing,通知当前 call 的详细信息',
|
||||||
|
res
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
CallLib.onCallConnected(res => {
|
||||||
|
console.log(res)
|
||||||
|
console.log(
|
||||||
|
'Engine:OnCallConnected=>' +
|
||||||
|
'已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
|
||||||
|
res
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
CallLib.onRemoteUserJoined(res => {
|
||||||
|
console.log(
|
||||||
|
'Engine:OnRemoteUserJoined=>' +
|
||||||
|
'主叫端拨出电话,被叫端收到请求后,加入通话,被叫端Id为=>',
|
||||||
|
res.data.userId
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 挂断电话 */
|
||||||
|
const isDisconnected = ref(true)
|
||||||
|
CallLib.onCallDisconnected(res => {
|
||||||
|
console.log(
|
||||||
|
'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
|
||||||
|
res.data.reason
|
||||||
|
)
|
||||||
|
isDisconnected.value = false
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => isDisconnected.value,
|
||||||
|
v => {
|
||||||
|
navigateBack()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
CallLib.onRemoteUserRinging(res => {
|
||||||
|
console.log(
|
||||||
|
'主叫端拨出电话,被叫端收到请求,发出振铃响应时触发,对端Id为=>',
|
||||||
|
res.data.userId
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
CallLib.onError(res => {
|
||||||
|
console.log('通话过程中,发生异常,异常原因=>', res.data.reason)
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 按钮状态 */
|
||||||
|
const cutFn = show => {
|
||||||
|
if (show) {
|
||||||
|
// 接听电话 dialogue
|
||||||
|
CallLib.enableMicrophone(true)
|
||||||
|
CallLib.accept()
|
||||||
|
callState.value = 'dialogue'
|
||||||
|
} else {
|
||||||
|
//取消接听,返回上一页
|
||||||
|
CallLib.hangup()
|
||||||
|
navigateBack()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoad(async e => {
|
||||||
|
callState.value = e.type
|
||||||
|
console.log(e.type)
|
||||||
|
showLoading()
|
||||||
|
const res = await TUIUserService.getUserProfile({
|
||||||
|
userIDList: [e.userID]
|
||||||
|
})
|
||||||
|
hideLoading()
|
||||||
|
callerInfo.value = res.data[0]
|
||||||
|
if (e.type === 'call') {
|
||||||
|
CallLib.enableMicrophone(true)
|
||||||
|
CallLib.startSingleCall(callerInfo.value.userID, 0, 'answer')
|
||||||
|
}
|
||||||
|
console.log('===好友信息', res)
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- 来电接听界面 -->
|
||||||
|
<view class="incoming-call">
|
||||||
|
<!-- 背景模糊层 -->
|
||||||
|
<view class="blur-background" v-if="callBackground">
|
||||||
|
<image
|
||||||
|
:src="callBackground"
|
||||||
|
mode="aspectFill"
|
||||||
|
class="bg-image"
|
||||||
|
></image>
|
||||||
|
<view class="bg-overlay"></view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 主内容区 -->
|
||||||
|
<view class="caller-info">
|
||||||
|
<view class="caller-avatar-container">
|
||||||
|
<view class="caller-avatar" :class="{ 'avatar-ring': isRinging }">
|
||||||
|
<image
|
||||||
|
v-if="callerInfo?.avatar"
|
||||||
|
:src="callerInfo?.avatar"
|
||||||
|
class="avatar-image"
|
||||||
|
></image>
|
||||||
|
<uni-icons
|
||||||
|
v-else
|
||||||
|
type="contact-filled"
|
||||||
|
size="50"
|
||||||
|
color="#fff"
|
||||||
|
></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<text class="caller-name">
|
||||||
|
{{ callerInfo?.nick || callerInfo?.userID }}
|
||||||
|
</text>
|
||||||
|
<text class="call-type">
|
||||||
|
{{ callState === 'call' ? '语音呼叫中...' : '对话中...' }}
|
||||||
|
</text>
|
||||||
|
<!-- <text class="call-status">未接听</text> -->
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 控制按钮 -->
|
||||||
|
<view class="incoming-controls">
|
||||||
|
<view class="incoming-control" @click="cutFn(false)">
|
||||||
|
<view
|
||||||
|
class="call-btn decline-btn"
|
||||||
|
:class="{ 'btn-active': activeBtn === 'decline' }"
|
||||||
|
>
|
||||||
|
<uni-icons type="closeempty" size="32" color="#fff"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<text class="btn-text">拒绝</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view
|
||||||
|
v-if="callState === 'answer'"
|
||||||
|
class="incoming-control"
|
||||||
|
@click="cutFn(true)"
|
||||||
|
>
|
||||||
|
<view
|
||||||
|
class="call-btn accept-btn"
|
||||||
|
:class="{ 'btn-active': activeBtn === 'accept' }"
|
||||||
|
>
|
||||||
|
<uni-icons
|
||||||
|
type="checkmarkempty"
|
||||||
|
size="28"
|
||||||
|
color="#fff"
|
||||||
|
></uni-icons>
|
||||||
|
</view>
|
||||||
|
<text class="btn-text">接听</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.incoming-call {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 9999;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
background-color: #000;
|
||||||
|
|
||||||
|
.blur-background {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
z-index: 0;
|
||||||
|
|
||||||
|
.bg-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
filter: blur(20px);
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.caller-info {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding-top: 100rpx;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
.caller-avatar-container {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 40rpx;
|
||||||
|
|
||||||
|
.caller-avatar {
|
||||||
|
width: 180rpx;
|
||||||
|
height: 180rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: linear-gradient(135deg, #1aad19, #129611);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
.avatar-image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.avatar-ring {
|
||||||
|
animation: ringPulse 1.5s infinite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.caller-name {
|
||||||
|
font-size: 48rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.call-type {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.9);
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.call-status {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.call-timer {
|
||||||
|
margin-top: 30rpx;
|
||||||
|
padding: 10rpx 30rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border-radius: 30rpx;
|
||||||
|
|
||||||
|
.timer-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.incoming-controls {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
padding: 80rpx 100rpx 120rpx;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
.incoming-control {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.call-btn {
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
transition: all 0.2s;
|
||||||
|
|
||||||
|
&.decline-btn {
|
||||||
|
background-color: #f43f3b;
|
||||||
|
|
||||||
|
&.btn-active {
|
||||||
|
transform: scale(0.9);
|
||||||
|
background-color: #d93632;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.accept-btn {
|
||||||
|
background-color: #07c160;
|
||||||
|
|
||||||
|
&.btn-active {
|
||||||
|
transform: scale(0.9);
|
||||||
|
background-color: #06ad56;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text {
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-bar {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 60rpx;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
padding: 0 60rpx;
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
.action-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.action-icon {
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
transition: all 0.3s;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background-color: rgba(255, 255, 255, 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-text {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes ringPulse {
|
||||||
|
0% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(26, 173, 25, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
70% {
|
||||||
|
box-shadow: 0 0 0 30rpx rgba(26, 173, 25, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
box-shadow: 0 0 0 0 rgba(26, 173, 25, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 响应式调整 */
|
||||||
|
@media (max-height: 600px) {
|
||||||
|
.incoming-controls {
|
||||||
|
padding: 40rpx 100rpx 80rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-bar {
|
||||||
|
bottom: 40rpx !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,119 +1,102 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content">
|
<view class="content">
|
||||||
<!-- 单人视频 -->
|
<!-- 单人视频 -->
|
||||||
<view v-if="users.length<=2">
|
<view v-if="users.length <= 2">
|
||||||
<RongCloud-Call-RCUniCallView class="bigVideoView"
|
<RongCloud-Call-RCUniCallView
|
||||||
:style="{width:windowWidth+'px',height:windowHeight+'px'}" ref="bigVideoView">
|
class="bigVideoView"
|
||||||
</RongCloud-Call-RCUniCallView>
|
:style="{
|
||||||
<RongCloud-Call-RCUniCallView class="smallVideoView" :style="{width:200+'upx',height:200+'upx'}"
|
width: windowWidth + 'px',
|
||||||
ref="smallVideoView">
|
height: windowHeight + 'px'
|
||||||
</RongCloud-Call-RCUniCallView>
|
}"
|
||||||
</view>
|
ref="bigVideoView"
|
||||||
<!-- 多人视频 -->
|
></RongCloud-Call-RCUniCallView>
|
||||||
<view v-else>
|
<RongCloud-Call-RCUniCallView
|
||||||
<RongCloud-Call-RCUniCallView class="bigVideoView" :style="{width:windowWidth+'px',height:300+'px'}"
|
class="smallVideoView"
|
||||||
ref="bigVideoView">
|
:style="{ width: 200 + 'upx', height: 200 + 'upx' }"
|
||||||
</RongCloud-Call-RCUniCallView>
|
ref="smallVideoView"
|
||||||
<view class="smallViews">
|
></RongCloud-Call-RCUniCallView>
|
||||||
<RongCloud-Call-RCUniCallView v-for="(item,index) in viewArr" :key="item.userId" class="smallView"
|
|
||||||
:ref="item.userId">
|
|
||||||
</RongCloud-Call-RCUniCallView>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="nav">
|
|
||||||
<text class="nav-com" v-if="callWay === 1" @click="isMark=true">
|
|
||||||
邀请
|
|
||||||
</text>
|
|
||||||
<text class="nav-com" @click="closeCameraCur">
|
|
||||||
{{curCamera?'关闭':'开启'}}摄像头
|
|
||||||
</text>
|
|
||||||
<text class="nav-com" @click="switchCamera">
|
|
||||||
切换摄像头
|
|
||||||
</text>
|
|
||||||
<text class="nav-com" @click="microphone">
|
|
||||||
{{isMicrophone?'关闭':'开启'}}麦克风
|
|
||||||
</text>
|
|
||||||
<text class="nav-com" @click="enableSpeaker">
|
|
||||||
{{isEnableSpeaker?'关闭':'开启'}}扬声器
|
|
||||||
</text>
|
|
||||||
<text class="nav-com" v-if="mediaTypeCur === 'video'" @click.stop="isBeauty=!isBeauty">
|
|
||||||
美颜
|
|
||||||
</text>
|
|
||||||
</view>
|
|
||||||
<view class="container" :style="{width:windowWidth+'px'}">
|
|
||||||
<text class="hangup" @click="hangup">挂断 </text>
|
|
||||||
<text v-if="mediaTypeCur === 'video' " class="hangup" @click="changeMediaType">切换语音 </text>
|
|
||||||
</view>
|
|
||||||
<view class="box-mark" v-if="isMark" :style="{width:windowWidth+'px',height:windowHeight+'px'}" @click.stop="">
|
|
||||||
<view class="box-cen">
|
|
||||||
<text class="box-des">被邀请者ID:</text>
|
|
||||||
<view class="box-bot">
|
|
||||||
<input v-model="inviteUsersIds" ref="inviteInput" class="box-input" type="text"
|
|
||||||
placeholder="请输入被邀请者ID">
|
|
||||||
<text class="box-tit">必填;需加入群后,方可收到邀请,多个userId用英文半角逗号分开</text>
|
|
||||||
</view>
|
|
||||||
<view class="box-btns">
|
|
||||||
<button class="box-btn" type="default" @click="inviteUsers(false)">取消</button>
|
|
||||||
<button class="box-btn" type="default" @click="inviteUsers(true)">确定</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="beauty" v-if="isBeauty" :style="{width:windowWidth+'px'}" @click.stop="">
|
<!-- 底部按钮 -->
|
||||||
<view class="beauty-btn">
|
<view class="nav-box">
|
||||||
<view class="change-btn">
|
<view class="control-row">
|
||||||
<text class="ch-tit">美颜</text><text class="switch-btn"
|
<view class="icon-item" @click="microphone">
|
||||||
@click="switchChange">{{isChecked?'开启':'关闭'}}</text>
|
<view class="control-icon">
|
||||||
</view>
|
<uni-icons
|
||||||
<view class="close-btn">
|
:type="isMicrophone ? 'mic' : 'micoff'"
|
||||||
<text class="close-tit" @click="isBeauty=false">X</text>
|
size="24"
|
||||||
</view>
|
color="#fff"
|
||||||
</view>
|
></uni-icons>
|
||||||
<view class="beauty-view">
|
|
||||||
<view v-if="curIndex === '0'" class="beauty-tab filte-view">
|
|
||||||
<view class="tab-item" v-for="(item) in filteArr" :key="item.id" @click="cutFilte(item.id)"
|
|
||||||
:class="{current: item.id === curFilte}">
|
|
||||||
<text>{{item.name}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
|
<text class="btn-text">
|
||||||
|
{{ isMicrophone ? '关闭' : '开启' }}麦克风
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 美白 -->
|
<view class="icon-item" @click="closeCameraCur">
|
||||||
<view v-if="curIndex === '1'" class="white-view com-view">
|
<view class="control-icon">
|
||||||
<slider :value="whiteVal" min="0" max="9" @change="whiteChange" show-value />
|
<uni-icons
|
||||||
|
:type="curCamera ? 'eye' : 'eye-slash'"
|
||||||
|
size="24"
|
||||||
|
color="#fff"
|
||||||
|
></uni-icons>
|
||||||
|
</view>
|
||||||
|
<text class="btn-text">
|
||||||
|
{{ curCamera ? '关闭' : '开启' }}摄像头
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
<!-- 红润 -->
|
<view class="icon-item" @click="enableSpeaker">
|
||||||
<view v-if="curIndex === '2'" class="ruddy-view com-view">
|
<view class="control-icon">
|
||||||
<slider :value="ruddyVal" min="0" max="9" @change="ruddyChange" show-value />
|
<uni-icons
|
||||||
</view>
|
:type="isEnableSpeaker ? 'sound' : 'sound'"
|
||||||
<!-- 磨皮 -->
|
size="24"
|
||||||
<view v-if="curIndex === '3'" class="buffing-view com-view">
|
color="#fff"
|
||||||
<slider :value="buffingVal" min="0" max="9" @change="buffingChange" show-value />
|
></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<!-- 亮度 -->
|
<text class="btn-text">
|
||||||
<view v-if="curIndex === '4'" class="brightness-view com-view">
|
{{ isEnableSpeaker ? '关闭' : '开启' }}扬声器
|
||||||
<slider :value="brightnessVal" min="0" max="9" @change="brightnessChange" show-value />
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="beauty-tab">
|
<view class="control-row" :style="{ width: windowWidth + 'px' }">
|
||||||
<view class="tab-item" v-for="(item) in tabArr" :key="item.id" @click="curIndex = item.id"
|
<view class="icon-item" @click="changeMediaType">
|
||||||
:class="{current: item.id === curIndex}">
|
<view class="control-icon">
|
||||||
<text>{{item.text}}</text>
|
<uni-icons
|
||||||
|
:type="mediaTypeCur === 'video' ? 'phone' : 'videocam'"
|
||||||
|
size="24"
|
||||||
|
color="#fff"
|
||||||
|
></uni-icons>
|
||||||
|
</view>
|
||||||
|
<text class="btn-text">
|
||||||
|
{{ mediaTypeCur === 'video' ? '切换语音' : '切换视频' }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="hangup-btn icon-item" @click="hangup">
|
||||||
|
<view class="hangup-icon control-icon">
|
||||||
|
<uni-icons type="phone" size="28" color="#fff"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<text class="hangup-text">挂断</text>
|
||||||
|
</view>
|
||||||
|
<view class="icon-item" @click="switchCamera">
|
||||||
|
<view class="control-icon">
|
||||||
|
<uni-icons type="refresh" size="24" color="#fff"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<text class="btn-text">翻转</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import * as call from "@/uni_modules/RongCloud-CallWrapper/lib/index"
|
import * as call from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||||
// import * as im from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
// import * as im from "@/uni_modules/RongCloud-IMWrapper/js_sdk/index"
|
||||||
// import RCBeautyEngine from "@/uni_modules/RongCloud-BeautyWrapper/lib/RCBeautyEngine"
|
// import RCBeautyEngine from "@/uni_modules/RongCloud-BeautyWrapper/lib/RCBeautyEngine"
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
mediaType: "video",
|
mediaType: 'video',
|
||||||
callType: "out",
|
callType: 'out',
|
||||||
callWay: 0, //呼叫方式 0 单聊 1 群聊
|
callWay: 0, //呼叫方式 0 单聊 1 群聊
|
||||||
targetId: "",
|
targetId: '',
|
||||||
bottomHeight: 0,
|
bottomHeight: 0,
|
||||||
isConnected: false,
|
isConnected: false,
|
||||||
isSelf: false,
|
isSelf: false,
|
||||||
@@ -134,44 +117,6 @@
|
|||||||
inviteUsersIds: '',
|
inviteUsersIds: '',
|
||||||
mediaTypeCur: 'audio',
|
mediaTypeCur: 'audio',
|
||||||
isBeauty: false,
|
isBeauty: false,
|
||||||
tabArr: [{
|
|
||||||
id: '0',
|
|
||||||
text: '滤镜'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '1',
|
|
||||||
text: '美白'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '2',
|
|
||||||
text: '红润'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '3',
|
|
||||||
text: '磨皮'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: '4',
|
|
||||||
text: '亮度'
|
|
||||||
},
|
|
||||||
],
|
|
||||||
filteArr: [{
|
|
||||||
id: 0,
|
|
||||||
name: '原画'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 1,
|
|
||||||
name: '唯美'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 2,
|
|
||||||
name: '清新'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 3,
|
|
||||||
name: '浪漫'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
curIndex: '0',
|
curIndex: '0',
|
||||||
curFilte: 0,
|
curFilte: 0,
|
||||||
whiteVal: 0,
|
whiteVal: 0,
|
||||||
@@ -181,201 +126,272 @@
|
|||||||
isChecked: false
|
isChecked: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad: function() {
|
onLoad: function () {
|
||||||
console.log("来room页面了?");
|
var _this = this
|
||||||
var _this = this;
|
|
||||||
uni.getStorage({
|
uni.getStorage({
|
||||||
key: "room-parameters",
|
key: 'room-parameters',
|
||||||
success: (res) => {
|
success: res => {
|
||||||
this.mediaType = res.data.mediaType;
|
this.mediaType = res.data.mediaType
|
||||||
this.callType = res.data.callType ? res.data.callType : 'in';
|
this.callType = res.data.callType ? res.data.callType : 'in'
|
||||||
this.groupId = res.data.groupId ? res.data.groupId : '';
|
this.groupId = res.data.groupId ? res.data.groupId : ''
|
||||||
this.userIds = res.data.userIds ? res.data.userIds : '';
|
this.userIds = res.data.userIds ? res.data.userIds : ''
|
||||||
if (this.callType === 'out') {
|
if (this.callType === 'out') {
|
||||||
console.log('呼出out')
|
console.log('呼出out')
|
||||||
this.targetId = res.data.targetId;
|
this.targetId = res.data.targetId
|
||||||
this.startCall();
|
this.startCall()
|
||||||
} else {
|
} else {
|
||||||
console.log('呼入接受')
|
console.log('呼入接受')
|
||||||
this.accept();
|
this.accept()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
success: function(res) {
|
success: function (res) {
|
||||||
_this.windowWidth = res.windowWidth;
|
_this.windowWidth = res.windowWidth
|
||||||
_this.windowHeight = res.windowHeight;
|
_this.windowHeight = res.windowHeight
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
uni.$on('OnCallConnected', this.onCallConnected)
|
uni.$on('OnCallConnected', this.onCallConnected)
|
||||||
uni.$on('OnCallDisconnected', this.onCallDisconnected)
|
uni.$on('OnCallDisconnected', this.onCallDisconnected)
|
||||||
// this.initBeautyOpton();
|
this.initBeautyOpton()
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
uni.$off('OnCallDisconnected');
|
uni.$off('OnCallDisconnected')
|
||||||
uni.$off('OnCallConnected');
|
uni.$off('OnCallConnected')
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
call.hangup();
|
call.hangup()
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
const session = call.getCurrentCallSession();
|
const session = call.getCurrentCallSession()
|
||||||
if (session) {
|
if (session) {
|
||||||
call.hangup();
|
call.hangup()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeMediaType() {
|
changeMediaType() {
|
||||||
this.mediaTypeCur = 'audio';
|
if (this.mediaTypeCur == 'video') {
|
||||||
call.changeMediaType(0);
|
this.mediaTypeCur = 'audio'
|
||||||
|
} else {
|
||||||
|
this.mediaTypeCur = 'video'
|
||||||
|
}
|
||||||
|
call.changeMediaType(0)
|
||||||
},
|
},
|
||||||
inviteUsers(flag) {
|
inviteUsers(flag) {
|
||||||
if (flag) {
|
if (flag) {
|
||||||
if (this.inviteUsersIds === '') {
|
if (this.inviteUsersIds === '') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请输入被邀请者ID",
|
title: '请输入被邀请者ID',
|
||||||
icon: "error",
|
icon: 'error',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
let userIdsArr = this.inviteUsersIds.split(',');
|
let userIdsArr = this.inviteUsersIds.split(',')
|
||||||
call.inviteUsers(userIdsArr, []);
|
call.inviteUsers(userIdsArr, [])
|
||||||
}
|
}
|
||||||
this.$refs.inviteInput.blur();
|
this.$refs.inviteInput.blur()
|
||||||
this.isMark = false;
|
this.isMark = false
|
||||||
},
|
},
|
||||||
switchVideo() {
|
switchVideo() {
|
||||||
this.isMe = !this.isMe;
|
this.isMe = !this.isMe
|
||||||
let session = call.getCurrentCallSession();
|
let session = call.getCurrentCallSession()
|
||||||
if (this.isMe) {
|
if (this.isMe) {
|
||||||
switch (uni.getSystemInfoSync().platform) {
|
switch (uni.getSystemInfoSync().platform) {
|
||||||
case 'android':
|
case 'android':
|
||||||
call.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0, false);
|
call.setVideoView(
|
||||||
call.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0, true);
|
session.targetId,
|
||||||
break;
|
this.$refs.bigVideoView.ref,
|
||||||
|
0,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
call.setVideoView(
|
||||||
|
session.mine.userId,
|
||||||
|
this.$refs.smallVideoView.ref,
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
break
|
||||||
case 'ios':
|
case 'ios':
|
||||||
call.setVideoView(session.targetId, this.$refs.bigVideoView.ref, 0);
|
call.setVideoView(
|
||||||
call.setVideoView(session.mine.userId, this.$refs.smallVideoView.ref, 0);
|
session.targetId,
|
||||||
break;
|
this.$refs.bigVideoView.ref,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
call.setVideoView(
|
||||||
|
session.mine.userId,
|
||||||
|
this.$refs.smallVideoView.ref,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
console.log('运行在开发者工具上')
|
console.log('运行在开发者工具上')
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (uni.getSystemInfoSync().platform) {
|
switch (uni.getSystemInfoSync().platform) {
|
||||||
case 'android':
|
case 'android':
|
||||||
call.setVideoView(session.mine.userId, this.$refs.bigVideoView.ref, 0, false);
|
call.setVideoView(
|
||||||
call.setVideoView(session.targetId, this.$refs.smallVideoView.ref, 0, true);
|
session.mine.userId,
|
||||||
break;
|
this.$refs.bigVideoView.ref,
|
||||||
|
0,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
call.setVideoView(
|
||||||
|
session.targetId,
|
||||||
|
this.$refs.smallVideoView.ref,
|
||||||
|
0,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
break
|
||||||
case 'ios':
|
case 'ios':
|
||||||
call.setVideoView(session.mine.userId, this.$refs.bigVideoView.ref, 0);
|
call.setVideoView(
|
||||||
call.setVideoView(session.targetId, this.$refs.smallVideoView.ref, 0);
|
session.mine.userId,
|
||||||
break;
|
this.$refs.bigVideoView.ref,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
call.setVideoView(
|
||||||
|
session.targetId,
|
||||||
|
this.$refs.smallVideoView.ref,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
console.log('运行在开发者工具上')
|
console.log('运行在开发者工具上')
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
closeCameraCur() {
|
closeCameraCur() {
|
||||||
this.curCamera = !this.curCamera;
|
this.curCamera = !this.curCamera
|
||||||
let camera = call.currentCamera();
|
let camera = call.currentCamera()
|
||||||
call.enableCamera(this.curCamera, camera)
|
call.enableCamera(this.curCamera, camera)
|
||||||
},
|
},
|
||||||
closeCameraBack() {
|
closeCameraBack() {
|
||||||
this.backCamera = !this.backCamera;
|
this.backCamera = !this.backCamera
|
||||||
call.enableCamera(this.backCamera, 1)
|
call.enableCamera(this.backCamera, 1)
|
||||||
},
|
},
|
||||||
switchCamera() {
|
switchCamera() {
|
||||||
call.switchCamera();
|
call.switchCamera()
|
||||||
},
|
},
|
||||||
microphone() {
|
microphone() {
|
||||||
this.isMicrophone = !this.isMicrophone;
|
this.isMicrophone = !this.isMicrophone
|
||||||
call.enableMicrophone(this.isMicrophone);
|
call.enableMicrophone(this.isMicrophone)
|
||||||
},
|
},
|
||||||
enableSpeaker() {
|
enableSpeaker() {
|
||||||
this.isEnableSpeaker = !this.isEnableSpeaker;
|
this.isEnableSpeaker = !this.isEnableSpeaker
|
||||||
call.enableSpeaker(this.isEnableSpeaker);
|
call.enableSpeaker(this.isEnableSpeaker)
|
||||||
},
|
},
|
||||||
hangup() {
|
hangup() {
|
||||||
this.isSelf = true;
|
this.isSelf = true
|
||||||
// RCBeautyEngine.resetBeauty();
|
call.hangup()
|
||||||
call.hangup();
|
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
accept() {
|
accept() {
|
||||||
call.accept();
|
call.accept()
|
||||||
},
|
},
|
||||||
startCall() {
|
startCall() {
|
||||||
const type = this.mediaType === 'audio' ? 0 : 1;
|
const type = this.mediaType === 'audio' ? 0 : 1
|
||||||
this.mediaTypeCur = this.mediaType;
|
this.mediaTypeCur = this.mediaType
|
||||||
if (this.targetId.length > 0) {
|
if (this.targetId.length > 0) {
|
||||||
call.enableSpeaker(true);
|
call.enableSpeaker(true)
|
||||||
call.startSingleCall(this.targetId, type, null);
|
call.startSingleCall(this.targetId, type, null)
|
||||||
this.currentCallSession = call.getCurrentCallSession();
|
this.currentCallSession = call.getCurrentCallSession()
|
||||||
this.users = this.currentCallSession.users ? this.currentCallSession.users : [];
|
this.users = this.currentCallSession.users
|
||||||
|
? this.currentCallSession.users
|
||||||
|
: []
|
||||||
} else {
|
} else {
|
||||||
call.startGroupCall(this.groupId, this.userIds, [], type, '');
|
call.startGroupCall(this.groupId, this.userIds, [], type, '')
|
||||||
this.users = this.userIds;
|
this.users = this.userIds
|
||||||
|
|
||||||
console.log(this.users);
|
console.log(this.users)
|
||||||
this.currentCallSession = call.getCurrentCallSession();
|
this.currentCallSession = call.getCurrentCallSession()
|
||||||
this.users = this.currentCallSession.users ? this.currentCallSession.users : [];
|
this.users = this.currentCallSession.users
|
||||||
|
? this.currentCallSession.users
|
||||||
|
: []
|
||||||
}
|
}
|
||||||
let _this = this;
|
let _this = this
|
||||||
// im.getCurrentUserId(function(result){
|
// im.getCurrentUserId(function(result){
|
||||||
// _this.systemInfoSync(result.userId,_this.$refs.bigVideoView.ref,false);
|
// _this.systemInfoSync(result.userId,_this.$refs.bigVideoView.ref,false);
|
||||||
// })
|
// })
|
||||||
if (this.currentCallSession) {
|
if (this.currentCallSession) {
|
||||||
this.systemInfoSync(this.currentCallSession.mine.userId, this.$refs.bigVideoView.ref, false);
|
this.systemInfoSync(
|
||||||
|
this.currentCallSession.mine.userId,
|
||||||
|
this.$refs.bigVideoView.ref,
|
||||||
|
false
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onCallConnected() {
|
onCallConnected() {
|
||||||
let context = this;
|
let context = this
|
||||||
console.log('oncallconnected接收了');
|
console.log('oncallconnected接收了')
|
||||||
this.mediaTypeCur = this.mediaType;
|
this.mediaTypeCur = this.mediaType
|
||||||
call.enableSpeaker(true);
|
call.enableSpeaker(true)
|
||||||
this.currentCallSession = call.getCurrentCallSession();
|
this.currentCallSession = call.getCurrentCallSession()
|
||||||
this.callWay = this.currentCallSession.callType;
|
this.callWay = this.currentCallSession.callType
|
||||||
this.users = this.currentCallSession.users ? this.currentCallSession.users : [];
|
this.users = this.currentCallSession.users
|
||||||
let isHasMine = this.users.findIndex((item) => {
|
? this.currentCallSession.users
|
||||||
return item.userId === this.currentCallSession.mine.userId;
|
: []
|
||||||
});
|
let isHasMine = this.users.findIndex(item => {
|
||||||
|
return item.userId === this.currentCallSession.mine.userId
|
||||||
|
})
|
||||||
if (isHasMine === -1) {
|
if (isHasMine === -1) {
|
||||||
this.users.push(this.currentCallSession.mine);
|
this.users.push(this.currentCallSession.mine)
|
||||||
}
|
}
|
||||||
if (this.currentCallSession && this.currentCallSession.users.length > 0) {
|
if (
|
||||||
|
this.currentCallSession &&
|
||||||
|
this.currentCallSession.users.length > 0
|
||||||
|
) {
|
||||||
//视频是两个的时候
|
//视频是两个的时候
|
||||||
if (this.currentCallSession.users.length <= 2) {
|
if (this.currentCallSession.users.length <= 2) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.systemInfoSync(this.currentCallSession.mine.userId, this.$refs.smallVideoView.ref,
|
this.systemInfoSync(
|
||||||
true);
|
this.currentCallSession.mine.userId,
|
||||||
this.viewArr = this.currentCallSession.users.filter((item) => {
|
this.$refs.smallVideoView.ref,
|
||||||
return item.userId !== this.currentCallSession.mine.userId;
|
true
|
||||||
});
|
)
|
||||||
this.viewArr.forEach((itm) => {
|
this.viewArr = this.currentCallSession.users.filter(
|
||||||
this.targetId = itm.userId;
|
item => {
|
||||||
this.systemInfoSync(itm.userId, this.$refs.bigVideoView.ref, false);
|
return (
|
||||||
});
|
item.userId !== this.currentCallSession.mine.userId
|
||||||
}, 100);
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
this.viewArr.forEach(itm => {
|
||||||
|
this.targetId = itm.userId
|
||||||
|
this.systemInfoSync(
|
||||||
|
itm.userId,
|
||||||
|
this.$refs.bigVideoView.ref,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}, 100)
|
||||||
} else {
|
} else {
|
||||||
// 视频超过三个
|
// 视频超过三个
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.systemInfoSync(this.currentCallSession.mine.userId, this.$refs.bigVideoView.ref,
|
this.systemInfoSync(
|
||||||
false);
|
this.currentCallSession.mine.userId,
|
||||||
this.viewArr = this.currentCallSession.users.filter((item) => {
|
this.$refs.bigVideoView.ref,
|
||||||
return item.userId !== this.currentCallSession.mine.userId;
|
false
|
||||||
});
|
)
|
||||||
|
this.viewArr = this.currentCallSession.users.filter(
|
||||||
|
item => {
|
||||||
|
return (
|
||||||
|
item.userId !== this.currentCallSession.mine.userId
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.viewArr.forEach((itm) => {
|
this.viewArr.forEach(itm => {
|
||||||
this.systemInfoSync(itm.userId, this.$refs[itm.userId][0].ref,
|
this.systemInfoSync(
|
||||||
false);
|
itm.userId,
|
||||||
});
|
this.$refs[itm.userId][0].ref,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
})
|
||||||
}, 100)
|
}, 100)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -384,18 +400,18 @@
|
|||||||
systemInfoSync(userId, ref, isZOrderOnTop) {
|
systemInfoSync(userId, ref, isZOrderOnTop) {
|
||||||
switch (uni.getSystemInfoSync().platform) {
|
switch (uni.getSystemInfoSync().platform) {
|
||||||
case 'android':
|
case 'android':
|
||||||
call.setVideoView(userId, ref, 0, isZOrderOnTop);
|
call.setVideoView(userId, ref, 0, isZOrderOnTop)
|
||||||
break;
|
break
|
||||||
case 'ios':
|
case 'ios':
|
||||||
call.setVideoView(userId, ref, 0);
|
call.setVideoView(userId, ref, 0)
|
||||||
break;
|
break
|
||||||
default:
|
default:
|
||||||
console.log('运行在开发者工具上')
|
console.log('运行在开发者工具上')
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onCallDisconnected() {
|
onCallDisconnected() {
|
||||||
this.isMe = true;
|
this.isMe = true
|
||||||
if (!this.isSelf) {
|
if (!this.isSelf) {
|
||||||
uni.navigateBack({
|
uni.navigateBack({
|
||||||
delta: 1
|
delta: 1
|
||||||
@@ -403,103 +419,89 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
switchChange() {
|
switchChange() {
|
||||||
this.isChecked = !this.isChecked;
|
this.isChecked = !this.isChecked
|
||||||
if (!this.isChecked) {
|
if (!this.isChecked) {
|
||||||
this.reset();
|
this.reset()
|
||||||
} else {
|
} else {
|
||||||
this.setBeautyOption();
|
this.setBeautyOption()
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
//设置美颜
|
|
||||||
setBeautyOption() {
|
|
||||||
let option = {
|
|
||||||
whitenessLevel: this.whiteVal,
|
|
||||||
ruddyLevel: this.ruddyVal,
|
|
||||||
smoothLevel: this.buffingVal,
|
|
||||||
brightLevel: this.brightnessVal
|
|
||||||
}
|
|
||||||
if (this.isChecked) { //开启
|
|
||||||
console.log('设置美颜')
|
|
||||||
// RCBeautyEngine.setBeautyOptions(this.isChecked, option);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
//切换滤镜
|
|
||||||
cutFilte(id) {
|
|
||||||
//切换滤镜打开美颜
|
|
||||||
if (!this.isChecked) {
|
|
||||||
this.isChecked = true;
|
|
||||||
}
|
|
||||||
let option = {
|
|
||||||
whitenessLevel: this.whiteVal,
|
|
||||||
ruddyLevel: this.ruddyVal,
|
|
||||||
smoothLevel: this.buffingVal,
|
|
||||||
brightLevel: this.brightnessVal
|
|
||||||
}
|
|
||||||
//打开滤镜
|
|
||||||
this.curFilte = id;
|
|
||||||
// this.isChecked ? RCBeautyEngine.setBeautyOptions(this.isChecked, option) : '';
|
|
||||||
// RCBeautyEngine.setBeautyFilter(this.curFilte);
|
|
||||||
},
|
|
||||||
//美白
|
|
||||||
whiteChange(e) {
|
|
||||||
console.log('美白', e.detail.value);
|
|
||||||
//打开美颜
|
|
||||||
if (!this.isChecked) {
|
|
||||||
this.isChecked = true;
|
|
||||||
}
|
|
||||||
this.whiteVal = e.detail.value;
|
|
||||||
this.setBeautyOption();
|
|
||||||
},
|
|
||||||
//红润
|
|
||||||
ruddyChange(e) {
|
|
||||||
console.log('红润', e.detail.value);
|
|
||||||
//打开美颜
|
|
||||||
if (!this.isChecked) {
|
|
||||||
this.isChecked = true;
|
|
||||||
}
|
|
||||||
this.ruddyVal = e.detail.value;
|
|
||||||
this.setBeautyOption();
|
|
||||||
},
|
|
||||||
//磨皮
|
|
||||||
buffingChange(e) {
|
|
||||||
console.log('磨皮', e.detail.value);
|
|
||||||
//打开美颜
|
|
||||||
if (!this.isChecked) {
|
|
||||||
this.isChecked = true;
|
|
||||||
}
|
|
||||||
this.buffingVal = e.detail.value;
|
|
||||||
this.setBeautyOption();
|
|
||||||
},
|
|
||||||
//亮度
|
|
||||||
brightnessChange(e) {
|
|
||||||
console.log('亮度', e.detail.value);
|
|
||||||
//打开美颜
|
|
||||||
if (!this.isChecked) {
|
|
||||||
this.isChecked = true;
|
|
||||||
}
|
|
||||||
this.brightnessVal = e.detail.value;
|
|
||||||
this.setBeautyOption();
|
|
||||||
},
|
|
||||||
//重置
|
|
||||||
reset() {
|
|
||||||
// RCBeautyEngine.resetBeauty();
|
|
||||||
// this.initBeautyOpton();
|
|
||||||
},
|
|
||||||
// initBeautyOpton() {
|
|
||||||
// //初始化滤镜
|
|
||||||
// this.curFilte = RCBeautyEngine.getCurrentBeautyFilter();
|
|
||||||
// //初始化美颜参数
|
|
||||||
// let beautyOption = RCBeautyEngine.getCurrentBeautyOptions();
|
|
||||||
// this.whiteVal = beautyOption.whitenessLevel;
|
|
||||||
// this.ruddyVal = beautyOption.ruddyLevel;
|
|
||||||
// this.buffingVal = beautyOption.smoothLevel;
|
|
||||||
// this.brightnessVal = beautyOption.brightLevel;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.nav-box {
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 99;
|
||||||
|
/* height: 220rpx; */
|
||||||
|
width: 750rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding-bottom: 60rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hangup-btn {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hangup-icon {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: #ff3b30 !important;
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hangup-text {
|
||||||
|
font-size: 14rpx;
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-text {
|
||||||
|
font-size: 14rpx;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-row {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 40rpx;
|
||||||
|
/* width: 100%; */
|
||||||
|
flex-direction: row;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8rpx;
|
||||||
|
margin: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.control-icon {
|
||||||
|
width: 80rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
border-radius: 50%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -539,12 +541,6 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 200upx;
|
|
||||||
right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.camera {
|
.camera {
|
||||||
background: #ccc;
|
background: #ccc;
|
||||||
}
|
}
|
||||||
@@ -555,25 +551,13 @@
|
|||||||
background: rgba(0, 0, 0, 0.5);
|
background: rgba(0, 0, 0, 0.5);
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.hangup {
|
|
||||||
width: 200upx;
|
|
||||||
height: 100upx;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 100upx;
|
|
||||||
background: red;
|
|
||||||
margin-right: 50upx;
|
|
||||||
border-radius: 50upx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.box-mark {
|
.box-mark {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
background: rgba(0, 0, 0, .5);
|
background: rgba(0, 0, 0, 0.5);
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -679,7 +663,6 @@
|
|||||||
background: #ccc;
|
background: #ccc;
|
||||||
padding-left: 30upx;
|
padding-left: 30upx;
|
||||||
padding-right: 30upx;
|
padding-right: 30upx;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.beauty-tab {
|
.beauty-tab {
|
||||||
@@ -693,7 +676,8 @@
|
|||||||
padding-top: 40upx;
|
padding-top: 40upx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filte-view {}
|
.filte-view {
|
||||||
|
}
|
||||||
|
|
||||||
.tab-item {
|
.tab-item {
|
||||||
width: 100upx;
|
width: 100upx;
|
||||||
@@ -708,5 +692,6 @@
|
|||||||
background: yellow;
|
background: yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
.white-view {}
|
.white-view {
|
||||||
</style>
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
BIN
static/images/administrator.png
Normal file
BIN
static/images/administrator.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
560
stores/user.js
560
stores/user.js
@@ -1,332 +1,286 @@
|
|||||||
|
import { defineStore } from 'pinia'
|
||||||
import {
|
import {
|
||||||
defineStore
|
getToken,
|
||||||
} from 'pinia'
|
getUserInfoData,
|
||||||
import {
|
setUserInfoData,
|
||||||
getToken,
|
removeUserInfoData,
|
||||||
getUserInfoData,
|
getSig,
|
||||||
setUserInfoData,
|
setSig,
|
||||||
removeUserInfoData,
|
removeSig,
|
||||||
getSig,
|
getFontSize,
|
||||||
setSig,
|
setFontSize,
|
||||||
removeSig,
|
removeFontSize
|
||||||
getFontSize,
|
|
||||||
setFontSize,
|
|
||||||
removeFontSize
|
|
||||||
} from '@/utils/storage'
|
} from '@/utils/storage'
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
import {
|
import { useLoginState } from '@/uni_modules/tuikit-atomic-x/state/LoginState'
|
||||||
useLoginState
|
import * as CallLib from '@/uni_modules/RongCloud-CallWrapper/lib/index'
|
||||||
} from '@/uni_modules/tuikit-atomic-x/state/LoginState'
|
|
||||||
import * as CallLib from "@/uni_modules/RongCloud-CallWrapper/lib/index"
|
|
||||||
import RCIMIWEngine from '@/uni_modules/RongCloud-IMWrapper-V2/js_sdk/RCIMEngine'
|
import RCIMIWEngine from '@/uni_modules/RongCloud-IMWrapper-V2/js_sdk/RCIMEngine'
|
||||||
import permision from "@/js_sdk/wa-permission/permission.js"
|
import { reasonDeal, errorDeal, imCode } from '@/utils/code.js'
|
||||||
import {reasonDeal,errorDeal,imCode} from '@/utils/code.js'
|
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
import {
|
import { useLoginState } from 'tuikit-atomicx-vue3'
|
||||||
useLoginState
|
|
||||||
} from 'tuikit-atomicx-vue3'
|
|
||||||
// #endif
|
// #endif
|
||||||
import {
|
import { useTokenStore } from './token'
|
||||||
useTokenStore
|
import { getUserData, userLogout, updateUserData } from '@/api'
|
||||||
} from './token'
|
import { ref } from 'vue'
|
||||||
import {
|
import { useUI } from '@/utils/use-ui'
|
||||||
getUserData,
|
import { reLaunch } from '@/utils/router'
|
||||||
userLogout,
|
import { getTencentUserSig } from '@/api'
|
||||||
updateUserData
|
import { TUILogin } from '@tencentcloud/tui-core-lite'
|
||||||
} from '@/api'
|
import { TUIChatEngine } from '@tencentcloud/chat-uikit-engine-lite'
|
||||||
import {
|
import { getUserIntegral } from '@/api/my-index'
|
||||||
ref
|
import { removeFriendList, removeGroupList } from '../utils/storage'
|
||||||
} from 'vue'
|
import { getRongYunLoginInfo } from '../api'
|
||||||
import {
|
|
||||||
useUI
|
|
||||||
} from '@/utils/use-ui'
|
|
||||||
import {
|
|
||||||
reLaunch
|
|
||||||
} from '@/utils/router'
|
|
||||||
import {
|
|
||||||
getTencentUserSig
|
|
||||||
} from '@/api'
|
|
||||||
import {
|
|
||||||
TUILogin
|
|
||||||
} from '@tencentcloud/tui-core-lite'
|
|
||||||
import {
|
|
||||||
TUIChatEngine
|
|
||||||
} from '@tencentcloud/chat-uikit-engine-lite'
|
|
||||||
import {
|
|
||||||
getUserIntegral
|
|
||||||
} from '@/api/my-index'
|
|
||||||
import {
|
|
||||||
removeFriendList,
|
|
||||||
removeGroupList
|
|
||||||
} from '../utils/storage'
|
|
||||||
import {
|
|
||||||
getRongYunLoginInfo
|
|
||||||
} from '../api'
|
|
||||||
|
|
||||||
export const useUserStore = defineStore('user', () => {
|
export const useUserStore = defineStore('user', () => {
|
||||||
const {
|
const { clearToken } = useTokenStore()
|
||||||
clearToken
|
const { showDialog, showToast } = useUI()
|
||||||
} = useTokenStore()
|
|
||||||
const {
|
|
||||||
showDialog,
|
|
||||||
showToast
|
|
||||||
} = useUI()
|
|
||||||
|
|
||||||
const userInfo = ref(
|
const userInfo = ref(
|
||||||
getUserInfoData() ? JSON?.parse(getUserInfoData()) : {}
|
getUserInfoData() ? JSON?.parse(getUserInfoData()) : {}
|
||||||
)
|
)
|
||||||
/** 用户字体大小 */
|
/** 用户字体大小 */
|
||||||
const fontSizeData = ref(getFontSize())
|
const fontSizeData = ref(getFontSize())
|
||||||
|
|
||||||
/** 腾讯 IM 存储数据 */
|
/** 腾讯 IM 存储数据 */
|
||||||
const tencentUserSig = ref(getSig() ? JSON?.parse(getSig()) : {})
|
const tencentUserSig = ref(getSig() ? JSON?.parse(getSig()) : {})
|
||||||
|
|
||||||
/** 用户积分数 */
|
/** 用户积分数 */
|
||||||
const integralData = ref(0)
|
const integralData = ref(0)
|
||||||
const imEngine = ref(null)
|
/** 融云 IM 引擎 */
|
||||||
|
const imEngine = ref(null)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户信息(可从缓存或接口)
|
* 获取用户信息(可从缓存或接口)
|
||||||
*/
|
*/
|
||||||
const fetchUserInfo = async () => {
|
const fetchUserInfo = async () => {
|
||||||
// 尝试从本地缓存读取
|
// 尝试从本地缓存读取
|
||||||
const cachedToken = getToken()
|
const cachedToken = getToken()
|
||||||
const cachedUserInfo = getUserInfoData()
|
const cachedUserInfo = getUserInfoData()
|
||||||
const cachedSig = getSig()
|
const cachedSig = getSig()
|
||||||
|
|
||||||
if (cachedToken && cachedUserInfo) {
|
if (cachedToken && cachedUserInfo) {
|
||||||
userInfo.value = JSON.parse(cachedUserInfo)
|
userInfo.value = JSON.parse(cachedUserInfo)
|
||||||
tencentUserSig.value = JSON.parse(cachedSig)
|
tencentUserSig.value = JSON.parse(cachedSig)
|
||||||
loginTencentIM()
|
loginTencentIM()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await getIntegral()
|
await getIntegral()
|
||||||
const res = await getUserData()
|
const res = await getUserData()
|
||||||
await setUserInfo(res.data)
|
await setUserInfo(res.data)
|
||||||
loginTencentIM()
|
loginTencentIM()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置用户信息
|
* 设置用户信息
|
||||||
*/
|
*/
|
||||||
const setUserInfo = async data => {
|
const setUserInfo = async data => {
|
||||||
const res = await getTencentUserSig()
|
const res = await getTencentUserSig()
|
||||||
const ryData = await getRongYunLoginInfo()
|
const ryData = await getRongYunLoginInfo()
|
||||||
const IM_DATA = {
|
const IM_DATA = {
|
||||||
...res.data,
|
...res.data,
|
||||||
...ryData.data
|
...ryData.data
|
||||||
}
|
}
|
||||||
tencentUserSig.value = IM_DATA
|
tencentUserSig.value = IM_DATA
|
||||||
userInfo.value = data
|
userInfo.value = data
|
||||||
setUserInfoData(data)
|
setUserInfoData(data)
|
||||||
setSig(IM_DATA)
|
setSig(IM_DATA)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取用户积分 */
|
/** 获取用户积分 */
|
||||||
const getIntegral = async () => {
|
const getIntegral = async () => {
|
||||||
const res = await getUserIntegral()
|
const res = await getUserIntegral()
|
||||||
integralData.value = res.data.availablePoints
|
integralData.value = res.data.availablePoints
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录腾讯 IM
|
* 登录腾讯 IM
|
||||||
*/
|
*/
|
||||||
const loginTencentIM = async () => {
|
const loginTencentIM = async () => {
|
||||||
await refreshUserInfo()
|
await refreshUserInfo()
|
||||||
await TUILogin.login({
|
await TUILogin.login({
|
||||||
SDKAppID: tencentUserSig.value.sdkappID,
|
SDKAppID: tencentUserSig.value.sdkappID,
|
||||||
userID: tencentUserSig.value.userId,
|
userID: tencentUserSig.value.userId,
|
||||||
userSig: tencentUserSig.value.userSig,
|
userSig: tencentUserSig.value.userSig,
|
||||||
framework: `vue3`
|
framework: `vue3`
|
||||||
})
|
})
|
||||||
|
|
||||||
await TUIChatEngine.login({
|
await TUIChatEngine.login({
|
||||||
SDKAppID: tencentUserSig.value.sdkappID,
|
SDKAppID: tencentUserSig.value.sdkappID,
|
||||||
userID: tencentUserSig.value.userId,
|
userID: tencentUserSig.value.userId,
|
||||||
userSig: tencentUserSig.value.userSig,
|
userSig: tencentUserSig.value.userSig,
|
||||||
useUploadPlugin: true // 使用文件上传插件
|
useUploadPlugin: true // 使用文件上传插件
|
||||||
})
|
})
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
await useLoginState().login({
|
await useLoginState().login({
|
||||||
SDKAppID: tencentUserSig.value.sdkappID,
|
SDKAppID: tencentUserSig.value.sdkappID,
|
||||||
userID: tencentUserSig.value.userId,
|
userID: tencentUserSig.value.userId,
|
||||||
userSig: tencentUserSig.value.userSig
|
userSig: tencentUserSig.value.userSig
|
||||||
})
|
})
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
await useLoginState().login({
|
await useLoginState().login({
|
||||||
sdkAppID: tencentUserSig.value.sdkappID,
|
sdkAppID: tencentUserSig.value.sdkappID,
|
||||||
userID: tencentUserSig.value.userId,
|
userID: tencentUserSig.value.userId,
|
||||||
userSig: tencentUserSig.value.userSig
|
userSig: tencentUserSig.value.userSig
|
||||||
})
|
})
|
||||||
console.log(tencentUserSig.value.appKey, '====')
|
console.log(tencentUserSig.value.appKey, '====')
|
||||||
connectIM()
|
await connectIM()
|
||||||
// #endif
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//连接融云IM
|
//连接融云IM
|
||||||
async function connectIM() {
|
const connectIM = async () => {
|
||||||
const options = {
|
const options = {
|
||||||
naviServer: ''
|
naviServer: ''
|
||||||
}
|
}
|
||||||
imEngine.value = await RCIMIWEngine.create(tencentUserSig.value.appKey, options)
|
imEngine.value = await RCIMIWEngine.create(
|
||||||
imEngine.value.setOnConnectedListener((res) => {
|
tencentUserSig.value.appKey,
|
||||||
if (res.code != 0) {
|
options
|
||||||
uni.hideLoading();
|
)
|
||||||
uni.showToast({
|
imEngine.value.setOnConnectedListener(res => {
|
||||||
title: 'OnCon:' + res.code,
|
if (res.code != 0) {
|
||||||
icon: 'error'
|
uni.hideLoading()
|
||||||
})
|
uni.showToast({
|
||||||
return
|
title: 'OnCon:' + res.code,
|
||||||
}
|
icon: 'error'
|
||||||
//连接成功
|
})
|
||||||
CallLib.init({});
|
return
|
||||||
onAllListeners()
|
}
|
||||||
console.log('call.init')
|
//连接成功
|
||||||
// this.libPage = true;
|
CallLib.init({})
|
||||||
// this.loginUserId = res.userId;
|
console.log('call.init')
|
||||||
uni.hideLoading();
|
// this.libPage = true;
|
||||||
console.log('登录成功')
|
// this.loginUserId = res.userId;
|
||||||
if (uni.getSystemInfoSync().platform === 'android') {
|
uni.hideLoading()
|
||||||
permision.requestAndroidPermission('android.permission.CAMERA');
|
console.log('登录成功')
|
||||||
permision.requestAndroidPermission('android.permission.RECORD_AUDIO');
|
})
|
||||||
}
|
const callback = {
|
||||||
});
|
onDatabaseOpened: res => {
|
||||||
let code = await imEngine.value.connect(tencentUserSig.value.ryToken, 10)
|
console.log('数据库打开')
|
||||||
if (code != 0) {
|
},
|
||||||
uni.hideLoading();
|
onConnected: res => {
|
||||||
uni.showToast({
|
console.log(res)
|
||||||
title: 'connect:' + code,
|
if (res.code === 0) {
|
||||||
icon: 'error'
|
// uni.showToast({
|
||||||
})
|
// title: '连接成功',
|
||||||
}
|
// icon: 'none'
|
||||||
}
|
// })
|
||||||
|
console.log('连接成功')
|
||||||
function onAllListeners(){
|
} else if (res.code === 34001) {
|
||||||
CallLib.onCallReceived(res => {
|
// uni.showToast({
|
||||||
console.log(res)
|
// title: '连接已存在,不需要再连接',
|
||||||
console.log(
|
// icon: 'none'
|
||||||
'Engine:OnCallReceived=>' + '监听通话呼入, 目标id=>',
|
// })
|
||||||
res.data.targetId
|
console.log('连接已存在,不需要再连接')
|
||||||
)
|
}
|
||||||
})
|
}
|
||||||
|
}
|
||||||
CallLib.onCallConnected(res => {
|
let code = await imEngine.value.connect(
|
||||||
console.log(res)
|
tencentUserSig.value.ryToken,
|
||||||
console.log(
|
10,
|
||||||
'Engine:OnCallConnected=>' +
|
callback
|
||||||
'已建立通话通话接通时,通过回调 onCallConnected 通知当前 call 的详细信息',
|
)
|
||||||
res
|
if (code != 0) {
|
||||||
)
|
uni.hideLoading()
|
||||||
})
|
uni.showToast({
|
||||||
|
title: 'connect:' + code,
|
||||||
CallLib.onRemoteUserJoined(res => {
|
icon: 'error'
|
||||||
console.log(
|
})
|
||||||
'Engine:OnRemoteUserJoined=>' +
|
}
|
||||||
'主叫端拨出电话,被叫端收到请求后,加入通话,被叫端Id为=>',
|
}
|
||||||
res.data.userId
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
CallLib.onCallDisconnected(res => {
|
|
||||||
console.log(
|
|
||||||
'Engine:OnCallDisconnected=>' + '挂断成功, 挂断原因=>',
|
|
||||||
res.data.reason
|
|
||||||
)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 清除用户信息(退出登录)
|
* 清除用户信息(退出登录)
|
||||||
*/
|
*/
|
||||||
const clearUserInfo = async () => {
|
const clearUserInfo = async () => {
|
||||||
const show = await showDialog('提示', '确定要退出登录吗?')
|
const show = await showDialog('提示', '确定要退出登录吗?')
|
||||||
if (show) {
|
if (show) {
|
||||||
await logout()
|
await logout()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出登录(不带提示)
|
* 退出登录(不带提示)
|
||||||
*/
|
*/
|
||||||
const logout = async () => {
|
const logout = async () => {
|
||||||
if (!userInfo.value) return
|
if (!userInfo.value) return
|
||||||
try {
|
try {
|
||||||
userInfo.value = null
|
userInfo.value = null
|
||||||
|
|
||||||
await userLogout()
|
await userLogout()
|
||||||
await TUILogin.logout()
|
await TUILogin.logout()
|
||||||
await TUIChatEngine.logout()
|
await TUIChatEngine.logout()
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
removeFriendList()
|
removeFriendList()
|
||||||
removeGroupList()
|
removeGroupList()
|
||||||
await useLoginState().logout()
|
await useLoginState().logout()
|
||||||
// #endif
|
// #endif
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
await useLoginState().logout()
|
await useLoginState().logout()
|
||||||
// #endif
|
// #endif
|
||||||
clearAllUserInfo()
|
clearAllUserInfo()
|
||||||
await showToast('退出登录成功', 'success')
|
await showToast('退出登录成功', 'success')
|
||||||
reLaunch('/pages/login/login')
|
reLaunch('/pages/login/login')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
clearAllUserInfo()
|
clearAllUserInfo()
|
||||||
await showToast('退出登录成功', 'success')
|
await showToast('退出登录成功', 'success')
|
||||||
reLaunch('/pages/login/login')
|
reLaunch('/pages/login/login')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 清空所有用户缓存 */
|
/** 清空所有用户缓存 */
|
||||||
const clearAllUserInfo = async () => {
|
const clearAllUserInfo = async () => {
|
||||||
userInfo.value = null
|
userInfo.value = null
|
||||||
tencentUserSig.value = null
|
tencentUserSig.value = null
|
||||||
fontSizeData.value = 26
|
fontSizeData.value = 26
|
||||||
clearToken()
|
clearToken()
|
||||||
removeUserInfoData()
|
removeUserInfoData()
|
||||||
removeSig()
|
removeSig()
|
||||||
removeFontSize()
|
removeFontSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 刷新用户信息(如用户信息被修改) */
|
/** 刷新用户信息(如用户信息被修改) */
|
||||||
const refreshUserInfo = async () => {
|
const refreshUserInfo = async () => {
|
||||||
const res = await getUserData()
|
const res = await getUserData()
|
||||||
await getIntegral()
|
await getIntegral()
|
||||||
await setUserInfoData(res.data)
|
await setUserInfoData(res.data)
|
||||||
userInfo.value = res.data
|
userInfo.value = res.data
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新部分用户信息(例如昵称、头像)
|
* 更新部分用户信息(例如昵称、头像)
|
||||||
*/
|
*/
|
||||||
const updateUserInfo = async partialData => {
|
const updateUserInfo = async partialData => {
|
||||||
if (!userInfo.value) return
|
if (!userInfo.value) return
|
||||||
await updateUserData(partialData)
|
await updateUserData(partialData)
|
||||||
await refreshUserInfo()
|
await refreshUserInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 更新字体大小 */
|
/** 更新字体大小 */
|
||||||
const updateFontSize = async fontSize => {
|
const updateFontSize = async fontSize => {
|
||||||
fontSizeData.value = fontSize
|
fontSizeData.value = fontSize
|
||||||
setFontSize(fontSize)
|
setFontSize(fontSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
userInfo,
|
imEngine,
|
||||||
integralData,
|
userInfo,
|
||||||
tencentUserSig,
|
integralData,
|
||||||
fontSizeData,
|
tencentUserSig,
|
||||||
getIntegral,
|
fontSizeData,
|
||||||
clearAllUserInfo,
|
getIntegral,
|
||||||
updateFontSize,
|
clearAllUserInfo,
|
||||||
logout,
|
updateFontSize,
|
||||||
refreshUserInfo,
|
logout,
|
||||||
fetchUserInfo,
|
refreshUserInfo,
|
||||||
loginTencentIM,
|
fetchUserInfo,
|
||||||
setUserInfo,
|
loginTencentIM,
|
||||||
clearUserInfo,
|
setUserInfo,
|
||||||
updateUserInfo
|
clearUserInfo,
|
||||||
}
|
updateUserInfo
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
|||||||
@@ -33,6 +33,13 @@
|
|||||||
},
|
},
|
||||||
fail: (code, msg) => {
|
fail: (code, msg) => {
|
||||||
console.error(`sendTextMessage failed, code: ${code}, msg: ${msg}`);
|
console.error(`sendTextMessage failed, code: ${code}, msg: ${msg}`);
|
||||||
|
if (code == 10017) {
|
||||||
|
uni.showModal({
|
||||||
|
title: '提示',
|
||||||
|
content: '你被禁止发言',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
inputValue.value = ""
|
inputValue.value = ""
|
||||||
|
|||||||
@@ -1,313 +1,396 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="bottom-drawer-container" v-if="modelValue">
|
<view class="bottom-drawer-container" v-if="modelValue">
|
||||||
<view class="drawer-overlay" @tap="close"></view>
|
<view class="drawer-overlay" @tap="close"></view>
|
||||||
<view class="bottom-drawer" :class="{ 'drawer-open': modelValue }">
|
<view class="bottom-drawer" :class="{ 'drawer-open': modelValue }">
|
||||||
|
<view class="drawer-header">
|
||||||
<view class="drawer-header">
|
<view class="user-info">
|
||||||
<view class="user-info">
|
<image
|
||||||
<image class="user-avatar" :src="userInfo?.avatarURL || defaultAvatarURL" mode="aspectFill" />
|
class="user-avatar"
|
||||||
<view class="user-details">
|
:src="userInfo?.avatarURL || defaultAvatarURL"
|
||||||
<view class="name-badge-row">
|
mode="aspectFill"
|
||||||
<text class="user-name">{{ userInfo?.userName || userInfo?.userID || '' }}</text>
|
/>
|
||||||
<!-- <view class="badge">
|
<view class="user-details">
|
||||||
|
<view class="name-badge-row">
|
||||||
|
<text class="user-name">
|
||||||
|
{{ userInfo?.userName || userInfo?.userID || '' }}
|
||||||
|
</text>
|
||||||
|
<!-- <view class="badge">
|
||||||
<image class="badge-icon" src="/static/images/heart.png" mode="aspectFit" />
|
<image class="badge-icon" src="/static/images/heart.png" mode="aspectFit" />
|
||||||
<text class="badge-text">65</text>
|
<text class="badge-text">65</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<text class="user-id">ID: {{ userInfo?.userID || '' }}</text>
|
<text class="user-id">ID: {{ userInfo?.userID || '' }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="follow-button" @tap="followUser">
|
<!-- <view class="follow-button" @tap="followUser">
|
||||||
<text class="follow-text">Follow</text>
|
<text class="follow-text">Follow</text>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="drawer-content">
|
<view class="drawer-content">
|
||||||
<view class="drawer-actions">
|
<view class="drawer-actions">
|
||||||
<!-- <view class="action-btn" @tap="muteSpeak">
|
<view class="action-btn" @tap="muteSpeak">
|
||||||
<view class="action-btn-image-container">
|
<view class="action-btn-image-container">
|
||||||
<image class="action-btn-image" v-if="userInfo?.isMessageDisabled" src="/static/images/unmute-speak.png"
|
<image
|
||||||
mode="aspectFit" />
|
class="action-btn-image"
|
||||||
<image class="action-btn-image" v-else src="/static/images/mute-speak.png" mode="aspectFit" />
|
v-if="userInfo?.isMessageDisabled"
|
||||||
</view>
|
src="/static/images/unmute-speak.png"
|
||||||
<text class="action-btn-content" v-if="userInfo?.isMessageDisabled">解除禁言</text>
|
mode="aspectFit"
|
||||||
<text class="action-btn-content" v-else>禁言</text>
|
/>
|
||||||
</view> -->
|
<image
|
||||||
<view class="action-btn" @tap="kickOut">
|
class="action-btn-image"
|
||||||
<view class="action-btn-image-container">
|
v-else
|
||||||
<image class="action-btn-image" src="/static/images/kick-out-room.png" mode="aspectFit" />
|
src="/static/images/mute-speak.png"
|
||||||
</view>
|
mode="aspectFit"
|
||||||
<text class="action-btn-content">踢出房间</text>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<text
|
||||||
<!-- <view class="divider-line-container">
|
class="action-btn-content"
|
||||||
|
v-if="userInfo?.isMessageDisabled"
|
||||||
|
>
|
||||||
|
解除禁言
|
||||||
|
</text>
|
||||||
|
<text class="action-btn-content" v-else>禁言</text>
|
||||||
|
</view>
|
||||||
|
<view class="action-btn" @tap="kickOut">
|
||||||
|
<view class="action-btn-image-container">
|
||||||
|
<image
|
||||||
|
class="action-btn-image"
|
||||||
|
src="/static/images/kick-out-room.png"
|
||||||
|
mode="aspectFit"
|
||||||
|
/>
|
||||||
|
</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>
|
<view class="divider-line"></view>
|
||||||
</view> -->
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import { ref, computed } from 'vue'
|
||||||
ref
|
import { useLiveListState } from '@/uni_modules/tuikit-atomic-x/state/LiveListState'
|
||||||
} from 'vue';
|
import { useLiveAudienceState } from '@/uni_modules/tuikit-atomic-x/state/LiveAudienceState'
|
||||||
import {
|
const { currentLive } = useLiveListState()
|
||||||
useLiveListState
|
const {
|
||||||
} from "@/uni_modules/tuikit-atomic-x/state/LiveListState";
|
setAdministrator,
|
||||||
import {
|
revokeAdministrator,
|
||||||
useLiveAudienceState
|
kickUserOutOfRoom,
|
||||||
} from "@/uni_modules/tuikit-atomic-x/state/LiveAudienceState";
|
disableSendMessage
|
||||||
const {
|
} = useLiveAudienceState(uni?.$liveID)
|
||||||
currentLive
|
|
||||||
} = useLiveListState();
|
|
||||||
const {
|
|
||||||
setAdministrator,
|
|
||||||
revokeAdministrator,
|
|
||||||
kickUserOutOfRoom,
|
|
||||||
disableSendMessage
|
|
||||||
} = useLiveAudienceState(uni?.$liveID);
|
|
||||||
|
|
||||||
const defaultAvatarURL = 'https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_01.png';
|
const defaultAvatarURL =
|
||||||
const props = defineProps({
|
'https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_01.png'
|
||||||
modelValue: {
|
const props = defineProps({
|
||||||
type: Boolean,
|
modelValue: {
|
||||||
default: false
|
type: Boolean,
|
||||||
},
|
default: false
|
||||||
userInfo: {
|
},
|
||||||
type: Object,
|
userInfo: {
|
||||||
},
|
type: Object
|
||||||
liveID: {
|
},
|
||||||
type: String,
|
liveID: {
|
||||||
}
|
type: String
|
||||||
});
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['update:modelValue']);
|
const emit = defineEmits(['update:modelValue', 'update:userInfo'])
|
||||||
const close = () => {
|
|
||||||
emit('update:modelValue', false);
|
|
||||||
};
|
|
||||||
|
|
||||||
const muteSpeak = () => {
|
const userData = computed({
|
||||||
console.log(
|
get() {
|
||||||
`mute or unMute speak, liveID: ${props.liveID}, isMessageDisabled: ${props?.userInfo?.isMessageDisabled}`);
|
return props.userInfo
|
||||||
const params = {
|
},
|
||||||
liveID: uni?.$liveID,
|
set(value) {
|
||||||
userID: props?.userInfo?.userID,
|
emit('update:userInfo', value)
|
||||||
isDisable: !props?.userInfo?.isMessageDisabled,
|
}
|
||||||
};
|
})
|
||||||
|
|
||||||
if (props?.userInfo?.isMessageDisabled) {
|
const close = () => {
|
||||||
disableSendMessage(params);
|
emit('update:modelValue', false)
|
||||||
} else {
|
}
|
||||||
disableSendMessage(params);
|
|
||||||
}
|
|
||||||
|
|
||||||
close();
|
/** 设置为管理员 */
|
||||||
};
|
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 kickOut = () => {
|
const muteSpeak = () => {
|
||||||
console.log('kick out from room', props?.userInfo?.userID);
|
console.log(
|
||||||
|
`mute or unMute speak, liveID: ${props.liveID}, isMessageDisabled: ${props?.userInfo?.isMessageDisabled}`
|
||||||
|
)
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
uni.showModal({
|
close()
|
||||||
content: `确认踢出${props?.userInfo?.userName || props?.userInfo?.userID}吗?`,
|
}
|
||||||
success: (res) => {
|
}
|
||||||
if (res.confirm) {
|
})
|
||||||
kickUserOutOfRoom({
|
}
|
||||||
liveID: uni?.$liveID,
|
|
||||||
userID: props?.userInfo?.userID,
|
|
||||||
success: () => {
|
|
||||||
close()
|
|
||||||
console.log(`kickUserOutOfRoom success`);
|
|
||||||
},
|
|
||||||
fail: (errCode, errMsg) => {
|
|
||||||
console.log(`kickUserOutOfRoom fail errCode: ${errCode}, errMsg: ${errMsg}`);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const followUser = () => {
|
const kickOut = () => {
|
||||||
console.warn('== 关注用户 ', userInfo?.userName);
|
console.log('kick out from room', props?.userInfo?.userID)
|
||||||
// 这里可以添加关注用户的逻辑
|
|
||||||
uni.showToast({
|
uni.showModal({
|
||||||
title: '关注成功',
|
content: `确认踢出${
|
||||||
icon: 'success'
|
props?.userInfo?.userName || props?.userInfo?.userID
|
||||||
});
|
}吗?`,
|
||||||
}
|
success: res => {
|
||||||
|
if (res.confirm) {
|
||||||
|
kickUserOutOfRoom({
|
||||||
|
liveID: uni?.$liveID,
|
||||||
|
userID: props?.userInfo?.userID,
|
||||||
|
success: () => {
|
||||||
|
close()
|
||||||
|
console.log(`kickUserOutOfRoom success`)
|
||||||
|
},
|
||||||
|
fail: (errCode, errMsg) => {
|
||||||
|
console.log(
|
||||||
|
`kickUserOutOfRoom fail errCode: ${errCode}, errMsg: ${errMsg}`
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const followUser = () => {
|
||||||
|
console.warn('== 关注用户 ', userInfo?.userName)
|
||||||
|
// 这里可以添加关注用户的逻辑
|
||||||
|
uni.showToast({
|
||||||
|
title: '关注成功',
|
||||||
|
icon: 'success'
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.bottom-drawer-container {
|
.bottom-drawer-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-overlay {
|
.drawer-overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
background-color: rgba(0, 0, 0, 0.4);
|
background-color: rgba(0, 0, 0, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottom-drawer {
|
.bottom-drawer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
background: rgba(34, 38, 46, 1);
|
background: rgba(34, 38, 46, 1);
|
||||||
border-top-left-radius: 32rpx;
|
border-top-left-radius: 32rpx;
|
||||||
border-top-right-radius: 32rpx;
|
border-top-right-radius: 32rpx;
|
||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
transition-property: transform;
|
transition-property: transform;
|
||||||
transition-duration: 0.3s;
|
transition-duration: 0.3s;
|
||||||
transition-timing-function: ease;
|
transition-timing-function: ease;
|
||||||
height: 400rpx;
|
height: 400rpx;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-open {
|
.drawer-open {
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-header {
|
.drawer-header {
|
||||||
padding: 40rpx 48rpx;
|
padding: 40rpx 48rpx;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-info {
|
.user-info {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-avatar {
|
.user-avatar {
|
||||||
width: 80rpx;
|
width: 80rpx;
|
||||||
height: 80rpx;
|
height: 80rpx;
|
||||||
border-radius: 40rpx;
|
border-radius: 40rpx;
|
||||||
border-width: 2rpx;
|
border-width: 2rpx;
|
||||||
border-color: #ffffff;
|
border-color: #ffffff;
|
||||||
margin-right: 20rpx;
|
margin-right: 20rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-details {
|
.user-details {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name-badge-row {
|
.name-badge-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 8rpx;
|
margin-bottom: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-name {
|
.user-name {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge {
|
.badge {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: #8B5CF6;
|
background-color: #8b5cf6;
|
||||||
padding: 4rpx 12rpx;
|
padding: 4rpx 12rpx;
|
||||||
border-radius: 16rpx;
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge-icon {
|
.badge-icon {
|
||||||
width: 24rpx;
|
width: 24rpx;
|
||||||
height: 24rpx;
|
height: 24rpx;
|
||||||
margin-right: 8rpx;
|
margin-right: 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge-text {
|
.badge-text {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-id {
|
.user-id {
|
||||||
color: rgba(255, 255, 255, 0.7);
|
color: rgba(255, 255, 255, 0.7);
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.follow-button {
|
.follow-button {
|
||||||
background-color: #007AFF;
|
background-color: #007aff;
|
||||||
padding: 12rpx 32rpx;
|
padding: 12rpx 32rpx;
|
||||||
border-radius: 32rpx;
|
border-radius: 32rpx;
|
||||||
/* height: 64rpx; */
|
/* height: 64rpx; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.follow-text {
|
.follow-text {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-content {
|
.drawer-content {
|
||||||
height: 400rpx;
|
height: 400rpx;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
padding: 0 48rpx;
|
padding: 0 48rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-actions {
|
.drawer-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn {
|
.action-btn {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-left: 10rpx;
|
margin-left: 10rpx;
|
||||||
height: 160rpx;
|
height: 160rpx;
|
||||||
width: 120rpx
|
width: 120rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn-image-container {
|
.action-btn-image-container {
|
||||||
width: 100rpx;
|
width: 100rpx;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
background-color: rgba(43, 44, 48, 1);
|
background-color: rgba(43, 44, 48, 1);
|
||||||
margin-bottom: 16rpx;
|
margin-bottom: 16rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn-image {
|
.action-btn-image {
|
||||||
width: 50rpx;
|
width: 50rpx;
|
||||||
height: 50rpx;
|
height: 50rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-btn-content {
|
.action-btn-content {
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: rgba(255, 255, 255, 0.9);
|
color: rgba(255, 255, 255, 0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider-line-container {
|
.divider-line-container {
|
||||||
height: 68rpx;
|
height: 68rpx;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.divider-line {
|
.divider-line {
|
||||||
width: 268rpx;
|
width: 268rpx;
|
||||||
height: 10rpx;
|
height: 10rpx;
|
||||||
border-radius: 200rpx;
|
border-radius: 200rpx;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 16rpx;
|
bottom: 16rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user