|
@@ -7,13 +7,14 @@
|
|
|
<!-- 顶部导航 -->
|
|
|
<div class="header-chat">
|
|
|
<svg-icon class="page-icon" name="lf-arrow" @click="goBack" />
|
|
|
- <div class="header-title">{{ wsStore.toUserInfo.nickname || '群聊' }}</div>
|
|
|
+ <div class="header-title" v-if="wsStore.toUserInfo.type == 'group'">{{ wsStore.toUserInfo.nickname || '群聊' }}({{ groupMembersArr.length }})</div>
|
|
|
+ <div v-else class="header-title">{{ wsStore.toUserInfo.nickname }}</div>
|
|
|
<svg-icon class="page-icon" name="more" @click="goDetail" />
|
|
|
</div>
|
|
|
|
|
|
<!-- 群公告 -->
|
|
|
- <div class="groupNotice" v-if="!noticeRead && wsStore.toUserInfo.type == 'group'" @click="showNotice = true">
|
|
|
- <div class="m-ellipsis">{{ wsStore.toUserInfo.notice }}</div>
|
|
|
+ <div class="groupNotice" v-if="!noticeRead && wsStore.toUserInfo.type == 'group' && wsStore.toUserInfo.notice" @click="showNotice = true">
|
|
|
+ <div class="m-ellipsis">群公告:{{ wsStore.toUserInfo.notice }}</div>
|
|
|
<svg-icon class="item-icon" name="right1" />
|
|
|
</div>
|
|
|
|
|
@@ -35,7 +36,7 @@
|
|
|
class="list-img"
|
|
|
:class="isSender(item.toUsername, item) ? 'mr12' : 'ml12'"
|
|
|
round
|
|
|
- :src="item.sender?item.sender.avatar:item.avatar"
|
|
|
+ :src="formatAvatarUrl(item)"
|
|
|
@click="goToPage(item)"
|
|
|
/>
|
|
|
<!-- 内容 -->
|
|
@@ -144,6 +145,10 @@
|
|
|
cancel-text="取消"
|
|
|
@select="onActionSelect"
|
|
|
/>
|
|
|
+ <!-- @样式 -->
|
|
|
+ <div class="assign" v-if="wsStore.toUserInfo.type == 'group'">
|
|
|
+ <div class="assign-text">有人@我</div>
|
|
|
+ </div>
|
|
|
<!-- 引用消息展示 -->
|
|
|
<div v-if="quoteMsg" class="quote-box">
|
|
|
<div class="quote-content">{{ quoteMsg.fromUsername}}:{{ renderQuoteContent(quoteMsg) }}</div>
|
|
@@ -327,7 +332,20 @@ const emojis = [
|
|
|
const atList = ref();
|
|
|
const showBurn = ref(false) // 阅后即焚是否开启
|
|
|
const showNotice = ref(false);
|
|
|
-const noticeRead = ref(false)
|
|
|
+const noticeRead = ref(false);
|
|
|
+const groupMembersArr = ref([]);
|
|
|
+
|
|
|
+const currentMsg = ref('');
|
|
|
+const showActionSheet = ref(false)
|
|
|
+const actions = ref([])
|
|
|
+
|
|
|
+const formatAvatarUrl = (item) => {
|
|
|
+ const url = item?.sender?.avatar || item?.avatar || ''
|
|
|
+ if (/^https?:\/\//.test(url)) {
|
|
|
+ return url
|
|
|
+ }
|
|
|
+ return IM_PATH + url
|
|
|
+}
|
|
|
|
|
|
const isSender = (toUsername, item) => {
|
|
|
if(item?.sender){
|
|
@@ -559,7 +577,7 @@ const destroyMessage = (message) => {
|
|
|
const handleNoticeClose = () => {
|
|
|
console.log(11)
|
|
|
showNotice.value = false
|
|
|
- noticeRead.value = true
|
|
|
+ // noticeRead.value = true
|
|
|
}
|
|
|
|
|
|
|
|
@@ -670,15 +688,21 @@ const onSelectUser = (user) => {
|
|
|
ccMsg.value.push(user)
|
|
|
};
|
|
|
|
|
|
-const currentMsg = ref('');
|
|
|
-const showActionSheet = ref(false)
|
|
|
-const actions = [
|
|
|
- { name: "复制", key: "copy" },
|
|
|
- { name: "撤回", key: "revoke" },
|
|
|
- { name: "引用", key: "quote" },
|
|
|
- // { name: "置顶", key: "stick" },
|
|
|
-];
|
|
|
const onLongPress = (msg) => {
|
|
|
+ if(msg.toUsername == walletStore.account){
|
|
|
+ actions.value = [
|
|
|
+ { name: "复制", key: "copy" },
|
|
|
+ { name: "引用", key: "quote" },
|
|
|
+ // { name: "置顶", key: "stick" },
|
|
|
+ ]
|
|
|
+ }else{
|
|
|
+ actions.value = [
|
|
|
+ { name: "复制", key: "copy" },
|
|
|
+ { name: "撤回", key: "revoke" },
|
|
|
+ { name: "引用", key: "quote" },
|
|
|
+ // { name: "置顶", key: "stick" },
|
|
|
+ ]
|
|
|
+ }
|
|
|
currentMsg.value = msg;
|
|
|
showActionSheet.value = true;
|
|
|
};
|
|
@@ -825,6 +849,7 @@ const formatTime = (timestamp) => {
|
|
|
// 页面生命周期
|
|
|
onMounted(async () => {
|
|
|
wsStore.toUserInfo.uuid = route.query.uuid;
|
|
|
+ groupMembersArr.value = await wsStore.fetchGroupMembers();
|
|
|
await wsStore.getMessages({
|
|
|
uuid: wsStore.toUserInfo.type == 'user'?walletStore.account : route.query.uuid,
|
|
|
messageType: wsStore.toUserInfo.type == 'user'?1:2, //1:个人 2:群组
|
|
@@ -1259,6 +1284,17 @@ const goDetail = () =>{
|
|
|
color: red;
|
|
|
margin-left: 6px;
|
|
|
}
|
|
|
+.assign{
|
|
|
+ margin-bottom: 20px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ .assign-text{
|
|
|
+ color: #fff;
|
|
|
+ background: #4765dd;
|
|
|
+ border-radius: 30px 0 0 30px;
|
|
|
+ padding: 3px 10px;
|
|
|
+ }
|
|
|
+}
|
|
|
// 引用样式
|
|
|
.quote-box {
|
|
|
display: flex;
|