From 62be9a641458fc3159c7f81546703fdafdfea666 Mon Sep 17 00:00:00 2001 From: chenkainan Date: Tue, 19 Nov 2024 13:59:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 8 +++++++- pages.json | 7 ++++++- pages/index/index.vue | 5 ++++- pages/map/map.vue | 32 +++++++++++++++++++------------- pages/user/user.vue | 1 + 5 files changed, 37 insertions(+), 16 deletions(-) diff --git a/manifest.json b/manifest.json index 1f4e711..2a36a49 100644 --- a/manifest.json +++ b/manifest.json @@ -62,7 +62,13 @@ "scope.userLocation" : { "desc" : "获取用户距离商家距离" } - } + }, + "plugins": { + "myPlugin": { + "version": "1.0.0", + "provider": "wxcb555ab174f22ec9" + } + } }, "mp-alipay" : { "usingComponents" : true diff --git a/pages.json b/pages.json index d0bc9a3..5cf4aaf 100644 --- a/pages.json +++ b/pages.json @@ -10,7 +10,12 @@ { "path": "pages/map/map", "style": { - "navigationBarTitleText": "地图" + "navigationBarTitleText": "地图", + "mp-weixin": { + "usingComponents": { + "hello-component": "plugin://myPlugin/hello-component" + } + } } }, { diff --git a/pages/index/index.vue b/pages/index/index.vue index 5065908..0d4eada 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -38,7 +38,7 @@ 便民快捷购票入口 - + 地图导览 随时随地发现新旅程 @@ -188,6 +188,9 @@ notice: '', } }, + onShow() { + uni.setStorageSync('isFlag', true) + }, onReady() { // 获取经纬度 if(!uni.getStorageSync('location')) { diff --git a/pages/map/map.vue b/pages/map/map.vue index 359dd60..a315a84 100644 --- a/pages/map/map.vue +++ b/pages/map/map.vue @@ -1,7 +1,6 @@ @@ -9,22 +8,29 @@ export default { data() { return { - src: '' + src: '', + isFlag: true } }, + onHide() { + uni.setStorageSync('isFlag', false) + }, onShow() { - // 必须登录 - // let userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {} - // if(userInfo.token) { - // this.src = 'https://yandumap.sz-trip.com?token=' + userInfo.token - // }else { - // uni.navigateTo({ - // url: '/pages/login/login' - // }) - // } + this.gotoPath() }, methods: { - + gotoPath() { + this.isFlag = uni.getStorageSync('isFlag') + if(this.isFlag) { + uni.navigateTo({ + url: "plugin://myPlugin/index" + }) + }else { + uni.switchTab({ + url: '/pages/index/index' + }) + } + } } } diff --git a/pages/user/user.vue b/pages/user/user.vue index d550310..d548898 100644 --- a/pages/user/user.vue +++ b/pages/user/user.vue @@ -159,6 +159,7 @@ onShow() { this.userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {} console.log(this.userInfo) + uni.setStorageSync('isFlag', true) // this.dfkList = [] // this.nowDateTime = parseInt(new Date().getTime() / 1000) // this.Post({}, "/api/user/userInfo").then((res) => {