50 lines
1.3 KiB
Vue
50 lines
1.3 KiB
Vue
<script>
|
||
export default {
|
||
onLaunch() {
|
||
console.log('App Launch')
|
||
|
||
// 🔥 初始化字体缩放(使用 Vuex)
|
||
this.$store.dispatch('font/initFontScale')
|
||
|
||
// 从本地存储恢复登录状态
|
||
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%;
|
||
|
||
/*
|
||
* 使用 rem 方案后,不需要设置 font-size
|
||
* 所有元素使用 rem 单位,会自动相对于根字体大小计算
|
||
* 根字体大小由 JavaScript 动态设置(document.documentElement.style.fontSize)
|
||
*/
|
||
}
|
||
</style>
|