<template>
	<view class="content" :style="[{height:pageHeight+'px'}]">
		<view class="center">
			<view class="input">
				账号：<u-input placeholder="请输入账号" border="bottom" v-model="user_num"
					:customStyle="{border:'1rpx solid','border-radius':'10rpx'}"></u-input>
			</view>
			<view class="input">
				密码：<u-input placeholder="请输入密码" border="bottom" v-model="password"
					:customStyle="{border:'1rpx solid','border-radius':'10rpx'}" type="password"></u-input>
			</view>
		</view>
		<mobileButton leftBtnTitle="立即登陆" @leftClick="get_state"></mobileButton>
	</view>
</template>

<script>
	import {
		setWeixinConfig,
		onScanH5Weixin,
		getLocation
	} from '../../components/weixinSdkManager.js'
	import mobileButton from "../../components/mobile-bottom-btn.vue"
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	export default {
		data() {
			return {
				user_num: '',
				password: ''
			}
		},
		components: {
			mobileButton
		},
		onLoad() {
			// /roke/insider/login
			// 用户名 user
			// 密码  pwd
		},
		computed: {
			...mapGetters(['screenHeight', 'customTabBarHeight', 'naviStatusHeight']),
			pageHeight() {
				return this.screenHeight - this.naviStatusHeight
			},
		},
		methods: {
			get_state() {
				let that = this
				if(this.user_num==''){
					uni.showToast({
						title:'用户名不能为空',
						icon:'none'
					})
				}else if(this.password==''){
					uni.showToast({
						title:'密码不能为空',
						icon:'none'
					})
				}else{
					wx.request({
						url: 'http://ykykt.newerp.rokedata.com/roke/insider/login',
						method: "POST",
						data: {
							user:that.user_num,
							pwd:that.password
						},
						success(res) {
							console.log('appointment_state', res)
							if (res.data.result.status) {
								uni.navigateTo({
									url:'/pages/main/main'
								})
							} else {
								wx.showModal({
									title: '提示',
									content: res.data.result.msg,
									showCancel: false
								})
							}
						}
					})
				}
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		position: relative;
		background-image: url('../../static/loginBack.png');
	}

	.center {
		margin: auto;
	}

	.msg {
		position: absolute;
		text-align: center;
		width: 100%;
		bottom: 160rpx;
		color: #999;
	}

	.input {
		display: flex;
		align-items: center;
		font-size: 32rpx;
		margin-top: 20rpx;
		padding: 20rpx 0rpx;
		color: #fff;
	}
</style>