<template>
	<view style="height: 100vh;background-color: white;">
		<u-swiper :list="swaiperList"></u-swiper>
		<!-- 宫格组件 -->
		<uni-section title="功能" type="line"></uni-section>
		<view class="cu-list grid" :class="['col-4','no-border']">
			<view class="cu-item" v-for="(item,index) in cuIconList" :key="index" v-if="index<4*2" v-show="item.showFlag||adminType">
				<view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]" @click="click(item)" >
				</view>
				<text>{{item.name}}</text>
			</view>
		</view>
		<view v-show="adminType">
			<uni-section title="系统管理" type="line"></uni-section>
			<view class="cu-list grid" :class="['col-4','no-border']">
				<view class="cu-item" v-for="(item,index) in sysManageList" :key="index" v-if="index<4*2"
					@click="click(item)">
					<view :class="['cuIcon-' + item.cuIcon,'text-' + item.color]">
					</view>
					<text>{{item.name}}</text>
				</view>
			</view>
		</view>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cuIconList: [{
					cuIcon: 'writefill',
					color: 'red',
					name: '建档',
					url: '/pages/filing/list',
					showFlag:true
				}, {
					cuIcon: 'pullleft',
					color: 'red',
					name: '领活',
					url: '/pages/receive/list',
					showFlag:true
				}, {
					cuIcon: 'pullright',
					color: 'red',
					name: '送活',
					url: '/pages/back/list',
					showFlag:true
				}, {
					cuIcon: 'home',
					color: 'red',
					name: '库存',
					url: '/pages/stock/index',
					showFlag:true
				}, {
					cuIcon: 'rank',
					color: 'red',
					badge: 0,
					name: '计划排产',
					url: '/pages/plan/list',
					showFlag:false
				}, {
					cuIcon: 'text',
					color: 'red',
					badge: 0,
					name: '报表',
					url: '/pages/report/index',
					showFlag:true

				}],
				modalName: null,

				sysManageList: [{
					cuIcon: 'friendadd',
					color: 'red',
					name: '新增用户',
					url: '/pages/user/add'
				}, {
					cuIcon: 'friendfill',
					color: 'red',
					name: '用户管理',
					url:'/pages/user/list'
				}, {
					cuIcon: 'home',
					color: 'red',
					name: '车间管理',
					url:'/pages/workshop/list'
				}, {
					cuIcon: 'paint',
					color: 'red',
					name: '班组管理',
					url:'/pages/team/list'
				}],
				swaiperList: [
					'/static/swaiper_pic/work_space/20181112085705180.jpg',
					'/static/swaiper_pic/work_space/sy_xialapic.jpg',
					'/static/swaiper_pic/work_space/20150211145332520.jpg',
					'/static/swaiper_pic/work_space/sec2_lilianbg.jpg',
				],
				adminType: false
			}
		},
		methods: {
			click(item) {
				console.log(item.url)
				uni.navigateTo({
					url: item.url
				})
			}
		},
		onLoad(){
			this.adminType = this.$store.state.user.adminType
		}
	}
</script>

<style lang="scss">
	.grid-text {
		font-size: 14px;
		color: #909399;
		padding: 10rpx 0 20rpx 0rpx;
		/* #ifndef APP-PLUS */
		box-sizing: border-box;
		/* #endif */
	}
</style>
