app接收到报警记录后处理方法

This commit is contained in:
xusd 2024-06-03 09:30:34 +08:00
parent 05664feb52
commit 52f83b39e0

78
App.vue
View File

@ -1,35 +1,53 @@
<script>
import config from './config'
import store from '@/store'
import { getToken } from '@/utils/auth'
import config from './config'
import store from '@/store'
import {
getToken
} from '@/utils/auth'
export default {
onLaunch: function() {
this.initApp()
},
methods: {
//
initApp() {
//
this.initConfig()
//
//#ifdef H5
this.checkLogin()
//#endif
},
initConfig() {
this.globalData.config = config
},
checkLogin() {
if (!getToken()) {
this.$tab.reLaunch('/pages/login')
}
}
}
}
export default {
onLaunch: function() {
this.initApp();
this.listenMessage();
},
methods: {
listenMessage() {
// #ifdef APP-PLUS
const _self = this;
const _handlePush = function(message) {
// TODO
console.log(message);
if (message.payload.type === "alarm") {
uni.navigateTo({
url: '/pages/work/alarm/detailsAlarm?id=' + message.payload.id
});
}
};
plus.push.addEventListener('click', _handlePush);
// #endif
},
//
initApp() {
//
this.initConfig()
//
//#ifdef H5
this.checkLogin()
//#endif
},
initConfig() {
this.globalData.config = config
},
checkLogin() {
if (!getToken()) {
this.$tab.reLaunch('/pages/login')
}
}
}
}
</script>
<style lang="scss">
@import '@/static/scss/index.scss';
@import "uview-ui/index.scss";
</style>
@import '@/static/scss/index.scss';
@import "uview-ui/index.scss";
</style>