From f51a3af84d37d22c639850e77b53430552732d00 Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Sun, 15 Sep 2024 00:19:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat=20:=20=E9=80=9A=E8=AF=9D=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=BB=84=E4=BB=B6=E5=8F=8A=E5=88=9D=E5=A7=8B=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5socket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- package.json | 2 + src/components/liveCall/LiveCallItem.vue | 258 +++++++++++++++++++++++ src/components/liveCall/index.vue | 36 ++++ src/views/home/index.vue | 6 +- 5 files changed, 301 insertions(+), 3 deletions(-) create mode 100644 src/components/liveCall/LiveCallItem.vue create mode 100644 src/components/liveCall/index.vue diff --git a/.env.development b/.env.development index c2d2c3d..52ccbeb 100644 --- a/.env.development +++ b/.env.development @@ -1,2 +1,2 @@ # 开发环境基地址 -VITE_BASE_URL='http://frp.feashow.cn:31800/' +VITE_BASE_URL='/api' diff --git a/package.json b/package.json index 4fe46a5..a14fbc7 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "pinia": "^2.0.35", "sass": "^1.62.1", "scss": "^0.2.4", + "sockjs-client": "^1.6.1", + "stompjs": "^2.3.3", "unplugin-icons": "^0.16.1", "vite-plugin-inspect": "^0.7.26", "vue": "^3.2.47", diff --git a/src/components/liveCall/LiveCallItem.vue b/src/components/liveCall/LiveCallItem.vue new file mode 100644 index 0000000..0bf39c7 --- /dev/null +++ b/src/components/liveCall/LiveCallItem.vue @@ -0,0 +1,258 @@ + + + + + diff --git a/src/components/liveCall/index.vue b/src/components/liveCall/index.vue new file mode 100644 index 0000000..3b3989b --- /dev/null +++ b/src/components/liveCall/index.vue @@ -0,0 +1,36 @@ + + + + + diff --git a/src/views/home/index.vue b/src/views/home/index.vue index 766f114..37c3d10 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -1,9 +1,11 @@ From 689fa89c80a7c30c3c2f00c47555e315a81a165f Mon Sep 17 00:00:00 2001 From: odjbin <1042039504@qq.com> Date: Sun, 15 Sep 2024 00:29:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat=20:=20=E9=80=9A=E8=AF=9D=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=BB=84=E4=BB=B6=E5=8A=A0=E4=B8=8A=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/liveCall/LiveCallItem.vue | 51 ++++++++++++++++++------ 1 file changed, 39 insertions(+), 12 deletions(-) diff --git a/src/components/liveCall/LiveCallItem.vue b/src/components/liveCall/LiveCallItem.vue index 0bf39c7..2955b8f 100644 --- a/src/components/liveCall/LiveCallItem.vue +++ b/src/components/liveCall/LiveCallItem.vue @@ -9,11 +9,12 @@
+
6月5日 12:05
-

{{ item.nickName }}

+

{{ item.nickName }}

{{ item.contactText }}
@@ -22,7 +23,7 @@
-

{{ item.nickName }}

+

{{ item.nickName }}

{{ item.contactText }}
@@ -38,25 +39,35 @@ import SockJS from 'sockjs-client/dist/sockjs.min.js' import {getToken} from '@/utils/auth' const userId = ref(1) -const recordList = ref([ { +const recordList = ref([{ id: 2, nickName: 'AI助手', - contactText: '得到222' + contactText: '你好' }, { id: 1, nickName: '我', - contactText: '得到1' + contactText: '你好!' }, { id: 2, nickName: 'AI助手', - contactText: '得到222' + contactText: '你好' }, { id: 1, nickName: '我', - contactText: '得到1' + contactText: '你好!' + }, + { + id: 2, + nickName: 'AI助手', + contactText: '你好' + }, + { + id: 1, + nickName: '我', + contactText: '你好!' }, ]) @@ -82,15 +93,16 @@ const scrollbarRef = ref(null); const scrollToBottom = () => { if (scrollbarRef.value) { const container = scrollbarRef.value.$el.querySelector('.el-scrollbar__wrap'); - console.info("🚀 ~method:container -----", container) container.style.scrollBehavior = 'smooth'; // 添加平滑滚动效果 container.scrollTop = container.scrollHeight; } }; - -onMounted(() => { +nextTick(() => { scrollToBottom(); }) +// onMounted(() => { +// scrollToBottom(); +// }) const initWebSocket = () => { try { const wsUrl = "http://frp.feashow.cn:31800/ws" @@ -157,6 +169,21 @@ const initWebSocket = () => { .chat-content { width: 100%; + .time-grap { + display: flex; + align-items: center; + justify-content: center; + + > span { + font-size: 13px; + padding: 5px 10px; + border: 1px solid #d7d9da; + border-radius: 25px; + } + + margin-bottom: 10px; + } + .word { display: flex; margin-bottom: 20px; @@ -170,7 +197,7 @@ const initWebSocket = () => { .info { margin-left: 10px; - .time { + .name { font-size: 12px; color: rgba(51, 51, 51, 0.8); margin: 0; @@ -217,7 +244,7 @@ const initWebSocket = () => { margin-left: 10px; text-align: right; - .time { + .name { font-size: 12px; color: rgba(51, 51, 51, 0.8); height: 20px;