42 lines
1.0 KiB
Vue
42 lines
1.0 KiB
Vue
<script>
|
|
export default {
|
|
onLaunch() {
|
|
console.log('App Launch')
|
|
|
|
// 从本地存储恢复登录状态
|
|
const token = uni.getStorageSync('token')
|
|
const userInfo = uni.getStorageSync('userInfo')
|
|
const deviceUuid = uni.getStorageSync('deviceUuid')
|
|
|
|
if (token) {
|
|
this.$store.commit('user/SET_TOKEN', token)
|
|
this.$store.commit('user/SET_DEVICE_UUID', deviceUuid || '')
|
|
|
|
if (userInfo) {
|
|
this.$store.commit('user/SET_USER_INFO', userInfo)
|
|
}
|
|
this.$store.commit('user/SET_LOGIN', true)
|
|
|
|
// 启动 Token 自动续期定时器
|
|
this.$store.dispatch('user/startTokenRefresh')
|
|
|
|
// 初始化打印机配置
|
|
this.$store.dispatch('print/initPrinterConfig')
|
|
// 初始化扫码模式配置
|
|
this.$store.dispatch('scan/initScanMode')
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import './styles/index.scss';
|
|
// 引入字体图标
|
|
@import './static/iconfont/font_5178893_r4lrriz2ngn/iconfont.css';
|
|
|
|
page {
|
|
height: 100%;
|
|
}
|
|
</style>
|