| | |
| | | var weight: Int = 0 |
| | | var bodyStatus = "" |
| | | |
| | | func save(){ |
| | | UserDefaults.standard.set(self.toJSONString(), forKey: "StartClouseHomeModel") |
| | | UserDefaults.standard.synchronize() |
| | | } |
| | | |
| | | static func get()->StartClouseHomeModel?{ |
| | | if let string = UserDefaults.standard.string(forKey: "StartClouseHomeModel"){ |
| | | return StartClouseHomeModel.deserialize(from: string) |
| | | }else{ |
| | | return nil |
| | | } |
| | | |
| | | } |
| | | // func save(){ |
| | | // UserDefaults.standard.set(self.toJSONString(), forKey: "StartClouseHomeModel") |
| | | // UserDefaults.standard.synchronize() |
| | | // } |
| | | // |
| | | // static func get()->StartClouseHomeModel?{ |
| | | // if let string = UserDefaults.standard.string(forKey: "StartClouseHomeModel"){ |
| | | // return StartClouseHomeModel.deserialize(from: string) |
| | | // }else{ |
| | | // return nil |
| | | // } |
| | | // |
| | | // } |
| | | } |
| | | |
| | | struct StartClouseListModel:HandyJSON{ |
| | |
| | | var remainingNums = 0 |
| | | var totalNums = 0 |
| | | var periodOfValidity = "" |
| | | var isAble = 0 |
| | | var id = 0 |
| | | } |
| | | |
| | | struct StartClouseVideoListModel:HandyJSON { |
| | |
| | | .interface(url: "/account/api/startCource/queryStudentData") |
| | | .append(key: "lat", value: locationTool.currentLocation?.coordinate.latitude.string) |
| | | .append(key: "lon", value: locationTool.currentLocation?.coordinate.longitude.string) |
| | | .append(key: "stuId", value: StartClouseHomeModel.get()?.stuId) |
| | | .append(key: "stuId", value: UserDefaults.standard.value(forKey: "currentStuId") as? Int) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | |
| | | .interface(url: "/course/api/startCource/afterSourceList") |
| | | .append(key: "courseTypeId", value: courseTypeId) |
| | | .append(key: "search", value: search) |
| | | .append(key: "stuId", value: StartClouseHomeModel.get()?.stuId) |
| | | .append(key: "stuId", value: UserDefaults.standard.value(forKey: "currentStuId") as? Int) |
| | | return NetworkRequest.request(params: params, method: .post, progress: false) |
| | | } |
| | | |
| | |
| | | .append(key: "num", value: num) |
| | | .append(key: "oldCourseId", value: oldCourseId) |
| | | .append(key: "time", value: time.joined(separator: ",").replacingOccurrences(of: ".", with: "-")) |
| | | .append(key: "stuId", value: StartClouseHomeModel.get()?.stuId) |
| | | .append(key: "stuId", value: UserDefaults.standard.value(forKey: "currentStuId") as? Int) |
| | | return NetworkRequest.request(params: params, method: .post, progress: true) |
| | | } |
| | | |
| | |
| | | private var couponModels = [CouponInfoModel]() |
| | | private var selectCouponModel:CouponInfoModel? |
| | | private var classHours:Int? |
| | | private var signUpCourseModel:SignUpCourseItemModel? |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | |
| | | btn_handleBtn.setTitle("立即报名", for: .normal) |
| | | } |
| | | |
| | | |
| | | if signUpCourseModel?.payStatus == .unPayment{ |
| | | btn_handleBtn.setTitle("待支付", for: .normal) |
| | | btn_addStudent.isHidden = true |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | |
| | | btn_addStudent.spacingBetweenImageAndTitle = 3 |
| | | } |
| | | |
| | | init(detailModel:CourseDetailModel,isExtend:Bool = false,classHours:Int? = nil) { |
| | | init(detailModel:CourseDetailModel,isExtend:Bool = false,classHours:Int? = nil,signUpCourseModel:SignUpCourseItemModel? = nil) { |
| | | super.init(nibName: nil, bundle: nil) |
| | | self.detailModel = detailModel |
| | | self.isExtend = isExtend |
| | | self.classHours = classHours |
| | | self.signUpCourseModel = signUpCourseModel |
| | | } |
| | | |
| | | required init?(coder: NSCoder) { |
| | |
| | | Services.startCourseHome().subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | self?.startClouseHomeModel = model |
| | | model.save() |
| | | UserDefaults.standard.setValue(model.stuId, forKey: "currentStuId") |
| | | UserDefaults.standard.synchronize() |
| | | self?.updateData() |
| | | } |
| | | }).disposed(by: weakSelf.disposeBag) |
| | |
| | | guard let weakSelf = self else { return } |
| | | Services.startCourseHome().subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | model.save() |
| | | UserDefaults.standard.setValue(model.stuId, forKey: "currentStuId") |
| | | UserDefaults.standard.synchronize() |
| | | if model.isThere == 1{ |
| | | let courseInfoVC = CourseInfoVC() |
| | | courseInfoVC.startClouseHomeModel = model |
| | |
| | | Services.startCourseHome().subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | if model.isThere == 1{ |
| | | model.save() |
| | | UserDefaults.standard.setValue(model.stuId, forKey: "currentStuId") |
| | | UserDefaults.standard.synchronize() |
| | | let courseInfoVC = CourseInfoVC() |
| | | courseInfoVC.startClouseHomeModel = model |
| | | let clouseNav = BaseNav(rootViewController: courseInfoVC) |
| | |
| | | |
| | | extension SignUpCourseVC:UITableViewDelegate{ |
| | | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| | | let item = viewModel.dataSource.value[indexPath.row] |
| | | let item = viewModel.dataSource.value[indexPath.row] |
| | | Services.registeredData(coursePayId: item.coursePayId).subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | let vc = CourseDetailVC(id: item.coursePackageId,signUpCourseModel: m) |
| | | self.push(vc: vc) |
| | | } |
| | | |
| | | |
| | | }) { error in |
| | | |
| | | }.disposed(by: disposeBag) |
| | | |
| | | |
| | | /** |
| | | let item = viewModel.dataSource.value[indexPath.row] |
| | | Services.queryCourseInfo(id: item.coursePackageId).subscribe(onNext: { data in |
| | | if let m = data.data{ |
| | | let vc = CourseDetailApplyVC(detailModel: m,isExtend: item.payStatus.rawValue == 2) |
| | | let vc = CourseDetailApplyVC(detailModel: m,signUpCourseModel: item) |
| | | self.push(vc: vc) |
| | | } |
| | | }).disposed(by: self.disposeBag) |
| | | |
| | | */ |
| | | } |
| | | } |
| | | |
| | |
| | | @IBAction func changeAction(_ sender: UIButton) { |
| | | if let s = selectIndex{ |
| | | let id = viewModel.dataSource.value[s].stuId |
| | | UserDefaults.standard.setValue(id, forKey: "currentStuId") |
| | | UserDefaults.standard.synchronize() |
| | | Services.startCourseSwitch(id: id).subscribe(onNext: { data in |
| | | NotificationCenter.default.post(name: StudentUpdate_Nofi, object: nil) |
| | | self.navigationController?.popViewController() |
| | |
| | | let unassignView = CourseUnAssignView.jq_loadNibView() |
| | | unassignView.frame = sceneDelegate?.window?.frame ?? .zero |
| | | unassignView.label_num.text = "未分配课时数:\(num)" |
| | | unassignView.list = list |
| | | unassignView.list = list.filter({$0.isAble == 1}) |
| | | sceneDelegate?.window?.addSubview(unassignView) |
| | | UIView.animate(withDuration: 0.5) { |
| | | unassignView.view_container.transform = CGAffineTransform(scaleX: 1.0, y: 1.0) |
| | |
| | | } |
| | | |
| | | let m = list[selectIndex!] |
| | | Services.weeksOfAddHours(packetId: m.courseId).subscribe(onNext: { data in |
| | | Services.weeksOfAddHours(packetId: m.id).subscribe(onNext: { data in |
| | | UIView.animate(withDuration: 0.5) { |
| | | self.view_container.transform = CGAffineTransform(scaleX: 0.1, y: 0.1) |
| | | self.alpha = 0 |
| | |
| | | |
| | | Services.startCourseHome().subscribe(onNext: {[weak self] data in |
| | | if let model = data.data{ |
| | | model.save() |
| | | UserDefaults.standard.setValue(model.stuId, forKey: "currentStuId") |
| | | UserDefaults.standard.synchronize() |
| | | if model.isThere == 1{ |
| | | let courseInfoVC = CourseInfoVC() |
| | | courseInfoVC.startClouseHomeModel = model |