diff --git a/components/deepExploration_header.vue b/components/deepExploration_header.vue index eb37c83..39c7860 100644 --- a/components/deepExploration_header.vue +++ b/components/deepExploration_header.vue @@ -154,13 +154,19 @@ async function itemClick(item) { model: 5, }); if (res.code == 200) { + const message = res.data; const deepExplorationStore = useDeepExplorationStore(); deepExplorationStore.setDeepExplorationInfo(message); - onDrawerBackClick(); console.log('点击了历史数据',deepExplorationStore.deepExplorationInfo); - + onDrawerBackClick(); + setTimeout(() => { + uni.navigateTo({ + url: '/pages/deepExploration/MainForceActions' + }); + }, 200); } + } const historyList = ref([]); diff --git a/pages/deepExploration/MainForceActions.vue b/pages/deepExploration/MainForceActions.vue index 0ae9809..a4975e8 100644 --- a/pages/deepExploration/MainForceActions.vue +++ b/pages/deepExploration/MainForceActions.vue @@ -31,8 +31,8 @@ {{stockPrice}} - {{stockAdd}} {{stockChange}} + {{stockAdd}} @@ -91,25 +91,9 @@ } from '@/stores/modules/deepExploration' const deepExplorationStore = useDeepExplorationStore() - + const historyData = ref({}) - watch( - () => deepExplorationStore.deepExplorationInfo, // 监听的目标值(函数返回,避免响应式丢失) - (newVal, oldVal) => { - console.log('deepExplorationInfo 变化了:', newVal) - historyData.value = {...newVal} - console.log(historyData.value.wokeFlowData); - - //工作流数据 - const rawMarkdown = historyData.value.wokeFlowData.One.markdown; - const adaptedMarkdown = rawMarkdown.replace(/^### /gm, ''); // 全局替换行首的### - markdownContent.value = adaptedMarkdown; - // markdownContent.value = res.data.markdown - htmlContent.value = marked.parse(markdownContent.value); - }, { - deep: true - } // 开启深度监听(对象内部属性变化也能触发) - ) + // 响应式变量定义 const type = ref('deepExploration') const iSMT = ref(0) @@ -217,8 +201,8 @@ stockId.value = result.data.stockId language.value = result.data.language market.value = result.data.market - - + + const res = await getModel1Second({ language: language.value, recordId: recordId.value, @@ -234,9 +218,9 @@ htmlContent.value = marked.parse(markdownContent.value); } console.log('res', res); - + await getServerData() - + } else if (result.code == 400) { markdownContent.value = result.message; @@ -245,11 +229,11 @@ return } - + } - } catch { + } catch (e) { error.value = e.message || '加载失败,请重试'; } finally { loading.value = false; @@ -290,18 +274,19 @@ console.log('k线数据', result); stockName.value = result.data.StockInformation.Name || 'Tesla Inc.' - stockCode.value = result.data.StockInformation.Code || 'TSLA' + stockCode.value = result.data.StockInformation.Code || 'TSLA' stockTime.value = result.data.StockInformation.Time || '2025/10/29' stockChange.value = result.data.StockInformation.Zhang || '5.120%' - stockAdd.value = result.data.StockInformation.ZhangFu || '22.410' - - if(result.data.chartData){ - - chartData.value = { - ...JSON.parse(JSON.stringify(result.data.chartData)) - } - chartKey.value++; - console.log('chartData', chartData.value); + stockAdd.value = result.data.StockInformation.ZhangFu || '22.410' + stockPrice.value = result.data.StockInformation.Price || '435.900' + + if (result.data.chartData) { + + chartData.value = { + ...JSON.parse(JSON.stringify(result.data.chartData)) + } + chartKey.value++; + console.log('chartData', chartData.value); } } @@ -418,12 +403,51 @@ // }, 500) // } + + + let unwatch = null; // 生命周期钩子:组件挂载后执行(替代onReady) - onMounted(async() => { + onMounted(async () => { iSMT.value = uni.getSystemInfoSync().statusBarHeight await getServerData() // 调用数据获取函数 await handleModels() + unwatch = watch( + () => deepExplorationStore.deepExplorationInfo, // 监听的目标值(函数返回,避免响应式丢失) + (newVal, oldVal) => { + console.log('deepExplorationInfo 变化了:', newVal) + historyData.value = { + ...newVal + } + console.log(historyData.value.wokeFlowData); + console.log('222', historyData.value.stockData.StockInformation); + + //工作流数据 + const rawMarkdown = historyData.value.wokeFlowData.One.markdown; + const adaptedMarkdown = rawMarkdown.replace(/^### /gm, ''); // 全局替换行首的### + markdownContent.value = adaptedMarkdown; + // markdownContent.value = res.data.markdown + htmlContent.value = marked.parse(markdownContent.value); + + //k线 + chartData.value = { + ...JSON.parse(JSON.stringify(historyData.value.stockData.chartData)) + } + chartKey.value++; + console.log('chartData', chartData.value); + + stockName.value = historyData.value.stockData.StockInformation.Name || 'Tesla Inc.' + stockCode.value = historyData.value.stockData.StockInformation.Code || 'TSLA' + stockTime.value = historyData.value.stockData.StockInformation.Time || '2025/10/29' + stockChange.value = historyData.value.stockData.StockInformation.Zhang || '5.120%' + stockAdd.value = historyData.value.stockData.StockInformation.ZhangFu || '22.410' + stockPrice.value = historyData.value.stockData.StockInformation.Price || '435.900' + }, { + deep: true, + immediate: true + } // 开启深度监听(对象内部属性变化也能触发) + ) + }) // 页面加载时执行 @@ -562,7 +586,7 @@ line-height: 18px; } - + } .right {