Browse Source

change chat

master
godo 6 months ago
parent
commit
88bc65e8cc
  1. 1
      README.md
  2. 6
      cloud/README.md
  3. 457
      frontend/src/components/chat/Chat.vue
  4. 137
      frontend/src/components/chat/ChatMenu.vue
  5. 2
      frontend/src/system/member.ts

1
README.md

@ -28,6 +28,7 @@
- 更改文档存储方式,支持选择文件夹
- 内网聊天新增ai对话,可保存对话历史,可更换模型和prompt
- 新增可定义端口和访问路径,支持web端系统重启
- 新增企业端gitee登录和github登录
## 🏭 第三阶段目标(十二月底发布)
1. **文档处理与Markdown智能升级**

6
cloud/README.md

@ -1,5 +1,7 @@
## godocloud客户端安装帮助
- cloud目录为企业版打包客户端而设定,可以自由定制客户端,根据以下步骤打包
### 第一步:安装nodejs
```
@ -19,7 +21,7 @@ sudo chmod +x build.sh
```
#### windows环境下打包
- 首先安装mingw-w64,进入命令行界面
- 首先安装mingw-w32,进入命令行界面
```
./build.sh
@ -36,7 +38,7 @@ sudo chmod +x ./godocloud_linux_amd64
```
- 访问地址:http://localhost:56781
- 备注:如需更改端口地址,修改cloud/cmd/main.go中
- 备注:如需更改端口地址,修改cloud/cmd/main.go中,改完之后要重新打包部署
```
const serverAddress = ":56781"

457
frontend/src/components/chat/Chat.vue

@ -1,46 +1,46 @@
<script setup lang="ts">
import { useChatStore } from "@/stores/chat";
import { getWorkflowUrl } from "@/system/config";
import { Search } from "@element-plus/icons-vue";
const store = useChatStore();
const workUrl = getWorkflowUrl();
onMounted(() => {
store.initChat();
});
import { useChatStore } from "@/stores/chat";
import { getWorkflowUrl } from "@/system/config";
import { Search } from "@element-plus/icons-vue";
const store = useChatStore();
const workUrl = getWorkflowUrl();
onMounted(() => {
store.initChat();
});
const generateData = () => {
return store.allUserList.map((user: any) => ({
key: user.id,
label: user.nickname,
avatar: user.avatar, //
}));
};
const generateData = () => {
return store.allUserList.map((user: any) => ({
key: user.id,
label: user.nickname,
avatar: user.avatar, //
}));
};
const data = ref(generateData());
// users any[]
let users = ref<any[]>([]);
const myTransfer = ref()
const data = ref(generateData());
// users any[]
let users = ref<any[]>([]);
const myTransfer = ref()
watchEffect(() => {
if (store.allUserList.length > 0) {
data.value = generateData();
}
});
watchEffect(() => {
if (store.allUserList.length > 0) {
data.value = generateData();
}
});
// searchList
watch(
() => store.searchInput,
(newSearchInput) => {
if (newSearchInput === "") {
store.searchList = []; //
} else {
store.searchList = store.chatList.filter(
(user: { displayName: string | string[] }) =>
user.displayName.includes(newSearchInput)
);
}
// searchList
watch(
() => store.searchInput,
(newSearchInput) => {
if (newSearchInput === "") {
store.searchList = []; //
} else {
store.searchList = store.chatList.filter(
(user: { displayName: string | string[] }) =>
user.displayName.includes(newSearchInput)
);
}
);
}
);
</script>
<template>
<el-container class="container">
@ -48,103 +48,62 @@
<el-aside class="menu">
<chat-menu />
</el-aside>
<el-container
class="side"
v-if="store.currentNavId < 3"
>
<el-container class="side" v-if="store.currentNavId < 4">
<!--搜索栏-->
<el-header
class="search"
v-if="store.currentNavId < 2"
>
<el-input
placeholder="搜索"
:prefix-icon="Search"
class="search-input"
v-model="store.searchInput"
/>
<!-- 邀请群聊 -->
<button
class="inviteGroupChats"
@click="store.setGroupChatInvitedDialogVisible(true)"
>
<el-icon><Plus /></el-icon>
</button>
</el-header>
<!--好友列表-->
<el-main class="list">
<el-scrollbar>
<chat-msg-list v-if="store.currentNavId == 0" />
<chat-user-list v-if="store.currentNavId == 1" />
</el-scrollbar>
</el-main>
<template v-if="store.currentNavId < 2">
<el-header class="search">
<el-input placeholder="搜索" :prefix-icon="Search" class="search-input" v-model="store.searchInput" />
<!-- 邀请群聊 -->
<button class="inviteGroupChats" @click="store.setGroupChatInvitedDialogVisible(true)">
<el-icon>
<Plus />
</el-icon>
</button>
</el-header>
<!--好友列表-->
<el-main class="list">
<el-scrollbar>
<chat-msg-list v-if="store.currentNavId == 0" />
<chat-user-list v-if="store.currentNavId == 1" />
</el-scrollbar>
</el-main>
</template>
<ai-chat-left v-if="store.currentNavId == 3" />
</el-container>
<el-container class="chat-box">
<chat-box v-if="store.currentNavId < 1" />
<chat-user-info v-if="store.currentNavId == 1"></chat-user-info>
<ai-chat-main v-if="store.currentNavId == 3" />
</el-container>
<el-container
class="chat-setting"
v-if="store.currentNavId == 2"
>
<iframe
class="workflow"
:src="workUrl"
></iframe>
<el-container class="chat-setting" v-if="store.currentNavId == 2">
<iframe class="workflow" :src="workUrl"></iframe>
</el-container>
<el-container
class="chat-setting"
v-if="store.currentNavId == 5"
>
<el-container class="chat-setting" v-if="store.currentNavId == 5">
<ChatUserSetting />
</el-container>
</el-container>
<!-- 邀请群聊弹窗 -->
<el-dialog
v-model="store.groupChatInvitedDialogVisible"
width="80%"
title="创建群聊"
style="height: 550px"
align-center
>
<el-dialog v-model="store.groupChatInvitedDialogVisible" width="80%" title="创建群聊" style="height: 550px"
align-center>
<div class="dialog-body">
<!-- 添加输入部门名的输入框 -->
<div>
<el-form label-position="top">
<el-form-item label="群聊名称:">
<el-input
maxlength="8"
show-word-limit
style="width: 240px; height: 30px"
class="department-name"
v-model="store.departmentName"
placeholder="请输入群聊名称"
></el-input>
<el-input maxlength="8" show-word-limit style="width: 240px; height: 30px"
class="department-name" v-model="store.departmentName" placeholder="请输入群聊名称"></el-input>
</el-form-item>
</el-form>
</div>
<!-- 使用 Element el-transfer 组件替换自定义穿梭框 -->
<el-transfer
v-model="users"
:data="data"
:titles="['可选项', '已选项']"
filterable
style="height: 250px"
filter-placeholder="搜索用户名"
:props="{ key: 'key', label: 'label', avatar: 'avatar' }"
:left-default-checked="[]"
class="transfer-container"
ref="myTransfer"
>
<el-transfer v-model="users" :data="data" :titles="['可选项', '已选项']" filterable style="height: 250px"
filter-placeholder="搜索用户名" :props="{ key: 'key', label: 'label', avatar: 'avatar' }"
:left-default-checked="[]" class="transfer-container" ref="myTransfer">
<!-- 自定义穿梭框列表项模板 -->
<template #default="{ option }">
<el-avatar
:src="option.avatar"
size="small"
style="margin-right: 5px"
/>
<el-avatar :src="option.avatar" size="small" style="margin-right: 5px" />
<span>{{ option.label }}</span>
</template>
</el-transfer>
@ -152,167 +111,169 @@
<template #footer>
<span class="dialog-footer">
<el-button
style="background-color: #0078d4; color: #fff"
@click="store.groupChatInvitedDialogVisible = false"
>取消</el-button
>
<el-button
style="background-color: #0078d4; color: #fff"
@click="store.createGroupChat(users)"
>确定</el-button
>
<el-button style="background-color: #0078d4; color: #fff"
@click="store.groupChatInvitedDialogVisible = false">取消</el-button>
<el-button style="background-color: #0078d4; color: #fff"
@click="store.createGroupChat(users)">确定</el-button>
</span>
</template>
</el-dialog>
</template>
<style scoped>
:deep(.el-transfer) {
:deep(.el-transfer) {
display: flex;
flex-direction: row;
/* 将布局方向设置为横向 */
width: 550px;
/* 让穿梭框占满宽度 */
justify-content: center;
align-items: center;
.el-transfer__buttons {
display: flex;
flex-direction: row; /* 将布局方向设置为横向 */
width: 550px; /* 让穿梭框占满宽度 */
justify-content: center;
justify-content: space-evenly;
align-items: center;
.el-transfer__buttons {
display: flex;
justify-content: space-evenly;
align-items: center;
width: 120px;
padding: 0 0 !important;
.el-button {
width: 40px !important;
height: 30px !important;
background-color: #0078d4;
color: #fff;
}
width: 120px;
padding: 0 0 !important;
.el-button {
width: 40px !important;
height: 30px !important;
background-color: #0078d4;
color: #fff;
}
}
}
::v-deep .el-dialog .el-dialog__header {
border: none !important;
}
::v-deep .el-dialog .el-dialog__header {
border: none !important;
}
::v-deep .el-transfer-panel {
width: 270px !important; /* 设置每个穿梭框面板的宽度 */
height: 250px !important;
}
::v-deep .el-transfer-panel {
width: 270px !important;
/* 设置每个穿梭框面板的宽度 */
height: 250px !important;
}
::v-deep .el-transfer-panel__body {
height: 200px !important;
}
::v-deep .el-transfer-panel__body {
height: 200px !important;
}
::v-deep .el-checkbox__label {
margin-left: 10px !important;
}
::v-deep .el-checkbox__label {
margin-left: 10px !important;
}
.container {
display: flex;
height: 100%;
width: 100%;
overflow-y: hidden;
overflow-x: hidden;
border-top: 1px solid #e8e8e8;
}
.container {
display: flex;
height: 100%;
width: 100%;
overflow-y: hidden;
overflow-x: hidden;
border-top: 1px solid #e8e8e8;
}
.menu {
width: 55px;
background-color: #ffffff;
overflow-y: hidden;
overflow-x: hidden;
-webkit-app-region: drag;
}
.menu {
width: 55px;
background-color: #ffffff;
overflow-y: hidden;
overflow-x: hidden;
-webkit-app-region: drag;
}
.side {
flex: 1;
/* 占据剩余宽度 */
/* max-width: 200px; */
/* min-width: 200px; */
min-height: 650px;
max-height: max-content;
border-right: 1px solid #e8e8e8;
overflow-y: hidden;
overflow-x: hidden;
}
.side {
flex: 1;
/* 占据剩余宽度 */
/* max-width: 200px; */
/* min-width: 200px; */
min-height: 650px;
max-height: max-content;
border-right: 1px solid #e8e8e8;
overflow-y: hidden;
overflow-x: hidden;
}
.search {
display: flex;
align-items: center;
justify-content: space-evenly;
width: 100%;
height: 50px;
padding: 0;
padding-right: 10px;
-webkit-app-region: drag;
border-bottom: 1px solid #e8e8e8;
border-left: 1px solid #e8e8e8;
}
.inviteGroupChats {
width: 40px;
height: 30px;
border: none;
border-radius: 4px;
background-color: #f0f0f0;
}
.search {
display: flex;
align-items: center;
justify-content: space-evenly;
width: 100%;
height: 50px;
padding: 0;
padding-right: 10px;
-webkit-app-region: drag;
border-bottom: 1px solid #e8e8e8;
border-left: 1px solid #e8e8e8;
}
.user-item {
width: 100%;
height: 30px;
display: flex;
align-items: center;
}
.inviteGroupChats {
width: 40px;
height: 30px;
border: none;
border-radius: 4px;
background-color: #f0f0f0;
}
.search-input {
width: calc(100% - 20px);
margin: 10px;
height: 32px;
-webkit-app-region: no-drag;
--el-input-placeholder-color: #bfbfbf !important;
--el-input-icon-color: #bfbfbf !important;
}
.user-item {
width: 100%;
height: 30px;
display: flex;
align-items: center;
}
.list {
width: 100%;
height: 100%;
padding: 0;
overflow-y: hidden;
overflow-x: hidden;
border-left: 1px solid #e8e8e8;
}
.dialog-body {
width: 100%;
height: 350px;
}
.search-input {
width: calc(100% - 20px);
margin: 10px;
height: 32px;
-webkit-app-region: no-drag;
--el-input-placeholder-color: #bfbfbf !important;
--el-input-icon-color: #bfbfbf !important;
}
.chat-box {
flex: 3;
width: 100%;
height: 100%;
max-height: max-content;
background-color: #ffffff;
}
.list {
width: 100%;
height: 100%;
padding: 0;
overflow-y: hidden;
overflow-x: hidden;
border-left: 1px solid #e8e8e8;
}
.chat-setting {
width: calc(100% - 65px);
height: 100%;
overflow: hidden;
}
.workflow {
width: 100%;
height: 100%;
object-fit: contain;
border: none;
}
.dialog-body {
width: 100%;
height: 350px;
}
.no-message-container {
height: 100%;
margin: 120px auto;
text-align: center;
font-size: 14px;
justify-content: center;
}
.chat-box {
flex: 3;
width: 100%;
height: 100%;
max-height: max-content;
background-color: #ffffff;
}
.department-name {
margin: 10px 0;
}
.chat-setting {
width: calc(100% - 65px);
height: 100%;
overflow: hidden;
}
.workflow {
width: 100%;
height: 100%;
object-fit: contain;
border: none;
}
.no-message-container {
height: 100%;
margin: 120px auto;
text-align: center;
font-size: 14px;
justify-content: center;
}
.department-name {
margin: 10px 0;
}
</style>

137
frontend/src/components/chat/ChatMenu.vue

@ -1,34 +1,23 @@
<script setup>
import { useChatStore } from "@/stores/chat";
import { Setting as SettingIcon } from "@element-plus/icons-vue";
import { useChatStore } from "@/stores/chat";
import { Setting as SettingIcon } from "@element-plus/icons-vue";
const store = useChatStore();
const store = useChatStore();
</script>
<template>
<!-- 头像 -->
<el-row>
<el-avatar
shape="square"
:size="40"
class="userAvatar"
:src="store.userInfo.avatar"
/>
<el-avatar shape="square" :size="40" class="userAvatar" :src="store.userInfo.avatar" />
</el-row>
<!-- 菜单按钮 -->
<el-row @click="store.setCurrentNavId(0)">
<div class="menu-icon-box">
<el-icon
v-if="store.currentNavId === 0"
class="menu-icon-on"
>
<el-icon v-if="store.currentNavId === 0" class="menu-icon-on">
<Comment />
</el-icon>
<el-icon
v-else
class="menu-icon"
>
<el-icon v-else class="menu-icon">
<Comment />
</el-icon>
</div>
@ -36,21 +25,24 @@
<el-row @click="store.setCurrentNavId(1)">
<div class="menu-icon-box">
<el-icon
v-if="store.currentNavId === 1"
class="menu-icon-on"
>
<el-icon v-if="store.currentNavId === 1" class="menu-icon-on">
<UserFilled />
</el-icon>
<el-icon
v-else
class="menu-icon"
>
<el-icon v-else class="menu-icon">
<User />
</el-icon>
</div>
</el-row>
<el-row @click="store.setCurrentNavId(3)">
<div class="menu-icon-box">
<el-icon v-if="store.currentNavId === 3" class="menu-icon-on">
<Promotion />
</el-icon>
<el-icon v-else class="menu-icon">
<Position />
</el-icon>
</div>
</el-row>
<!-- <el-row @click="store.setCurrentNavId(2)">
<div class="menu-icon-box">
<el-icon
@ -69,69 +61,60 @@
</el-row> -->
<!-- 设置按钮固定在底部 -->
<el-row
class="settings-icon-row"
@click="store.setCurrentNavId(5)"
>
<el-row class="settings-icon-row" @click="store.setCurrentNavId(5)">
<div class="menu-icon-box">
<el-icon
v-if="store.currentNavId === 5"
class="menu-icon-on"
>
<el-icon v-if="store.currentNavId === 5" class="menu-icon-on">
<Tools />
</el-icon>
<el-icon
v-else
class="menu-icon"
>
<Tools />
<el-icon v-else class="menu-icon">
<Tools />
</el-icon>
</div>
</el-row>
</template>
<style scoped>
.chat-user-info {
position: relative;
height: 100%;
}
.chat-user-info {
position: relative;
height: 100%;
}
.userAvatar {
margin: 6px auto;
-webkit-app-region: no-drag;
}
.userAvatar {
margin: 6px auto;
-webkit-app-region: no-drag;
}
.menu-icon-box {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
margin: 10px auto;
transition: all 0.5s;
}
.menu-icon-box {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
margin: 10px auto;
transition: all 0.5s;
}
.menu-icon {
margin: 0 auto;
font-size: 25px;
cursor: pointer;
color: #86909C;
}
.menu-icon {
margin: 0 auto;
font-size: 25px;
cursor: pointer;
color: #86909C;
}
.menu-icon-on {
margin: 0 auto;
font-size: 25px;
color: #0d42d2;
cursor: pointer;
}
.menu-icon-on {
margin: 0 auto;
font-size: 25px;
color: #0d42d2;
cursor: pointer;
}
/* 设置按钮独立在底部 */
.settings-icon-row {
position: absolute;
bottom: 20px;
left: 0;
right: 0;
width: 55px;
height: 55px;
}
/* 设置按钮独立在底部 */
.settings-icon-row {
position: absolute;
bottom: 20px;
left: 0;
right: 0;
width: 55px;
height: 55px;
}
</style>

2
frontend/src/system/member.ts

@ -5,7 +5,7 @@ export const memberList = [
content:"Chat",
frame: true,
width: 800,
height: 650,
height: 600,
center: true,
resizable: true,
isDeskTop: true,

Loading…
Cancel
Save