| | |
| | | import QMUIKit |
| | | |
| | | class StoresInfoView: UIView,JQNibView{ |
| | | @IBOutlet weak var label_topTitle: UILabel! |
| | | @IBOutlet weak var view_container: UIView! |
| | | @IBOutlet weak var img_logo: UIImageView! |
| | | @IBOutlet weak var label_title: UILabel! |
| | | @IBOutlet weak var label_address: UILabel! |
| | | @IBOutlet weak var label_distance: UILabel! |
| | | @IBOutlet weak var btn_exchange: QMUIButton! |
| | | |
| | | private var clouse:((Bool)->Void)! |
| | | |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | | view_container.transform = .init(scaleX: 0.1, y: 0.1) |
| | | alpha = 0 |
| | | layoutIfNeeded() |
| | | btn_exchange.imagePosition = .top |
| | | btn_exchange.spacingBetweenImageAndTitle = 8 |
| | | } |
| | | |
| | | static func show(_ detailModel:CourseDetailModel,clouse:@escaping (Bool)->Void){ |
| | | let storesView = StoresInfoView.jq_loadNibView() |
| | | storesView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | storesView.label_topTitle.text = "请报名预约门店" |
| | | storesView.img_logo.sd_setImage(with: URL(string: detailModel.storeCoverDrawing)) |
| | | storesView.label_title.text = detailModel.storeName |
| | | storesView.label_address.text = detailModel.storeAddress |
| | | storesView.label_distance.text = String(format: "距你%.2lfkm", detailModel.distance) |
| | | storesView.clouse = clouse |
| | | sceneDelegate?.window?.addSubview(storesView) |
| | | @IBOutlet weak var label_topTitle: UILabel! |
| | | @IBOutlet weak var view_container: UIView! |
| | | @IBOutlet weak var img_logo: UIImageView! |
| | | @IBOutlet weak var label_title: UILabel! |
| | | @IBOutlet weak var label_address: UILabel! |
| | | @IBOutlet weak var label_distance: UILabel! |
| | | @IBOutlet weak var btn_exchange: QMUIButton! |
| | | |
| | | UIView.animate(withDuration: 0.4) { |
| | | storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | | storesView.alpha = 1 |
| | | } |
| | | } |
| | | private var clouse:((Bool)->Void)! |
| | | |
| | | static func show(_ activityModel:ActivityDetailStoreModel,clouse:@escaping (Bool)->Void){ |
| | | let storesView = StoresInfoView.jq_loadNibView() |
| | | storesView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | storesView.label_topTitle.text = "请确认预约门店" |
| | | storesView.img_logo.sd_setImage(with: URL(string: activityModel.storeCoverDrawing)) |
| | | storesView.label_title.text = activityModel.name |
| | | storesView.label_address.text = activityModel.address |
| | | storesView.label_distance.text = String(format: "距你%.2lfkm", activityModel.distance) |
| | | storesView.clouse = clouse |
| | | sceneDelegate?.window?.addSubview(storesView) |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | | view_container.transform = .init(scaleX: 0.1, y: 0.1) |
| | | alpha = 0 |
| | | layoutIfNeeded() |
| | | btn_exchange.imagePosition = .top |
| | | btn_exchange.spacingBetweenImageAndTitle = 8 |
| | | } |
| | | |
| | | UIView.animate(withDuration: 0.4) { |
| | | storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | | storesView.alpha = 1 |
| | | } |
| | | } |
| | | static func show(_ detailModel:CourseDetailModel,clouse:@escaping (Bool)->Void){ |
| | | let storesView = StoresInfoView.jq_loadNibView() |
| | | storesView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | storesView.label_topTitle.text = "请报名预约门店" |
| | | storesView.img_logo.sd_setImage(with: URL(string: detailModel.storeCoverDrawing)) |
| | | storesView.label_title.text = detailModel.storeName |
| | | storesView.label_address.text = detailModel.storeAddress |
| | | storesView.label_distance.text = String(format: "距你%.2lfkm", detailModel.distance) |
| | | storesView.clouse = clouse |
| | | sceneDelegate?.window?.addSubview(storesView) |
| | | |
| | | static func show(_ siteDetailModel:SiteDetailModel,clouse:@escaping (Bool)->Void){ |
| | | let storesView = StoresInfoView.jq_loadNibView() |
| | | storesView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | UIView.animate(withDuration: 0.4) { |
| | | storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | | storesView.alpha = 1 |
| | | } |
| | | } |
| | | |
| | | storesView.img_logo.sd_setImage(with: URL(string: siteDetailModel.storeCoverDrawing)) |
| | | storesView.label_title.text = siteDetailModel.storeName |
| | | storesView.label_address.text = siteDetailModel.storeAddress |
| | | storesView.label_distance.text = String(format: "距你%.2lfkm", siteDetailModel.distance) |
| | | storesView.clouse = clouse |
| | | sceneDelegate?.window?.addSubview(storesView) |
| | | static func show(_ activityModel:ActivityDetailStoreModel,clouse:@escaping (Bool)->Void){ |
| | | let storesView = StoresInfoView.jq_loadNibView() |
| | | storesView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | storesView.label_topTitle.text = "请确认预约门店" |
| | | storesView.img_logo.sd_setImage(with: URL(string: activityModel.storeCoverDrawing)) |
| | | storesView.label_title.text = activityModel.name |
| | | storesView.label_address.text = activityModel.address |
| | | storesView.label_distance.text = String(format: "距你%.2lfkm", activityModel.distance) |
| | | storesView.clouse = clouse |
| | | sceneDelegate?.window?.addSubview(storesView) |
| | | |
| | | UIView.animate(withDuration: 0.4) { |
| | | storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | | storesView.alpha = 1 |
| | | } |
| | | } |
| | | UIView.animate(withDuration: 0.4) { |
| | | storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | | storesView.alpha = 1 |
| | | } |
| | | } |
| | | |
| | | |
| | | @IBAction func cancelAction(_ sender: UIButton) { |
| | | close() |
| | | } |
| | | static func show(_ siteDetailModel:SiteDetailModel,clouse:@escaping (Bool)->Void){ |
| | | let storesView = StoresInfoView.jq_loadNibView() |
| | | storesView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | |
| | | storesView.img_logo.sd_setImage(with: URL(string: siteDetailModel.storeCoverDrawing)) |
| | | storesView.label_title.text = siteDetailModel.storeName |
| | | storesView.label_address.text = siteDetailModel.storeAddress |
| | | storesView.label_distance.text = String(format: "距你%.2lfkm", siteDetailModel.distance) |
| | | storesView.clouse = clouse |
| | | sceneDelegate?.window?.addSubview(storesView) |
| | | |
| | | UIView.animate(withDuration: 0.4) { |
| | | storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | | storesView.alpha = 1 |
| | | } |
| | | } |
| | | |
| | | static func show(model:ActivityDetailStoreModel,clouse:@escaping (Bool)->Void){ |
| | | let storesView = StoresInfoView.jq_loadNibView() |
| | | storesView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | storesView.label_topTitle.text = "请确认参与赛点" |
| | | storesView.img_logo.sd_setImage(with: URL(string: model.storeCoverDrawing)) |
| | | storesView.label_title.text = model.name |
| | | storesView.label_address.text = model.address |
| | | storesView.label_distance.text = String(format: "距你%.2lfkm", model.distance) |
| | | storesView.clouse = clouse |
| | | sceneDelegate?.window?.addSubview(storesView) |
| | | |
| | | UIView.animate(withDuration: 0.4) { |
| | | storesView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | | storesView.alpha = 1 |
| | | } |
| | | } |
| | | |
| | | |
| | | @IBAction func exchangeAction(_ sender: UIButton) { |
| | | close() |
| | | clouse(false) |
| | | } |
| | | |
| | | @IBAction func completeAction(_ sender: UIButton) { |
| | | close() |
| | | clouse(true) |
| | | } |
| | | |
| | | private func close(){ |
| | | UIView.animate(withDuration: 0.4) { |
| | | self.view_container.transform = .init(scaleX: 0.1, y: 0.1) |
| | | self.alpha = 0 |
| | | } completion: { _ in |
| | | self.removeFromSuperview() |
| | | } |
| | | } |
| | | @IBAction func cancelAction(_ sender: UIButton) { |
| | | close() |
| | | } |
| | | |
| | | |
| | | @IBAction func exchangeAction(_ sender: UIButton) { |
| | | close() |
| | | clouse(false) |
| | | } |
| | | |
| | | @IBAction func completeAction(_ sender: UIButton) { |
| | | close() |
| | | clouse(true) |
| | | } |
| | | |
| | | private func close(){ |
| | | UIView.animate(withDuration: 0.4) { |
| | | self.view_container.transform = .init(scaleX: 0.1, y: 0.1) |
| | | self.alpha = 0 |
| | | } completion: { _ in |
| | | self.removeFromSuperview() |
| | | } |
| | | } |
| | | } |