loading.vue
1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<template>
</template>
<script type='text/ecmascript-6'>
export default {
name: '',
data () {
return {
}
},
mounted () {
uni.showLoading({
mask: true
})
let userInfo = uni.$storage.get('userInfo')
if (userInfo && userInfo.sceneType != undefined && userInfo.sceneType != null) {
uni.$api.userApi.getListSelectAccount().then(res => {
uni.hideLoading()
setTimeout(() => {
if (res.code == 0) {
let url = {
1: '/pages/boutique/index',
0: '/pages/equity/index',
7: '/pages/usedCar/index'
}[userInfo.sceneType]
uni.reLaunch({
url
})
}
else this.toLogin()
}, 500)
}).catch(() => [
this.toLogin()
])
} else this.toLogin()
},
methods: {
toLogin () {
uni.hideLoading()
uni.$storage.rm("userInfo")
uni.reLaunch({
url: '/pages/common/login'
})
}
}
}
</script>
<style scoped lang='scss'>
</style>