74 lines
2.4 KiB
JavaScript
74 lines
2.4 KiB
JavaScript
|
|
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
|