连云港陪玩陪聊
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
chunwan/App.vue

52 lines
1.3 KiB

<script>
import permision from "@/js_sdk/wa-permission/permission.js"
export default {
onLaunch: () => {
// 2 获取客户端推送标识信息 cid , 必须要获取到cid后才能接收推送信息
uni.getPushClientId({
success: (res) => {
// 将获取到的cid存起来,方便其它页面从缓存中获取
uni.setStorageSync('cid',res.cid)
console.log('客户端推送标识:', res.cid)
}
})
// 3 启动监听推送消息事件
uni.onPushMessage(res => {
const { type, data } = res
console.log('"click"-从系统推送服务点击消息启动应用事件;', res);
if (type == 'click') {
console.log('"click"-从系统推送服务点击消息启动应用事件;', res);
if (data?.payload?.type == 1) {
uni.reLaunch({
url: '/pages/index/index'
});
} else {
uni.reLaunch({
url: '/pages/users/order/index'
});
}
}
if (type == 'receive') {
console.log('"receive"-应用从推送服务器接收到推送消息事件', res);
}
});
}
}
</script>
<style>
/* #ifdef APP-PLUS || H5 */
page{
background-color: #f5f5f5;
}
/* #endif */
.permissions_box{
padding: 50rpx 30rpx;
font-size: 30rpx;
line-height: 50rpx;
background-color: #fff;
}
</style>