<template>
	<view>
		<u-navbar back-text="返回"   class="top-navbar" :background="{'background':'transparent'}"></u-navbar>
		<view class="login-logo">
			<u-image width="120rpx" height="120rpx" src="../../static/img/logo.png" border-radius="20"></u-image>
			<h3>停车场管理端</h3>
		</view>
		<view class="tip">{{tiptxt}}</view>
	</view>
</template>

<script>
	import * as api from '@/apis/login.js'
	import app from '@/utils/app.js'
	
	export default {
		data() {
			return {
				tiptxt:'正在进入系统...'
			}
		},
		onLoad() {
			this.login(app.getURLParams())
		},
		methods: {
			login(param){
				api.login3(param).then(resp=>{
					if(!resp.success){
						this.tiptxt=resp.msg || '登录失败'
						return
					}
					app.addSetting(resp.data);
					uni.switchTab({
						url: '../index/index'
					})
				}).catch(err=>{
					console.log(err)
					this.tiptxt='登录出现错误'
				}).finally(()=>{
					if(this.tiptxt=='正在进入系统...'){
						this.tiptxt=''
					}
				})
			}
			
		}
	}
</script>

<style>
page{
		background: url(../../static/img/bgbg.png) no-repeat;
		background-size: 100%;
	}
</style>
<style lang="scss" scoped>
	.login-logo{
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-top: 20%;
		h3{
			margin:15px 0;
		}
	}
	.tip{
		margin:100rpx 0rpx;
		padding:30rpx;
		text-align: center;
		font-size: 32rpx;
		color:#333;
	}
</style>