splash.vue 1.35 KB
<template>
	<view class="container">
		<view class="container-box">
			<image :src="mpOwnConfig.logo"></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',
				mpOwnConfig: {}
			};
		},
		onLoad() {
			uni.setStorageSync('getConfiguration', {
				isConfiguration: false
			});
			this.getPlateForm();
		},
		created() {
			if (!this.userInfo.isToken) {
				setTimeout(() => {
					useReLaunch('/publicLoginSubPage/public/login')
				}, 1000);
			} else {
				setTimeout(() => {
					useReLaunch('/pages/index/index')
				}, 1000);
			}
		},
		computed: {
			...mapState(['userInfo']),
		},
		methods: {
			async getPlateForm() {
				const res = await api.loginApi.getPlateCustomApi()
				this.mpOwnConfig = {
					bg: res.background,
					logo: res.logo ? res.logo : this.staticLogo,
					name: res.name
				};
			}
		}
	};
</script>

<style lang="scss">
	.container {
		width: 100%;
		height: 100%;
		margin-top: 300rpx;

		.container-box {
			display: flex;
			align-items: center;
			justify-content: space-between;
			flex-direction: column;

			image {
				width: 100rpx;
				height: 100rpx;
			}
		}
	}
</style>