From e39204acff67d6cd0afefb02b1f1b44ee07bf71c Mon Sep 17 00:00:00 2001 From: wangxia <779219182@qq.com> Date: Tue, 12 Aug 2025 15:39:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 33 +++++++++++++++++++++++++++++++++ pages/home/index.vue | 3 ++- pages/person/index.vue | 3 ++- pages/workBench/index.vue | 1 + utils/common.js | 3 +++ 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/App.vue b/App.vue index eb85fd9..e0b5cf6 100644 --- a/App.vue +++ b/App.vue @@ -16,6 +16,38 @@ export default { onLaunch() { let that = this; uni.removeStorageSync("selectedCity"); + // 可能只在小程序生效的监听方法 + // uni.onBeforeAppRoute((res) => { + // console.log("setNavStyle", res); + // try { + // that.G.Post("/common/user/browsing/history/addRecord", { browsingUrl: res.path }, (res) => {}); + // } catch (error) { + // console.log("error", error); + // } + // }); + // 监听路由跳转 + uni.addInterceptor("navigateTo", { + // 跳转前拦截 + invoke(args) { + console.log("navigateTo 跳转前", args); + that.G.watchUserPage(args.url); + }, + }); + uni.addInterceptor("reLaunch", { + // 跳转前拦截 + invoke(args) { + console.log("reLaunch 跳转前", args); + that.G.watchUserPage(args.url); + }, + }); + uni.addInterceptor("redirectTo", { + // 跳转前拦截 + invoke(args) { + console.log("redirectTo 跳转前", args); + that.G.watchUserPage(args.url); + }, + }); + }, onShow: function (options) { let that = this; @@ -77,6 +109,7 @@ export default { } }, methods: { + initWyyx() { let that = this; diff --git a/pages/home/index.vue b/pages/home/index.vue index 086d092..8285bcc 100644 --- a/pages/home/index.vue +++ b/pages/home/index.vue @@ -350,6 +350,7 @@ export default { this.agencyInfo = uni.getStorageSync("agencyInfo"); this.userInfo = uni.getStorageSync("apply-userinfo"); that.loadSelectedCityFromCache(); + that.G.watchUserPage("pages/home/index"); } }, @@ -440,7 +441,7 @@ export default { // res.recordList = []; // if (res.recordCount == 0) { - that.loading = false; + that.loading = false; // } else { // that.loading = true; // } diff --git a/pages/person/index.vue b/pages/person/index.vue index cafe789..6059066 100644 --- a/pages/person/index.vue +++ b/pages/person/index.vue @@ -352,6 +352,7 @@ export default { this.getCompanyInfo(); } }); + that.G.watchUserPage("pages/person/index"); // that.userInfo = uni.getStorageSync("apply-userinfo"); } else { that.waitNum_ups = 0; @@ -375,7 +376,7 @@ export default { getNewApplyNum() { let that = this; this.G.Get(this.api.order_getNewApplyNumNotViewed, {}, (res) => { - console.log(res, "getNewApplyNum"); + console.log(res, "getNewApplyNum"); that.applyNum = res; }); }, diff --git a/pages/workBench/index.vue b/pages/workBench/index.vue index 149c5a4..34cac64 100644 --- a/pages/workBench/index.vue +++ b/pages/workBench/index.vue @@ -202,6 +202,7 @@ export default { this.getList(); } this.getGZHInfo(); + that.G.watchUserPage("pages/workBench/index"); }, onReachBottom() { let that = this; diff --git a/utils/common.js b/utils/common.js index f6a40ec..2fa735d 100644 --- a/utils/common.js +++ b/utils/common.js @@ -160,6 +160,8 @@ let data = { /* 设置导航条 */ setNavStyle ($form = 'default') { + console.log('into setNavStyle'); + if ($form == 'home') { uni.setNavigationBarColor({ backgroundColor: "#fff", @@ -1572,6 +1574,7 @@ let data = { } return str; }, + } export default data;