OfficeApp/App.vue

66 lines
1.7 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");
2023-08-26 18:41:06 +08:00
import Updater from '@/uni_modules/guyue-updater/index';
2023-08-19 16:39:16 +08:00
// #endif
export default {
onLaunch: async function() {
console.log('App Launch')
2023-08-26 18:41:06 +08:00
this.$store.dispatch('initConfig');
2023-08-28 18:24:47 +08:00
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()
// 设置音频文件地址
audioContext.src = './static/mp3/order.mp3'
let noticeArr = []
// 播放音频
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
if (!noticeArr.includes(res.messageID)) {
console.log(res.messageID)
audioContext.play()
noticeArr.push(res.messageID)
console.log("app的")
uni.vibrateLong({
success: function() {
console.log('success');
}
});
}
})
2023-08-26 18:41:06 +08:00
// 版本更新
2023-08-29 11:18:03 +08:00
// 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 // 是否静默更新
// })
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>