From 1ac4d39e91868fd9413ad2f98800a49e8a627250 Mon Sep 17 00:00:00 2001 From: zzp <34701892@qq.com> Date: Wed, 20 Aug 2025 13:30:34 +0800 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E7=8A=B6=E6=80=81=E5=88=A4=E6=96=AD=E5=8F=8A=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor: 优化代码格式和组件结构 feat: 添加点击登录跳转功能 style: 调整搜索框宽度和样式 chore: 更新API基础URL配置 --- src/App.vue | 3 +- src/components/RankListMini.vue | 126 ++++++++++++++++-------- src/components/articleList/index.vue | 112 +++++++++++++++------ src/components/mini/Tabbar.vue | 63 +++++++++--- src/config/index.ts | 2 +- src/pages/detail/indexNewsInfo.vue | 97 ++++++++++++------- src/pages/login/indexMini.vue | 55 +++++++---- src/pages/minihome/index.vue | 139 +++++++++++++++------------ src/pages/sreachReq/index.vue | 104 ++++++++++++++------ 9 files changed, 471 insertions(+), 230 deletions(-) diff --git a/src/App.vue b/src/App.vue index ac1e267..034ebbc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,10 +8,9 @@ onLaunch(() => { console.log("App Launch"); stores.initWxConfig(); }); -onShow(() => { }); +onShow(() => {}); onHide(() => { console.log("App Hide"); - uni.setStorageSync('homeTabIndex', null) }); diff --git a/src/components/mini/Tabbar.vue b/src/components/mini/Tabbar.vue index 3aaca59..47982ed 100644 --- a/src/components/mini/Tabbar.vue +++ b/src/components/mini/Tabbar.vue @@ -1,35 +1,72 @@ From 9e337565a5c6e2d9e25750d0ea95d8ca0924e11a Mon Sep 17 00:00:00 2001 From: zzp <34701892@qq.com> Date: Tue, 26 Aug 2025 08:47:48 +0800 Subject: [PATCH 02/11] =?UTF-8?q?fix(config):=20=E6=9B=B4=E6=96=B0baseUrlD?= =?UTF-8?q?ataV=E9=85=8D=E7=BD=AE=E4=B8=BA=E6=B5=8B=E8=AF=95=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将baseUrlDataV从生产环境地址更改为测试环境地址,便于开发调试 --- src/config/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/config/index.ts b/src/config/index.ts index 9111ea4..15d0ad9 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -2,5 +2,7 @@ // export const baseUrl = "http://192.168.3.38:8040/apih5"; export const baseUrl = "http://123.60.153.169:8040/apih5"; // export const baseUrl = "https://cankao.cs.com.cn/apih5"; -export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav"; + +// export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav"; +export const baseUrlDataV = "http://123.60.153.169:9995/zzck_datav"; From e35509eda80f79a7902e1a80a9f2f0c1b88f5137 Mon Sep 17 00:00:00 2001 From: zzp <34701892@qq.com> Date: Tue, 26 Aug 2025 15:34:27 +0800 Subject: [PATCH 03/11] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0API=E5=9F=BA?= =?UTF-8?q?=E7=A1=80URL=E5=B9=B6=E4=BC=98=E5=8C=96=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B9=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将API基础URL从HTTP切换到HTTPS并更新路径 - 根据登录状态模糊显示部分列表内容 - 优化列表项标题显示格式 --- src/config/index.ts | 6 +-- src/pages/realtimeInfo/rankDetail.vue | 67 +++++++++++++++++---------- 2 files changed, 46 insertions(+), 27 deletions(-) diff --git a/src/config/index.ts b/src/config/index.ts index 15d0ad9..7277d70 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -1,8 +1,8 @@ // const baseURL = "http://192.168.31.25:8060/api"; // export const baseUrl = "http://192.168.3.38:8040/apih5"; -export const baseUrl = "http://123.60.153.169:8040/apih5"; +export const baseUrl = "https://cankao.cs.com.cn/mini"; // export const baseUrl = "https://cankao.cs.com.cn/apih5"; -// export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav"; -export const baseUrlDataV = "http://123.60.153.169:9995/zzck_datav"; +export const baseUrlDataV = "https://cankao.cs.com.cn/zzck_datav"; +// export const baseUrlDataV = "http://123.60.153.169:9995/zzck_datav"; diff --git a/src/pages/realtimeInfo/rankDetail.vue b/src/pages/realtimeInfo/rankDetail.vue index a66f7b7..92aae8a 100644 --- a/src/pages/realtimeInfo/rankDetail.vue +++ b/src/pages/realtimeInfo/rankDetail.vue @@ -1,17 +1,23 @@ @@ -151,7 +179,6 @@ const loginOut = () => { uni.reLaunch({ url: "/pages/login/index", }); - }; const handleClick = (val: number) => { diff --git a/src/components/mineMini.vue b/src/components/mineMini.vue index 1771326..068aa17 100644 --- a/src/components/mineMini.vue +++ b/src/components/mineMini.vue @@ -3,7 +3,10 @@ - + {{ !isLoginStatus ? "未登录用户" : maskPhoneNumber() @@ -38,24 +41,41 @@ color: '#333333', }" @click="handleClick(-1)"> --> - + }" + @click="handleClick(0)" + > - + }" + @click="handleClick(1)" + > - + }" + @click="handleClick(2)" + > - - + }" + @click="handleClick(3)" + > @@ -88,8 +112,12 @@ - + @@ -99,9 +127,9 @@ import { onPullDownRefresh, onShow } from "@dcloudio/uni-app"; import { Session } from "@/utils/storage"; import LoginPopup from "@/components/loginPopup/index.vue"; import { useShareStore } from "@/stores/shareStore"; -import Navbar from '@/components/mini/Navbar.vue' +import Navbar from "@/components/mini/Navbar.vue"; -const emit = defineEmits(['logout']) +const emit = defineEmits(["logout"]); const stores = useShareStore(); const curPages = getCurrentPages(); @@ -161,23 +189,23 @@ const loginBtnStatus = () => { // 退出登录,回到登录页面 const loginOut = () => { - uni.clearStorageSync() - emit("logout") + uni.clearStorageSync(); + emit("logout"); }; const handleClick = (val: number) => { + uni.setStorageSync("homeTabIndex", 1); if (val === -1) { uni.navigateTo({ url: "/pages/subscribed/index", }); } else if (val === 3) { wx.openPrivacyContract({ - success: () => { }, // 打开成功 - fail: () => { }, // 打开失败 - complete: () => { }, + success: () => {}, // 打开成功 + fail: () => {}, // 打开失败 + complete: () => {}, }); - } - else { + } else { uni.navigateTo({ url: `/pages/bookmark/index?tabs=${val}`, }); diff --git a/src/components/mini/Tabbar.vue b/src/components/mini/Tabbar.vue index 47982ed..c6cea0c 100644 --- a/src/components/mini/Tabbar.vue +++ b/src/components/mini/Tabbar.vue @@ -33,7 +33,7 @@ 全部 + >我的 diff --git a/src/pages/detail/indexNewsInfo.vue b/src/pages/detail/indexNewsInfo.vue index be76770..e671ced 100644 --- a/src/pages/detail/indexNewsInfo.vue +++ b/src/pages/detail/indexNewsInfo.vue @@ -76,7 +76,12 @@ + + diff --git a/src/components/domestic.vue b/src/components/domestic.vue index cdcb098..26f3c0f 100644 --- a/src/components/domestic.vue +++ b/src/components/domestic.vue @@ -21,8 +21,16 @@ - - + + @@ -44,8 +52,11 @@ - + @@ -95,7 +106,11 @@ watch( () => props.newsList, (newValue, oldValue) => { const token = Session.get("token"); - isPay.value = !token ? true : newValue[0]?.needpay ? newValue[0]?.needpay : false; + isPay.value = !token + ? true + : newValue[0]?.needpay + ? newValue[0]?.needpay + : false; } ); @@ -253,7 +268,8 @@ const handlePopupSuccessCallback = () => { display: block; width: 44rpx; height: 6rpx; - background: url("https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/icon_dot.png") no-repeat center; + background: url("https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/images/icon_dot.png") + no-repeat center; background-size: 100% 100%; } } @@ -434,7 +450,11 @@ const handlePopupSuccessCallback = () => { // margin-bottom: 24rpx; padding: 40rpx 0; border-radius: 8rpx; - background: linear-gradient(90deg, rgba(255, 250, 240, 1) 0%, rgba(254, 238, 210, 1) 100%); + background: linear-gradient( + 90deg, + rgba(255, 250, 240, 1) 0%, + rgba(254, 238, 210, 1) 100% + ); .need-pay-text { font-size: 28rpx; @@ -452,7 +472,11 @@ const handlePopupSuccessCallback = () => { font-size: 32rpx; color: #fff; border-radius: 20rpx; - background: linear-gradient(90deg, rgba(252, 92, 105, 1) 0%, rgba(231, 48, 63, 1) 100%); + background: linear-gradient( + 90deg, + rgba(252, 92, 105, 1) 0%, + rgba(231, 48, 63, 1) 100% + ); } } } diff --git a/src/components/domesticMini.vue b/src/components/domesticMini.vue new file mode 100644 index 0000000..bd489eb --- /dev/null +++ b/src/components/domesticMini.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/src/pages/minihome/index.vue b/src/pages/minihome/index.vue index f80c655..1917af4 100644 --- a/src/pages/minihome/index.vue +++ b/src/pages/minihome/index.vue @@ -15,7 +15,7 @@ top: 0, zIndex: '999999', }" - v-if="tabIndex == 0" + v-if="tabIndex == 0 || tabIndex == 2" > - + + + + + + @@ -93,6 +99,7 @@ import Tabs from "@/components/mini/Tabs.vue"; import { getTopNews } from "@/api/newsInfo"; import { onPageNotFound, onPageScroll, onShow } from "@dcloudio/uni-app"; import { getNavHeight } from "@/utils/util"; +import Domestic from "@/components/domesticMini.vue"; const list1 = reactive([ "https://cankao.obs.cn-east-3.myhuaweicloud.com/mini/newmini/banner1.png", @@ -134,10 +141,18 @@ function goSreach() { const isScroll = ref(false); onPageScroll((val) => { - if (val.scrollTop > 150) { - isScroll.value = true; + if (tabIndex.value == 0 || tabIndex.value == 1) { + if (val.scrollTop > 150) { + isScroll.value = true; + } else { + isScroll.value = false; + } } else { - isScroll.value = false; + if (val.scrollTop > 80) { + isScroll.value = true; + } else { + isScroll.value = false; + } } }); From d74ce739719005d7c8522987bdd40792c689d238 Mon Sep 17 00:00:00 2001 From: zzp <34701892@qq.com> Date: Sat, 30 Aug 2025 20:33:45 +0800 Subject: [PATCH 09/11] =?UTF-8?q?feat(=E5=9B=BD=E5=86=85=E8=B5=84=E8=AE=AF?= =?UTF-8?q?):=20=E6=B7=BB=E5=8A=A0=E5=9B=BD=E5=86=85=E8=B5=84=E8=AE=AF?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E5=8A=9F=E8=83=BD=E5=8F=8A=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在domesticMini.vue中添加跳转到详情页的功能 - 在api/index.ts中新增获取国内资讯详情的接口 - 修改indexNewsInfo.vue以支持国内资讯详情展示 - 更新minihome/index.vue的tab切换逻辑 --- src/api/index.ts | 9 +++++-- src/components/domesticMini.vue | 7 ++++++ src/pages/detail/indexNewsInfo.vue | 39 ++++++++++++++++++++---------- src/pages/minihome/index.vue | 10 ++++++-- 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index e2d75e1..5db9a52 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -72,7 +72,12 @@ export const doShare = (data: any) => { return Request.post("/user/share", data); }; -// 微信分享 +// 国内资讯列表 export const getDomestic = (data: any) => { return Request.get("/news/domestic", data); -}; \ No newline at end of file +}; + +// 国内资讯详情 +export const getDomesticDetail = (data: any) => { + return Request.get(`/news/domestic/${data.id}`); +}; diff --git a/src/components/domesticMini.vue b/src/components/domesticMini.vue index bd489eb..8906d12 100644 --- a/src/components/domesticMini.vue +++ b/src/components/domesticMini.vue @@ -19,6 +19,13 @@ const form = reactive({ pageNum: 1, pageSize: 10, }); + +function doDetail(item) { + uni.navigateTo({ + url: "/pages/detail/indexNewsInfo?id=" + item.id + "&type=guonei", + }); +} + async function getDomesticFn() { uni.showLoading(); let { code, data } = await getDomestic({ diff --git a/src/pages/detail/indexNewsInfo.vue b/src/pages/detail/indexNewsInfo.vue index 0d1b636..718190c 100644 --- a/src/pages/detail/indexNewsInfo.vue +++ b/src/pages/detail/indexNewsInfo.vue @@ -50,7 +50,7 @@ { console.log("🚀 ~ onReachBottom ~ onReachBottom:"); }); +const isDomestic = ref(false); onLoad(async (option: any) => { uni.pageScrollTo({ scrollTop: 0, }); - newType.value = option.type || 14; - const res = await fetchArticleDetail({ - id: option.id, - // id: 763, - }); + if (option?.type == "guonei") { + isDomestic.value = true; + let res = await getDomesticDetail({ id: option.id }); + if (res.code === 200) { + data.value = res.data; - if (res.code === 200) { - data.value = res.data; + data.value.content = res.data.content.replace(/\n{3,}/g, "\n"); - res.data.content = res.data.content.replace(/\n{3,}/g, "\n"); + columnName.value = data.columnName1; + } + } else { + newType.value = option.type || 14; + const res = await fetchArticleDetail({ + id: option.id, + // id: 763, + }); - columnName.value = res.data.columnName1; - newList(res.data.columnId1); - wxShare(); + if (res.code === 200) { + data.value = res.data; + + res.data.content = res.data.content.replace(/\n{3,}/g, "\n"); + + columnName.value = res.data.columnName1; + newList(res.data.columnId1); + wxShare(); + } } }); diff --git a/src/pages/minihome/index.vue b/src/pages/minihome/index.vue index 1917af4..f9a8581 100644 --- a/src/pages/minihome/index.vue +++ b/src/pages/minihome/index.vue @@ -124,6 +124,9 @@ function tabChange(index) { break; case 1: break; + case 2: + uni.setStorageSync("homeTabIndex", 2); + break; } } @@ -157,8 +160,11 @@ onPageScroll((val) => { }); onShow(() => { - if (uni.getStorageSync("homeTabIndex") == 1) { - tabChange(1); + if ( + uni.getStorageSync("homeTabIndex") == 1 || + uni.getStorageSync("homeTabIndex") == 2 + ) { + tabChange(uni.getStorageSync("homeTabIndex")); } else { tabChange(0); } From cda80c62d64b2e3ad559968f333641ffc686d9f9 Mon Sep 17 00:00:00 2001 From: zzp <34701892@qq.com> Date: Sat, 30 Aug 2025 21:21:49 +0800 Subject: [PATCH 10/11] =?UTF-8?q?feat(=E6=96=87=E7=AB=A0=E7=BB=84=E4=BB=B6?= =?UTF-8?q?):=20=E6=B7=BB=E5=8A=A0=E5=9B=BD=E5=86=85=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为文章组件添加 isDomestic 属性,用于控制国内新闻的显示逻辑 调整首页搜索框和国内新闻列表的显示条件及间距 --- src/components/article/indexNewsInfo.vue | 11 +++++++++-- src/pages/detail/indexNewsInfo.vue | 2 +- src/pages/minihome/index.vue | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/article/indexNewsInfo.vue b/src/components/article/indexNewsInfo.vue index e6d404a..39cb75c 100644 --- a/src/components/article/indexNewsInfo.vue +++ b/src/components/article/indexNewsInfo.vue @@ -8,7 +8,7 @@ - + 来源: {{ props.data.tag }} @@ -53,7 +53,10 @@ - + {{ props.data.summary }} @@ -100,6 +103,10 @@ const props = defineProps({ type: Object, default: () => {}, }, + isDomestic: { + type: Boolean, + default: false, + }, }); const tagList1 = ref([ { diff --git a/src/pages/detail/indexNewsInfo.vue b/src/pages/detail/indexNewsInfo.vue index 718190c..39b2299 100644 --- a/src/pages/detail/indexNewsInfo.vue +++ b/src/pages/detail/indexNewsInfo.vue @@ -37,7 +37,7 @@ -
+
diff --git a/src/pages/minihome/index.vue b/src/pages/minihome/index.vue index f9a8581..f397f53 100644 --- a/src/pages/minihome/index.vue +++ b/src/pages/minihome/index.vue @@ -45,7 +45,7 @@ > - + - + From c6d8278f7d2c8d2f50d34047ecd2ad2005325eb5 Mon Sep 17 00:00:00 2001 From: zzp <34701892@qq.com> Date: Sat, 30 Aug 2025 21:31:35 +0800 Subject: [PATCH 11/11] =?UTF-8?q?feat(domesticMini):=20=E5=9C=A8=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E8=B7=B3=E8=BD=AC=E6=97=B6=E5=AD=98=E5=82=A8homeTabIn?= =?UTF-8?q?dex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在doDetail函数中添加uni.setStorageSync调用,用于在跳转到详情页时保存当前tab索引 --- src/components/domesticMini.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/domesticMini.vue b/src/components/domesticMini.vue index 8906d12..7f79897 100644 --- a/src/components/domesticMini.vue +++ b/src/components/domesticMini.vue @@ -21,6 +21,7 @@ const form = reactive({ }); function doDetail(item) { + uni.setStorageSync("homeTabIndex", 2); uni.navigateTo({ url: "/pages/detail/indexNewsInfo?id=" + item.id + "&type=guonei", });