Browse Source

首页deepMate输入内容跳转到该页面并发起请求;

maziyang/feature-20251025172218-智能客服中台
宋杰 4 weeks ago
parent
commit
842b2b766f
  1. 31
      components/DeepMate.vue
  2. 21
      pages/deepMate/deepMate.vue
  3. 2
      pages/home/home.vue

31
components/DeepMate.vue

@ -34,8 +34,14 @@
</view>
</view>
<view class="deepmate-action">
<input class="stock-input" type="text" placeholder="请输入股票代码/名称,获取AI洞察" />
<view class="send-button-container">
<input
class="stock-input"
type="text"
placeholder="请输入股票代码/名称,获取AI洞察"
v-model="inputValue"
@confirm="handleSend"
/>
<view class="send-button-container" @click="handleSend">
<image class="send-button" src="https://d31zlh4on95l9h.cloudfront.net/images/3da018821a5c82b06a1d6ddc81b960ac.png" mode="aspectFit"></image>
</view>
</view>
@ -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 = ''
}
}
}

21
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();

2
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'

Loading…
Cancel
Save