Files
app-govern/App.vue

57 lines
1.5 KiB
Vue
Raw Normal View History

2023-01-11 16:33:13 +08:00
<script>
2023-07-06 14:24:03 +08:00
import { queryDictDataCache } from './common/api/dictionary.js'
2023-08-11 11:03:31 +08:00
import { getImageUrl } from '@/common/api/basic'
2023-01-11 16:33:13 +08:00
export default {
onLaunch: function () {
2023-08-10 09:18:17 +08:00
console.log(window)
2023-03-30 09:04:07 +08:00
// this.connect()
2023-07-06 14:24:03 +08:00
console.log('App Launch')
let devCode = uni.getStorageSync('devCode')
2023-07-03 20:29:24 +08:00
if (!devCode) {
2023-07-06 14:24:03 +08:00
uni.getSystemInfo({
success: (result) => {
uni.setStorageSync('devCode', result.deviceId)
},
})
2023-03-16 15:26:25 +08:00
}
2023-08-11 11:03:31 +08:00
if (!uni.getStorageSync(this.$cacheKey.access_token)) {
2023-08-10 09:18:17 +08:00
uni.reLaunch({
2023-08-11 11:03:31 +08:00
url: '/pages/user/login',
2023-08-10 09:18:17 +08:00
})
}
2023-08-11 11:03:31 +08:00
// 查询字典
2023-07-24 08:47:20 +08:00
queryDictDataCache().then((res) => {
uni.setStorageSync(this.$cacheKey.dictData, res.data)
})
2023-08-11 11:03:31 +08:00
// 更新用户头像
let userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
if (userInfo.headSculpture) {
getImageUrl(userInfo.headSculpture).then((res) => {
userInfo.avatar = res.data
uni.setStorageSync(this.$cacheKey.userInfo, userInfo)
})
}
2023-01-11 16:33:13 +08:00
},
onHide: function () {
console.log('App Hide')
2023-07-06 14:24:03 +08:00
},
2023-01-11 16:33:13 +08:00
}
</script>
<style lang="scss">
/*每个页面公共css */
@import './common/css/base.scss';
2023-03-16 15:26:25 +08:00
/deep/ uni-tabbar .uni-tabbar__badge {
2023-02-09 08:50:01 +08:00
width: auto;
height: 28rpx;
line-height: 28rpx;
border-radius: 28rpx;
min-width: 28rpx;
font-size: 20rpx;
padding: 0 8rpx;
}
2023-01-11 16:33:13 +08:00
</style>