Browse Source

历史数据对接完成

maziyang/feature-20251025172218-智能客服中台
ZhangYong 4 weeks ago
parent
commit
5f2dfe5eef
  1. 10
      components/deepExploration_header.vue
  2. 98
      pages/deepExploration/MainForceActions.vue

10
components/deepExploration_header.vue

@ -154,13 +154,19 @@ async function itemClick(item) {
model: 5, model: 5,
}); });
if (res.code == 200) { if (res.code == 200) {
const message = res.data; const message = res.data;
const deepExplorationStore = useDeepExplorationStore(); const deepExplorationStore = useDeepExplorationStore();
deepExplorationStore.setDeepExplorationInfo(message); deepExplorationStore.setDeepExplorationInfo(message);
onDrawerBackClick();
console.log('点击了历史数据',deepExplorationStore.deepExplorationInfo); console.log('点击了历史数据',deepExplorationStore.deepExplorationInfo);
onDrawerBackClick();
setTimeout(() => {
uni.navigateTo({
url: '/pages/deepExploration/MainForceActions'
});
}, 200);
} }
} }
const historyList = ref([]); const historyList = ref([]);

98
pages/deepExploration/MainForceActions.vue

@ -31,8 +31,8 @@
</view> </view>
<view class="graph_data"> <view class="graph_data">
<text>{{stockPrice}}</text> <text>{{stockPrice}}</text>
<text>{{stockAdd}}</text>
<text>{{stockChange}}</text> <text>{{stockChange}}</text>
<text>{{stockAdd}}</text>
</view> </view>
<view class="graph_content"> <view class="graph_content">
<view class="charts-box"> <view class="charts-box">
@ -91,25 +91,9 @@
} from '@/stores/modules/deepExploration' } from '@/stores/modules/deepExploration'
const deepExplorationStore = useDeepExplorationStore() const deepExplorationStore = useDeepExplorationStore()
const historyData = ref({}) 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 type = ref('deepExploration')
const iSMT = ref(0) const iSMT = ref(0)
@ -217,8 +201,8 @@
stockId.value = result.data.stockId stockId.value = result.data.stockId
language.value = result.data.language language.value = result.data.language
market.value = result.data.market market.value = result.data.market
const res = await getModel1Second({ const res = await getModel1Second({
language: language.value, language: language.value,
recordId: recordId.value, recordId: recordId.value,
@ -234,9 +218,9 @@
htmlContent.value = marked.parse(markdownContent.value); htmlContent.value = marked.parse(markdownContent.value);
} }
console.log('res', res); console.log('res', res);
await getServerData() await getServerData()
} else if (result.code == 400) { } else if (result.code == 400) {
markdownContent.value = result.message; markdownContent.value = result.message;
@ -245,11 +229,11 @@
return return
} }
} }
} catch {
} catch (e) {
error.value = e.message || '加载失败,请重试'; error.value = e.message || '加载失败,请重试';
} finally { } finally {
loading.value = false; loading.value = false;
@ -290,18 +274,19 @@
console.log('k线数据', result); console.log('k线数据', result);
stockName.value = result.data.StockInformation.Name || 'Tesla Inc.' 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' stockTime.value = result.data.StockInformation.Time || '2025/10/29'
stockChange.value = result.data.StockInformation.Zhang || '5.120%' 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) // }, 500)
// } // }
let unwatch = null;
// onReady // onReady
onMounted(async() => {
onMounted(async () => {
iSMT.value = uni.getSystemInfoSync().statusBarHeight iSMT.value = uni.getSystemInfoSync().statusBarHeight
await getServerData() // await getServerData() //
await handleModels() 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; line-height: 18px;
} }
} }
.right { .right {

Loading…
Cancel
Save