51 lines
1.3 KiB
Vue
51 lines
1.3 KiB
Vue
<script>
|
|
import {queryDictDataCache} from './common/api/dictionary.js'
|
|
import {getImageUrl} from '@/common/api/basic'
|
|
|
|
export default {
|
|
onLaunch: function () {
|
|
console.log(window)
|
|
// this.connect()
|
|
console.log('App Launch')
|
|
let devCode = uni.getStorageSync('devCode')
|
|
if (!devCode) {
|
|
uni.getSystemInfo({
|
|
success: (result) => {
|
|
uni.setStorageSync('devCode', result.deviceId)
|
|
},
|
|
})
|
|
}
|
|
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
|
|
uni.reLaunch({
|
|
url: '/pages/user/login',
|
|
})
|
|
}
|
|
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
|
|
if (!userInfo) return
|
|
// 查询字典
|
|
queryDictDataCache().then((res) => {
|
|
uni.setStorageSync(this.$cacheKey.dictData, res.data)
|
|
})
|
|
|
|
},
|
|
onHide: function () {
|
|
console.log('App Hide')
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
/*每个页面公共css */
|
|
@import './common/css/base.scss';
|
|
|
|
/deep/ uni-tabbar .uni-tabbar__badge {
|
|
width: auto;
|
|
height: 28rpx;
|
|
line-height: 28rpx;
|
|
border-radius: 28rpx;
|
|
min-width: 28rpx;
|
|
font-size: 20rpx;
|
|
padding: 0 8rpx;
|
|
}
|
|
</style>
|