64 lines
1.6 KiB
Vue
64 lines
1.6 KiB
Vue
<script>
|
|
//#ifdef APP-PLUS
|
|
const jpushModule = uni.requireNativePlugin("JG-JPush");
|
|
// #endif
|
|
export default {
|
|
onLaunch: async function(info) {
|
|
// let noticeArr = []
|
|
// jpushModule.addNotificationListener(res => {
|
|
// if (!noticeArr.includes(res.messageID)) {
|
|
// const audioContext = uni.createInnerAudioContext()
|
|
// // 设置音频文件地址
|
|
// audioContext.src = `/static/audio/order.mp3`;
|
|
// // console.log(res.messageID)
|
|
// audioContext.play()
|
|
// noticeArr.push(res.messageID)
|
|
// console.log("app的监听")
|
|
// }
|
|
// })
|
|
uni.showModal({
|
|
content: info
|
|
})
|
|
if(info.referrerInfo?.extraData?.uniMP) uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
|
|
console.log('App Launch')
|
|
this.$store.dispatch('initConfig');
|
|
try {
|
|
if (!this.$store.state.app.token) uni.reLaunch({
|
|
url: '/pages/oaLogin/oaLogin'
|
|
})
|
|
} catch (e) {
|
|
uni.reLaunch({
|
|
url: '/pages/oaLogin/oaLogin'
|
|
})
|
|
}
|
|
},
|
|
onShow: function() {
|
|
const audioContext = uni.createInnerAudioContext()
|
|
// 设置音频文件地址
|
|
audioContext.src = '/static/mp3/order.mp3'
|
|
// 播放音频
|
|
//#ifdef APP-PLUS
|
|
jpushModule.addNotificationListener(res => {
|
|
if (res.notificationEventType == 'notificationOpened') return
|
|
audioContext.play()
|
|
uni.vibrateLong();
|
|
console.log("app的监听")
|
|
})
|
|
// #endif
|
|
console.log('App Show')
|
|
},
|
|
onHide: function() {
|
|
console.log('App Hide')
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
/*每个页面公共css */
|
|
@import "static/css/base.css";
|
|
@import "static/css/style.scss";
|
|
|
|
view {
|
|
box-sizing: border-box;
|
|
}
|
|
</style> |