<template>
	<view class="home">
		<view class="search-area">
			<u-search 
			placeholder="搜索设备" 
			v-model="keyword" 
			shape="square" 
			:clearabled="true"
			:show-action="true" 
			action-text="搜索" 
			:animation="true"
			search-icon-color="#000"
			color="#000"
			placeholder-color="#5c5b5b"
			@search="search"
			@custom="search"></u-search>
		</view>
		<view class="rule-area">
			公告
		</view>
		<view class="borrow-area">
			借用设备
		</view>
		<view class="scan-area">
			<view class="scan-code">
				<i class="iconfont icon-saoyisao"></i>
				<text>扫码设备</text>
			</view>
			<view class="scan-mine" @click="toMine">
				<i class="iconfont icon-wode"></i>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword:""
			}
		},
		methods: {
			search(){
				uni.navigateTo({
					url:'/pages/search/search?keyword='+this.keyword,
				})
			},
			toMine(){
				uni.navigateTo({
					url:'/pages/menus/menu/menu',
				})
			}
		},
		onShow:function(){
			this.keyword = ""
		}
	}
</script>

<style lang="scss" scoped>
.home{
	padding: 20rpx;
	display: flex;
	flex-direction: column;
	height: 100vh;
	box-sizing: border-box;
}
.search-area{
	margin-bottom: 20rpx ;
	flex-shrink: 0;
	position: relative;
	input{
		height: 76rpx;
		border: 2rpx solid #000;
		line-height: 76rpx;
		padding-left:80rpx ;
	}
	.iconfont{
		position: absolute;
		font-size: 40rpx;
		top: 20rpx;
		left: 16rpx;
	}
}
.rule-area{
	margin-bottom: 20rpx ;
	flex-shrink: 0;
	height: 270rpx;
	border: 2rpx solid #000;
}
.borrow-area{
	flex-shrink: 0;
	margin-bottom: 20rpx ;
	height: 120rpx;
	border: 2rpx solid #000;
}
.scan-area{
	flex-shrink: 1;
	height: 100%;
	position: relative;
	.scan-code{
		width: 280rpx;
		height: 280rpx;
		background-color: #000;
		color: $uni-text-color-inverse;
		border-radius: 50%;
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%,-50%);
		display: flex;    
		align-items: center;
		justify-content: center;
		text-align: center;
		flex-direction: column;
		font-size: 36rpx;
		.iconfont{
			font-size: 80rpx;
			margin: 20rpx 0;
		}
	}
	.scan-mine{
		width: 80rpx;
		height: 80rpx;
		color: rgba(80, 80, 80, 1);
		border-radius: 21px;
		// font-size: 14px;
		line-height: 150%;
		box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.5);
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		flex-direction: column;
		font-size: 36rpx;
		position: absolute;
		bottom: 20rpx;
		left: 20rpx;
	}
}
</style>
