123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- //
- // IHAreaListCell.swift
- // Inhealth
- //
- // Created by weclouds on 2019/12/13.
- // Copyright © 2019 weclouds. All rights reserved.
- //
- import UIKit
- class IHAreaListCell: UITableViewCell {
-
- var room:RoomData?{
- didSet{
- if let room = self.room {
- roomIconImageV.netImage(url: room.image!, placeholder: "酒店头像")
- roomIconImageV.contentMode = .scaleToFill // 平铺
- roomNumberLabel.text = room.number
- lightCountLabel.text = "\(room.lightCount!)/\(room.lightTotalCount!)"
-
- if room.type == "1" {
- //学校
- imageV.image = UIImage(named: "背景-紫")
- purifierLabel.textColor = .purple
- lightCountLabel.text = room.classroomLightCount!
- sensorStatusLabel.text = room.blackboardLightCount!
- curtainNumberLabel.text = room.curtainDeviceCount!
- purifierStatusLabel.text = room.panelDeviceCount
- }else{
- if room.sensorStatus == "1" {
- sensorStatusLabel.text = "在线"
- imageV.image = UIImage(named: "背景-紫")
- }else{
- sensorStatusLabel.text = "离线"
- imageV.image = UIImage(named: "背景-紫")
- }
- if room.purifierStatus == "1" {
- purifierStatusLabel.text = "开"
- }else{
- purifierStatusLabel.text = "关"
- }
- }
-
- if let purifier = room.purifier{
- if purifier == "No data"{
- purifierLabel.text = "无数据"
- }else{
- purifierLabel.text = purifier
- }
- }
- // purifierLabel.text = room.purifier ?? "无数据"
-
- }
- }
- }
-
- @IBOutlet weak var roomIconImageV: UIImageView!
-
- @IBOutlet weak var roomNumberLabel: UILabel!
-
- @IBOutlet weak var lightCountLabel: UILabel!
-
- @IBOutlet weak var sensorStatusLabel: UILabel!
-
- @IBOutlet weak var curtainNumberLabel: UILabel!
- @IBOutlet weak var purifierStatusLabel: UILabel!
-
- @IBOutlet weak var purifierLabel: UILabel!
-
- @IBOutlet weak var boxView: UIView!
-
- @IBOutlet weak var imageV: UIImageView!
-
-
- override func awakeFromNib() {
- super.awakeFromNib()
- // Initialization code
- //绿色-开灯 蓝色-关灯 紫色-故障
- // imageV.allRoundShadowClearColor()
- // imageV.layer.shadowColor = UIColor.lightGray.cgColor
- // imageV.layer.shadowOpacity = 0.8
- // imageV.layer.shadowRadius = 0.6
- // imageV.layer.shadowOffset = CGSize(width: 2, height: 2)
- }
- override func layoutSubviews() {
- super.layoutSubviews()
- imageV.layer.shadowColor = UIColor.lightGray.cgColor
- imageV.layer.shadowOpacity = 0.8
- imageV.layer.shadowRadius = 0.6
- imageV.layer.shadowOffset = CGSize(width: 2, height: 2)
-
- }
- override func setSelected(_ selected: Bool, animated: Bool) {
- super.setSelected(selected, animated: animated)
- // Configure the view for the selected state
- }
-
- }
|