From b0004e30c72237e16a988792bc92a80276dfb4dc Mon Sep 17 00:00:00 2001 From: hwj Date: Mon, 18 May 2026 11:54:01 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9A=E9=87=8D=E6=9E=84navbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 21 --- src/components/common/NavBar.vue | 161 ++++++++++++++++++++ src/page_record/feedingRecordForm.vue | 7 +- src/page_report/planProgress.vue | 4 +- src/page_report/replaceForm.vue | 6 +- src/page_report/reportForm.vue | 4 +- src/pages.json | 58 ++++--- src/pages/common/textview/index.vue | 9 +- src/pages/common/webview/index.vue | 15 +- src/pages/index.vue | 16 +- src/pages/login.vue | 2 + src/pages/mine.vue | 78 ++++++++-- src/pages/report.vue | 29 +++- src/pages/work.vue | 33 +++- src/pages_function/pages/planList/index.vue | 10 +- src/pages_function/pages/taskList/index.vue | 5 +- src/pages_mine/pages/about/index.vue | 16 +- src/pages_mine/pages/avatar/index.vue | 13 +- src/pages_mine/pages/help/index.vue | 16 +- src/pages_mine/pages/info/edit.vue | 14 +- src/pages_mine/pages/info/index.vue | 17 +-- src/pages_mine/pages/pwd/index.vue | 14 +- src/pages_mine/pages/setting/index.vue | 24 +-- 23 files changed, 397 insertions(+), 175 deletions(-) create mode 100644 src/components/common/NavBar.vue diff --git a/src/App.vue b/src/App.vue index cfec83f..6bbca27 100644 --- a/src/App.vue +++ b/src/App.vue @@ -12,8 +12,6 @@ function wrapUniTextApi() { const rawShowToast = uni.showToast const rawShowModal = uni.showModal const rawShowLoading = uni.showLoading - const rawSetNavigationBarTitle = uni.setNavigationBarTitle - const rawSetNavigationBarColor = uni.setNavigationBarColor uni.showToast = (options = {}) => { const next = { ...options } @@ -45,25 +43,6 @@ function wrapUniTextApi() { } return rawShowModal(next) } - uni.setNavigationBarTitle = (options = {}) => { - const next = { ...options } - if (typeof next.title === 'string') { - next.title = translateLiteral(next.title) - } - const result = rawSetNavigationBarTitle(next) - setTimeout(() => { - const pages = getCurrentPages() - if (pages && pages.length > 0) { - const route = pages[pages.length - 1].route || '' - if (route === 'pages/login') { - rawSetNavigationBarColor({ frontColor: '#000000', backgroundColor: '#ffffff' }) - } else { - rawSetNavigationBarColor({ frontColor: '#ffffff', backgroundColor: '#22486e' }) - } - } - }, 150) - return result - } } export default { diff --git a/src/components/common/NavBar.vue b/src/components/common/NavBar.vue new file mode 100644 index 0000000..4de5575 --- /dev/null +++ b/src/components/common/NavBar.vue @@ -0,0 +1,161 @@ + + + + + \ No newline at end of file diff --git a/src/page_record/feedingRecordForm.vue b/src/page_record/feedingRecordForm.vue index 386563d..46b4eb5 100644 --- a/src/page_record/feedingRecordForm.vue +++ b/src/page_record/feedingRecordForm.vue @@ -1,5 +1,6 @@ diff --git a/src/pages/common/webview/index.vue b/src/pages/common/webview/index.vue index 8388c76..3a0cdfe 100644 --- a/src/pages/common/webview/index.vue +++ b/src/pages/common/webview/index.vue @@ -1,11 +1,17 @@ diff --git a/src/pages/index.vue b/src/pages/index.vue index 1c839fd..aa2afe5 100644 --- a/src/pages/index.vue +++ b/src/pages/index.vue @@ -1,11 +1,10 @@ diff --git a/src/pages/work.vue b/src/pages/work.vue index 1682fb9..26df729 100644 --- a/src/pages/work.vue +++ b/src/pages/work.vue @@ -1,14 +1,31 @@ + + diff --git a/src/pages_function/pages/planList/index.vue b/src/pages_function/pages/planList/index.vue index 64e2974..df9aae7 100644 --- a/src/pages_function/pages/planList/index.vue +++ b/src/pages_function/pages/planList/index.vue @@ -1,5 +1,6 @@ diff --git a/src/pages_function/pages/taskList/index.vue b/src/pages_function/pages/taskList/index.vue index 7897d5e..8fd3ad8 100644 --- a/src/pages_function/pages/taskList/index.vue +++ b/src/pages_function/pages/taskList/index.vue @@ -1,5 +1,6 @@