<template>
	<view class="home_content">
		<view class="zd-row header">
			<view class="zd-col-8 home_title">首页</view>
			<view class="zd-col-8 zd-row jcflexend home_userinfo">
				<view class="user_icon"></view>
				<view class="user_name">{{userName}}</view>
				<view class="exit_text" @tap="Quit">退出</view>
			</view>
		</view>
		<view class="welcome_text_wraper">
			<view class="welcome_text">{{userName}}, 欢迎进入诺力三期平板系统！</view>
		</view>
		<view class="zd_wrapper">
			<view class="zd-row menu-wrap">
				<view class="menu-item" v-for="(e, i) in menuList" :key="i" @tap="toPage(e)">
					<view class="menu_name_bg" :class="'bg_texture_' + i">
						<view class="menu-name">{{e.name}}</view>
						<view class="bill_count">{{e.counts}}</view>
					</view>
				</view>
			</view>
		</view>
		<view class="left_bg"></view>
		<view class="left_bg right_bg"></view>
	</view>
</template>

<script>
	import {getBillsCount} from '@/utils/getData2.js'
	export default {
		data() {
			return {
				userName: this.$store.getters.userInfo !== '' ? JSON.parse(this.$store.getters.userInfo).username : '',
				menuList: []
			};
		},
		created () {
			this._getBillsCount()
		},
		methods: {
			async _getBillsCount () {
				let res = await getBillsCount()
				this.menuList = [...res]
				
			},
			toPage (e) {
				let url = ''
				if (e.ywlx === 'OUT') {
					url = '/pages/management/out-storage?id=' + e.djlx
				} else {
					url = '/pages/management/in-storage?id=' + e.djlx
				}
				uni.redirectTo({
					url: url
				})
			},
			Quit () {
			  this.$store.dispatch('delUserInfo')
			  uni.redirectTo({
			  	url: '/pages/login/login'
			  })
			}
		}
	}
</script>

<style lang="stylus">
@import '../../common/style/mixin.styl';
.home_content
	position relative
	_wh(100%, 100%)
	_bis(,'../../static/images/home_bg.jpg', 100%, 100%,bottom)
.header
	height 120rpx
	padding 0 30rpx
	align-items flex-start
	justify-content flex-end
	_bis(,'../../static/images/header_bg.png', 100%, 100%,bottom)
.home_title
	_font(50rpx,70rpx,#F6F9FE,,center)
	font-family: YouSheBiaoTiHei;
.home_userinfo
	height 70rpx
.user_icon
	_wh(50rpx, 50rpx)
	margin-right 10rpx
	_bis(,'../../static/images/user_icon.png', 100%, 100%,center)
.user_name
	_font(34rpx,34rpx,#fff,,center)
	padding-right 10rpx
	margin 18rpx 20rpx 18rpx 0
	border-right 1rpx solid #AECAF5
.exit_text
	height 60rpx
	_font(28rpx,60rpx,#fff,,center)
	padding 0 20rpx
	margin 5rpx 0
	_bis(,'../../static/images/state-item_bg.png', 100%, 100%,center)
.welcome_text_wraper
	height 140rpx
	margin 30rpx 100rpx
.welcome_text
	_font(26px, 140rpx,  #F6F9FE,,)
	padding-left 40rpx
	font-family: YouSheBiaoTiHei
	background: linear-gradient(180deg, rgba(255,255,255,1) 0%, rgba(49,190,255,0.9) 0%, rgba(239,252,254,1) 40%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
.zd_wrapper
	_wh(calc(100% - 200rpx),calc(100% - 450rpx)) /** 120rpx + 200rpx + 130rpx */
	margin 40rpx 100rpx 0rpx 100rpx 
	_bis(,'../../static/images/bg-task-r2.png', 100%, 100%,center)
.menu-wrap
	flex-wrap wrap
	justify-content flex-start
	align-content center
	height 100%
.menu-item
	width 20%
	margin-bottom 100rpx
.menu_name_bg
	position relative
	_wh(200rpx, 200rpx)
	margin 0 auto
	border-radius 40rpx
	background-image: radial-gradient( ellipse farthest-corner at 22rpx 22rpx , #afafb9, #afafb9 50%, #ffffff 50%);
	background-size: 22rpx 22rpx;
.bg_texture_1, .bg_texture_7
	background: repeating-linear-gradient( -45deg, #afafb9, #afafb9 10rpx, #ffffff 10rpx, #ffffff 16rpx );
	.menu-name
		background-color rgba(49, 95, 255, 0.8)
.bg_texture_3, .bg_texture_6
	background-image:  repeating-linear-gradient(45deg, #afafb9 25%, transparent 25%, transparent 75%, #afafb9 75%, #afafb9), repeating-linear-gradient(45deg, #afafb9 25%, #ffffff 25%, #ffffff 75%, #afafb9 75%, #afafb9);
	background-position: 0 0, 22rpx 22rpx;
	background-size: 44rpx 22rpx;
	.menu-name
		background-color rgba(0, 239, 48, 0.8)
.bg_texture_2, .bg_texture_5
	background: radial-gradient(circle, transparent 20%, #ffffff 20%, #ffffff 80%, transparent 80%, transparent), radial-gradient(circle, transparent 20%, #ffffff 20%, #ffffff 80%, transparent 80%, transparent) 27.5rpx 27.5rpx, linear-gradient(#afafb9 4rpx, transparent 4rpx) 0 -4rpx, linear-gradient(90deg, #afafb9 4rpx, #ffffff 4rpx) -4rpx 0;
	background-size: 55rpx 55rpx, 55rpx 55rpx, 27.5rpx 27.5rpx, 27.5rpx 27.5rpx;
	.menu-name
		background-color rgba(255, 189, 45, 0.8)
.bg_texture_4
	.menu-name
		background-color rgba(255, 139, 69, 0.8)
.menu-name
	display flex
	justify-content center
	align-items center
	_wh(200rpx, 200rpx)
	padding 20rpx
	border-radius 40rpx
	_font(40rpx, 50rpx, #fff,bold,center)
	background-color rgba(0,166,255,0.8)
.bill_count
	position absolute
	top -20rpx
	right -20rpx
	_wh(60rpx, 60rpx)
	background-color $red
	border-radius 50%
	_font(40rpx, 60rpx, #fff,bold,center)
	box-shadow 6rpx 6rpx 2rpx 2rpx rgba(0,0,0,.3)
.left_bg
	position absolute
	left 0
	top 0
	_wh(50rpx, 100%)
	_bis(,'../../static/images/hud_left.png', 100%, ,center)
.right_bg
	left auto
	right 0
	background-image url('../../static/images/hud_right.png')
</style>
