wuliu_sy/App.vue

59 lines
1.1 KiB
Vue
Raw Permalink Normal View History

2023-11-18 11:02:11 +08:00
<script>
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
2023-11-28 08:59:04 +08:00
2023-12-02 15:29:39 +08:00
import Cache from '@/utils/cache';
2023-11-18 11:02:11 +08:00
export default {
onLaunch: function() {
console.log('App Launch')
// #ifdef APP-PLUS
2023-11-28 08:59:04 +08:00
// 锁定屏幕方向 横屏正方向
plus.screen.lockOrientation('landscape-primary');
// #endif
2023-12-02 15:29:39 +08:00
},
onLoad() {
2023-11-18 11:02:11 +08:00
},
onShow: function() {
2023-12-02 15:29:39 +08:00
2023-11-18 11:02:11 +08:00
console.log('App Show')
const audioContext = uni.createInnerAudioContext()
// 设置音频文件地址
audioContext.src = '/static/mp3/order.mp3'
// 播放音频
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
2023-11-28 08:59:04 +08:00
// console.log(res, '111111')
2023-11-18 11:02:11 +08:00
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;
}
2023-11-28 08:59:04 +08:00
@import "static/css/base.css";
2023-11-18 11:02:11 +08:00
@import url('static/iconfont/iconfont.css')
</style>