diff --git a/frontend/components.d.ts b/frontend/components.d.ts index 9f7913a..b6418b7 100644 --- a/frontend/components.d.ts +++ b/frontend/components.d.ts @@ -16,17 +16,28 @@ declare module 'vue' { BatteryPop: typeof import('./src/components/taskbar/BatteryPop.vue')['default'] Browser: typeof import('./src/components/builtin/Browser.vue')['default'] Calendar: typeof import('./src/components/builtin/Calendar.vue')['default'] - Chat: typeof import('./src/components/localchat/Chat.vue')['default'] + Chat: typeof import('./src/components/chat/Chat.vue')['default'] + ChatBox: typeof import('./src/components/chat/ChatBox.vue')['default'] ChatContent: typeof import('./src/components/localchat/ChatContent.vue')['default'] ChatDomain: typeof import('./src/components/localchat/ChatDomain.vue')['default'] ChatEditor: typeof import('./src/components/localchat/ChatEditor.vue')['default'] ChatFoot: typeof import('./src/components/localchat/ChatFoot.vue')['default'] + ChatHeader: typeof import('./src/components/chat/ChatHeader.vue')['default'] + ChatHistory: typeof import('./src/components/chat/ChatHistory.vue')['default'] + ChatList: typeof import('./src/components/chat/ChatList.vue')['default'] + ChatMenu: typeof import('./src/components/chat/ChatMenu.vue')['default'] + ChatMessage: typeof import('./src/components/chat/ChatMessage.vue')['default'] + ChatMsgList: typeof import('./src/components/chat/ChatMsgList.vue')['default'] ChatNav: typeof import('./src/components/localchat/ChatNav.vue')['default'] + ChatUserList: typeof import('./src/components/chat/ChatUserList.vue')['default'] + ChatUserSetting: typeof import('./src/components/chat/ChatUserSetting.vue')['default'] + ChatWorkList: typeof import('./src/components/chat/ChatWorkList.vue')['default'] CloseButton: typeof import('./src/components/ui/CloseButton.vue')['default'] CloseDesktop: typeof import('./src/components/desktop/CloseDesktop.vue')['default'] ColorPicker: typeof import('./src/components/setting/ColorPicker.vue')['default'] Computer: typeof import('./src/components/computer/Computer.vue')['default'] ComputerNavBar: typeof import('./src/components/computer/ComputerNavBar.vue')['default'] + Conservation: typeof import('./src/components/chat/Conservation.vue')['default'] ContextMenu: typeof import('./src/components/builtin/ContextMenu.vue')['default'] CreateUrl: typeof import('./src/components/builtin/CreateUrl.vue')['default'] CustomIcon: typeof import('./src/components/taskbar/CustomIcon.vue')['default'] @@ -41,6 +52,7 @@ declare module 'vue' { EditFileName: typeof import('./src/components/builtin/EditFileName.vue')['default'] EditType: typeof import('./src/components/builtin/EditType.vue')['default'] ElAlert: typeof import('element-plus/es')['ElAlert'] + ElAside: typeof import('element-plus/es')['ElAside'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElButton: typeof import('element-plus/es')['ElButton'] @@ -51,16 +63,20 @@ declare module 'vue' { ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] ElCol: typeof import('element-plus/es')['ElCol'] ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] + ElContainer: typeof import('element-plus/es')['ElContainer'] ElDatePicker: typeof import('element-plus/es')['ElDatePicker'] ElDialog: typeof import('element-plus/es')['ElDialog'] ElDrawer: typeof import('element-plus/es')['ElDrawer'] ElEmpty: typeof import('element-plus/es')['ElEmpty'] + ElFooter: typeof import('element-plus/es')['ElFooter'] ElForm: typeof import('element-plus/es')['ElForm'] ElFormItem: typeof import('element-plus/es')['ElFormItem'] + ElHeader: typeof import('element-plus/es')['ElHeader'] ElIcon: typeof import('element-plus/es')['ElIcon'] ElImage: typeof import('element-plus/es')['ElImage'] ElInput: typeof import('element-plus/es')['ElInput'] ElLink: typeof import('element-plus/es')['ElLink'] + ElMain: typeof import('element-plus/es')['ElMain'] ElOption: typeof import('element-plus/es')['ElOption'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopover: typeof import('element-plus/es')['ElPopover'] @@ -84,15 +100,18 @@ declare module 'vue' { FileProps: typeof import('./src/components/builtin/FileProps.vue')['default'] FileTree: typeof import('./src/components/builtin/FileTree.vue')['default'] FileViewer: typeof import('./src/components/builtin/FileViewer.vue')['default'] + Home: typeof import('./src/components/chat/Home.vue')['default'] IframeFile: typeof import('./src/components/window/IframeFile.vue')['default'] ImageViewer: typeof import('./src/components/builtin/ImageViewer.vue')['default'] Install: typeof import('./src/components/install/Install.vue')['default'] InstallCompony: typeof import('./src/components/install/InstallCompony.vue')['default'] InstallMember: typeof import('./src/components/install/InstallMember.vue')['default'] InstallPerson: typeof import('./src/components/install/InstallPerson.vue')['default'] + LocalChat: typeof import('./src/components/localchat/LocalChat.vue')['default'] LockDesktop: typeof import('./src/components/desktop/LockDesktop.vue')['default'] Magnet: typeof import('./src/components/taskbar/Magnet.vue')['default'] MarkDown: typeof import('./src/components/builtin/MarkDown.vue')['default'] + Menu: typeof import('./src/components/chat/Menu.vue')['default'] MenuBar: typeof import('./src/components/window/MenuBar.vue')['default'] MenuList: typeof import('./src/components/taskbar/MenuList.vue')['default'] MessageCenterPop: typeof import('./src/components/taskbar/MessageCenterPop.vue')['default'] diff --git a/frontend/src/components/chat/Chat.vue b/frontend/src/components/chat/Chat.vue new file mode 100644 index 0000000..525df2e --- /dev/null +++ b/frontend/src/components/chat/Chat.vue @@ -0,0 +1,105 @@ + + + + \ No newline at end of file diff --git a/frontend/src/components/chat/ChatBox.vue b/frontend/src/components/chat/ChatBox.vue new file mode 100644 index 0000000..42df783 --- /dev/null +++ b/frontend/src/components/chat/ChatBox.vue @@ -0,0 +1,170 @@ + + + + \ No newline at end of file diff --git a/frontend/src/components/chat/ChatMenu.vue b/frontend/src/components/chat/ChatMenu.vue new file mode 100644 index 0000000..4996a86 --- /dev/null +++ b/frontend/src/components/chat/ChatMenu.vue @@ -0,0 +1,72 @@ + + + + + diff --git a/frontend/src/components/chat/ChatMessage.vue b/frontend/src/components/chat/ChatMessage.vue new file mode 100644 index 0000000..de2d0d6 --- /dev/null +++ b/frontend/src/components/chat/ChatMessage.vue @@ -0,0 +1,166 @@ + + + + + diff --git a/frontend/src/components/chat/ChatMsgList.vue b/frontend/src/components/chat/ChatMsgList.vue new file mode 100644 index 0000000..41693d7 --- /dev/null +++ b/frontend/src/components/chat/ChatMsgList.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/frontend/src/components/chat/ChatUserList.vue b/frontend/src/components/chat/ChatUserList.vue new file mode 100644 index 0000000..30629a8 --- /dev/null +++ b/frontend/src/components/chat/ChatUserList.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/frontend/src/components/chat/ChatUserSetting.vue b/frontend/src/components/chat/ChatUserSetting.vue new file mode 100644 index 0000000..d10664b --- /dev/null +++ b/frontend/src/components/chat/ChatUserSetting.vue @@ -0,0 +1,23 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/chat/ChatWorkList.vue b/frontend/src/components/chat/ChatWorkList.vue new file mode 100644 index 0000000..e3130e9 --- /dev/null +++ b/frontend/src/components/chat/ChatWorkList.vue @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/localchat/Chat.vue b/frontend/src/components/localchat/LocalChat.vue similarity index 100% rename from frontend/src/components/localchat/Chat.vue rename to frontend/src/components/localchat/LocalChat.vue diff --git a/frontend/src/stores/chat.ts b/frontend/src/stores/chat.ts new file mode 100644 index 0000000..2c4b7d2 --- /dev/null +++ b/frontend/src/stores/chat.ts @@ -0,0 +1,86 @@ +import { defineStore } from 'pinia' +import emojiList from "@/assets/emoji.json" +import { getSystemConfig } from '@/system/config' +export const useChatStore = defineStore('chatStore', () => { + const userList: any = ref([]) // 用户列表 + const chatList: any = ref([]) // 消息列表 + const msgList: any = ref([]) //聊天消息列表 + const userInfo: any = ref({}) + const showChooseFile = ref(false) + const currentPage = ref(1) + const pageSize = ref(50) + const scrollbarRef = ref() + const innerRef = ref() + const config = getSystemConfig() + const currentNavId = ref(0) + const message: any = ref() + const targetUserInfo:any = ref({}) + const targetUserId = ref(0) + const search = ref('') + const contextMenu = ref({ + visible: false, + chatMessageId: 0, + list: [ + { + id: 2, + label: '撤回', + } + ], + x: 0, + y: 0 + }) + const initChat = () => { + if(config.userInfo.avatar == ''){ + config.userInfo.avatar = '/logo.png' + } + userInfo.value = config.userInfo + } + const setCurrentNavId = (id: number) => { + currentNavId.value = id + } + const sendMessage = async () => { + await setScrollToBottom() + } + const setScrollToBottom = async () => { + await nextTick() + const max = innerRef.value.clientHeight + scrollbarRef.value.setScrollTop(max) + } + const changeChatList = async (item:any) => { + // const res = await getChatList(id) + // chatList.value = res.data + } + const handleContextMenu = async (id: number) => { + contextMenu.value.visible = false; + } + const showContextMenu = (event: any, id: number) => { + contextMenu.value.visible = true; + contextMenu.value.chatMessageId = id; + contextMenu.value.x = event.x; + contextMenu.value.y = event.y; + } + return { + emojiList, + userList, + chatList, + msgList, + userInfo, + search, + showChooseFile, + currentPage, + pageSize, + scrollbarRef, + innerRef, + currentNavId, + targetUserInfo, + targetUserId, + message, + contextMenu, + initChat, + setCurrentNavId, + sendMessage, + changeChatList, + handleContextMenu, + showContextMenu + } +}) \ No newline at end of file diff --git a/frontend/src/stores/db.ts b/frontend/src/stores/db.ts index 7e86eca..aa9dc14 100644 --- a/frontend/src/stores/db.ts +++ b/frontend/src/stores/db.ts @@ -1,12 +1,13 @@ import Dexie from 'dexie' -export type ChatTable = 'chatuser' | 'chatmsg' | 'chatfile' +export type ChatTable = 'chatuser' | 'chatmsg' | 'chatmessage' | 'groupmessage' export const dbInit:any = new Dexie('GodoOSDatabase'); dbInit.version(1).stores({ chatuser:'++id,ip,hostname,userName,avatar,mobile,nickName,isOnline,updatedAt,createdAt', chatmsg:'++id,targetId,targetIp,senderInfo,reciperInfo,content,type,status,isRead,isMe,readAt,createdAt', - chatfile:'++id,msgId,fileName,fileSize,fileType,fileUrl,filePath,fileExt' + chatmessage:'++id,userId,toUserId,senderInfo,isMe,isRead,content,type,readAt,createdAt', + groupmessage:'++id,userId,groupId,senderInfo,isMe,isRead,content,type,readAt,createdAt' }); export const db = { diff --git a/frontend/src/system/applist.ts b/frontend/src/system/applist.ts index 074394f..a7446e8 100644 --- a/frontend/src/system/applist.ts +++ b/frontend/src/system/applist.ts @@ -189,7 +189,8 @@ export const appList = [ { name: 'localchat', appIcon: "chat", - content: "Chat", + //content: "LocalChat", + content:"Chat", frame: true, width: 800, height: 600,