From bdd15e5104b1f3d73f4503a09ad18f55b09e35d7 Mon Sep 17 00:00:00 2001 From: hwj Date: Tue, 19 May 2026 11:13:36 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9A=E9=87=8D=E6=9E=84navbar?= =?UTF-8?q?=EF=BC=8C=E6=94=B9=E7=94=A8uview-plus=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/AppTitleHeader.vue | 108 --------------- src/components/common/NavBar.vue | 128 ++++++------------ .../pages/criticalComponent/detail.vue | 4 +- .../pages/criticalComponent/index.vue | 4 +- src/pages_function/pages/equipment/detail.vue | 4 +- src/pages_function/pages/equipment/index.vue | 4 +- .../pages/equipmentCategory/detail.vue | 4 +- .../pages/equipmentCategory/index.vue | 4 +- .../pages/equipmentLedger/detail.vue | 4 +- .../pages/equipmentLedger/index.vue | 4 +- src/pages_function/pages/keypart/detail.vue | 4 +- src/pages_function/pages/keypart/index.vue | 4 +- .../pages/materialCategory/detail.vue | 4 +- .../pages/materialCategory/index.vue | 4 +- .../pages/materialInfo/detail.vue | 4 +- .../pages/materialInfo/index.vue | 4 +- src/pages_function/pages/mold/detail.vue | 4 +- src/pages_function/pages/mold/index.vue | 4 +- .../pages/moldInspectionItems/detail.vue | 4 +- .../pages/moldInspectionItems/index.vue | 4 +- .../pages/moldInspectionPlan/detail.vue | 4 +- .../pages/moldInspectionPlan/index.vue | 4 +- .../pages/moldLedger/detail.vue | 4 +- src/pages_function/pages/moldLedger/index.vue | 4 +- .../pages/moldTaskConfiguration/detail.vue | 4 +- .../pages/moldTaskConfiguration/index.vue | 4 +- src/pages_function/pages/moldType/detail.vue | 4 +- src/pages_function/pages/moldType/index.vue | 4 +- .../pages/moldWorkOrderInquiry/detail.vue | 4 +- .../pages/moldWorkOrderInquiry/index.vue | 4 +- src/pages_function/pages/moldget/detail.vue | 4 +- src/pages_function/pages/moldget/index.vue | 4 +- .../pages/moldoperate/detail.vue | 4 +- .../pages/moldoperate/index.vue | 4 +- .../pages/moldreturn/detail.vue | 4 +- src/pages_function/pages/moldreturn/index.vue | 4 +- src/pages_function/pages/product/detail.vue | 4 +- src/pages_function/pages/product/index.vue | 4 +- .../pages/productBom/detail.vue | 4 +- src/pages_function/pages/productBom/index.vue | 4 +- src/pages_function/pages/spare/detail.vue | 4 +- src/pages_function/pages/spare/index.vue | 4 +- 42 files changed, 123 insertions(+), 273 deletions(-) delete mode 100644 src/components/common/AppTitleHeader.vue diff --git a/src/components/common/AppTitleHeader.vue b/src/components/common/AppTitleHeader.vue deleted file mode 100644 index b3d7f87..0000000 --- a/src/components/common/AppTitleHeader.vue +++ /dev/null @@ -1,108 +0,0 @@ - - - - - diff --git a/src/components/common/NavBar.vue b/src/components/common/NavBar.vue index ace2e82..f3aec09 100644 --- a/src/components/common/NavBar.vue +++ b/src/components/common/NavBar.vue @@ -1,18 +1,23 @@ @@ -30,6 +35,10 @@ const props = defineProps({ type: String, default: '' }, + subTitle: { + type: String, + default: '' + }, backgroundColor: { type: String, default: '#22486e' @@ -44,17 +53,8 @@ const props = defineProps({ } }) -const systemInfo = uni.getSystemInfoSync() -const statusBarHeight = ref(systemInfo.statusBarHeight || 0) const currentPagesLength = ref(1) -const navBodyHeight = computed(() => { - const platform = systemInfo.platform || '' - if (platform === 'android') return 48 - if (platform === 'ios') return 44 - return 44 -}) - const isLoginPage = computed(() => { const pages = getCurrentPages() if (pages && pages.length > 0) { @@ -68,19 +68,24 @@ const showBackBtn = computed(() => { return currentPagesLength.value > 1 }) -const navbarStyle = computed(() => { - const bg = isLoginPage.value ? '#ffffff' : props.backgroundColor - return { - backgroundColor: bg, - paddingTop: '0px' - } +const navbarBgColor = computed(() => { + return isLoginPage.value ? '#ffffff' : props.backgroundColor +}) + +const navTextColor = computed(() => { + return isLoginPage.value ? '#000000' : props.textColor }) const translatedTitle = computed(() => translateLiteral(props.title)) -const textColor = computed(() => { - if (isLoginPage.value) return '#000000' - return props.textColor +const translatedSubTitle = computed(() => translateLiteral(props.subTitle)) + +const titleStyleObj = computed(() => { + return { + color: navTextColor.value, + fontWeight: '700', + fontSize: '34rpx' + } }) onShow(() => { @@ -89,6 +94,7 @@ onShow(() => { }) function handleBack() { + if (!showBackBtn.value) return uni.navigateBack({ fail: () => { uni.reLaunch({ @@ -100,62 +106,14 @@ function handleBack() { \ No newline at end of file + diff --git a/src/pages_function/pages/criticalComponent/detail.vue b/src/pages_function/pages/criticalComponent/detail.vue index 62c48c3..ac72026 100644 --- a/src/pages_function/pages/criticalComponent/detail.vue +++ b/src/pages_function/pages/criticalComponent/detail.vue @@ -1,7 +1,7 @@