修复已知问题
This commit is contained in:
@@ -30,11 +30,12 @@
|
||||
import backSVG from '../../../assets/icon/back.svg'
|
||||
import { useUI } from '../../../../utils/use-ui'
|
||||
import { endUserService } from '../../../../api/my-index'
|
||||
import { navigateBack, reLaunch } from '../../../../utils/router'
|
||||
|
||||
const { showDialog, showToast } = useUI()
|
||||
|
||||
const emits = defineEmits(['openGroupManagement'])
|
||||
const props = defineProps(['isGroup', 'serviceID'])
|
||||
const props = defineProps(['isGroup', 'serviceID', 'type'])
|
||||
|
||||
const currentConversation = ref<IConversationModel>()
|
||||
const typingStatus = ref(false)
|
||||
@@ -91,15 +92,19 @@
|
||||
}
|
||||
|
||||
const back = async () => {
|
||||
if (props.type === 'GROUP') {
|
||||
reLaunch('/')
|
||||
return
|
||||
}
|
||||
if (props.serviceID) {
|
||||
const show = await showDialog('提示', '确定要退出当前会话吗?')
|
||||
if (show) {
|
||||
await endUserService(props.serviceID)
|
||||
await showToast('结束服务成功')
|
||||
uni.navigateBack()
|
||||
navigateBack()
|
||||
}
|
||||
} else {
|
||||
uni.navigateBack()
|
||||
navigateBack()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="chat" :style="{ marginBottom: keywordHight + 'px' }">
|
||||
<TUICallKit></TUICallKit>
|
||||
<div :class="['tui-chat', !isPC && 'tui-chat-h5']">
|
||||
<div
|
||||
v-if="!currentConversationID"
|
||||
@@ -15,6 +16,7 @@
|
||||
:isGroup="!isNotInGroup ? isGroup : null"
|
||||
:headerExtensionList="headerExtensionList"
|
||||
:serviceID="serviceID"
|
||||
:type="backStatusName"
|
||||
@closeChat="closeChat"
|
||||
@openGroupManagement="handleGroup"
|
||||
/>
|
||||
@@ -101,6 +103,7 @@
|
||||
TUIConstants,
|
||||
ExtensionInfo
|
||||
} from '@tencentcloud/tui-core-lite'
|
||||
import { TUICallKit } from '@trtc/calls-uikit-vue'
|
||||
import ChatHeader from './chat-header/index.vue'
|
||||
import MessageList from './message-list/index.vue'
|
||||
import MessageInput from './message-input/index.vue'
|
||||
@@ -121,7 +124,11 @@
|
||||
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||
import { initChat, logout } from './entry-chat-only.ts'
|
||||
|
||||
// 返回状态
|
||||
const backStatusName = ref('')
|
||||
|
||||
onLoad(options => {
|
||||
backStatusName.value = options?.type || ''
|
||||
serviceID.value = options?.id || ''
|
||||
initChat(options)
|
||||
})
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
v-else-if="item.type === TYPES.MSG_LOCATION"
|
||||
:content="item.getMessageContent()"
|
||||
/>
|
||||
<!-- 自定义消息,目前只支持【红包】 -->
|
||||
<!-- 自定义消息,目前只支持:红包,商品详情 -->
|
||||
<MessageCustom
|
||||
v-else-if="item.type === TYPES.MSG_CUSTOM"
|
||||
ref="customRefMessage"
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
>
|
||||
<Avatar
|
||||
useSkeletonAnimation
|
||||
:type="message.conversationType"
|
||||
:id="message.from"
|
||||
:url="message.avatar || ''"
|
||||
:style="{ flex: '0 0 auto' }"
|
||||
/>
|
||||
|
||||
@@ -100,6 +100,22 @@
|
||||
</text> -->
|
||||
</view>
|
||||
</template>
|
||||
<!-- 商品详情 -->
|
||||
<template
|
||||
v-else-if="customData.businessID === CHAT_MSG_CUSTOM_TYPE.GOODS"
|
||||
>
|
||||
<view class="goods-box" @click="onGoods">
|
||||
<image
|
||||
mode="heightFix"
|
||||
:src="goodsData.cover"
|
||||
class="img-box"
|
||||
></image>
|
||||
<view class="right-box">
|
||||
<text class="name">{{ goodsData.title }}</text>
|
||||
<text class="price">¥ {{ goodsData.price }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span v-html="content.custom" />
|
||||
</template>
|
||||
@@ -125,6 +141,7 @@
|
||||
import star from '../../../../assets/icon/star-light.png'
|
||||
import unopenedEnvelope from '../../../../assets/icon/unopened-envelope.svg'
|
||||
import kaiEnvelope from '../../../../assets/icon/kai-unopened-envelope.svg'
|
||||
import { navigateTo } from '../../../../../utils/router'
|
||||
|
||||
interface Props {
|
||||
messageItem: IMessageModel
|
||||
@@ -173,6 +190,16 @@
|
||||
}
|
||||
})
|
||||
|
||||
/** 商品详情显示数据 */
|
||||
const goodsData = computed(() => {
|
||||
return JSON.parse(props.messageItem.payload.data)
|
||||
})
|
||||
|
||||
/** 点击商品详情 */
|
||||
const onGoods = () => {
|
||||
navigateTo('/pages/mall/detail', { productId: goodsData.value.id })
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
custom.value = props.content
|
||||
message.value = props.messageItem
|
||||
@@ -298,4 +325,38 @@
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-box {
|
||||
display: flex;
|
||||
.img-box {
|
||||
flex-shrink: 0;
|
||||
width: 180rpx;
|
||||
height: 240rpx;
|
||||
border-radius: 12rpx;
|
||||
overflow: hidden;
|
||||
background: rgb(182, 182, 182);
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
.right-box {
|
||||
width: 50vw;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
.name {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
}
|
||||
.price {
|
||||
font-size: 28rpx;
|
||||
font-weight: 500;
|
||||
color: #ff7201;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -171,7 +171,7 @@ const isHoverFingerPointer = computed<boolean>(() => {
|
||||
|
||||
function openReadUserPanel() {
|
||||
if (isHoverFingerPointer.value) {
|
||||
emits('openReadUserPanel');
|
||||
// emits('openReadUserPanel');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -380,19 +380,25 @@
|
||||
|
||||
/** 是否最开始创建群聊 */
|
||||
const isFirstCreateGroup = (item: IConversationModel) => {
|
||||
// 打印
|
||||
if (item.type === 'GROUP' && item?.lastMessage?.payload?.data) {
|
||||
const data = JSON.parse(item?.lastMessage?.payload?.data)
|
||||
return data.content === 'Create Group'
|
||||
? `${item.getLastMessage('text')?.split(':')[0]}:创建群聊`
|
||||
: ''
|
||||
}
|
||||
// if (item.type === 'GROUP' && item?.lastMessage?.payload?.data) {
|
||||
// const data = JSON.parse(item?.lastMessage?.payload?.data)
|
||||
// return data.content === 'Create Group'
|
||||
// ? `${item.getLastMessage('text')?.split(':')[0]}:创建群聊`
|
||||
// : ''
|
||||
// }
|
||||
if (item?.lastMessage?.payload?.data) {
|
||||
const data = JSON.parse(item?.lastMessage?.payload?.data)
|
||||
const text = item.getLastMessage('text')?.split(':')
|
||||
const isText = text && text.length > 1
|
||||
if (data.businessID === CHAT_MSG_CUSTOM_TYPE.GOODS) {
|
||||
console.log(item, '==2222222=')
|
||||
|
||||
return `自定义数据--`
|
||||
if (isText) {
|
||||
return `${text[0]}:[商品信息] ${data.title}`
|
||||
} else {
|
||||
return `[商品信息]:${data.title}`
|
||||
}
|
||||
}
|
||||
if (data.content === 'Create Group' && item.type === 'GROUP') {
|
||||
return `${item.getLastMessage('text')?.split(':')[0]}:创建群聊`
|
||||
}
|
||||
return ''
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
height: avatarSize,
|
||||
borderRadius: '80rpx'
|
||||
}"
|
||||
@click="onTopAvatar"
|
||||
>
|
||||
<template v-if="isUniFrameWork">
|
||||
<image
|
||||
@@ -42,14 +43,26 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import TUICore, { TUIConstants } from '@tencentcloud/tui-core-lite'
|
||||
import { ref, toRefs } from '../../../adapter-vue'
|
||||
import { isUniFrameWork } from '../../../utils/env'
|
||||
import TUIChatEngine, {
|
||||
TUIFriendService
|
||||
} from '@tencentcloud/chat-uikit-engine-lite'
|
||||
import { useAuthUser } from '../../../../composables/useAuthUser'
|
||||
import { navigateTo } from '@/utils/router'
|
||||
import { useUI } from '../../../../utils/use-ui'
|
||||
|
||||
const { tencentUserSig } = useAuthUser()
|
||||
const { showLoading, hideLoading } = useUI()
|
||||
|
||||
interface IProps {
|
||||
url: string
|
||||
size?: string
|
||||
borderRadius?: string
|
||||
useSkeletonAnimation?: boolean
|
||||
id?: string
|
||||
type?: string
|
||||
}
|
||||
|
||||
interface IEmits {
|
||||
@@ -66,7 +79,9 @@
|
||||
url: 'https://web.sdk.qcloud.com/component/TUIKit/assets/avatar_21.png',
|
||||
size: '36px',
|
||||
borderRadius: '5px',
|
||||
useSkeletonAnimation: false
|
||||
useSkeletonAnimation: false,
|
||||
id: '',
|
||||
type: ''
|
||||
})
|
||||
|
||||
const {
|
||||
@@ -97,6 +112,52 @@
|
||||
}
|
||||
emits('onError', e)
|
||||
}
|
||||
|
||||
/** 点击头像跳转 */
|
||||
const onTopAvatar = () => {
|
||||
console.log(props.type)
|
||||
if (props.id) {
|
||||
showLoading()
|
||||
TUICore.callService({
|
||||
serviceName: TUIConstants.TUISearch.SERVICE.NAME,
|
||||
method: TUIConstants.TUISearch.SERVICE.METHOD.SEARCH_USER,
|
||||
params: {
|
||||
userID: props.id
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res.data, '==')
|
||||
const searchList = res.data
|
||||
if (searchList.length > 0) {
|
||||
TUIFriendService.checkFriend({
|
||||
type: TUIChatEngine.TYPES.SNS_CHECK_TYPE_BOTH,
|
||||
userIDList: [searchList[0].userID]
|
||||
})
|
||||
.then(v => {
|
||||
const isShow =
|
||||
v.data.successUserIDList[0].relation ===
|
||||
TUIChatEngine.TYPES.SNS_TYPE_BOTH_WAY
|
||||
hideLoading()
|
||||
navigateTo('/pages/adduser/details', {
|
||||
id: searchList[0].userID,
|
||||
state: props.type,
|
||||
type: isShow
|
||||
? '1'
|
||||
: searchList[0].userID == tencentUserSig.value.userId
|
||||
? '99'
|
||||
: ''
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
hideLoading()
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -122,9 +183,7 @@
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #ececec;
|
||||
transition:
|
||||
opacity 0.3s,
|
||||
background-color 0.1s ease-out;
|
||||
transition: opacity 0.3s, background-color 0.1s ease-out;
|
||||
|
||||
&.skeleton-animation {
|
||||
animation: breath 2s linear 0.3s infinite;
|
||||
|
||||
Reference in New Issue
Block a user