wuliu_sy/App.vue

51 lines
1.0 KiB
Vue

<script>
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
export default {
onLaunch: function() {
console.log('App Launch')
// #ifdef APP-PLUS
// 锁定屏幕方向 横屏正方向
plus.screen.lockOrientation('landscape-primary');
// #endif
},
onShow: function() {
console.log('App Show')
const audioContext = uni.createInnerAudioContext()
// 设置音频文件地址
audioContext.src = '/static/mp3/order.mp3'
// 播放音频
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
// console.log(res, '111111')
if (res.notificationEventType == 'notificationOpened') return
audioContext.play()
uni.vibrateLong();
console.log("app的监听")
})
// #endif
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
* {
margin: 0;
padding: 0;
}
page {
background: #F3F4F8;
}
@import "static/css/base.css";
@import url('static/iconfont/iconfont.css')
</style>