46 lines
986 B
Vue
46 lines
986 B
Vue
<script>
|
|
// var jpushModule = uni.requireNativePlugin("JG-JPush");
|
|
var jpushModule = uni.requireNativePlugin("JG-JPush");
|
|
|
|
export default {
|
|
onLaunch: function() {
|
|
jpushModule.initJPushService()
|
|
const audioContext = uni.createInnerAudioContext()
|
|
audioContext.src = './static/mp3/order.mp3'
|
|
let ida = [0]
|
|
jpushModule.addNotificationListener(function(result) {
|
|
if (!ida.includes(result.messageID)) {
|
|
audioContext.play()
|
|
}
|
|
ida.push(result.messageID)
|
|
})
|
|
|
|
console.log('App Launch')
|
|
try {
|
|
if (!this.$store.state.app.token) uni.redirectTo({
|
|
url: '/pages/oaLogin/oaLogin'
|
|
})
|
|
} catch (e) {
|
|
uni.redirectTo({
|
|
url: '/pages/oaLogin/oaLogin'
|
|
})
|
|
}
|
|
},
|
|
onShow: function() {
|
|
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> |