123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- //
- // IHGuestsVCtr.swift
- // Inhealth
- //
- // Created by weclouds on 2020/1/19.
- // Copyright © 2020 weclouds. All rights reserved.
- //
- import UIKit
- class IHGuestsVCtr: UIViewController {
- @IBOutlet weak var imageView: UIImageView!
-
- @IBOutlet weak var box: UIView!
-
- @IBOutlet weak var locationBtn: UIButton!
-
-
- @IBOutlet weak var lightCountLabel
- : UILabel!
-
- @IBOutlet weak var SensorStatusLabel: UILabel!
-
- @IBOutlet weak var purStatusLabel: UILabel!
-
- var roomInfo:CustomerRoom?{
- didSet{
- if let roomInfo = self.roomInfo {
- if let image = roomInfo.image,let lightTotalCount = roomInfo.lightTotalCount,let lightCount = roomInfo.lightCount,let sensorOnline = roomInfo.sensorOnline,let purStatus = roomInfo.purStatus ,let location = roomInfo.location {
- imageView.netImage(url: image, placeholder: "编组")
- lightCountLabel.text = "\(lightCount)/\(lightTotalCount)"
- var sensorStatus = "Off-line"
- if sensorOnline == "0"{
- sensorStatus = "Off-line"
- }else if sensorOnline == "1"{
- sensorStatus = "On-line"
- }
- SensorStatusLabel.text = sensorStatus
- var purStr = "Enable"
- if purStatus == "0" {
- purStr = "Disable"
- }else if purStatus == "1"{
- purStr = "Enable"
- }
- purStatusLabel.text = purStr
- locationBtn.setTitle(location, for: .disabled)
- }
- }
- }
- }
-
- override func viewDidLoad() {
- super.viewDidLoad()
- setNavigationBar()
- createUI()
- IHAddressService.share.getFirstHotel { (hotelId, hotelName) in
- Intermediate.hotelId = hotelId!
- self.navigationBarTitle = hotelName
- }
-
- IHLoginService.share.GuestsRoom(requstSuccess: { (roomInfo) in
- self.roomInfo = roomInfo
- }) {
-
- }
- }
-
-
- func createUI() {
- let width : CGFloat = 325
- let height : CGFloat = 350
- let r : CGFloat = (width * 0.5 * width * 0.5 + 35 * 35 ) / (2 * 35)
- let path0 = UIBezierPath(rect: CGRect(x: 0, y: 0, width: width, height: height - 35))
- path0.addArc(withCenter: CGPoint(x: width * 0.5, y: height - r), radius: r, startAngle: 1 / 4 * .pi, endAngle: 3 / 4 * .pi, clockwise: true)
-
- let masklayer = CAShapeLayer()
- masklayer.frame = self.imageView.bounds
- masklayer.path = path0.cgPath
- self.imageView.layer.mask = masklayer
- box.allRoundShadow()
- }
- func setNavigationBar() {
- //导航栏的渲染方式
- self.navigationBarTitle = " "
- let mapItem = UIBarButtonItem(image: UIImage(named: "map")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(mapAction))
- let setItem = UIBarButtonItem(image: UIImage(named: "设置")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(setAction))
- let leftItem = UIBarButtonItem(image: UIImage(named: "定位")?.withRenderingMode(.alwaysOriginal), style: .plain, target: self, action: #selector(mapAction1))
-
- self.navigationItem.rightBarButtonItems = [mapItem,setItem]
- self.navigationItem.leftBarButtonItem = leftItem
-
- }
-
-
- @objc func setAction(){
- log.debug("点击了")
- log.debug("个人中心")
- let personalVC = IHPersonalCenterVCtr()
- self.navigationController?.pushViewController(personalVC, animated: true)
- }
-
-
-
- @objc func mapAction1(){
- log.debug("点击了")
- // let addressVC = IHAddressController()
- // addressVC.delegate = self
- // self.modal(addressVC, controllerHeight: 350)
-
- let picker = IHHotelPickerVCtr.shareInstance
- self.navigationController?.pushViewController(picker, animated: true)
- }
- @objc func mapAction(){
- log.debug("点击了")
- let map = IHDashboardMapMainVCtr()
-
- self.navigationController?.pushViewController(map, animated: true)
- }
-
- }
- extension IHGuestsVCtr:IHAddressControllerDelegate {
- func selectedAddress(address: String, addressID: String) {
- self.navigationBarTitle = address
- Intermediate.hotelId = addressID
- }
-
- }
|