From a1ac0f1634ff0bd8f04259fc4cf7ebabd8c8c82d Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期二, 10 十月 2023 16:40:52 +0800 Subject: [PATCH] 修复BUG --- WanPai/Root/Course/VC/CourseDetailVC.swift | 35 ++++++++++++++++++++--------------- 1 files changed, 20 insertions(+), 15 deletions(-) diff --git a/WanPai/Root/Course/VC/CourseDetailVC.swift b/WanPai/Root/Course/VC/CourseDetailVC.swift index 2a03f03..a01277c 100644 --- a/WanPai/Root/Course/VC/CourseDetailVC.swift +++ b/WanPai/Root/Course/VC/CourseDetailVC.swift @@ -33,6 +33,7 @@ @IBOutlet weak var label_coin: UILabel! @IBOutlet weak var cons_handleHei: NSLayoutConstraint! @IBOutlet weak var btn_enroll: UIButton! + @IBOutlet weak var view_tag: UIView! private var id = 0 @@ -44,13 +45,14 @@ img_cover.sd_setImage(with: URL(string: m.coverDrawing)) label_title.text = m.name label_distance.text = String(format: "距离我%.2lfkm", m.distance) - label_local.text = m.storeAddress - label_listenWeek.text = m.weeks.joined(separator: "、") + label_local.text = String(format: "%@(%@)", m.storeName,m.storeAddress) + label_listenWeek.text = "每" + m.weeks.joined(separator: "、") label_listenTime.text = m.times.joined(separator: "|") label_vaildTime.text = m.time label_courseType.text = m.type.strTitle label_courseType.isHidden = m.type == .none view_vaildTime.isHidden = m.type == .normal + label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0 let w = String.jq_getWidth(text: m.type.strTitle, height: 25, font: 14) label_courseType.jq_cornerPartWithNib(byRoundingCorners: [.topLeft,.bottomLeft], radii: 8, size: CGSize(width: w, height: 25)) @@ -89,10 +91,10 @@ } //会员价 - if let vipPrice = subM.vipPrice{ + if subM.vipPrice != 0{ let vipAttribute = AttributedStringbuilder.build() .add(string: "会员价:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) - .add(string: vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) + .add(string: subM.vipPrice.currency(), withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) label_vipPrice.attributedText = vipAttribute.mutableAttributedString } } @@ -103,6 +105,7 @@ label_vipPrice.isHidden = true label_vaildTime.text = "购买当天有效" view_listen.isHidden = true + label_price.isHidden = (m.list.first?.paymentPrice ?? 0) == 0 } //体验课,假期课不展示 @@ -111,17 +114,17 @@ cons_handleHei.constant = 0 } - if let m = signUpCourseModel{ - label_originPrice.isHidden = true -// label_vipPrice.isHidden = true - - let coinAttribute = AttributedStringbuilder.build() - .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) - .add(string: "\(m.wpGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) - label_coin.attributedText = coinAttribute.mutableAttributedString - label_price.text = m.paymentPrice.currency() - label_coin.alpha = m.wpGold == 0 ? 0:1 - } +// if let m = signUpCourseModel{ +// label_originPrice.isHidden = true +//// label_vipPrice.isHidden = true +// +// let coinAttribute = AttributedStringbuilder.build() +// .add(string: "玩湃币:", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#3F3F3F")) +// .add(string: "\(m.wpGold)币", withFont: UIFont.systemFont(ofSize: 14, weight: .semibold), withColor: UIColor(hexStr: "#F21313")) +// label_coin.attributedText = coinAttribute.mutableAttributedString +// label_price.text = m.paymentPrice.currency() +// label_coin.alpha = m.wpGold == 0 ? 0:1 +// } } } } @@ -159,6 +162,8 @@ override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() + let w = String.jq_getWidth(text: detailModel?.type.strTitle ?? "", height: 25, font: 14) + 16 + view_tag.jq_addCorners(corner: [.topLeft,.bottomLeft], radius: 4, width: w, height: 25) } @IBAction func applyAction(_ sender: UIButton) { -- Gitblit v1.7.1