<template>

	<view class="">
		<view class="cu-list menu-avatar">
			<view class="cu-item deviceTypeItem" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in deviceData"
			 :key="index" :data-target="'move-box-' + index" @tap="hrefKing(index)">
				<view class="cu-avatar round lg" :style="`background-image:url(${item.imgUrl})`"></view>
				<view class="content" >
					<view class="">{{item.title}}</view>
				</view>
				<view class="nav-right num">
					<view class="text-grey">
						共{{item.num}}个设备
						<text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceData: [{
						imgUrl: '../../static/square-video.png',
						title: '视频',
						num: 6
					}, {
						imgUrl: '../../static/square-dl.png',
						title: '电力监测',
						num: 11
					}

				],

				modalName: null,

			};
		},
		methods: {
			// goDeviceManage() {
			// 	uni.navigateTo({
			// 		url: '/pages/deviceManage/deviceManage',
			// 		success: res => {},
			// 		fail: () => {},
			// 		complete: () => {}
			// 	});
			// },
			hrefKing(index) {
			                // log(index)
			                let url = "";
			                switch (index) {
			                    case 0:
			                        url = "/pages/videoList/videoList"//进口水果
			                        break;
			                    case 1:
			                        url = "/pages/deviceManage/deviceManage"//热门品种
			                        break;
			                    
			                    default:
			                        break;
			                }
			                if (url) {
			                    uni.navigateTo({
			                        url: url
			                    })
			                } else {
			                    uni.showToast({
			                        title:'功能未完成~',
			                        icon:'none'
			                    })
			                }
			            },



		}

	}
</script>

<style lang="scss">
	.cu-list.menu-avatar>.cu-item .content>uni-view:first-child {
		font-size: 32rpx;
	}

	.num {
		font-size: 30rpx;
		color: #666;
	}
</style>
