From 769382fe253de2b6018438840da49bb95ba8bd8f Mon Sep 17 00:00:00 2001 From: dongqian <3475123872@qq.com> Date: Wed, 29 Oct 2025 21:58:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83=E9=80=89=E8=82=A1=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/deepExploration/deepExploration.js | 9 +- pages/deepExploration/deepExploration.vue | 44 +++- pages/deepExploration/stockSelectDetail.vue | 320 +++++++++++++++------------- 3 files changed, 223 insertions(+), 150 deletions(-) diff --git a/api/deepExploration/deepExploration.js b/api/deepExploration/deepExploration.js index 754ad5e..ea763a4 100644 --- a/api/deepExploration/deepExploration.js +++ b/api/deepExploration/deepExploration.js @@ -92,7 +92,14 @@ export const stocSelectApi = (data) => { data:data }) } - +//根据名字选股策略 +export const stocSelectByNameApi = (data) => { + return http({ + method: 'POST', + url: '/api/deep/getStrategyByName', + data:data + }) +} //历史记录详情 diff --git a/pages/deepExploration/deepExploration.vue b/pages/deepExploration/deepExploration.vue index 026d156..f6e6e67 100644 --- a/pages/deepExploration/deepExploration.vue +++ b/pages/deepExploration/deepExploration.vue @@ -113,7 +113,7 @@ src="/static/deepExploration-images/plus.png" mode="aspectFill" > - 抄底卖顶 + 波段行情 选股价格 - + {{ item.tscode }} {{ item.close }} {{ item.preClose }} @@ -151,7 +151,7 @@ } from 'vue' import footerBar from '@/components/footerBar.vue' import deepExploration_header from '@/components/deepExploration_header.vue' - import { stocSelectApi } from '@/api/deepExploration/deepExploration.js' + import { stocSelectApi, stocSelectByNameApi } from '@/api/deepExploration/deepExploration.js' const type = ref("deepExploration"); const iSMT = ref(0); @@ -194,6 +194,7 @@ const searchStock = () => { } //选股策略数据(接口填充) const stockData = ref([]); + const stockDataByName = ref([]); // 安徽板块数据(只显示前三条) // 加载选股策略(接口) const loadStockSelection = async () => { @@ -235,11 +236,48 @@ const searchStock = () => { } } + // 安徽板块:按名称查询,仅前三条,字段映射不变 + const loadStockSelectionByName = async () => { + try { + const res = await stocSelectByNameApi({ name: '安徽' }) + const raw = res?.data + const dataObj = raw?.data || raw + let list = [] + if (Array.isArray(dataObj)) { + list = dataObj + } else if (dataObj && typeof dataObj === 'object') { + const target = dataObj['安徽'] + if (Array.isArray(target)) { + list = target + } else { + const firstArr = Object.values(dataObj).find(v => Array.isArray(v)) + if (Array.isArray(firstArr)) list = firstArr + } + } + + if (Array.isArray(list) && list.length) { + const mapped = list.map(item => ({ + tscode: item.tsCode ?? item.tscode ?? item.code ?? '', + close: item.close ?? item.lastClose ?? '', + preClose: item.preClose ?? item.preclose ?? item.prevClose ?? '' + })) + stockDataByName.value = mapped.slice(0, 3) + console.log('安徽板块列表长度:', stockDataByName.value.length, '首项:', stockDataByName.value[0]) + } else { + console.warn('按名称(安徽)接口返回空列表或结构不匹配', raw) + } + } catch (e) { + console.error('按名称(安徽)接口调用失败', e) + uni.showToast({ title: '安徽板块加载失败', icon: 'none' }) + } + } + onMounted(() => { // 状态栏高度 iSMT.value = uni.getSystemInfoSync().statusBarHeight; // 调用接口填充数据 loadStockSelection() + loadStockSelectionByName() // 安徽板块填充 }) diff --git a/pages/deepExploration/stockSelectDetail.vue b/pages/deepExploration/stockSelectDetail.vue index 64ee01d..3a90ec4 100644 --- a/pages/deepExploration/stockSelectDetail.vue +++ b/pages/deepExploration/stockSelectDetail.vue @@ -3,12 +3,12 @@ - + {{item}} - - + + @@ -23,7 +23,7 @@ - {{item.name}} @@ -48,153 +48,176 @@