70 lines
2.0 KiB
Vue
70 lines
2.0 KiB
Vue
<script>
|
|
//#ifdef APP-PLUS
|
|
const jpushModule = uni.requireNativePlugin("JG-JPush");
|
|
import Updater from '@/uni_modules/guyue-updater/index';
|
|
// #endif
|
|
export default {
|
|
onLaunch: async function() {
|
|
// 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的监听")
|
|
// }
|
|
// })
|
|
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的监听")
|
|
})
|
|
// 版本更新
|
|
// Updater.update({
|
|
// title: '发现新版本',
|
|
// content: '1. 我们更新了新的UI设计\n2. 我们更新了新的UI设计\n3. 我们更新了新的UI设计\n4. 我们更新了新的UI设计\n',
|
|
// versionName: '1.3.6',
|
|
// downUrl: 'https://lihai001.oss-cn-chengdu.aliyuncs.com/__UNI__B5B1EDD__20230816174515.apk',
|
|
// force: false, // 是否强制更新
|
|
// quiet: false // 是否静默更新
|
|
// })
|
|
// #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> |