From f7e33a3255d9f87b20e4a06fc32012eaad77cad5 Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期三, 11 十月 2023 14:52:37 +0800 Subject: [PATCH] 完善 --- WanPai/Root/Course/VC/CourseDetailApplyVC.swift | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-) diff --git a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift index 7127fe4..db6758e 100644 --- a/WanPai/Root/Course/VC/CourseDetailApplyVC.swift +++ b/WanPai/Root/Course/VC/CourseDetailApplyVC.swift @@ -55,7 +55,7 @@ title = "课程详情" if let m = detailModel{ - img_cover.sd_setImage(with: URL(string: m.coverDrawing)) + img_cover.sd_setImage(with: URL(string: m.storeCoverDrawing)) label_title.text = m.name label_listenWeek.text = "每" + m.weeks.joined(separator: "、") label_listenTime.text = m.times.joined(separator: "|") @@ -68,6 +68,7 @@ case .vocation: label_vaild.text = m.time view_vaildTime.isHidden = false + view_packageList.isHidden = true case .experience: label_vaild.text = "购买当天有效" view_vaildTime.isHidden = false @@ -125,6 +126,13 @@ fatalError("init(coder:) has not been implemented") } + override func setRx() { + NotificationCenter.default.rx.notification(StudentUpdate_Nofi).take(until: self.rx.deallocated).subscribe {[weak self] noti in + guard let weakSelf = self else { return } + //重新唤起添加学生 + weakSelf.studentAction(weakSelf.btn_addStudent) + }.disposed(by: disposeBag) + } @IBAction func couponAction(_ sender: TapBtn) { CouponChooseView.show(couponModels,defaultModel: selectCouponModel) {[weak self] m in @@ -354,13 +362,18 @@ cell.studentModel = studentModels[indexPath.row] cell.deleClouse = { [weak self] index in guard let weakSelf = self else { return } - tableView.beginUpdates() - weakSelf.studentModels.remove(at: index) - tableView.deleteRows(at: [IndexPath(row: index, section: 0)], with: .right) - tableView.endUpdates() - weakSelf.cons_tableHei.constant = CGFloat((weakSelf.studentModels.count) * 87) - tableView.reloadData() - weakSelf.changePrice(weakSelf.selectClassIndex) + if weakSelf.studentModels.count > 1{ + tableView.beginUpdates() + weakSelf.studentModels.remove(at: index) + tableView.deleteRows(at: [IndexPath(row: index, section: 0)], with: .right) + tableView.endUpdates() + weakSelf.cons_tableHei.constant = CGFloat((weakSelf.studentModels.count) * 87) + tableView.reloadData() + weakSelf.changePrice(weakSelf.selectClassIndex) + }else{ + alert(msg: "至少选择一位学员") + } + } return cell } -- Gitblit v1.7.1