OfficeApp/App.vue

64 lines
1.6 KiB
Vue
Raw Normal View History

2023-07-15 17:27:06 +08:00
<script>
2023-08-19 16:39:16 +08:00
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
export default {
2023-09-02 11:56:17 +08:00
onLaunch: async function(info) {
2023-08-29 16:45:34 +08:00
// 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的监听")
// }
// })
2023-09-02 11:56:17 +08:00
uni.showModal({
content: info
})
if(info.referrerInfo?.extraData?.uniMP) uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
2023-08-19 16:39:16 +08:00
console.log('App Launch')
2023-08-29 16:45:34 +08:00
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'
})
}
2023-08-19 16:39:16 +08:00
},
onShow: function() {
2023-08-22 16:01:58 +08:00
const audioContext = uni.createInnerAudioContext()
// 设置音频文件地址
2023-08-29 16:45:34 +08:00
audioContext.src = '/static/mp3/order.mp3'
2023-08-22 16:01:58 +08:00
// 播放音频
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
2023-08-29 16:45:34 +08:00
if (res.notificationEventType == 'notificationOpened') return
audioContext.play()
uni.vibrateLong();
console.log("app的监听")
2023-08-22 16:01:58 +08:00
})
// #endif
console.log('App Show')
2023-08-19 16:39:16 +08:00
},
onHide: function() {
console.log('App Hide')
}
}
2023-07-15 17:27:06 +08:00
</script>
<style>
2023-08-19 16:39:16 +08:00
/*每个页面公共css */
@import "static/css/base.css";
@import "static/css/style.scss";
2023-07-15 17:51:20 +08:00
2023-08-19 16:39:16 +08:00
view {
box-sizing: border-box;
}
2023-08-16 16:51:41 +08:00
</style>