diff --git a/main.js b/main.js index 37e8faf..a43ada7 100644 --- a/main.js +++ b/main.js @@ -6,18 +6,21 @@ import uView from "uview-ui"; Vue.use(uView); Vue.config.productionTip = false App.mpType = 'app' +import store from "@/store/index.js" const app = new Vue({ - ...App + store, + ...App }) app.$mount() // #endif - // #ifdef VUE3 -import { createSSRApp } from 'vue' +import { + createSSRApp +} from 'vue' export function createApp() { - const app = createSSRApp(App) - return { - app - } + const app = createSSRApp(App) + return { + app + } } -// #endif \ No newline at end of file +// #endif diff --git a/pages.json b/pages.json index 4fad2ab..6d4a295 100644 --- a/pages.json +++ b/pages.json @@ -71,7 +71,16 @@ "enablePullDownRefresh": false } } - ], + ,{ + "path" : "pages/template/template", + "style" : + { + "navigationBarTitleText": "模板消息订阅", + "enablePullDownRefresh": false + } + + } + ], "globalStyle": { "navigationBarTextStyle": "white", "navigationBarTitleText": "", diff --git a/pages/homepage/homepage.vue b/pages/homepage/homepage.vue index fceda0a..553750d 100644 --- a/pages/homepage/homepage.vue +++ b/pages/homepage/homepage.vue @@ -25,6 +25,9 @@ + + 管理员模板消息订阅 + 在线学习 @@ -69,18 +72,23 @@ beijingurl: null, //背景 nurserStationPresonId: 35, //护理员id selectOrderByNursePersonCountlist: {}, //项目数量对象 + personRoleLoginFlag: null, //身份认证 }; }, onShow() { this.beijingurl = baseurl + '/profile/nursePersonAppletPicture/person_center.png' this.OrderByNursePersonCount(); + var that = this + const value = uni.getStorageSync('personRoleLoginFlag'); + if (value) { + that.personRoleLoginFlag = value + } else {} }, methods: { //项目数量 OrderByNursePersonCount() { selectOrderByNursePersonCount(this.nurserStationPresonId).then(res => { this.selectOrderByNursePersonCountlist = res - console.log(this.selectOrderByNursePersonCountlist) }) }, goMymission(item) { @@ -88,6 +96,12 @@ url: `/pages/Mymission/Mymission?orderStatus=${item}` }) }, + //跳转到模板消息订阅界面 + goTemplate() { + uni.navigateTo({ + url: "/pages/template/template" + }) + }, }, } @@ -99,6 +113,16 @@ .app { position: relative; + .TemplateMessage { + width: 94%; + margin: 40rpx auto; + background-color: #f4f6f7; + height: 150rpx; + line-height: 150rpx; + text-align: center; + font-size: 36rpx; + } + .bottomfloat { position: relative; diff --git a/pages/login/login.vue b/pages/login/login.vue index 93242e6..67f90dd 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -43,6 +43,7 @@ getPersonWeChatUserInfo(this.logincode, this.phonecode).then(res => { if (res.code == 200) { uni.setStorageSync("nursePersonId", res.data.nurseStationPersonId) + uni.setStorageSync("personRoleLoginFlag", res.data.personRoleLoginFlag) this.$refs.uToast.show({ title: '登录成功', type: 'success', diff --git a/pages/template/template.vue b/pages/template/template.vue new file mode 100644 index 0000000..29c5298 --- /dev/null +++ b/pages/template/template.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/static/temple.png b/static/temple.png new file mode 100644 index 0000000..0f2b51b Binary files /dev/null and b/static/temple.png differ diff --git a/store/index.js b/store/index.js new file mode 100644 index 0000000..e9bb9c4 --- /dev/null +++ b/store/index.js @@ -0,0 +1,73 @@ +import Vue from 'vue' +import Vuex from 'vuex' +Vue.use(Vuex) +const store = new Vuex.Store({ + state: { + //公共的变量,这里的变量不能随便修改,只能通过触发mutations的方法才能改变 + }, + mutations: { + //相当于同步的操作 + //点击确认 + //预约订单接受消息通知 + subscribesuccess(state) { + wx.requestSubscribeMessage({ + tmplIds: [ + 't6PZuAOalg6RTh_dzORsHsO8Q1meZcgnI-aBmaWo0T8', + 'sQQCAXGLyDsQOKfZCGibhSmcamlbc7wKeGBt1pKCyBM', + 'LeOiaoAggUK5eEtz8vVs8Pjp0O2lf0T75nc8vTYtfiQ', + ], + success(res) {}, + fail(err) {}, + complete(scc) {} + }) + }, + //预约订单拒绝消息通知 + integralsubscribesuccess(state) { + wx.requestSubscribeMessage({ + tmplIds: [ + '-3YtSqNtujio6XeJ3Ax95wmWSZL6k7ozp9eSk5ZUM30', + 'fmZMOW9dq4kKBH-BEpcVIltbG0C9-aiQUVG3USVfgR8', + 'foVV7Gke-8JdzgzHQ7QQrDV5lK1L5xLkuUyZurQC8L4', + ], + success(res) {}, + fail(err) {}, + complete(scc) {} + }) + }, + }, + actions: { + //预约订单拒绝消息通知 + //相当于异步的操作,不能直接改变state的值,只能通过触发mutations的方法才能改变 + integralopenPopup(contxt) { + const nursePersonIds = uni.getStorageSync('nursePersonId'); + // 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问” + wx.getSetting({ + withSubscriptions: true, // 是否获取用户订阅消息的订阅状态,默认false不返回 + success(res) { + console.log(res.authSetting['scope.subscribeMessage']) + if (res.authSetting['scope.subscribeMessage']) {} else { + //因为没有选择总是保持,所以需要调起授权弹窗再次授权 + contxt.commit('integralsubscribesuccess') + } + } + }) + }, + //预约订单接受消息通知 + // 是否设置过授权 + openPopup(contxt) { + const nursePersonIds = uni.getStorageSync('nursePersonId'); + // 获取用户的当前设置,判断是否点击了“总是保持以上,不在询问” + wx.getSetting({ + withSubscriptions: true, // 是否获取用户订阅消息的订阅状态,默认false不返回 + success(res) { + console.log(res.authSetting['scope.subscribeMessage']) + if (res.authSetting['scope.subscribeMessage']) {} else { + //因为没有选择总是保持,所以需要调起授权弹窗再次授权 + contxt.commit('subscribesuccess') + } + } + }) + }, + } +}) +export default store