| | |
| | | guard authInputPhone() else {return} |
| | | guard authInputCode() else {return} |
| | | |
| | | guard btn_isRead.isEnabled else { |
| | | guard btn_isRead.isSelected else { |
| | | alert(msg: "请阅读并同意《隐私协议》《用户协议》");return |
| | | } |
| | | |
| | |
| | | var good: MarketModel? |
| | | var goodTypes = [MarketTypeModel]() |
| | | var orderNumber: String = "" |
| | | var residueNumber:Int? |
| | | var recipient: MarketRecipientModel? |
| | | } |
| | | |
| | |
| | | var totalIntegral = 0 |
| | | var type = 0 |
| | | var week = 0 |
| | | var canStudy = 0 |
| | | } |
| | | |
| | | class ListenNewModel:HandyJSON{ |
| | |
| | | self.page = page |
| | | self.listenNewModel = listenNewModel |
| | | } |
| | | |
| | | |
| | | required init?(coder: NSCoder) { |
| | | fatalError("init(coder:) has not been implemented") |
| | | } |
| | | |
| | | |
| | | override func viewDidLoad() { |
| | | super.viewDidLoad() |
| | | navigationItem.titleView = UIView() |
| | |
| | | NotificationCenter.default.post(name: NextLession_Noti, object: nil) |
| | | weakSelf.viewModel.answerType.accept(.none) |
| | | weakSelf.viewModel.selectIndex.accept(nil) |
| | | weakSelf.rootViewModel.answerItems[weakSelf.page] = weakSelf.listenNewModel.subjectList[weakSelf.page] |
| | | weakSelf.isListen = false |
| | | } |
| | | return |
| | |
| | | collectionView.reloadData() |
| | | } |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | let flowLayout = self.collectionView.collectionViewLayout as! UICollectionViewFlowLayout |
| | | let w = (self.collectionView.size.width - flowLayout.minimumLineSpacing) / 2 |
| | | let h = (self.collectionView.size.height - flowLayout.minimumInteritemSpacing) / 2 |
| | | |
| | | if flowLayout.itemSize.width != w || flowLayout.itemSize.height != h{ |
| | | flowLayout.itemSize = CGSize(width: w, height: h) |
| | | collectionView.reloadData() |
| | | } |
| | | } |
| | | |
| | | override func setRx() { |
| | | viewModel.selectIndex.subscribe(onNext: {[weak self] index in |
| | | guard let weakSelf = self else { return } |
| | |
| | | self?.isAnsterComplete = true |
| | | |
| | | VoicePlayer.share().playSuccessVoice() |
| | | |
| | | let teamId = weakSelf.listenNewModel.data?.id.components(separatedBy: ",")[weakSelf.page] |
| | | weakSelf.rootViewModel.insertCorrectAnswer(teamId: teamId, answerId: weakSelf.listenNewModel.subjectList[weakSelf.page][index.row].id) |
| | | |
| | | DispatchQueue.main.asyncAfter(deadline: .now()+2) { |
| | | VoicePlayer.share().playerAt(url: weakSelf.listenNewModel.subjectList[weakSelf.page][index.row].correct) |
| | | } |
| | |
| | | self?.answerSuccess(cell) |
| | | case .fail: |
| | | self?.viewModel.answerType.accept(.fail) |
| | | // self?.collectionView.isUserInteractionEnabled = false |
| | | self?.answerFail(errorSound: weakSelf.listenNewModel.subjectList[weakSelf.page][index.row].error) |
| | | self?.collectionView.reloadData() |
| | | default:break |
| | | } |
| | | } |
| | |
| | | }completion: { _ in |
| | | self.collectionView.reloadData() |
| | | } |
| | | } |
| | | |
| | | private func answerFail(errorSound:String?){ |
| | | self.collectionView.reloadData() |
| | | VoicePlayer.share().playerAt(url: errorSound) |
| | | } |
| | | } |
| | | |
| | |
| | | isListen = false |
| | | self.view.isUserInteractionEnabled = false |
| | | } |
| | | |
| | | |
| | | func playComplete() { |
| | | isListen = true |
| | | self.view.isUserInteractionEnabled = true |
| | |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | Services.onlineDuration().subscribe(onNext: { data in |
| | | if let time = data.data{ |
| | | sceneDelegate?.globalTimeval = time |
| | | sceneDelegate?.startTimer() |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | | |
| | | @IBAction func listenAction(_ sender: UIButton) { |
| | |
| | | image_state.alpha = 0 |
| | | image_state.transform = .init(scaleX: 0.1, y: 0.1) |
| | | label_title.isHidden = true |
| | | image_cover.contentMode = .scaleToFill |
| | | } |
| | | |
| | | func setState(state:Fight_lessonType){ |
| | |
| | | case none |
| | | } |
| | | |
| | | |
| | | //中途退出所需要 |
| | | class ExitLearnModel{ |
| | | var topicsIds = Set<Int>() |
| | | } |
| | | |
| | | class HomeListenFightViewModel{ |
| | | |
| | | /// 当前页数 |
| | |
| | | //所有回答的 |
| | | var answerItems = Dictionary<Int,Any>() //{page:0,data:String,currectAt:0} |
| | | var answerCount = BehaviorRelay<Int>(value: 1) |
| | | |
| | | var answerItems_1 = Dictionary<String,Set<Int>>() |
| | | |
| | | //回答正确的题 |
| | | func insertCorrectAnswer(teamId:String?,answerId:Int){ |
| | | guard teamId != nil else {return} |
| | | if answerItems_1[teamId!] == nil{ |
| | | answerItems_1[teamId!] = Set<Int>() |
| | | } |
| | | answerItems_1[teamId!]!.insert(answerId) |
| | | } |
| | | } |
| | | |
| | | class HomeListenFightVC: BaseVC { |
| | |
| | | switch viewModel.listenType.value { |
| | | case .lesson1,.lesson2,.lesson3,.lesson4,.lesson5: |
| | | let data = (data as! ListenNewModel).data |
| | | ids = data?.id ?? "" |
| | | toalIntegral = data?.integral ?? 0 |
| | | default:break |
| | | } |
| | |
| | | CommonAlertView.show(content: "未完成全部答题,确认退出吗?") {[weak self] () in |
| | | guard let weakSelf = self else { return } |
| | | |
| | | var temIds = [String]() |
| | | var topicIds = [String]() |
| | | for v in weakSelf.viewModel.answerItems.values{ |
| | | if let v = v as? Listen1Model{ |
| | | temIds.append("\(v.data?.id ?? 0)") |
| | | for sV in v.subjectList{ |
| | | topicIds.append("\(sV.id)") |
| | | } |
| | | } |
| | | } |
| | | let topicIds = weakSelf.viewModel.answerItems_1.keys.sorted() |
| | | let temIds = weakSelf.viewModel.answerItems_1.values.flatMap({$0}).map({"\($0)"}) |
| | | |
| | | switch weakSelf.viewModel.listenType.value{ |
| | | case .lesson1,.lesson2,.lesson3,.lesson4,.lesson5: |
| | | if temIds.count > 0 && topicIds.count > 0{ |
| | | Services.exitLearning(type:weakSelf.viewModel.listenType.value.rawValue,week: weakSelf.viewModel.week.value!, day: weakSelf.viewModel.day.value!, teamIds: temIds, topicIds: topicIds).subscribe(onNext: { data in |
| | | let totalNum = weakSelf.viewModel.correctNum + weakSelf.viewModel.errorNum |
| | | Services.exitLearning(type:weakSelf.viewModel.listenType.value.rawValue,week: weakSelf.viewModel.week.value!, day: weakSelf.viewModel.day.value!, teamIds: temIds, topicIds: topicIds,answerNumber: totalNum,correctNumber:weakSelf.viewModel.correctNum,studyTime:weakSelf.viewModel.times).subscribe(onNext: { data in |
| | | |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | let flowLayout = self.collectionView.collectionViewLayout as! UICollectionViewFlowLayout |
| | | let w = (self.collectionView.size.width - flowLayout.minimumLineSpacing) / 2 |
| | | let h = (self.collectionView.size.height - flowLayout.minimumInteritemSpacing) / 2 |
| | | |
| | | if flowLayout.itemSize.width != w || flowLayout.itemSize.height != h{ |
| | | flowLayout.itemSize = CGSize(width: w, height: h) |
| | | collectionView.reloadData() |
| | | } |
| | | } |
| | | |
| | | override func setUI() { |
| | | super.setUI() |
| | | |
| | |
| | | if handleView.vioceSoundUrl == weakSelf.listenNewModel.subjectList[weakSelf.page][row].correct{ |
| | | lessionType = .success |
| | | weakSelf.voicePlayer.playSuccessVoice() |
| | | // weakSelf.voicePlayer.playerInterrupt() |
| | | let teamId = weakSelf.listenNewModel.data?.id.components(separatedBy: ",")[weakSelf.page] |
| | | let answerId = weakSelf.listenNewModel.subjectList[weakSelf.page][row].id |
| | | weakSelf.rootViewModel.insertCorrectAnswer(teamId: teamId, answerId: answerId) |
| | | }else{ |
| | | lessionType = .fail |
| | | weakSelf.voicePlayer.playFailVoice() |
| | |
| | | playedIndex.removeAll() |
| | | let newRow = viewModel.selectIndex.value!.row+1 |
| | | if newRow >= listenNewModel.subjectList[page].count{ //防止坐标越界 |
| | | rootViewModel.answerItems[page] = listenNewModel.subjectList[page] |
| | | // rootViewModel.answerItems[page] = listenNewModel.subjectList[page] |
| | | NotificationCenter.default.post(name: NextLession_Noti, object: nil);return |
| | | } |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | let flowLayout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout |
| | | |
| | | let w = (collectionView.size.width - flowLayout.minimumLineSpacing) / 3.1 |
| | | let h = (collectionView.size.height - flowLayout.minimumInteritemSpacing) / 2 - 40 |
| | | if flowLayout.itemSize.width != w || flowLayout.itemSize.height != h{ |
| | | flowLayout.itemSize = CGSize(width: w, height: h) |
| | | collectionView.reloadData() |
| | | } |
| | | } |
| | | |
| | | private func setAnswerStackView(force:Bool = false){ |
| | | |
| | | |
| | |
| | | |
| | | @objc private func chooseAnswerAction(btn:UIButton){ |
| | | |
| | | guard viewModel.selectIndex != nil else {return} |
| | | guard viewModel.selectIndex.value != nil else {return} |
| | | |
| | | if !islisten{ |
| | | alertError(msg: "请先听题");return |
| | |
| | | } completion: { _ in |
| | | self.answterCount += 1 |
| | | self.voicePlayer.playerAt(url: self.listenNewModel.subjectList[self.page][valueIndex].correct) |
| | | |
| | | let teamId = self.listenNewModel.data?.id.components(separatedBy: ",")[self.page] |
| | | let answerId = self.listenNewModel.subjectList[self.page][valueIndex].id |
| | | self.rootViewModel.insertCorrectAnswer(teamId: teamId, answerId: answerId) |
| | | |
| | | DispatchQueue.main.asyncAfter(deadline: .now()+1.0) { |
| | | self.setAnswerStackView() |
| | | let v = self.rootViewModel.answerCount.value + 1 |
| | |
| | | |
| | | |
| | | if self.answterCount == 3{ |
| | | self.rootViewModel.answerItems[self.page] = self.listenNewModel.subjectList[self.page] |
| | | NotificationCenter.default.post(name: NextLession_Noti, object: nil) |
| | | return |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | let flowLayout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout |
| | | |
| | | let w = (collectionView.size.width - flowLayout.minimumLineSpacing) / 2 |
| | | let h = (collectionView.size.height - flowLayout.minimumInteritemSpacing) / 2.1 |
| | | |
| | | if flowLayout.itemSize.width != w || flowLayout.itemSize.height != h{ |
| | | flowLayout.itemSize = CGSize(width: w, height: h) |
| | | collectionView.reloadData() |
| | | } |
| | | } |
| | | |
| | | private func setAnswerStackView(){ |
| | | |
| | | guard let selectIndex = viewModel.selectIndex.value else{ |
| | |
| | | if tempSubV?.voiceUrl == answerModel?.correct{ |
| | | answerType = .success |
| | | voicePlayer.playSuccessVoice() |
| | | |
| | | let teamId = self.listenNewModel.data?.id.components(separatedBy: ",")[self.page] |
| | | let answerId = answerModel!.id |
| | | self.rootViewModel.insertCorrectAnswer(teamId: teamId, answerId: answerId) |
| | | |
| | | |
| | | DispatchQueue.main.asyncAfter(deadline: .now()+2) { |
| | | self.voicePlayer.playerAt(url: tempSubV!.voiceUrl) |
| | | } |
| | |
| | | if self.answerIndexs.count == 2{ |
| | | let v = self.rootViewModel.answerCount.value + 1 |
| | | self.rootViewModel.answerCount.accept(v) |
| | | self.rootViewModel.answerItems[self.page] = self.listenNewModel.subjectList[self.page] |
| | | // self.rootViewModel.answerItems[self.page] = self.listenNewModel.subjectList[self.page] |
| | | self.voicePlayer.playerEnd() |
| | | NotificationCenter.default.post(name: NextLession_Noti, object: nil) |
| | | self.voicePlayer.playerEnd() |
| | |
| | | setAnswerStackView() |
| | | } |
| | | |
| | | override func viewDidLayoutSubviews() { |
| | | super.viewDidLayoutSubviews() |
| | | let flowLayout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout |
| | | |
| | | let w = (collectionView.size.width - flowLayout.minimumLineSpacing) / 2 |
| | | let h = (collectionView.size.height - flowLayout.minimumInteritemSpacing) / 2.0 |
| | | |
| | | if flowLayout.itemSize.width != w || flowLayout.itemSize.height != h{ |
| | | flowLayout.itemSize = CGSize(width: w, height: h) |
| | | collectionView.reloadData() |
| | | } |
| | | } |
| | | |
| | | override func setRx() { |
| | | |
| | | } |
| | |
| | | if answer.id == selectAnswer.id{ |
| | | answerType = .success |
| | | voicePlayer.playSuccessVoice() |
| | | let teamId = listenNewModel.data?.id.components(separatedBy: ",")[page] |
| | | rootViewModel.insertCorrectAnswer(teamId: teamId, answerId: selectAnswer.id) |
| | | }else{ |
| | | answerType = .fail |
| | | voicePlayer.playFailVoice() |
| | |
| | | |
| | | DispatchQueue.main.asyncAfter(deadline: .now()+0.4) { |
| | | if self.answterCount >= 4{ |
| | | self.rootViewModel.answerItems[self.page] = self.listenNewModel.subjectList[self.page] |
| | | // self.rootViewModel.answerItems[self.page] = self.listenNewModel.subjectList[self.page] |
| | | self.voicePlayer.playerEnd() |
| | | NotificationCenter.default.post(name: NextLession_Noti, object: nil) |
| | | } |
| | |
| | | |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | let model = dataItems[selectIndexPath.row][indexPath.row] |
| | | |
| | | guard model.canStudy == 1 else { |
| | | CommonAlertView.show(isSinple: true, content: "请先完成上一周练习") |
| | | return |
| | | } |
| | | |
| | | Services.studySchedule(week: model.week).subscribe(onNext: {[weak self]data in |
| | | guard let weakSelf = self else { return } |
| | | if let model = data.data{ |
| | |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.separatorStyle = .none |
| | | tableView.showsVerticalScrollIndicator = false |
| | | tableView.showsHorizontalScrollIndicator = false |
| | | tableView.backgroundColor = Config.ThemeBGColor |
| | | tableView.register(UINib(nibName: "HomeListen_process_TCell", bundle: nil), forCellReuseIdentifier: "_HomeListen_process_TCell") |
| | | tableView.register(UINib(nibName: "HomeListen_item_TCell", bundle: nil), forCellReuseIdentifier: "_HomeListen_item_TCell") |
| | |
| | | override func setUI() { |
| | | super.setUI() |
| | | |
| | | //解决返回按钮区域过小,点击不灵敏 |
| | | title = " " |
| | | |
| | | let topMenuView = UIView() |
| | | topMenuView.backgroundColor = .white |
| | | topMenuView.jq_cornerRadius = 8 |
| | |
| | | let menuTypes = BehaviorRelay<[MarketTypeModel]>(value:[]) |
| | | var selectMenuTypes = Set<MarketTypeModel>(){ |
| | | didSet{ |
| | | types.accept(selectMenuTypes.map({$0.name})) |
| | | types.accept(selectMenuTypes.map({"\($0.id)"})) |
| | | beginRefresh() |
| | | } |
| | | } |
| | |
| | | </userDefinedRuntimeAttributes> |
| | | </view> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="82B-Dg-Sap"> |
| | | <rect key="frame" x="946" y="102" width="13" height="29"/> |
| | | <rect key="frame" x="940" y="98" width="19" height="44"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="29" id="wW2-Vh-riV"/> |
| | | <constraint firstAttribute="height" constant="44" id="yC7-fJ-c6s"/> |
| | | </constraints> |
| | | <fontDescription key="fontDescription" name="Impact" family="Impact" pointSize="24"/> |
| | | <fontDescription key="fontDescription" name="Impact" family="Impact" pointSize="36"/> |
| | | <color key="textColor" red="0.99607843139999996" green="0.14117647059999999" blue="0.050980392159999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="剩余积分:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A9t-n3-Bmf"> |
| | | <rect key="frame" x="867" y="105.5" width="74" height="22"/> |
| | | <rect key="frame" x="861" y="109" width="74" height="22"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="22" id="YFs-Uk-JaX"/> |
| | | </constraints> |
| | |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商品分类:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jg0-dG-OCI"> |
| | | <rect key="frame" x="65" y="105.5" width="74" height="22"/> |
| | | <rect key="frame" x="65" y="109" width="74" height="22"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="22" id="tki-uv-Hgf"/> |
| | | </constraints> |
| | |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="OCn-Jg-gWg"> |
| | | <rect key="frame" x="152" y="96" width="705" height="41"/> |
| | | <rect key="frame" x="152" y="99.5" width="699" height="41"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="41" id="A5O-nk-89N"/> |
| | | </constraints> |
| | |
| | | </collectionViewFlowLayout> |
| | | </collectionView> |
| | | <collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="EPp-Vf-S4a"> |
| | | <rect key="frame" x="0.0" y="159" width="1024" height="1207"/> |
| | | <rect key="frame" x="0.0" y="162.5" width="1024" height="1203.5"/> |
| | | <color key="backgroundColor" systemColor="systemBackgroundColor"/> |
| | | <collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="YMW-eo-TCY"> |
| | | <size key="itemSize" width="128" height="128"/> |
| | |
| | | <constraint firstItem="82B-Dg-Sap" firstAttribute="trailing" secondItem="Unb-0E-8fJ" secondAttribute="trailing" id="04D-Ur-Vzd"/> |
| | | <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Unb-0E-8fJ" secondAttribute="trailing" constant="65" id="9yv-3Y-78Y"/> |
| | | <constraint firstItem="Unb-0E-8fJ" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" constant="65" id="O97-uk-THq"/> |
| | | <constraint firstItem="82B-Dg-Sap" firstAttribute="top" secondItem="Unb-0E-8fJ" secondAttribute="bottom" constant="28" id="OiX-TJ-i3e"/> |
| | | <constraint firstItem="82B-Dg-Sap" firstAttribute="top" secondItem="Unb-0E-8fJ" secondAttribute="bottom" constant="24" id="OiX-TJ-i3e"/> |
| | | <constraint firstItem="A9t-n3-Bmf" firstAttribute="leading" secondItem="OCn-Jg-gWg" secondAttribute="trailing" constant="10" id="Q2g-q0-rku"/> |
| | | <constraint firstItem="OCn-Jg-gWg" firstAttribute="leading" secondItem="Jg0-dG-OCI" secondAttribute="trailing" constant="13" id="Rup-A4-pfm"/> |
| | | <constraint firstItem="82B-Dg-Sap" firstAttribute="centerY" secondItem="A9t-n3-Bmf" secondAttribute="centerY" id="bHH-o4-cLV"/> |
| | |
| | | |
| | | var info_Array = Array<String>() |
| | | |
| | | if m.good?.surplus != nil{ |
| | | info_Array.append("剩余数量:\(m.good?.surplus ?? 0)") |
| | | if m.residueNumber != nil{ |
| | | info_Array.append("剩余数量:\(m.residueNumber ?? 0)") |
| | | } |
| | | |
| | | if m.good?.userCount != nil{ |
| | |
| | | @IBAction func exchangeAction(_ sender: UIButton) { |
| | | |
| | | |
| | | guard viewModel.detailModel.value?.good?.surplus != 0 else { |
| | | guard viewModel.detailModel.value?.residueNumber != 0 else { |
| | | CommonAlertView.show(isSinple: true, content: "兑换失败,当前剩余数量不足!") { |
| | | |
| | | } |
| | |
| | | if viewModel.address.value.count == 0{ |
| | | let vc = AddressManageVC(type: .handle) |
| | | vc.title = "地址管理" |
| | | vc.chooseAddress {[weak self] m in |
| | | self?.label_address.text = m.address |
| | | self?.label_address_info.text = m.recipient + "|" + m.recipientPhone |
| | | self?.recipientId = m.id |
| | | self?.label_address_info.isHidden = false |
| | | } |
| | | push(vc: vc) |
| | | return |
| | | } |
| | | |
| | | let vc = AddressManageVC(type: .choose) |
| | | let vc = AddressManageVC(type: .handle) |
| | | vc.title = "地址管理" |
| | | vc.chooseAddress {[weak self] m in |
| | | self?.label_address.text = m.address |
| | |
| | | |
| | | guard recipientId != nil else{ |
| | | CommonAlertView.show(content: "请先选择收货地址") { |
| | | let vc = AddressManageVC(type: .choose) |
| | | let vc = AddressManageVC(type: .handle) |
| | | vc.title = "地址管理" |
| | | vc.chooseAddress {[weak self] m in |
| | | self?.label_address.text = m.address |
| | |
| | | </constraints> |
| | | </view> |
| | | <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_more_gray" translatesAutoresizingMaskIntoConstraints="NO" id="jKh-8m-ogE"> |
| | | <rect key="frame" x="536" y="40" width="6" height="10"/> |
| | | <rect key="frame" x="530" y="40" width="12" height="10"/> |
| | | <constraints> |
| | | <constraint firstAttribute="width" constant="12" id="0Vb-aw-7BH"/> |
| | | </constraints> |
| | | </imageView> |
| | | <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="ZAd-Ha-PgP"> |
| | | <rect key="frame" x="14" y="25.5" width="36" height="39.5"/> |
| | | <stackView opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" axis="vertical" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="ZAd-Ha-PgP"> |
| | | <rect key="frame" x="14" y="25.5" width="502" height="39.5"/> |
| | | <subviews> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ph9-Ra-CxP"> |
| | | <rect key="frame" x="0.0" y="0.0" width="36" height="20"/> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ph9-Ra-CxP"> |
| | | <rect key="frame" x="0.0" y="0.0" width="502" height="20"/> |
| | | <constraints> |
| | | <constraint firstAttribute="height" constant="20" id="cgw-w2-dsN"/> |
| | | <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="cgw-w2-dsN"/> |
| | | </constraints> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> |
| | | <color key="textColor" red="0.011764705882352941" green="0.015686274509803921" blue="0.019607843137254902" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
| | | <nil key="highlightedColor"/> |
| | | </label> |
| | | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hns-QV-baw"> |
| | | <rect key="frame" x="0.0" y="25" width="36" height="14.5"/> |
| | | <rect key="frame" x="0.0" y="25" width="502" height="14.5"/> |
| | | <fontDescription key="fontDescription" type="system" pointSize="12"/> |
| | | <nil key="textColor"/> |
| | | <nil key="highlightedColor"/> |
| | |
| | | <constraint firstItem="5h7-8X-cXI" firstAttribute="leading" secondItem="sfn-3Q-b7V" secondAttribute="leading" id="g86-ED-gAW"/> |
| | | <constraint firstAttribute="trailing" secondItem="jKh-8m-ogE" secondAttribute="trailing" constant="14" id="on7-ez-QYT"/> |
| | | <constraint firstItem="ZAd-Ha-PgP" firstAttribute="centerY" secondItem="sfn-3Q-b7V" secondAttribute="centerY" id="qhc-bm-AqF"/> |
| | | <constraint firstItem="jKh-8m-ogE" firstAttribute="leading" secondItem="ZAd-Ha-PgP" secondAttribute="trailing" constant="14" id="rNk-IQ-9WA"/> |
| | | </constraints> |
| | | <connections> |
| | | <action selector="addressAction:" destination="-1" eventType="touchUpInside" id="fj4-mV-Wor"/> |
| | |
| | | } |
| | | |
| | | @IBAction func handleAction(_ sender: UIButton) { |
| | | let vc = AddressManageVC(type: .choose) |
| | | let vc = AddressManageVC(type: .handle) |
| | | vc.title = "修改地址" |
| | | vc.chooseAddress { m in |
| | | CommonAlertView.show(content: "确认修改当前收货地址吗?") {[weak self] () in |
| | |
| | | <rect key="frame" x="90.5" y="0.0" width="778.5" height="54"/> |
| | | <fontDescription key="fontDescription" type="system" weight="medium" pointSize="14"/> |
| | | <textInputTraits key="textInputTraits"/> |
| | | <userDefinedRuntimeAttributes> |
| | | <userDefinedRuntimeAttribute type="number" keyPath="maximumTextLength"> |
| | | <integer key="value" value="11"/> |
| | | </userDefinedRuntimeAttribute> |
| | | </userDefinedRuntimeAttributes> |
| | | </textField> |
| | | <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1bK-P9-OGL"> |
| | | <rect key="frame" x="0.0" y="53.5" width="888" height="0.5"/> |
| | |
| | | } |
| | | |
| | | |
| | | tableView = UITableView(frame: .zero, style: .plain) |
| | | tableView = UITableView(frame: .zero, style: .grouped) |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.backgroundColor = .clear |
| | |
| | | |
| | | extension AddressManageVC:UITableViewDelegate{ |
| | | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| | | if addressManageType == .choose{ |
| | | let model = viewModel.dataSource.value[indexPath.row] |
| | | clouse?(model) |
| | | self.navigationController?.popViewController() |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | view_menuTitle.jq_addCorners(corner: [.topLeft,.topRight], radius: 20) |
| | | tableView.delegate = self |
| | | tableView.dataSource = self |
| | | tableView.showsVerticalScrollIndicator = false |
| | | tableView.showsHorizontalScrollIndicator = false |
| | | tableView.register(UINib(nibName: "Home_1_TCell", bundle: nil), forCellReuseIdentifier: "_Home_1_TCell") |
| | | tableView.separatorStyle = .none |
| | | } |
| | |
| | | @IBAction func chooseDateTimeAction(_ sender: UIButton) { |
| | | let year = viewModel.selectDate.value?.jq_nowYear() ?? Date().jq_nowYear() |
| | | let month = viewModel.selectDate.value?.jq_nowMonth() ?? Date().jq_nowMonth() |
| | | BitrhdayPickerView.show(title: "查询时间", type: .YM, defaultYear: year, defaultMonth: month, defaultDay: 0, minYear: 0) {[weak self] date in |
| | | BitrhdayPickerView.show(title: "查询时间", type: .YM, defaultYear: year, defaultMonth: month, defaultDay: 0, minYear: 2021) {[weak self] date in |
| | | self?.viewModel.selectDate.accept(date) |
| | | self?.viewModel.beginRefresh() |
| | | } |
| | |
| | | @IBOutlet weak var btn_close: UIButton! |
| | | @IBOutlet weak var cons_btnClose: NSLayoutConstraint! |
| | | |
| | | private var clouse:(()->Void)! |
| | | private var clouse:(()->Void)? |
| | | override func awakeFromNib() { |
| | | super.awakeFromNib() |
| | | self.alpha = 0 |
| | |
| | | layoutIfNeeded() |
| | | } |
| | | |
| | | static func show(isSinple:Bool = false, content:String,clouse:@escaping ()->Void){ |
| | | static func show(isSinple:Bool = false, content:String,clouse:( ()->Void)? = nil){ |
| | | let commonAlertView = CommonAlertView.jq_loadNibView() |
| | | sceneDelegate?.window?.addSubview(commonAlertView) |
| | | commonAlertView.label_content.text = content |
| | |
| | | self.view_container.transform = .init(scaleX: 0.1, y: 0.1) |
| | | } completion: { _ in |
| | | self.removeFromSuperview() |
| | | self.clouse() |
| | | self.clouse?() |
| | | } |
| | | } |
| | | } |
| | |
| | | class SceneDelegate: UIResponder, UIWindowSceneDelegate { |
| | | |
| | | var window: UIWindow? |
| | | var globalTimeval:Int? |
| | | var timer:Timer? |
| | | private var disposeBag = JQ_disposeBag |
| | | |
| | | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { |
| | | guard let windowScene = (scene as? UIWindowScene) else { return } |
| | | |
| | | UserDefaults.standard.set(Date().timeIntervalSince1970, forKey: "scheduledTimer") |
| | | window = UIWindow(windowScene: windowScene) |
| | | window?.frame = windowScene.coordinateSpace.bounds |
| | | if #available(iOS 13.0, *) { |
| | |
| | | SVProgressHUD.setMaximumDismissTimeInterval(1.5) |
| | | SVProgressHUD.setDefaultMaskType(.custom) |
| | | |
| | | guard let tokenModel = LoginTokenModel.getToken(),!LoginTokenModel.isOverdue() else { |
| | | needLogin() |
| | | return |
| | | guard !LoginTokenModel.isOverdue() else { |
| | | needLogin();return |
| | | } |
| | | loginSuccess() |
| | | |
| | |
| | | LoginTokenModel.clearToken() |
| | | |
| | | } |
| | | |
| | | func startTimer(){ |
| | | guard let timeval = globalTimeval else {return} |
| | | timer = Timer.scheduledTimer(withTimeInterval: 60, repeats: true) {[weak self] timer in |
| | | guard let weakSelf = self else { return } |
| | | if let v = UserDefaults.standard.object(forKey: "scheduledTimer") as? TimeInterval{ |
| | | if Date().timeIntervalSince1970 - v > Double(timeval) * 60.0{ |
| | | Services.giveIntegral().subscribe(onNext: { _ in |
| | | |
| | | }).disposed(by: weakSelf.disposeBag) |
| | | UserDefaults.standard.set(Date().timeIntervalSince1970, forKey: "scheduledTimer") |
| | | UserDefaults.standard.synchronize() |
| | | } |
| | | } |
| | | } |
| | | timer?.fire() |
| | | RunLoop.current.add(timer!, forMode: .common) |
| | | } |
| | | } |
| | | |
| | |
| | | case 504: //登录设备最大限制 |
| | | break |
| | | case 503: //登录被冻结 |
| | | DispatchQueue.main.async { |
| | | alert(msg: next.msg) |
| | | } |
| | | CommonAlertView.show(isSinple: true, content: next.msg) |
| | | // case 501: |
| | | // CommonAlertView.show(title: "提示", content: next.msg,isSingle: true) { _ in |
| | | // |
| | |
| | | return NetworkRequest.request(params: params, method: .post,encoding: JSONEncoding.default, progress: true) |
| | | } |
| | | |
| | | class func exitLearning(type:Int,week:Int,day:Int,teamIds:[String],topicIds:[String])->Observable<BaseResponse<SimpleModel>>{ |
| | | class func exitLearning(type:Int,week:Int,day:Int,teamIds:[String],topicIds:[String],answerNumber:Int,correctNumber:Int,studyTime:Int)->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/study/base/study/exitLearning") |
| | | .append(key: "week", value: week) |
| | |
| | | .append(key: "teamIds", value: teamIds.joined(separator: ",")) |
| | | .append(key: "topicIds", value: topicIds.joined(separator: ",")) |
| | | .append(key: "type", value: type) |
| | | .append(key: "answerNumber", value: answerNumber) |
| | | .append(key: "correctNumber", value: correctNumber) |
| | | .append(key: "studyTime", value: studyTime) |
| | | return NetworkRequest.request(params: params, method: .post,encoding: JSONEncoding.default, progress: true) |
| | | } |
| | | |
| | |
| | | .append(key: "recipientId", value: recipientId) |
| | | return NetworkRequest.request(params: params, method: .get, progress: true) |
| | | } |
| | | |
| | | class func onlineDuration()->Observable<BaseResponse<Int>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/study/base/study/onlineDuration") |
| | | return NetworkRequest.request(params: params, method: .get, progress: false) |
| | | } |
| | | |
| | | class func giveIntegral()->Observable<BaseResponse<SimpleModel>>{ |
| | | let params = ParamsAppender.build(url: All_Url) |
| | | params.interface(url: "/study/base/study/giveIntegral") |
| | | return NetworkRequest.request(params: params, method: .get, progress: false) |
| | | } |
| | | } |
| | | |
| | | extension Services{ |