From 6dcc946e1cb19a030ad61e907266f3540c115cc9 Mon Sep 17 00:00:00 2001 From: "34701892@qq.com" <34701892@qq.com> Date: Thu, 20 Nov 2025 18:38:16 +0800 Subject: [PATCH] =?UTF-8?q?feat(ETF):=20=E6=96=B0=E5=A2=9EETF=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E5=8F=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加fetchEtfDetail接口用于获取ETF详情数据 - 创建indexEtfInfo页面展示ETF详情信息 - 在indexEtf页面添加跳转到详情页功能 - 调整.env.development中的API地址配置 - 优化indexEtf页面样式和加载逻辑 --- .env.development | 4 +- src/api/index.ts | 5 + src/pages.json | 5 +- src/pages/realtimeInfo/indexEtf.vue | 51 +++-- src/pages/realtimeInfo/indexEtfInfo.vue | 256 ++++++++++++++++++++++++ 5 files changed, 301 insertions(+), 20 deletions(-) create mode 100644 src/pages/realtimeInfo/indexEtfInfo.vue diff --git a/.env.development b/.env.development index 9a5e003..c881666 100644 --- a/.env.development +++ b/.env.development @@ -2,8 +2,8 @@ ENV = development # 本地环境接口地址 -VITE_API_URL = http://123.60.153.169:8040/apih5 -# VITE_API_URL = http://4155gf93ll13.vicp.fun/apih5 +# VITE_API_URL = http://123.60.153.169:8040/apih5 +VITE_API_URL = http://4155gf93ll13.vicp.fun/apih5 # VITE_API_URL = http://123.60.79.143:8041/apih5 # VITE_API_URL =http://localhost:8040/apih5 # VITE_API_URL = https://cankao.cs.com.cn/apih5 diff --git a/src/api/index.ts b/src/api/index.ts index d9d865d..0b4d81a 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -85,3 +85,8 @@ export const doLogout = (data: any) => { export const getEtfIndexList = (data: any) => { return Request.post("/news/etfIndexList", data); }; + +// 获取ETF详情 +export const fetchEtfDetail = (data: any) => { + return Request.post("/news/etfList", data); +}; diff --git a/src/pages.json b/src/pages.json index b373301..304845f 100644 --- a/src/pages.json +++ b/src/pages.json @@ -25,6 +25,9 @@ { "path": "pages/realtimeInfo/indexEtf" }, + { + "path": "pages/realtimeInfo/indexEtfInfo" + }, { "path": "pages/sreachReq/index" }, @@ -88,4 +91,4 @@ "allowsBounceVertical": "YES" } } -} \ No newline at end of file +} diff --git a/src/pages/realtimeInfo/indexEtf.vue b/src/pages/realtimeInfo/indexEtf.vue index 2a17893..10d271a 100644 --- a/src/pages/realtimeInfo/indexEtf.vue +++ b/src/pages/realtimeInfo/indexEtf.vue @@ -55,7 +55,8 @@ {{ item.summary }} - + + {{ etf.name }}
@@ -95,22 +96,22 @@ import { onReachBottom } from "@dcloudio/uni-app"; import { getEtfIndexList } from "@/api/index"; const listData = ref([ - { - day: "2026-10-26", - list: [ - { - time: "11:30:56", - title: "刚果延长禁令后,中国钴价和库存飙升刚果延长禁令后,中国钴价和库存飙升", - summary: "刚果民主共和国将钴出口禁令延长至9月,导致全球约四分之三的钴供应受到影响。这一消息引…", - etfs: [ - { - name: "医药 ETF", - code: "string", - }, - ], - }, - ], - }, + // { + // day: "2026-10-26", + // list: [ + // { + // time: "11:30:56", + // title: "刚果延长禁令后,中国钴价和库存飙升刚果延长禁令后,中国钴价和库存飙升", + // summary: "刚果民主共和国将钴出口禁令延长至9月,导致全球约四分之三的钴供应受到影响。这一消息引…", + // etfs: [ + // { + // name: "医药 ETF", + // code: "string", + // }, + // ], + // }, + // ], + // }, ]); const form = ref({ @@ -118,10 +119,15 @@ const form = ref({ keyword: null, }); async function getData() { + uni.showLoading({ + title: "加载中", + }); let { code, data } = await getEtfIndexList({ ...form.value, size: 20, }); + uni.hideLoading(); + if (code == 200) { if (form.value.page == 1) { listData.value = []; @@ -173,6 +179,13 @@ function goDetail(item, index) { } } +function goEtfDetail(item) { + console.log("🚀 ~ goEtfDetail ~ item:", item); + uni.navigateTo({ + url: `/pages/realtimeInfo/indexEtfInfo?name=${item.name}&code=${item.code}`, + }); +} + function onSreach() { if (Session.get("token")) { form.value.page = 1; @@ -487,15 +500,19 @@ onMounted(async () => { margin-top: 10rpx; gap: 20rpx; margin-top: 30rpx; + margin-bottom: 30rpx; .item_etf_item { // width: 168rpx; + width: calc(50% - 60rpx); height: 48rpx; background: #edf1f5; border-radius: 125rpx; padding: 5rpx 25rpx; display: flex; align-items: center; + text-align: center; + justify-content: space-between; text { font-family: PingFangSC, PingFang SC; diff --git a/src/pages/realtimeInfo/indexEtfInfo.vue b/src/pages/realtimeInfo/indexEtfInfo.vue new file mode 100644 index 0000000..c63971e --- /dev/null +++ b/src/pages/realtimeInfo/indexEtfInfo.vue @@ -0,0 +1,256 @@ + + + + +