From 81c98ce3b2a5686a9b0565204ee942deaf64579a Mon Sep 17 00:00:00 2001 From: "34701892@qq.com" <34701892@qq.com> Date: Mon, 24 Nov 2025 08:49:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DETF=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=90=88=E5=B9=B6=E9=80=BB=E8=BE=91=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83API?= =?UTF-8?q?=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复indexEtf.vue中分页加载时相同day数据的合并问题,避免重复数据 更新.env.development中的VITE_API_URL为https://cankao.cs.com.cn/apih5 --- .env.development | 4 ++-- src/pages/realtimeInfo/indexEtf.vue | 32 ++++++++++++++++++++++------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.env.development b/.env.development index da0a3b9..705b440 100644 --- a/.env.development +++ b/.env.development @@ -2,10 +2,10 @@ ENV = development # 本地环境接口地址 -VITE_API_URL = http://123.60.153.169:8040/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://192.168.0.135:8040/apih5 -# VITE_API_URL = https://cankao.cs.com.cn/apih5 +VITE_API_URL = https://cankao.cs.com.cn/apih5 VITE_API_DATAV_URL = https://cankao.cs.com.cn/zzck_datav \ No newline at end of file diff --git a/src/pages/realtimeInfo/indexEtf.vue b/src/pages/realtimeInfo/indexEtf.vue index 35eb3ac..af8a7e7 100644 --- a/src/pages/realtimeInfo/indexEtf.vue +++ b/src/pages/realtimeInfo/indexEtf.vue @@ -76,7 +76,8 @@ :show="LoginShow" @handlePopupClose="handlePopupClose" @handlePopupSuccessCallback="handlePopupSuccessCallback" - @handlePopupErrorCallback="handlePopupErrorCallback" /> + @handlePopupErrorCallback="handlePopupErrorCallback" + /> @@ -128,13 +129,30 @@ async function getData() { uni.hideLoading(); if (code == 200) { - if (form.value.page == 1) { - listData.value = []; - listData.value = data.list; - } else { - listData.value = [...listData.value, ...data.list]; + if (form.value.page == 1) { + listData.value = []; + listData.value = data.list; + } else { + // 处理可能的day字段重复,合并相同day的list数据 + const newList = [...data.list]; + const updatedList = [...listData.value]; + + newList.forEach(newItem => { + // 检查是否存在相同day的条目 + const existingItemIndex = updatedList.findIndex(item => item.day === newItem.day); + + if (existingItemIndex !== -1) { + // 如果存在相同day,合并list数据 + updatedList[existingItemIndex].list = [...updatedList[existingItemIndex].list, ...newItem.list]; + } else { + // 如果不存在相同day,直接添加 + updatedList.push(newItem); + } + }); + + listData.value = updatedList; + } } - } } const LoginShow = ref(false);