QAQ
This commit is contained in:
@@ -173,6 +173,7 @@
|
||||
'message-tool-out': item.flow === 'out',
|
||||
'message-tool-in': item.flow === 'in'
|
||||
}"
|
||||
:role="userType"
|
||||
:messageItem="item"
|
||||
:isMultipleSelectMode="isMultipleSelectMode"
|
||||
@toggleMultipleSelectMode="
|
||||
@@ -237,7 +238,8 @@
|
||||
TUIStore,
|
||||
StoreName,
|
||||
TUITranslateService,
|
||||
TUIChatService
|
||||
TUIChatService,
|
||||
TUIGroupService
|
||||
} from '@tencentcloud/chat-uikit-engine-lite'
|
||||
import {
|
||||
setInstanceMapping,
|
||||
@@ -287,6 +289,7 @@
|
||||
import { navigateTo } from '../../../../utils/router'
|
||||
import { useUI } from '../../../../utils/use-ui'
|
||||
import { useUserStore } from '../../../../stores/user'
|
||||
import { useAuthUser } from '../../../../composables/useAuthUser'
|
||||
|
||||
interface IEmits {
|
||||
(e: 'closeInputToolBar'): void
|
||||
@@ -316,6 +319,9 @@
|
||||
const isOfficial = TUIStore.getData(StoreName.APP, 'isOfficial')
|
||||
const thisInstance = getCurrentInstance()?.proxy || getCurrentInstance()
|
||||
|
||||
const { tencentUserSig } = useAuthUser()
|
||||
/** 当前用户状态 */
|
||||
const userType = ref('')
|
||||
const messageList = ref<IMessageModel[]>()
|
||||
const multipleSelectedMessageIDList = ref<string[]>([])
|
||||
const isCompleted = ref(false)
|
||||
@@ -370,7 +376,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
// Retrieve the information about whether the audio has been played from localStorage
|
||||
audioPlayedMapping.value =
|
||||
chatStorage.getChatStorage('audioPlayedMapping') || {}
|
||||
@@ -388,6 +394,20 @@
|
||||
setInstanceMapping('messageList', thisInstance)
|
||||
|
||||
uni.$on('scroll-to-bottom', scrollToLatestMessage)
|
||||
|
||||
/**
|
||||
* isGroup: boolean
|
||||
groupID: string
|
||||
isNotInGroup: boolean
|
||||
*/
|
||||
|
||||
if (props.isGroup) {
|
||||
const res = await TUIGroupService.getGroupMemberProfile({
|
||||
groupID: props.groupID,
|
||||
userIDList: [tencentUserSig.value.userId]
|
||||
})
|
||||
userType.value = res.data.memberList[0].role
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
|
||||
@@ -30,7 +30,8 @@
|
||||
TUIStore,
|
||||
StoreName,
|
||||
TUITranslateService,
|
||||
IMessageModel
|
||||
IMessageModel,
|
||||
TUIGroupService
|
||||
} from '@tencentcloud/chat-uikit-engine-lite'
|
||||
import { TUIGlobal } from '@tencentcloud/universal-api'
|
||||
import {
|
||||
@@ -64,6 +65,7 @@
|
||||
// #endif
|
||||
|
||||
interface IProps {
|
||||
role?: string
|
||||
messageItem: IMessageModel
|
||||
isMultipleSelectMode: boolean
|
||||
}
|
||||
@@ -75,8 +77,10 @@
|
||||
const emits = defineEmits<IEmits>()
|
||||
const props = withDefaults(defineProps<IProps>(), {
|
||||
isMultipleSelectMode: false,
|
||||
messageItem: () => ({} as IMessageModel)
|
||||
role: '',
|
||||
messageItem: () => ({}) as IMessageModel
|
||||
})
|
||||
|
||||
const featureConfig = TUIChatConfig.getFeatureConfig()
|
||||
|
||||
const TYPES = TUIChatEngine.TYPES
|
||||
@@ -116,18 +120,10 @@
|
||||
key: 'revoke',
|
||||
text: TUITranslateService.t('TUIChat.撤回'),
|
||||
iconUrl: revokeIcon,
|
||||
renderCondition() {
|
||||
renderCondition: () => {
|
||||
if (!featureConfig.RevokeMessage || !message.value) return false
|
||||
if (isRedEnvelopeMessage(message.value)) return false
|
||||
|
||||
// console.log(message.value.conversationType === 'GROUP', '====')
|
||||
console.log(message.value, '====')
|
||||
// if (message.value.conversationType === 'GROUP') {
|
||||
// TUIGroupService.getGroupAttributes({
|
||||
// groupID: 'group1',
|
||||
// keyList: ['key1', 'key2']
|
||||
// })
|
||||
// }
|
||||
if (isRevokeMessage(message.value)) return true
|
||||
return (
|
||||
message.value.flow === 'out' &&
|
||||
message.value.status === 'success'
|
||||
@@ -214,7 +210,7 @@
|
||||
const message = ref<IMessageModel>()
|
||||
const messageToolDom = ref<HTMLElement>()
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
TUIStore.watch(StoreName.CHAT, {
|
||||
translateTextInfo: onMessageTranslationInfoUpdated,
|
||||
voiceToTextInfo: onMessageConvertInfoUpdated
|
||||
@@ -430,6 +426,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 判断群聊时撤回状态 */
|
||||
const isRevokeMessage = (message: IMessageModel): boolean => {
|
||||
if (message.conversationType === 'GROUP') {
|
||||
if (props.role === 'Owner') {
|
||||
return true
|
||||
}
|
||||
if (props.role === 'Admin') {
|
||||
return true
|
||||
}
|
||||
return message.flow === 'out' && message.status === 'success'
|
||||
}
|
||||
return message.flow === 'out' && message.status === 'success'
|
||||
}
|
||||
|
||||
function onMessageTranslationInfoUpdated(
|
||||
info: Map<string, ITranslateInfo[]>
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user