1.添加首页 订阅消息

yj-dev
杨杰 3 years ago
parent 4feb309e5c
commit b8364e1fbb
  1. 32
      pages/tabBar/home/home.vue

@ -316,6 +316,7 @@
}, },
onLoad() { onLoad() {
let that = this; let that = this;
// that.openMsg();
// 1.wxcode // 1.wxcode
// #ifdef MP // #ifdef MP
uni.login({ uni.login({
@ -360,6 +361,37 @@
// #endif // #endif
}, },
methods: { methods: {
//
openMsg() {
var that = this
//
wx.getSetting({
withSubscriptions:true, //false
success(res) {
if(res.authSetting['scope.subscribeMessage'] || res.authSetting['scope.subscribeMessage'] == undefined) { //
uni.openSetting({ //
success(res) {
console.log(res.authSetting)
},
fail(err) {
console.log(err)
}
});
}else { //
uni.requestSubscribeMessage({
tmplIds: 1,
success (res) {
console.log(res)
},
fail:(res) => {
console.log(res)
}
})
}
}
})
},
// //
getCmsContent() { getCmsContent() {
let params = { let params = {

Loading…
Cancel
Save