fix(component): 🐛 修复群聊当前登录用户右键菜单功能逻辑错误

修复用户上线状态不更新
This commit is contained in:
nongyehong 2024-11-19 23:01:09 +08:00
parent 2f2a2a2068
commit 00c35ff6fe
8 changed files with 102 additions and 13 deletions

View File

@ -7,5 +7,6 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="ts-external-references" level="project" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptLibraryMappings">
<file url="PROJECT" libraries="{ts-external-references}" />
</component>
</project>

View File

@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="ts-external-references" type="javaScript">
<properties>
<sourceFilesUrls>
<item url="file://$PROJECT_DIR$/node_modules/.pnpm/@rspack+core@1.1.0_@swc+helpers@0.5.15/node_modules/@rspack/core/module.d.ts" />
</sourceFilesUrls>
</properties>
<CLASSES>
<root url="file://$PROJECT_DIR$/node_modules/.pnpm/@rspack+core@1.1.0_@swc+helpers@0.5.15/node_modules/@rspack/core/module.d.ts" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -128,7 +128,6 @@ import { useDebounceFn } from '@vueuse/core'
const groupStore = useGroupStore()
const globalStore = useGlobalStore()
const groupUserList = computed(() => groupStore.userList)
console.log('groupUserList', groupUserList.value)
const userList = computed(() => {
return groupUserList.value.map((item: UserItem) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -152,7 +151,6 @@ const { optionsList, report, selectKey } = useChatMain()
const { handlePopoverUpdate } = usePopover(selectKey, 'image-chat-sidebar')
watch(userList, (newVal) => {
console.log('newVal', newVal)
//
if (searchRef.value) {
filteredUserList.value = newVal.filter((user) => user.name.toLowerCase().includes(searchRef.value.toLowerCase()))

View File

@ -178,7 +178,8 @@ export const useChatMain = (activeItem?: SessionItem) => {
{
label: 'TA',
icon: 'aite',
click: () => {}
click: () => {},
visible: (item: any) => (item.uid ? item.uid !== userUid.value : item.fromUser.uid !== userUid.value)
},
{
label: '查看资料',
@ -189,6 +190,12 @@ export const useChatMain = (activeItem?: SessionItem) => {
Mitt.emit(`${MittEnum.INFO_POPOVER}-${type}`, { uid: uid, type: type })
}
},
{
label: '修改群昵称',
icon: 'edit',
click: () => {},
visible: (item: any) => (item.uid ? item.uid === userUid.value : item.fromUser.uid === userUid.value)
},
{
label: '添加好友',
icon: 'people-plus',

View File

@ -137,15 +137,15 @@ class WS {
// 获取用户详情
await chatStore.getSessionList(true)
// 自己更新自己上线
// groupStore.batchUpdateUserStatus([
// {
// activeStatus: OnlineEnum.ONLINE,
// avatar: rest.avatar,
// lastOptTime: Date.now(),
// name: rest.name,
// uid: rest.uid
// }
// ])
groupStore.batchUpdateUserStatus([
{
activeStatus: OnlineEnum.ONLINE,
avatar: rest.avatar,
lastOptTime: Date.now(),
name: rest.name,
uid: rest.uid
}
])
// TODO 先不获取 emoji 列表,当我点击 emoji 按钮的时候再获取
// await emojiStore.getEmojiList()
Mitt.emit(WsResEnum.LOGIN_SUCCESS, params.data)

View File

@ -121,7 +121,6 @@ export const useGroupStore = defineStore('group', () => {
for (let index = 0, len = items.length; index < len; index++) {
const curUser = items[index]
const findIndex = userList.value.findIndex((item) => item.uid === curUser.uid)
console.log(findIndex)
userList.value[findIndex] = {
...userList.value[findIndex],
activeStatus: items[index].activeStatus

View File

@ -0,0 +1,64 @@
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
ActionBar: typeof import('./../components/windows/ActionBar.vue')['default']
AddFriendsModal: typeof import('./../components/common/AddFriendsModal.vue')['default']
ApplyList: typeof import('./../components/rightBox/ApplyList.vue')['default']
ChatBox: typeof import('./../components/rightBox/chatBox/index.vue')['default']
ChatFooter: typeof import('./../components/rightBox/chatBox/ChatFooter.vue')['default']
ChatHeader: typeof import('./../components/rightBox/chatBox/ChatHeader.vue')['default']
ChatMain: typeof import('./../components/rightBox/chatBox/ChatMain.vue')['default']
ChatSidebar: typeof import('./../components/rightBox/chatBox/ChatSidebar.vue')['default']
ContextMenu: typeof import('./../components/common/ContextMenu.vue')['default']
Details: typeof import('./../components/rightBox/Details.vue')['default']
Emoji: typeof import('./../components/rightBox/emoji/index.vue')['default']
Image: typeof import('./../components/rightBox/renderMessage/Image.vue')['default']
InfoPopover: typeof import('./../components/common/InfoPopover.vue')['default']
MsgInput: typeof import('./../components/rightBox/MsgInput.vue')['default']
NaiveProvider: typeof import('./../components/common/NaiveProvider.vue')['default']
NAvatar: typeof import('naive-ui')['NAvatar']
NAvatarGroup: typeof import('naive-ui')['NAvatarGroup']
NBadge: typeof import('naive-ui')['NBadge']
NButton: typeof import('naive-ui')['NButton']
NButtonGroup: typeof import('naive-ui')['NButtonGroup']
NCheckbox: typeof import('naive-ui')['NCheckbox']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDialogProvider: typeof import('naive-ui')['NDialogProvider']
NDropdown: typeof import('naive-ui')['NDropdown']
NEllipsis: typeof import('naive-ui')['NEllipsis']
NFlex: typeof import('naive-ui')['NFlex']
NIcon: typeof import('naive-ui')['NIcon']
NIconWrapper: typeof import('naive-ui')['NIconWrapper']
NImage: typeof import('naive-ui')['NImage']
NImageGroup: typeof import('naive-ui')['NImageGroup']
NInput: typeof import('naive-ui')['NInput']
NLoadingBarProvider: typeof import('naive-ui')['NLoadingBarProvider']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']
NModalProvider: typeof import('naive-ui')['NModalProvider']
NNotificationProvider: typeof import('naive-ui')['NNotificationProvider']
NPopover: typeof import('naive-ui')['NPopover']
NPopselect: typeof import('naive-ui')['NPopselect']
NQrCode: typeof import('naive-ui')['NQrCode']
NRadio: typeof import('naive-ui')['NRadio']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSkeleton: typeof import('naive-ui')['NSkeleton']
NSpin: typeof import('naive-ui')['NSpin']
NSwitch: typeof import('naive-ui')['NSwitch']
NTab: typeof import('naive-ui')['NTab']
NTabs: typeof import('naive-ui')['NTabs']
NTooltip: typeof import('naive-ui')['NTooltip']
NVirtualList: typeof import('naive-ui')['NVirtualList']
RenderMessage: typeof import('./../components/rightBox/renderMessage/index.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
Screenshot: typeof import('./../components/common/Screenshot.vue')['default']
Text: typeof import('./../components/rightBox/renderMessage/Text.vue')['default']
}
}