1.对接app. 接受通知

huipay-app-dev
杨杰 1 year ago
parent c5f7eaccc6
commit 9438c69d75
  1. 24
      App.vue
  2. 14
      manifest.json

@ -39,6 +39,15 @@
storeAddress: ''
},
onLaunch: function() {
uni.getPushClientId({
success: res => {
console.log('=========='+res.cid)
},
fail(err) {
console.log(err)
}
})
let that = this;
uni.getStorage({
key: 'payuser',
@ -59,21 +68,6 @@
}
</script>
<script>
export default {
//#ifdef APP-PLUS
// cid
uni.getPushClientId({
success: res => {
console.log(res.cid)
},
fail(err) {
console.log(err)
}
}) // 接受推送消息// "type": "click" 用户点击系统通知栏中的消息APP启动或者激活到前台运行触发click事件// "type": "receive" 客户端接收到透传消息时(在系统通知栏中不显示消息),触发receive事件uni.onPushMessage(res => {console.log(res)if(res.type === 'click'){console.log(res.data.payload)}if (res.type === 'receive') {// 如果你希望当应用在线时也通过通知栏消息可以创建通知栏消息来提醒用户// uni.createPushMessage({// title: res.data.title,// content: res.data.content,// payload: res.data.payload// })}})//#endif},onShow: function () {},onHide: function () {}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "/static/iconfont/font.scss";

@ -17,7 +17,9 @@
"delay" : 0
},
/* */
"modules" : {},
"modules" : {
"Push" : {}
},
/* */
"distribute" : {
/* android */
@ -43,7 +45,15 @@
/* ios */
"ios" : {},
/* SDK */
"sdkConfigs" : {},
"sdkConfigs" : {
"push" : {
"unipush" : {
"version" : "2",
"offline" : true,
"oppo" : {}
}
}
},
"icons" : {
"android" : {
"hdpi" : "unpackage/res/icons/72x72.png",

Loading…
Cancel
Save