<template name="history">
	<view>
		<scroll-view>
			<!-- 通风设备 -->
			<view v-for="(typeitem,index) in typeList">
				
				<view class="cu-bar bg-white solid-bottom margin-top" :style="[{animation: 'show 0.5s 1'}]">
					<view class="action">
						<text class='cuIcon-title text-blue'></text>{{typeitem.itemText}}
					</view>
				</view>
					
				<view class="cu-list grid col-4 text-sm">
					<view class="cu-item animation-slide-bottom" :style="[{animationDelay: (index + 1)*0.05 + 's'}]" v-for="(item,index) in typeitem.children" :key="index" @tap="goPage(item.itemValue)">
						<view class="padding text-center">
							<image :src="icon_prefix+'xinwen.png'" style="width:28px;height:28px;">
							</image>
							<view class="margin-top-xs">{{item.itemText}}</view>
						</view>
					</view>
				</view>
			</view>
				
		</scroll-view>
		<view class="cu-tabbar-height margin-top"></view>
	</view>
</template>

<script>
	import { us,os } from '@/common/util/type.js'
	import socket from '@/common/js-sdk/socket/socket.js'
	import api from "@/api/api";
	export default {
		name: 'home',
		watch: {
		},
		data() {
			return {
				icon_prefix:"/static/home/128/",
				typeList:[],
				usList:us.data,
				osList:os.data,
				dsList:os.data,
				msgCount:0,
				dot:{
				  mailHome:false
				}
			}
		},
		created() {
			this.loadData();
		},
		methods: {
			loadData(){
				  return new Promise((resolve, reject) => {
				   api.getDeviceType({}).then(response => {
				      if(response.data.code ==200){ 
						  for(var i=0;i<response.data.result.length;i++){
							  if(response.data.result[i].itemValue.indexOf("synthesizeS")==-1)
							    this.typeList.push(response.data.result[i])
						  }
				      }else{
				        resolve(response)
				      }
				    }).catch(error => {
						console.log("catch===>response",response)
				      reject(error)
				    })
				  })
			},
			goPage(page){
			   this.$emit("menuClick",page)
			},
		}
	}
</script>

<style scoped>
	.cu-list.grid>.cu-item {
	  padding: 0px 0px; 
	}
    .line2-icon {
	  width: 60px;
	  height: 60px;
    }
	
</style>
