From bc3d46b41fc83a4ee644036f70ee31bc10cdf762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B2=A9=E4=BB=9488?= <> Date: Tue, 13 Jan 2026 10:33:53 +0800 Subject: [PATCH] bug --- 西平县中医院报告对比/lu/axios.js | 19 +++++++++---------- 西平县中医院报告对比/pages/main/home/home.vue | 5 +++++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/西平县中医院报告对比/lu/axios.js b/西平县中医院报告对比/lu/axios.js index 19f7419..f107ac1 100644 --- a/西平县中医院报告对比/lu/axios.js +++ b/西平县中医院报告对比/lu/axios.js @@ -18,15 +18,14 @@ const noLogin = [ const getParams = (key) => { - let params_str = window.location.href.split('?')[1] - let params_arr = params_str.split('&') - for (let i in params_arr) { - if (params_arr[i].indexOf(key + '=') !== -1) { - return params_arr[i].split('=')[1] - } - } - return false -} + const pages = getCurrentPages(); + if (pages.length === 0) return false; + + const currentPage = pages[pages.length - 1]; + // uni-app 中页面参数统一在 options 里(H5 的 query / 小程序的 options) + const value = currentPage.options?.[key]; + return value || false; +}; export const $post = async ({ url, @@ -40,7 +39,7 @@ export const $post = async ({ } if (requests[url]) return false; requests[url] = true - data.hospital = getParams('hospital') + data.hospital = getParams('hospital') || '4' let res = await uni.request({ url: $api(url), method: 'post', diff --git a/西平县中医院报告对比/pages/main/home/home.vue b/西平县中医院报告对比/pages/main/home/home.vue index 73d39d9..9b3b5e5 100644 --- a/西平县中医院报告对比/pages/main/home/home.vue +++ b/西平县中医院报告对比/pages/main/home/home.vue @@ -52,6 +52,11 @@ GetReportList() } + // onShow(()=>{ + // uni.navigateTo({ + // url: `/pages/main/home/home?hospital=4` + // }) + // })