<template>
	<view class="body">
		<form>
			<view class="face-wapper">
				<image src="https://maomaochong.top:8088/i/2024/03/21/65fc3855eb44b.png" class="face"></image>
			</view>
			
			<view class="info-wapper">
				<label class="words-lbl">账号</label>
				<input name="username" type="text" v-model="username" class="input" placeholder="请输入用户名" placeholder-class="graywords"/>
			</view>
			
			<view class="info-wapper" style="margin-top: 40upx;margin-bottom: 40upx;">
				<label class="words-lbl">密码</label>
				<input name="password" type="text" v-model="password" password="true" class="input" placeholder="请输入密码" placeholder-class="graywords"/>
			</view>
			<u-button type="primary" @click="formSubmit" style="width: 90%;">登录</u-button>
			
		</form>
			
			<!-- <view class="info-wapper" style="margin-top: 40upx;">
				<label class="words-lbl">班次</label>
				<view class="input">
				<xfl-select
				:list="list"
				:initValue="'甲'"
				:showItemNum="2" 
				:isCanInput="false"  
				:style_Container="listBoxStyle"
				class="xialaakuang"
				@change="change"
				@cancel="bindCancel"
				>
				</xfl-select>
				</view>
			</view>
			<view class="info-wapper" style="margin-top: 40upx;">
				<label class="words-lbl">班时</label>
				<view class="input">
				<xfl-select
				:list="list1"
				:initValue="'白班'"
				:showItemNum="2" 
				:isCanInput="false"  
				:style_Container="listBoxStyle"
				class="xialaakuang"
				@change="change1"
				@cancel="bindCancel"
				>
				</xfl-select>
				</view>
			 </view> -->
			
			
			<!-- <button type="primary" form-type="submit" style="margin-top: 60upx; width: 90%;">登录</button>
			
		</form> -->
	</view>
</template>

<script>
	import { login } from "../../api/api.js"
	export default {
		data() {
			return {
				res : {
				},
				list:['甲','乙','丙','丁'],
				list1:['白班','晚班'],
				listBoxStyle: `height: 10upx;width:100%; font-size: 14px;`,
				username:'',
				password:''
				
			}
		},
		
		methods: {
			formSubmit(event){
				var me = this;
				
				if(me.username==""||me.password==""){
					uni.showModal({
						title: '用户名或密码不能为空！'
					})
				}else{
					uni.showLoading({
						title: '登陆中,请稍后'
					});
					
				}
			
				var data = {
					userId:me.username,
					pwd:me.password
				}
				console.log(data)
				login(data).then((r)=>{
					uni.hideLoading();
					console.log(r)
					uni.switchTab({
						url:"../me/me"
					})
					// uni.redirectTo({
					// 	url:"../wuliugenzongX/genzong"
					// })
				}).catch((err)=>{
					uni.hideLoading();
				})
						
			},
			bindChange(valve){
				// this.startTime=valve.replace(/[-: ]/g,"");
				this.startTime=valve
				console.log(this.startTime)
			},
			bindChange1(valve){
				// this.endTime=valve.replace(/[-: ]/g,"");
				this.endTime=valve
				console.log(this.endTime)
			},
			bindCancel(){
				
			}
		}
	}
</script>

<style>
	@import url("login.css");
</style>
