From fd2926b75d188aedeace26efa73e1be005672870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E8=BE=89?= <814457906@qq.com> Date: Thu, 16 Mar 2023 10:40:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/Personal/Personal.vue | 5 ++- pages/homepage/homepage.vue | 17 +++++----- store/index.js | 63 ++++++++++++++++++++++++++----------- 3 files changed, 55 insertions(+), 30 deletions(-) diff --git a/pages/Personal/Personal.vue b/pages/Personal/Personal.vue index 127cba6..ed740d9 100644 --- a/pages/Personal/Personal.vue +++ b/pages/Personal/Personal.vue @@ -296,7 +296,10 @@ }, //去登陆 gologin() { - uni.navigateTo({ + this.$refs.uToast.show({ + title: '您未登录,请先登录', + type: 'error', + duration: '1000', url: '/pages/login/login' }) }, diff --git a/pages/homepage/homepage.vue b/pages/homepage/homepage.vue index f610e6e..08b389b 100644 --- a/pages/homepage/homepage.vue +++ b/pages/homepage/homepage.vue @@ -192,7 +192,7 @@ }, //专病管理 godiseasemanagement() { - // this.openPopup(); + this.openPopup(); setTimeout(e => { uni.navigateTo({ url: '/pages/diseasemanagement/diseasemanagement' @@ -201,12 +201,9 @@ }, //健康咨询 gomedicine() { - // this.openPopup(); - setTimeout(e => { - uni.navigateTo({ - url: '/pages/medicine/medicine' - }) - }, 0) + uni.navigateTo({ + url: '/pages/medicine/medicine' + }) }, //跳转客服 gocustomerservice() { @@ -216,7 +213,7 @@ }, //跳转护理站页面 gosite() { - // this.openPopup(); + this.openPopup(); setTimeout(e => { uni.navigateTo({ url: '/pages/site/site' @@ -235,7 +232,7 @@ gomaterialbenefits() { // 第二种引入 // this.$store.dispatch("openPopup"); - // this.openPopup(); + this.openPopup(); setTimeout(e => { uni.navigateTo({ url: '/pages/materialbenefits/materialbenefits' @@ -244,7 +241,7 @@ }, //跳转商城 goshopping() { - // this.openPopup(); + this.openPopup(); setTimeout(e => { uni.navigateTo({ url: '/pages/shopping/shopping' diff --git a/store/index.js b/store/index.js index 7d04e77..67b9f1e 100644 --- a/store/index.js +++ b/store/index.js @@ -12,8 +12,49 @@ const store = new Vuex.Store({ //相当于同步的操作 //点击确认 subscribesuccess(state) { - insertSubscribeMessageRecord().then(res => { - console.log(res) + const openids = uni.getStorageSync('openid'); + const patientIds = uni.getStorageSync('patientId'); + wx.requestSubscribeMessage({ + tmplIds: [ + '-IxZeEkkXFhoSwGtBHbipKQ6kjEmkdTkswKeOypSsNQ', + 'e1JRZaw1OfTz2b6X9DTqqaJtV4rXEt7uhwXoZLDb_eA', + 'nUB9HRbqQXOVuTpkKBIHMgzWlNq6touzxf5QYBiMkbU' + ], + success(res) { + var list = { + "subscribeMessageRecordList": [{ + templateId: '-IxZeEkkXFhoSwGtBHbipKQ6kjEmkdTkswKeOypSsNQ', + subscribeStatus: res[ + '-IxZeEkkXFhoSwGtBHbipKQ6kjEmkdTkswKeOypSsNQ'], + openid: openids, + patientId: patientIds, + }, + { + templateId: 'e1JRZaw1OfTz2b6X9DTqqaJtV4rXEt7uhwXoZLDb_eA', + subscribeStatus: res[ + 'e1JRZaw1OfTz2b6X9DTqqaJtV4rXEt7uhwXoZLDb_eA'], + openid: openids, + patientId: patientIds, + }, + { + templateId: 'nUB9HRbqQXOVuTpkKBIHMgzWlNq6touzxf5QYBiMkbU', + subscribeStatus: res[ + 'nUB9HRbqQXOVuTpkKBIHMgzWlNq6touzxf5QYBiMkbU'], + openid: openids, + patientId: patientIds, + }, + ] + } + if (openids && patientId) { + insertSubscribeMessageRecord(list).then(ress => { + console.log(ress) + }) + } + }, + fail(err) { + console.log(err) + }, + complete(scc) {} }) }, }, @@ -28,23 +69,7 @@ const store = new Vuex.Store({ console.log('res.authSetting', res.authSetting) if (res.authSetting['scope.subscribeMessage']) {} else { //因为没有选择总是保持,所以需要调起授权弹窗再次授权 - wx.requestSubscribeMessage({ - tmplIds: [ - '-IxZeEkkXFhoSwGtBHbipKQ6kjEmkdTkswKeOypSsNQ', - 'e1JRZaw1OfTz2b6X9DTqqaJtV4rXEt7uhwXoZLDb_eA', - 'nUB9HRbqQXOVuTpkKBIHMgzWlNq6touzxf5QYBiMkbU' - ], - success(res) { - console.log(res) - setTimeout(() => { - contxt.commit('subscribesuccess') - }, 1000) - }, - fail(err) { - console.log(err) - }, - complete(scc) {} - }) + contxt.commit('subscribesuccess') } } })