splash.vue 1.22 KB
<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">{{ $t('spreadTail') }}</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>