Files
app-govern/App.vue
2023-08-30 10:03:07 +08:00

58 lines
1.6 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)
})
// 更新用户头像
if (userInfo.headSculpture) {
getImageUrl(userInfo.headSculpture).then((res) => {
userInfo.avatar = res.data
uni.setStorageSync(this.$cacheKey.userInfo, userInfo)
})
}
},
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>