From 842b2b766f71d278785a3a641dbfccf3ed6aa84c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E6=9D=B0?= Date: Wed, 29 Oct 2025 21:39:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5deepMate=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E8=B7=B3=E8=BD=AC=E5=88=B0=E8=AF=A5=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=B9=B6=E5=8F=91=E8=B5=B7=E8=AF=B7=E6=B1=82=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/DeepMate.vue | 31 +++++++++++++++++++++++++++++-- pages/deepMate/deepMate.vue | 21 ++++++++++++++++++++- pages/home/home.vue | 2 +- 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/components/DeepMate.vue b/components/DeepMate.vue index 5132a5d..d7a0f67 100644 --- a/components/DeepMate.vue +++ b/components/DeepMate.vue @@ -34,8 +34,14 @@ - - + + @@ -49,7 +55,28 @@ name: 'DeepMate', data() { return { + inputValue: '' + } + }, + methods: { + handleSend() { + // 检查输入是否为空 + if (!this.inputValue.trim()) { + uni.showToast({ + title: '请输入股票代码或名称', + icon: 'none', + duration: 2000 + }) + return + } + + // 跳转到deepMate页面,并传递输入的内容 + uni.navigateTo({ + url: `/pages/deepMate/deepMate?query=${encodeURIComponent(this.inputValue.trim())}` + }) + // 清空输入框 + this.inputValue = '' } } } diff --git a/pages/deepMate/deepMate.vue b/pages/deepMate/deepMate.vue index 90e0f70..1373c5d 100644 --- a/pages/deepMate/deepMate.vue +++ b/pages/deepMate/deepMate.vue @@ -291,7 +291,7 @@ const { safeAreaInsets } = uni.getSystemInfoSync(); import { ref, computed, onMounted, onUnmounted, watch, nextTick } from "vue"; import footerBar from "../../components/footerBar"; import marked from "marked"; // 引入 marked 库 -import { onPageScroll } from "@dcloudio/uni-app"; +import { onPageScroll, onLoad } from "@dcloudio/uni-app"; import { postStock, postIntent, @@ -358,6 +358,25 @@ const hotTopics = ref([ }, ]); +// 处理页面加载时的路由参数 +onLoad((options) => { + console.log('deepMate页面接收到参数:', options); + + // 如果有query参数,自动发送消息 + if (options.query) { + const decodedQuery = decodeURIComponent(options.query); + console.log('解码后的查询内容:', decodedQuery); + + // 设置输入框内容并自动发送 + inputMessage.value = decodedQuery; + + // 延迟一下再发送,确保页面已经完全加载 + setTimeout(() => { + sendMessage(); + }, 500); + } +}); + // 初始化 onMounted(() => { const sys = uni.getSystemInfoSync(); diff --git a/pages/home/home.vue b/pages/home/home.vue index f9c46a3..466b9b0 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -192,7 +192,7 @@ import footerBar from '../../components/footerBar.vue' import MarketOverview from '../../components/MarketOverview.vue' import DeepMate from '../../components/DeepMate.vue' -// import tcpConnection from '../../api/tcpConnection.js' +import tcpConnection from '../../api/tcpConnection.js' import th from '../../static/language/th' import MySelectionsAPI from '../../api/home/mySelections.js' import { useUserStore } from '../../stores/modules/userInfo'