wangxia 3 months ago
commit 952f4790fe

@ -2,7 +2,10 @@
<span <span
class="appellation" class="appellation"
:style="{ color: color, fontSize: fontSize + 'px' }" :style="{ color: color, fontSize: fontSize + 'px' }"
>{{ appellation }}</span >
{{ appellation }}
<span v-if="subtitle" style="color: orange;">{{ subtitle }}</span>
</span
> >
</template> </template>
@ -17,9 +20,9 @@ import {
import { deepClone } from '../utils' import { deepClone } from '../utils'
const appellation = ref('') const appellation = ref('-')
const { account, teamId, ignoreAlias, nickFromMsg } = withDefaults( const { pid,account, teamId, ignoreAlias, nickFromMsg } = withDefaults(
defineProps<{ defineProps<{
account: string account: string
teamId?: string teamId?: string
@ -27,6 +30,7 @@ const { account, teamId, ignoreAlias, nickFromMsg } = withDefaults(
nickFromMsg?: string nickFromMsg?: string
color?: string color?: string
fontSize?: number fontSize?: number
pid?: number
}>(), }>(),
{ {
teamId: undefined, teamId: undefined,
@ -34,18 +38,38 @@ const { account, teamId, ignoreAlias, nickFromMsg } = withDefaults(
nickFromMsg: '-', nickFromMsg: '-',
color: '#333', color: '#333',
fontSize: 16, fontSize: 16,
pid:0
} }
) )
const subtitle = ref('');
const uninstallAppellationWatch = autorun(() => { const uninstallAppellationWatch = autorun(() => {
appellation.value = deepClone( if(pid){
uni.$UIKitStore.uiStore.getAppellation({ async function getUserInfo() {
account, try {
teamId, const res = await uni.$UIKitStore.userStore.getUserActive(pid.split('|')[2])
ignoreAlias, return res
nickFromMsg, } catch (error) {
console.error('getUserInfo error:', error)
}
}
getUserInfo().then(res => {
if(res.serverExtension){
subtitle.value = '@' + JSON.parse(res.serverExtension).fullName;
}else{
subtitle.value = '';
}
appellation.value = res.name;
}) })
) }else{
appellation.value = deepClone(
uni.$UIKitStore.uiStore.getAppellation({
account,
teamId,
ignoreAlias,
nickFromMsg,
})
)
}
}) })
onUnmounted(() => { onUnmounted(() => {
uninstallAppellationWatch() uninstallAppellationWatch()

@ -23,7 +23,7 @@
</div> </div>
<div class="conversation-item-right"> <div class="conversation-item-right">
<div class="conversation-item-top"> <div class="conversation-item-top">
<Appellation class="conversation-item-title u-skeleton-fillet" fontSize="17" v-if="conversation.type === V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P" :account="to" /> <Appellation :pid="props.conversation.conversationId" class="conversation-item-title u-skeleton-fillet" fontSize="17" v-if="conversation.type === V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_P2P" :account="to" />
<span v-else class="conversation-item-title u-skeleton-fillet"> <span v-else class="conversation-item-title u-skeleton-fillet">
{{ sessionName }} {{ sessionName }}
</span> </span>
@ -273,6 +273,7 @@ function handleTouchMove(event: TouchEvent) {
} }
function handleConversationItemClick() { function handleConversationItemClick() {
uni.setStorageSync("selectopenimid", props.conversation.conversationId);
if (props.showMoreActions) { if (props.showMoreActions) {
emit("leftSlide", null); emit("leftSlide", null);
return; return;

@ -1,5 +1,5 @@
<template> <template>
<div v-if="!isConnected && text " class="network-alert"> <div v-if="!isConnected && text && false " class="network-alert">
{{ text }} {{ text }}
</div> </div>
</template> </template>

@ -93,7 +93,7 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 1" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }}
</div> </div>
<div :class="props.msg.isSelf ? 'self-msg-recall' : 'msg-recall'"> <div :class="props.msg.isSelf ? 'self-msg-recall' : 'msg-recall'">
@ -114,8 +114,8 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 2" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }} <span v-if="subtitle" style="color: orange;">{{ subtitle }}</span>
</div> </div>
<MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true"> <MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true">
<ReplyMessage v-if="!!replyMsg" :replyMsg="replyMsg"></ReplyMessage> <ReplyMessage v-if="!!replyMsg" :replyMsg="replyMsg"></ReplyMessage>
@ -135,7 +135,7 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 3" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }}
</div> </div>
<MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true" style="cursor: pointer"> <MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true" style="cursor: pointer">
@ -161,7 +161,7 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 4" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }}
</div> </div>
<MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true" style="cursor: pointer"> <MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true" style="cursor: pointer">
@ -187,7 +187,7 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 5" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }}
</div> </div>
<MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true"> <MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true">
@ -206,7 +206,7 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 6" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }}
</div> </div>
<MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="false"> <MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="false">
@ -228,7 +228,7 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 7" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }}
</div> </div>
<MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true" style="cursor: pointer"> <MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true" style="cursor: pointer">
@ -355,7 +355,7 @@
: '' : ''
" :goto-user-card="true" /> " :goto-user-card="true" />
<div class="msg-content"> <div class="msg-content">
<div class="msg-name" v-if="!props.msg.isSelf"> <div class="msg-name 8" v-if="!props.msg.isSelf">
{{ appellation }} {{ appellation }}
</div> </div>
<MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true"> <MessageBubble :msg="props.msg" :tooltip-visible="true" :bg-visible="true">
@ -436,7 +436,7 @@
}) })
// //
const appellation = ref('') const appellation = ref('-')
const accountId = uni.$UIKitStore?.userStore?.myUserInfo.accountId const accountId = uni.$UIKitStore?.userStore?.myUserInfo.accountId
// //
@ -503,20 +503,40 @@
const handleReeditMsg = (msg : V2NIMMessageForUI) => { const handleReeditMsg = (msg : V2NIMMessageForUI) => {
uni.$emit(events.ON_REEDIT_MSG, msg) uni.$emit(events.ON_REEDIT_MSG, msg)
} }
const subtitle = ref('')
// //
const uninstallAppellationWatch = autorun(() => { const uninstallAppellationWatch = autorun(() => {
// > > > // > > >
appellation.value = deepClone( if(uni.getStorageSync('selectopenimid')){
uni.$UIKitStore.uiStore.getAppellation({ async function getUserInfo() {
account: props.msg.senderId, try {
teamId: const res = await uni.$UIKitStore.userStore.getUserActive(uni.getStorageSync('selectopenimid').split('|')[2])
conversationType === return res
V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM } catch (error) {
? to console.error('getUserInfo error:', error)
: '', }
}
getUserInfo().then(res => {
if(res.serverExtension){
subtitle.value = '@' + JSON.parse(res.serverExtension).fullName;
}else{
subtitle.value = '';
}
appellation.value = res.name;
}) })
) }else{
appellation.value = deepClone(
uni.$UIKitStore.uiStore.getAppellation({
account: props.msg.senderId,
teamId:
conversationType ===
V2NIMConst.V2NIMConversationType.V2NIM_CONVERSATION_TYPE_TEAM
? to
: '',
})
)
}
}) })
onUnmounted(() => { onUnmounted(() => {

@ -21,10 +21,10 @@
顶部聊天区域高度传过来{{msgKeyHeight}} 本页面{{screenHeight1}} {{rell}}--> 顶部聊天区域高度传过来{{msgKeyHeight}} 本页面{{screenHeight1}} {{rell}}-->
</div> </div>
<!-- 底部往上推paddingBottom + {{paddingBottom}} <!-- 滚动条位置scrollTop + {{scrollTop}}
底部往上推paddingBottom + {{paddingBottom}} 底部往上推paddingBottom + {{paddingBottom}}
聊天内容高度msgKeyHeight + {{msgKeyHeight}} 聊天内容高度msgKeyHeight + {{msgKeyHeight}}
--> -->
</view> </view>
</scroll-view> </scroll-view>
@ -98,7 +98,7 @@
// .selectViewport() // .selectViewport()
.scrollOffset((res) => { .scrollOffset((res) => {
scroll_new = res.scrollHeight; scroll_new = res.scrollHeight;
scrollTop.value = scroll_new - scroll_old; // scrollTop.value = scroll_new - scroll_old;
// // console.log("", scroll_new); // // console.log("", scroll_new);
}) })

Loading…
Cancel
Save