<template>

	<view class="">
		<view class="cu-list menu-avatar">
			<view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''" v-for="(item,index) in deviceData"
			 :key="index" :data-target="'move-box-' + index" @tap="goVideoDetail(item)">
				<view v-if="item.trueStatus==0" class="cu-avatar round lg" style="background-image:url(../../static/video-icon-on.png);opacity:.7" ></view>
				<view v-else class="cu-avatar round lg" style="background-image:url(../../static/video-icon-off.png);opacity:.7" ></view>
				
				<view class="content">
					<view class="">{{item.deviceName}}</view>
				</view>
				<view class="nav-right num">
					<view v-if="item.trueStatus==1" class="offline" >
						离线
						<text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
					</view>
					
					<view v-else class="online">
						在线
						<text class="icon iconfont margin-right-xs margin-left-lg">&#xe629;</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				deviceData: [
					// {
					// 	status: '离线',
					// 	imgUrl: '../../static/video-icon-off.png',
					// 	title: 'C59360332',
					// 	num: 6
					// }, {
					// 	status: '在线',
					// 	imgUrl: '../../static/video-icon-on.png',
					// 	title: 'C59360332',
					// 	num: 11
					// },
					// {
					// 	status: '异常',
					// 	imgUrl: '../../static/video-icon-error.png',
					// 	title: 'C59360332',
					// 	num: 6
					// }
				],
				modalName: null,

			};
		},
		onLoad:function(option){
			console.log(111)
			console.log(option.companyCode)
			this.companyCode=option.companyCode
			this.deviceType=option.deviceType
			this.getDeviceManage({"companyCode":option.companyCode,"deviceType":option.deviceType})
		},
		methods: {
			
			async getDeviceManage(ming={}) {
				const res= await this.$myRequest({
					url:'OperationMonitoring/getDeviceList',
					data:ming
				})
				console.log(res.data.data)
				this.deviceData=res.data.data
				// this.powerDeviceCount= res.data.data[0].powerDeviceCount
				// this.videoDeviceCount= res.data.data[0].videoDeviceCount
				
			},
			
			goVideoDetail(item) {
				uni.navigateTo({
					url: '/pages/videoDetail/videoDetail?deviceType=2&companyCode='+this.companyCode+'&deviceCode='+item.deviceCode+'',
					success: res => {},
					fail: () => {},
					complete: () => {}
				});
			},


		}

	}
</script>

<style lang="scss">
	
</style>
