From ba102e61d7a597fad743f6697c721071441f160f Mon Sep 17 00:00:00 2001 From: chenkainan Date: Wed, 20 Nov 2024 14:09:10 +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 | 9 +++++++-- pages.json | 2 +- pages/index/index.vue | 12 +++++++++++- pages/map/map.vue | 24 ++++++++++++++---------- static/css/base.css | 8 ++++++++ static/js/exportToPlugin.js | 10 ++++++++++ 6 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 static/js/exportToPlugin.js diff --git a/manifest.json b/manifest.json index 2a36a49..1cda74e 100644 --- a/manifest.json +++ b/manifest.json @@ -64,9 +64,14 @@ } }, "plugins": { - "myPlugin": { + "guide": { "version": "1.0.0", - "provider": "wxcb555ab174f22ec9" + "provider": "wxcb555ab174f22ec9", + "export": "static/js/exportToPlugin.js" + }, + "routePlan": { + "version": "1.0.19", + "provider": "wx50b5593e81dd937a" } } }, diff --git a/pages.json b/pages.json index 5cf4aaf..f710bca 100644 --- a/pages.json +++ b/pages.json @@ -13,7 +13,7 @@ "navigationBarTitleText": "地图", "mp-weixin": { "usingComponents": { - "hello-component": "plugin://myPlugin/hello-component" + "hello-component": "plugin://guide/index" } } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 0d4eada..96819a6 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -38,7 +38,7 @@ 便民快捷购票入口 - + 地图导览 随时随地发现新旅程 @@ -207,6 +207,16 @@ this.getLatest() }, methods: { + // 去地图导览 + gotoMap() { + // 必须登录 + let userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {} + if(userInfo.token) { + this.gotoPath('plugin://guide/index') + }else { + this.$store.commit('changeLoginPath') + } + }, //轮播图左右滑动 swiperChange(e) { this.current = e.detail.current; diff --git a/pages/map/map.vue b/pages/map/map.vue index a315a84..dc08131 100644 --- a/pages/map/map.vue +++ b/pages/map/map.vue @@ -16,19 +16,23 @@ uni.setStorageSync('isFlag', false) }, onShow() { - this.gotoPath() + this.gotoMap() }, methods: { - gotoPath() { - this.isFlag = uni.getStorageSync('isFlag') - if(this.isFlag) { - uni.navigateTo({ - url: "plugin://myPlugin/index" - }) + gotoMap() { + // 必须登录 + let userInfo = (uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))) || this.$store.state.user.userInfo || {} + if(userInfo.token) { + this.isFlag = uni.getStorageSync('isFlag') + if(this.isFlag) { + this.gotoPath('plugin://guide/index') + }else { + uni.switchTab({ + url: '/pages/index/index' + }) + } }else { - uni.switchTab({ - url: '/pages/index/index' - }) + this.$store.commit('changeLoginPath') } } } diff --git a/static/css/base.css b/static/css/base.css index 4c68785..8f30c0e 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -159,4 +159,12 @@ view { .topLeft .iconfont { font-size: 40rpx; color: #fff; +} + +.index--voice { + box-sizing: content-box !important; +} + +.card-action { + box-sizing: content-box !important; } \ No newline at end of file diff --git a/static/js/exportToPlugin.js b/static/js/exportToPlugin.js new file mode 100644 index 0000000..f5d4dc4 --- /dev/null +++ b/static/js/exportToPlugin.js @@ -0,0 +1,10 @@ +module.exports = { + getUnionId: async () => { + // .... + return JSON.parse(wx.getStorageSync('userInfo')).unionid || ''; + }, + getOpenId: async () => { + // .... + return JSON.parse(wx.getStorageSync('userInfo')).openid || ''; + }, +}; \ No newline at end of file