From 760dad0436b8addafae8d77ce44d51799d1bca7d Mon Sep 17 00:00:00 2001 From: puhui999 Date: Wed, 12 Jun 2024 17:05:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=9C=8D=EF=BC=9A=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8C=BA=E5=9F=9F=E6=8A=BD=E7=A6=BB=E5=B0=81?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 5 +- pages/chat/components/chatBox.vue | 456 +++++++++++++++++++ pages/chat/components/constants.js | 14 + pages/chat/index.vue | 559 +++--------------------- pages/chat/index1.vue | 678 +++++++++++++++++++++++++++++ pages/chat/socket.js | 18 +- sheep/api/promotion/kefu.js | 30 ++ sheep/config/index.js | 3 +- sheep/hooks/useWebSocket.js | 99 +++++ sheep/util/index.js | 4 +- 10 files changed, 1358 insertions(+), 508 deletions(-) create mode 100644 pages/chat/components/chatBox.vue create mode 100644 pages/chat/components/constants.js create mode 100644 pages/chat/index1.vue create mode 100644 sheep/api/promotion/kefu.js create mode 100644 sheep/hooks/useWebSocket.js diff --git a/.env b/.env index b4ae1fd2..751991fd 100644 --- a/.env +++ b/.env @@ -5,12 +5,15 @@ SHOPRO_VERSION = v1.8.3 SHOPRO_BASE_URL = http://api-dashboard.yudao.iocoder.cn # 后端接口 - 测试环境(通过 process.env.NODE_ENV = development) -SHOPRO_DEV_BASE_URL = http://127.0.0.1:48080 +SHOPRO_DEV_BASE_URL = http://192.168.1.105:48080 ### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc # 后端接口前缀(一般不建议调整) SHOPRO_API_PATH = /app-api +# 后端 websocket 接口前缀 +SHOPRO_WEBSOCKET_PATH = /infra/ws + # 开发环境运行端口 SHOPRO_DEV_PORT = 3000 diff --git a/pages/chat/components/chatBox.vue b/pages/chat/components/chatBox.vue new file mode 100644 index 00000000..5ca5980d --- /dev/null +++ b/pages/chat/components/chatBox.vue @@ -0,0 +1,456 @@ + + + + + diff --git a/pages/chat/components/constants.js b/pages/chat/components/constants.js new file mode 100644 index 00000000..0fd4e9ee --- /dev/null +++ b/pages/chat/components/constants.js @@ -0,0 +1,14 @@ +export const KeFuMessageContentTypeEnum = { + TEXT: 1, // 文本消息 + IMAGE: 2, // 图片消息 + VOICE: 3, // 语音消息 + VIDEO: 4, // 视频消息 + SYSTEM: 5, // 系统消息 + // ========== 商城特殊消息 ========== + PRODUCT: 10,// 商品消息 + ORDER: 11,// 订单消息" +}; +export const UserTypeEnum = { + MEMBER: 1, // 会员 面向 c 端,普通用户 + ADMIN: 2, // 管理员 面向 b 端,管理后台 +}; diff --git a/pages/chat/index.vue b/pages/chat/index.vue index 6c4bb1a3..ab27c44f 100644 --- a/pages/chat/index.vue +++ b/pages/chat/index.vue @@ -1,163 +1,14 @@