//
|
// CourseInfoVC.swift
|
// WanPai
|
//
|
// Created by 无故事王国 on 2023/6/21.
|
//
|
|
import UIKit
|
import JQTools
|
import SPPageMenu
|
import FFPage
|
import QMUIKit
|
|
let StudentRefresh_Nofi = Notification.Name.init("StudentRefresh_Nofi")
|
|
class CourseInfoVC: BaseVC {
|
|
@IBOutlet weak var scrollView: CourseInfoScrollView!
|
@IBOutlet weak var view_container: UIView!
|
@IBOutlet weak var img_header: UIImageView!
|
@IBOutlet weak var label_stu_name: UILabel!
|
@IBOutlet weak var label_stu_hei: UILabel!
|
@IBOutlet weak var label_stu_wei: UILabel!
|
@IBOutlet weak var label_stu_BMI: UILabel!
|
@IBOutlet weak var img_gender: UIImageView!
|
@IBOutlet weak var label_age: UILabel!
|
@IBOutlet weak var view_menu: UIView!
|
@IBOutlet weak var cons_menuHeight: NSLayoutConstraint!
|
@IBOutlet weak var btn_record: UIButton!
|
@IBOutlet weak var view_schedule: UIView!
|
@IBOutlet weak var tableView: UITableView!
|
@IBOutlet weak var cons_tableHei: NSLayoutConstraint!
|
@IBOutlet weak var mentalCollectionView: UICollectionView!
|
@IBOutlet weak var cons_mentalViewHei: NSLayoutConstraint!
|
@IBOutlet weak var exerciseCollectionView: UICollectionView!
|
@IBOutlet weak var label_weeklyScope: UILabel!
|
@IBOutlet weak var label_totalNums: UILabel!
|
@IBOutlet weak var label_deductedNums: UILabel!
|
@IBOutlet weak var label_remainingNums: UILabel!
|
@IBOutlet weak var stack_courseExercise: UIStackView!
|
@IBOutlet weak var view_exerciseTitle: UIView!
|
@IBOutlet weak var view_footer: UIView!
|
|
|
var startClouseHomeModel:StartClouseHomeModel?
|
var weeklyCourseModel:WeeklyCourseModel?
|
private var currentDate = Date()
|
private var unDispatchNum:Int?
|
private var mentals = [StudentMedalModel]()
|
|
private var pageMenu:SPPageMenu = {
|
let pageMenu = SPPageMenu(frame: .zero, trackerStyle: .line)
|
// 追踪线
|
pageMenu.trackerWidth = 56
|
pageMenu.setTrackerHeight(3, cornerRadius: 1.5)
|
pageMenu.tracker.backgroundColor = .clear
|
pageMenu.trackerFollowingMode = .always
|
pageMenu.contentInset = UIEdgeInsets(top: 0, left: 19, bottom: 0, right: 19)
|
|
// 分割线
|
pageMenu.dividingLine.backgroundColor = .clear
|
pageMenu.dividingLineHeight = 1
|
|
// item
|
pageMenu.spacing = 27.0
|
pageMenu.permutationWay = .scrollAdaptContent
|
|
// 字体
|
pageMenu.selectedItemTitleFont = UIFont.systemFont(ofSize: 18, weight: .medium)
|
pageMenu.unSelectedItemTitleFont = UIFont.systemFont(ofSize: 18,weight: .medium)
|
// 颜色
|
pageMenu.selectedItemTitleColor = UIColor(hexStr: "#6CC366")
|
pageMenu.unSelectedItemTitleColor = UIColor(hexStr: "#A4A4A4")
|
|
return pageMenu
|
}()
|
|
lazy var pageViewController:FFPageViewController = {
|
let pageVC = FFPageViewController()
|
pageVC.view.backgroundColor = .clear
|
pageVC.scrollview.backgroundColor = .clear
|
|
pageVC.scrollview.bounces = false
|
return pageVC
|
}()
|
|
private lazy var btn_dispatchCourse:UIButton = {
|
let btn = UIButton(type: .custom)
|
btn.setTitleColor(Def_ThemeColor, for: .normal)
|
|
let attribute = AttributedStringbuilder.build().add(string: "未分配课时", withFont: UIFont.systemFont(ofSize: 14), withColor: Def_ThemeColor).underLine(color: Def_ThemeColor).mutableAttributedString
|
btn.setAttributedTitle(attribute, for: .normal)
|
btn.addTarget(self, action: #selector(dispatchCourseAction), for: .touchUpInside)
|
return btn
|
|
}()
|
|
override func viewDidLoad() {
|
super.viewDidLoad()
|
updateData()
|
}
|
|
|
override func setUI() {
|
cons_menuHeight.constant = 0
|
scrollView.contentInset = UIEdgeInsets( top: 265 - JQ_NavBarHeight, left: 0, bottom: 0, right: 0)
|
scrollView.delegate = self
|
scrollView.bringSubviewToFront(img_header)
|
|
scrollView.bounces = false
|
scrollView.contentInsetAdjustmentBehavior = .never
|
|
let attribute = AttributedStringbuilder()
|
attribute.add(string: "上课记录", withFont: UIFont.systemFont(ofSize: 14), withColor: Def_ThemeColor)
|
attribute.underLine(color: Def_ThemeColor)
|
btn_record.titleLabel?.attributedText = attribute.mutableAttributedString
|
|
|
view_schedule.addSubview(pageViewController.view)
|
addChild(pageViewController)
|
pageViewController.delegate = self
|
view_schedule.insertSubview(pageViewController.view, at: 0)
|
pageViewController.didMove(toParent: self)
|
pageViewController.view.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: 90)
|
|
tableView.delegate = self
|
tableView.dataSource = self
|
tableView.isScrollEnabled = false
|
if #available(iOS 15.0, *) {
|
tableView.sectionHeaderTopPadding = 0
|
} else {
|
|
}
|
tableView.separatorStyle = .none
|
tableView.register(UINib(nibName: "CourseBookingTCell", bundle: nil), forCellReuseIdentifier: "_CourseBookingTCell")
|
tableView.backgroundColor = .clear
|
|
mentalCollectionView.delegate = self
|
mentalCollectionView.dataSource = self
|
mentalCollectionView.contentInset = UIEdgeInsets(top: 0, left: 58, bottom: 0, right: 58)
|
mentalCollectionView.tag = 1000
|
mentalCollectionView.isScrollEnabled = false
|
mentalCollectionView.register(UINib(nibName: "StudentMedalCCell", bundle: nil), forCellWithReuseIdentifier: "_StudentMedalCCell")
|
|
exerciseCollectionView.delegate = self
|
exerciseCollectionView.dataSource = self
|
exerciseCollectionView.tag = 1001
|
exerciseCollectionView.register(UINib(nibName: "StudentVideoCCell", bundle: nil), forCellWithReuseIdentifier: "_StudentVideoCCell")
|
|
// navigationItem.leftBarButtonItem = UIBarButtonItem(customView: leftBtn)
|
|
}
|
|
override func setRx() {
|
NotificationCenter.default.rx.notification(StudentRefresh_Nofi).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in
|
guard let weakSelf = self else { return }
|
Services.startCourseHome().subscribe(onNext: {[weak self] data in
|
if let model = data.data{
|
self?.startClouseHomeModel = model
|
self?.updateData()
|
}
|
}).disposed(by: weakSelf.disposeBag)
|
}).disposed(by: disposeBag)
|
|
|
NotificationCenter.default.rx.notification(StudentUpdate_Nofi).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in
|
guard let weakSelf = self else { return }
|
Services.startCourseHome().subscribe(onNext: {[weak self] data in
|
if let model = data.data{
|
if model.isThere == 1{
|
let courseInfoVC = CourseInfoVC()
|
courseInfoVC.startClouseHomeModel = model
|
let clouseNav = BaseNav(rootViewController: courseInfoVC)
|
clouseNav.tabBarItem = UITabBarItem(title: "玩湃运动营", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")!.withRenderingMode(.alwaysOriginal))
|
self?.tabBarController?.viewControllers![1] = clouseNav
|
}else {
|
if let vc = (self?.tabBarController?.viewControllers?[1] as? BaseNav)?.topViewController as? CourseVC{
|
vc.startClouseHomeModel = model
|
self?.viewDidLoad()
|
}
|
}
|
}
|
}).disposed(by: weakSelf.disposeBag)
|
}).disposed(by: disposeBag)
|
|
NotificationCenter.default.rx.notification(UpdateCurrentStore_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in
|
self?.getSelectDayData()
|
}) { error in
|
|
}.disposed(by: disposeBag)
|
}
|
|
private func updateData(){
|
if let m = startClouseHomeModel{
|
|
img_header.sd_setImage(with: URL(string: m.stuImg))
|
label_stu_name.text = m.stuName
|
img_gender.image = m.stuSex == .man ? UIImage(named: "icon_man") : UIImage(named: "icon_woman")
|
label_age.text = "/\(m.stuAge)岁"
|
|
label_stu_hei.attributedText = setAttribute(t1: "\(m.height)", t2: "cm")
|
label_stu_wei.attributedText = setAttribute(t1: "\(m.weight)", t2: "kg")
|
label_stu_BMI.attributedText = setAttribute(t1: m.bmi.jq_formatFloat, t2: m.bodyStatus)
|
|
if m.courseList.count > 0{
|
pageMenu.frame = CGRect(origin: .zero, size: CGSize(width: JQ_ScreenW - 100, height: 25))
|
pageMenu.delegate = self
|
view_menu.addSubview(pageMenu)
|
cons_menuHeight.constant = 25
|
pageMenu.setItems(m.courseList.map({$0.courseName}), selectedItemIndex: 0)
|
}
|
|
view_menu.addSubview(btn_dispatchCourse)
|
btn_dispatchCourse.snp.makeConstraints { make in
|
make.right.equalTo(-19)
|
make.centerY.equalToSuperview()
|
make.height.equalTo(25)
|
}
|
|
exerciseCollectionView.reloadData()
|
label_totalNums.text = "总课时数\( m.courseList.first?.totalNums ?? 0)"
|
label_deductedNums.text = "已扣课时数\( m.courseList.first?.deductedNums ?? 0)"
|
label_remainingNums.text = "剩余课时数\( m.courseList.first?.remainingNums ?? 0)"
|
|
exerciseCollectionView.isHidden = m.exerciseVideoList.isEmpty
|
view_exerciseTitle.isHidden = m.exerciseVideoList.isEmpty
|
// view_footer.isHidden = m.exerciseVideoList.isEmpty
|
|
Services.studMedalList(studentId: m.stuId).subscribe(onNext: {[weak self] data in
|
guard let weakSelf = self else { return }
|
if let models = data.data{
|
weakSelf.mentals = models
|
weakSelf.mentalCollectionView.reloadData()
|
let he = ceil(Double(models.count) / 3) * 91 + floor(Double(models.count) / 3) * 35
|
weakSelf.cons_mentalViewHei.constant = he
|
UIView.animate(withDuration: 0.3) {
|
weakSelf.view.layoutIfNeeded()
|
}
|
}
|
}).disposed(by: disposeBag)
|
|
Services.weeksOfGetHours().subscribe(onNext: {[weak self] data in
|
// self?.btn_dispatchCourse.isHidden = data.data == 0
|
self?.unDispatchNum = data.data
|
}) { error in
|
|
}.disposed(by: disposeBag)
|
getSelectDayData()
|
}
|
}
|
|
private func setAttribute(t1:String,t2:String)->NSMutableAttributedString{
|
let color:UIColor = UIColor(hexStr: "#2F5264")
|
let a1 = AttributedStringbuilder()
|
a1.add(string: t1, withFont: UIFont.systemFont(ofSize: 22), withColor: color)
|
.add(string: t2, withFont: UIFont.systemFont(ofSize: 12), withColor: color)
|
return a1.mutableAttributedString
|
}
|
|
override func viewDidLayoutSubviews() {
|
super.viewDidLayoutSubviews()
|
view_container.jq_addCorners(corner: [.topLeft,.topRight], radius: 42)
|
}
|
|
@objc func dispatchCourseAction(){
|
guard unDispatchNum != 0 else {
|
alert(msg: "没有未分配的课时");return
|
}
|
CourseUnAssignView.show(startClouseHomeModel?.courseList ?? [], num: unDispatchNum ?? 0)
|
}
|
|
@IBAction func addStudentAction(_ sender: QMUIButton) {
|
let vc = AddStudentVC(type: .course)
|
push(vc: vc)
|
}
|
|
@IBAction func exchangeAction(_ sender: UIButton) {
|
let vc = StudentExchangeVC()
|
push(vc: vc)
|
}
|
|
|
|
@IBAction func reportAction(_ sender: UIButton) {
|
guard startClouseHomeModel != nil else {return}
|
let vc = StudentReportVC(stuId: startClouseHomeModel!.stuId)
|
push(vc: vc)
|
}
|
|
|
@IBAction func detailAction(_ sender: UIButton) {
|
guard (startClouseHomeModel?.courseList.count ?? 0) > 0 else {return}
|
|
let index = pageMenu.selectedItemIndex
|
let models = startClouseHomeModel!.courseList
|
let studentModel = StudentSimpleProfileModel(stuId: startClouseHomeModel!.stuId, stuName: startClouseHomeModel!.stuName, stuImage: startClouseHomeModel!.stuImg)
|
let vc = StudentCourseDetailVC(models: models,defaultIndex: index,studentModel: studentModel)
|
push(vc: vc)
|
}
|
|
|
@IBAction func renewalAction(_ sender: UIButton) {
|
let index = pageMenu.selectedItemIndex
|
let models = startClouseHomeModel!.courseList
|
guard index < models.count else {return}
|
Services.queryCourseInfo(id: models[index].courseId).subscribe(onNext: {[weak self] data in
|
if let m = data.data{
|
let vc = CourseDetailApplyVC(detailModel: m,isExtend: true)
|
self?.push(vc: vc)
|
}
|
}).disposed(by: disposeBag)
|
}
|
|
@IBAction func bookingRecordAction(_ sender: UIButton) {
|
guard startClouseHomeModel != nil else {return}
|
let vc = CourseBookingListVC(student: startClouseHomeModel!)
|
push(vc: vc)
|
}
|
|
|
@IBAction func remarkAction(_ sender: UIButton) {
|
guard startClouseHomeModel != nil else {return}
|
let vc = StudentRemarkListVC(stuId: startClouseHomeModel!.stuId)
|
push(vc: vc)
|
}
|
|
|
@IBAction func forwardWeekAction(_ sender: UIButton) {
|
let forwardPage = pageViewController.currentPage - 1
|
pageViewController.scroll(toPage: forwardPage, animation: true)
|
}
|
|
@IBAction func nextWeekAction(_ sender: UIButton) {
|
let nextPage = pageViewController.currentPage + 1
|
pageViewController.scroll(toPage: nextPage, animation: true)
|
}
|
|
|
@IBAction func exerciseAction(_ sender: UITapGestureRecognizer) {
|
let vc = CourseExerciseSubListVC()
|
push(vc: vc)
|
}
|
|
private func getSelectDayData(){
|
if let model = startClouseHomeModel{
|
if let storeStr = UserDefaults.standard.object(forKey: "CurrentStore") as? String{
|
if let deserModel = HomeStoreModel.deserialize(from: storeStr){
|
Services.weeksOfCourseDetails(stuId: model.stuId, time: currentDate,storeId: deserModel.storeId).subscribe(onNext: {[weak self] data in
|
if let model = data.data{
|
self?.weeklyCourseModel = model
|
self?.cons_tableHei.constant = 58 + 72 * Double(model.data.count)
|
UIView.animate(withDuration: 0.3) {
|
self?.view.layoutIfNeeded()
|
self?.viewDidLayoutSubviews()
|
}
|
self?.tableView.reloadData()
|
}
|
}).disposed(by: disposeBag)
|
}
|
}
|
}
|
}
|
|
override var preferredStatusBarStyle: UIStatusBarStyle{
|
return .lightContent
|
}
|
|
// func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
// let offsetX = min(1,max(0,-(scrollView.contentOffset.y / 177.0)))
|
// leftBtn.alpha = offsetX
|
// }
|
|
@objc func localDetailAction(btn:UIButton){
|
let index = btn.tag - 10
|
if let model = weeklyCourseModel?.data[index]{
|
JQ_MapNavigationTool.startNav(CLLocationCoordinate2D(latitude: weeklyCourseModel!.lat, longitude: weeklyCourseModel!.lon), distanceName: weeklyCourseModel?.name ?? "未命名地址", scheme: "weparklife")
|
}
|
}
|
}
|
|
extension CourseInfoVC:UITableViewDelegate{
|
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
// let m = weeklyCourseModel?.data[indexPath.row]
|
let vc = SignUpCourseVC()
|
push(vc: vc)
|
}
|
}
|
|
extension CourseInfoVC:UITableViewDataSource{
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
let cell = tableView.dequeueReusableCell(withIdentifier: "_CourseBookingTCell") as! CourseBookingTCell
|
|
cell.view_corner.jq_addShadows(shadowColor: UIColor(hexStr: "#DADADA").withAlphaComponent(0.5), corner: 16, radius: 3.5, offset: CGSize(width: 0, height: 2), opacity: 1)
|
|
cell.weeklyCourseItemModel = weeklyCourseModel?.data[indexPath.row]
|
cell.clickClouse = {[weak self] m in
|
guard let weakSelf = self else { return }
|
if let stuId = weakSelf.startClouseHomeModel?.stuId{
|
//请假
|
if m.type == 1 && m.isType == 0{
|
CommonAlertView.show(title: "提示", content: "确认请假?") { status in
|
if status{
|
Services.startCourceRreverse(courseId: m.id, time: weakSelf.currentDate.jq_format("yyyy-MM-dd"), stuId: stuId).subscribe(onNext: {[weak self] data in
|
alertSuccess(msg: "请假成功")
|
self?.getSelectDayData()
|
|
}).disposed(by: weakSelf.disposeBag)
|
}
|
}
|
}
|
//购课
|
if m.type == 2{
|
let vc = ExperienceCourseVC(courseId: m.id)
|
weakSelf.push(vc: vc)
|
}
|
|
}
|
}
|
|
|
return cell
|
}
|
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
return weeklyCourseModel?.data.count ?? 0
|
}
|
|
func numberOfSections(in tableView: UITableView) -> Int {
|
return 1
|
}
|
|
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
return 72
|
}
|
|
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
|
if let m = weeklyCourseModel{
|
var headerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: "header")
|
if headerView == nil{
|
headerView = UITableViewHeaderFooterView(reuseIdentifier: "header")
|
|
let contentView = UIView()
|
contentView.borderColor = UIColor(hexStr: "#E7E3E3")
|
contentView.borderWidth = 1
|
contentView.cornerRadius = 11
|
headerView?.contentView.addSubview(contentView)
|
contentView.snp.makeConstraints { make in
|
make.center.equalToSuperview()
|
make.left.right.equalToSuperview()
|
make.height.equalTo(22)
|
}
|
|
let label_address = UILabel()
|
label_address.tag = 1000
|
label_address.text = "成都非遗玩湃全科体育公园 0.0km"
|
label_address.font = UIFont.systemFont(ofSize: 10, weight: .medium)
|
label_address.textColor = UIColor(hexStr: "#AFB4BC")
|
contentView.addSubview(label_address)
|
label_address.snp.makeConstraints { make in
|
make.left.equalToSuperview().offset(12)
|
make.centerY.equalToSuperview()
|
make.right.equalTo(-50)
|
}
|
|
let btn_detial = QMUIButton(type: .custom)
|
btn_detial.setTitle("位置详情", for: .normal)
|
btn_detial.tag = 10 + section
|
btn_detial.addTarget(self, action: #selector(localDetailAction(btn:)), for: .touchUpInside)
|
btn_detial.titleLabel?.font = UIFont.systemFont(ofSize: 10)
|
btn_detial.setTitleColor(UIColor(hexStr: "#AFB4BC"), for: .normal)
|
btn_detial.setImage(UIImage(named: "icon_pop"), for: .normal)
|
btn_detial.imagePosition = .left
|
btn_detial.spacingBetweenImageAndTitle = 3
|
contentView.addSubview(btn_detial)
|
btn_detial.snp.makeConstraints { make in
|
make.right.equalTo(-10)
|
make.centerY.equalToSuperview()
|
}
|
}
|
|
if let label = headerView?.contentView.viewWithTag(1000) as? UILabel{
|
label.text = String(format: "%@ %.1lfkm", m.name,m.distance)
|
}
|
|
headerView?.contentView.backgroundColor = .white
|
return headerView
|
}
|
return nil
|
}
|
|
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
|
return 58
|
}
|
}
|
|
|
extension CourseInfoVC:UICollectionViewDelegate{
|
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
|
if collectionView.tag == 1000{
|
guard let stuId = startClouseHomeModel?.stuId else { return }
|
let vc = StudentMentalListVC(stuId: stuId)
|
push(vc: vc)
|
}else{
|
let vc = CourseVideoDetailVC(id: 0)
|
vc.title = "课后练习"
|
push(vc: vc)
|
}
|
}
|
}
|
|
extension CourseInfoVC:UICollectionViewDataSource{
|
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
|
if collectionView.tag == 1000{
|
return mentals.count
|
}else{
|
return startClouseHomeModel?.exerciseVideoList.count ?? 0
|
}
|
}
|
|
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
if collectionView.tag == 1000{
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_StudentMedalCCell", for: indexPath) as! StudentMedalCCell
|
cell.img.image = mentals[indexPath.row].medalType.image
|
cell.t1.text = mentals[indexPath.row].medalType.title_en
|
cell.t2.text = mentals[indexPath.row].medalType.title
|
return cell
|
} else{
|
let model = startClouseHomeModel!.exerciseVideoList[indexPath.row]
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_StudentVideoCCell", for: indexPath) as! StudentVideoCCell
|
cell.videoListModel = model
|
return cell
|
}
|
}
|
}
|
|
extension CourseInfoVC:UICollectionViewDelegateFlowLayout{
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
|
if collectionView.tag == 1000{
|
return 30
|
}else {
|
return 12
|
}
|
}
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
|
if collectionView.tag == 1000{
|
return 30
|
}else {
|
return 0
|
}
|
}
|
|
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
if collectionView.tag == 1000{
|
let CellW = (JQ_ScreenW - 116 - 62 * 2) / 3
|
return CGSize(width: CellW, height: 91)
|
}else {
|
let CellW = (JQ_ScreenW - 44 - 13) / 2
|
return CGSize(width: CellW, height: 166)
|
}
|
}
|
}
|
|
extension CourseInfoVC:SPPageMenuDelegate{
|
func pageMenu(_ pageMenu: SPPageMenu, itemSelectedAt index: Int) {
|
guard startClouseHomeModel != nil else {return}
|
if let m = startClouseHomeModel?.courseList[index]{
|
label_totalNums.text = "总课时数\( m.totalNums)"
|
label_deductedNums.text = "已扣学时数\( m.deductedNums)"
|
label_remainingNums.text = "剩余学时数\( m.remainingNums)"
|
}
|
}
|
}
|
|
|
extension CourseInfoVC:FFPageViewControllerDelegate{
|
|
func pageViewController(_ pageViewController: FFPageViewController, currentPageChanged currentPage: Int) {
|
let vc = pageViewController.currentController as! CourseInfoScheduleVC
|
vc.currentSelectDate = currentDate
|
let first = vc.dates.first?.jq_format("yyyy.MM.dd")
|
let last = vc.dates.last?.jq_format("yyyy.MM.dd")
|
label_weeklyScope.text = "\(first ?? "")-\(last ?? "")"
|
}
|
|
func totalPagesOfpageViewController(_ pageViewConteoller: FFPageViewController) -> UInt {
|
return 11
|
}
|
|
func pageViewController(_ pageViewConteoller: FFPageViewController, controllerForPage page: Int) -> UIViewController {
|
let vc = CourseInfoScheduleVC(index: page) {[weak self] date in
|
self?.currentDate = date
|
self?.getSelectDayData()
|
}
|
return vc
|
}
|
}
|
|
public class CourseInfoScrollView:UIScrollView{
|
public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
for subView in subviews{
|
let p = subView.convert(point, to: self)
|
let hitTestView = subView.hitTest(p, with: event)
|
return hitTestView
|
}
|
return nil
|
}
|
}
|