|
|
|
@ -316,6 +316,7 @@ |
|
|
|
|
}, |
|
|
|
|
onLoad() { |
|
|
|
|
let that = this; |
|
|
|
|
// that.openMsg(); |
|
|
|
|
// 1.wx获取登录用户code |
|
|
|
|
// #ifdef MP |
|
|
|
|
uni.login({ |
|
|
|
@ -360,6 +361,37 @@ |
|
|
|
|
// #endif |
|
|
|
|
}, |
|
|
|
|
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() { |
|
|
|
|
let params = { |
|
|
|
|