<template>
	<view class="content">
		<loginPassword :themeColor="themeColor" :logoUrl="logoUrl" @loginFun="loginFun"></loginPassword>
	</view>
</template>

<script>
	import loginPassword from '@/subpkg/components/ay-login/login-password.vue';
	export default {
		components: {
			loginPassword
		},
		data() {
			return {
				themeColor: '#33CCCC',
				logoUrl: 'https://cdn.pixabay.com/photo/2016/11/23/17/55/beach-1854072__340.jpg',
			}
		},
		onLoad() {

		},
		methods: {
			loginFun(data) {
				console.log(data);
				console.log('data.loginData:', data.loginData); 
				uni.setStorageSync('userType', data.type);
				this.$http('common.login', data.loginData, '登录中', true).then((res) => {
					if (res.success == true) {
						if (res.data) {
							uni.setStorageSync('token', res.data.token);
						}
						uni.showToast({
							title: '登录成功',
							icon: 'none',
							success: function() {
								if (data.loginData.spdId) {
									uni.switchTab({
									    url: '/pages/platform/index'
									});
								} else {
									uni.redirectTo({
										url: '/subpkg/pages/home/home'
									});
								}
							}
						});
					}
				})
			}
		}
	}
</script>

<style>
	.content {
		width: 100%;
		height: 100%;
		/* 	background: url('../../static/home.png');
		background-size: 100% 100%;
		overflow: auto; */
	}
</style>