splash.vue
1.22 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
51
52
53
54
55
56
57
58
59
60
61
62
63
<template>
<view class="splash-container">
<view class="splash-container-box">
<image v-if="initConfig.logo" :src="initConfig.logo"></image>
<image v-else :src="staticLogo"></image>
<text class="splash-text-muted">连接世界 创造价值</text>
</view>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
import api from '@/api/index.js'
import {
useReLaunch
} from '@/plugins/utils.js'
export default {
data() {
return {
staticLogo: '/static/logo.png',
initConfig: {}
};
},
onLoad() {
uni.setStorageSync('getConfiguration', {
isConfiguration: false
});
this.getPlateForm();
},
created() {
if (!this.userInfo.isToken) {
setTimeout(() => {
useReLaunch('/login-subpackage/public/login')
}, 1000);
} else {
setTimeout(() => {
useReLaunch('/pages/index/index')
}, 1000);
}
},
computed: {
...mapState(['userInfo']),
},
methods: {
async getPlateForm() {
const res = await api.loginApi.getPlateCustomApi()
this.initConfig = {
bg: res.background,
logo: res.logo ? res.logo : this.staticLogo,
name: res.name
};
}
}
};
</script>
<style lang="scss" scoped>
@import './static/splash.scss';
</style>