From a4a30347df295a77657a4b87ee3293ef38ece503 Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期四, 04 七月 2024 14:09:56 +0800 Subject: [PATCH] fix bug --- DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.swift | 5 DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift | 105 ++++++++--- DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift | 6 DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift | 16 - DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.swift | 12 DolphinEnglishLearnStudent/Moudle/Me/MeVC.xib | 13 + DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift | 20 + DolphinEnglishLearnStudent/Moudle/Market/VC/MarketExchangeVC.swift | 16 + DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift | 29 +++ DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_5_VC.swift | 4 DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift | 18 + DolphinEnglishLearnStudent/Services/Services.swift | 17 + DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.swift | 22 + DolphinEnglishLearnStudent/Moudle/Market/VC/MarketContentVC.swift | 11 DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.swift | 2 DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift | 22 + DolphinEnglishLearnStudent/Moudle/Me/MeVC.swift | 6 DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift | 12 + DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift | 2 DolphinEnglishLearnStudent/Models/CommonModel.swift | 9 + DolphinEnglishLearnStudent/Moudle/Me/View/ShareView.swift | 38 +-- DolphinEnglishLearnStudent.xcodeproj/project.pbxproj | 1 DolphinEnglishLearnStudent/Moudle/Home/HomeListenFight_lesson_1_VC.swift | 40 +++- DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.xib | 21 +- DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.xib | 58 +++--- 25 files changed, 349 insertions(+), 156 deletions(-) diff --git a/DolphinEnglishLearnStudent.xcodeproj/project.pbxproj b/DolphinEnglishLearnStudent.xcodeproj/project.pbxproj index 55c8a9c..eef1d82 100644 --- a/DolphinEnglishLearnStudent.xcodeproj/project.pbxproj +++ b/DolphinEnglishLearnStudent.xcodeproj/project.pbxproj @@ -993,6 +993,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = ""; "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 5ZV937VB25; ENABLE_USER_SCRIPT_SANDBOXING = NO; diff --git a/DolphinEnglishLearnStudent/Models/CommonModel.swift b/DolphinEnglishLearnStudent/Models/CommonModel.swift index 195a981..b4ed463 100644 --- a/DolphinEnglishLearnStudent/Models/CommonModel.swift +++ b/DolphinEnglishLearnStudent/Models/CommonModel.swift @@ -268,6 +268,15 @@ required init(){} } + +struct TeamScheduleModel:HandyJSON{ + var answerNumber = 0 + var correctNumber = 0 + var teamIds = [Int]() //题组ids + var topicIds = [Int]() //已回答正确的题目Id +} + + struct Listen1DataModel:HandyJSON{ var createBy: String = "" var createTime: String = "" diff --git a/DolphinEnglishLearnStudent/Moudle/Home/HomeListenFight_lesson_1_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/HomeListenFight_lesson_1_VC.swift index 363892a..e4dcb20 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/HomeListenFight_lesson_1_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/HomeListenFight_lesson_1_VC.swift @@ -21,7 +21,6 @@ private var listenNewModel:ListenNewModel! private var randomElement:Listen1SubModel? private var page:Int! - var rootViewModel:HomeListenFightViewModel! private var isListen:Bool = false private var isAnsterComplete:Bool = false //是否已经回答完成[小题] private var isAnsterDone:Bool = false //是否已经回答完成[大题] @@ -42,6 +41,20 @@ return collection }() + var rootViewModel:HomeListenFightViewModel! + var teamScheduleModel:TeamScheduleModel?{ + didSet{ + if let m = teamScheduleModel{ + for v in listenNewModel.subjectList[page]{ + //已回答 + if m.topicIds.contains(v.id){ + isAnsterModel.insert(v) //记录 + } + } + } + } + } + required init(page:Int,listenNewModel:ListenNewModel){ super.init(nibName: nil, bundle: nil) self.page = page @@ -60,7 +73,7 @@ //制造随机 listenNewModel.subjectList[page].shuffle() - getNextAnswer() + getNextAnswer(isFirst: true) menuView?.listenType = .lesson1 DispatchQueue.main.asyncAfter(deadline: .now()+2) { @@ -91,16 +104,14 @@ menuView?.resetView() setUI() collectionView.reloadData() + getNextAnswer(isFirst: true) } - - private func getNextAnswer(){ + + /// 下一题 + /// - Parameter isFirst: 是否首次进入,首次页码不+1 + private func getNextAnswer(isFirst:Bool = false){ isListen = false if isAnsterModel.count == 4{ - if !isAnsterDone{ - let v = rootViewModel.answerCount.value - rootViewModel.answerCount.accept(v + 1) - } - isAnsterDone = true DispatchQueue.main.asyncAfter(deadline: .now()+3){[weak self] in guard let weakSelf = self else { return } @@ -108,6 +119,8 @@ weakSelf.viewModel.answerType.accept(.none) weakSelf.viewModel.selectIndex.accept(nil) weakSelf.isListen = false + let v = weakSelf.rootViewModel.answerCount.value + weakSelf.rootViewModel.answerCount.accept(v + 1) } return } @@ -131,6 +144,11 @@ DispatchQueue.main.asyncAfter(deadline: .now()+2) { VoicePlayer.share().playerAt(url: self.randomElement?.correct) self.menuView?.playing() + } + + if !isAnsterDone && isAnsterModel.count <= 4 && !isFirst{ + let v = rootViewModel.answerCount.value + rootViewModel.answerCount.accept(v + 1) } } @@ -289,10 +307,6 @@ if isAnsterComplete{ getNextAnswer() - if !isAnsterDone{ - let v = rootViewModel.answerCount.value - rootViewModel.answerCount.accept(v + 1) - } } } } diff --git a/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift b/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift index 358648b..1d5d432 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift @@ -41,15 +41,23 @@ @IBAction func listenAction(_ sender: UIButton) { Services.goodRecommend().subscribe(onNext: { data in - AwardListView.show(items: data.data ?? []) { _ in - let listenMenuVC = HomeListenMenuVC() - listenMenuVC.title = "第一年学习周目选择" - self.push(vc: listenMenuVC) - }closeClouse: { () in + if (data.data?.count ?? 0) > 0{ + AwardListView.show(items: data.data ?? []) { _ in + // not todo + }closeClouse: { () in + let listenMenuVC = HomeListenMenuVC() + listenMenuVC.title = "第一年学习周目选择" + self.push(vc: listenMenuVC) + } + }else{ let listenMenuVC = HomeListenMenuVC() listenMenuVC.title = "第一年学习周目选择" self.push(vc: listenMenuVC) } + },onError: { error in + let listenMenuVC = HomeListenMenuVC() + listenMenuVC.title = "第一年学习周目选择" + self.push(vc: listenMenuVC) }).disposed(by: disposeBag) diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift index c6a1293..6986a3e 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift @@ -65,10 +65,6 @@ contentVoiceView.jq_cornerRadius = 8 voice_view.addSubview(contentVoiceView) contentVoiceView.snp.makeConstraints { make in -// make.left.equalTo(40) -// make.right.equalTo(-40) -// make.top.equalTo(55) -// make.bottom.equalTo(-55) make.center.equalToSuperview() make.width.equalTo(self.width * 0.66) make.height.equalTo(self.height * 0.32) @@ -76,7 +72,7 @@ contentVoiceView.addSubview(img1) img1.snp.makeConstraints { make in - make.left.equalTo(23) + make.left.equalTo(self.width * 0.0958) make.width.height.equalTo(self.width * 0.133) make.centerY.equalToSuperview() } @@ -84,8 +80,8 @@ contentVoiceView.addSubview(img2) img2.snp.makeConstraints { make in - make.width.equalTo(45) - make.height.equalTo(31) + make.width.equalTo(self.width * 0.1875) + make.height.equalTo(self.width * 0.1292) make.center.equalToSuperview() } @@ -93,15 +89,15 @@ playBtn.setImage(UIImage(named: "icon_play")?.withTintColor(UIColor(hexString: "#41A2EB")!), for: .normal) contentVoiceView.addSubview(playBtn) playBtn.snp.makeConstraints { make in - make.right.equalTo(-23) - make.width.height.equalTo(32) + make.right.equalTo(-self.width * 0.0958) + make.width.height.equalTo(self.width * 0.133) make.centerY.equalToSuperview() } addSubview(stateImg) stateImg.snp.makeConstraints { make in make.center.equalToSuperview() - make.width.height.equalTo(76) + make.width.height.equalTo(self.width * 0.316) } cellResotePay() diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.swift index 9d5ac26..248b2d3 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_1_CCell.swift @@ -36,6 +36,10 @@ self.image_state.alpha = 1 self.image_state.transform = .init(scaleX: 1, y: 1) } + UIView.animate(withDuration: 0.5, delay: 3.0) { + self.image_state.alpha = 0 + self.image_state.transform = .init(scaleX: 0.1, y: 0.1) + } case .fail: image_state.image = UIImage(named: "icon_fail") UIView.animate(withDuration: 0.6, delay: 0, usingSpringWithDamping: 0.3, initialSpringVelocity: 0.4, options: .layoutSubviews) { @@ -43,6 +47,7 @@ self.image_state.transform = .init(scaleX: 1, y: 1) UIView.animate(withDuration: 0.5, delay: 3.0) { self.image_state.alpha = 0 + self.image_state.transform = .init(scaleX: 0.1, y: 0.1) } } case .none: diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.swift index db5274d..b7e82b6 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.swift @@ -9,7 +9,7 @@ class ListenFight_lesson_4_CCell: UICollectionViewCell { - @IBOutlet weak var view_handle: UIView! + @IBOutlet weak var view_handle: TapBtn! @IBOutlet weak var img_cover: UIImageView! @IBOutlet weak var view_container: UIView! @IBOutlet weak var img_state: UIImageView! @@ -33,17 +33,25 @@ func playAtIndex(clouse:@escaping(IndexPath)->Void){ self.playAtIndexClouse = clouse - } - @IBAction func playAction(_ sender: UIButton) { + func playing(){ + btn_handle.isHidden = true + btn_play.isHidden = true + btn_voice.setImage(UIImage(named: "icon_playing"), for: .normal) + } + + func playEnd(){ + btn_handle.isHidden = false + btn_play.isHidden = false + btn_voice.setImage(UIImage(named: "icon_play_1"), for: .normal) + } + + @IBAction func playAction(_ sender: TapBtn) { if let m = model{ -// btn_play.isHidden = true VoicePlayer.share().playerAt(url: m.correct) playAtIndexClouse?(indexPath) -// VoicePlayer.share().playEnd { -// self.btn_play.isHidden = false -// } + playing() } } } diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.xib b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.xib index 5b29d0c..f63ba29 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.xib +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_lesson_4_CCell.xib @@ -18,24 +18,21 @@ <rect key="frame" x="0.0" y="0.0" width="597" height="510"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <subviews> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xjz-V8-keG"> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Xjz-V8-keG" customClass="TapBtn" customModule="DolphinEnglishLearnStudent" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="159" height="52"/> <subviews> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LLy-9v-eQJ"> - <rect key="frame" x="104" y="10" width="32" height="32"/> + <button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="LLy-9v-eQJ"> + <rect key="frame" x="105" y="10" width="31" height="32"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" image="icon_play"/> - <connections> - <action selector="playAction:" destination="gTV-IL-0wX" eventType="touchUpInside" id="FV8-uE-yj8"/> - </connections> </button> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kgj-Ss-D90"> - <rect key="frame" x="65" y="12.5" width="27" height="27"/> + <button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kgj-Ss-D90"> + <rect key="frame" x="66" y="12.5" width="27" height="27"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" image="icon_play_1"/> </button> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZuK-r9-26C"> - <rect key="frame" x="14" y="9.5" width="33" height="33"/> + <button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZuK-r9-26C"> + <rect key="frame" x="15" y="9.5" width="33" height="33"/> <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> <state key="normal" image="icon_question"/> </button> @@ -49,6 +46,7 @@ <constraint firstItem="LLy-9v-eQJ" firstAttribute="leading" secondItem="kgj-Ss-D90" secondAttribute="trailing" constant="12" id="MoJ-Ne-mlq"/> <constraint firstAttribute="height" constant="52" id="gfp-ph-1NP"/> <constraint firstItem="kgj-Ss-D90" firstAttribute="leading" secondItem="ZuK-r9-26C" secondAttribute="trailing" constant="18" id="qM1-Yp-Nha"/> + <constraint firstItem="kgj-Ss-D90" firstAttribute="centerX" secondItem="Xjz-V8-keG" secondAttribute="centerX" id="x1s-RS-WOb"/> <constraint firstItem="kgj-Ss-D90" firstAttribute="centerY" secondItem="Xjz-V8-keG" secondAttribute="centerY" id="zxl-IP-PhN"/> </constraints> <userDefinedRuntimeAttributes> @@ -57,6 +55,9 @@ <real key="value" value="8"/> </userDefinedRuntimeAttribute> </userDefinedRuntimeAttributes> + <connections> + <action selector="playAction:" destination="gTV-IL-0wX" eventType="touchUpInside" id="8ns-md-QJB"/> + </connections> </view> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="OJ6-0b-fVC"> <rect key="frame" x="0.0" y="62" width="597" height="438"/> diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift index 2f28f92..cee56e4 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift @@ -72,6 +72,7 @@ } } + /// 回答错误数量 var errorNum:Int = 0{ didSet{ print("回答错误:\(correctNum)") @@ -165,7 +166,7 @@ self.viewModel.maxPage.accept(1) } } - + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @@ -175,8 +176,8 @@ sceneDelegate?.suspendTimer() } - override func viewDidLoad() { - super.viewDidLoad() + override func viewDidLoad() { + super.viewDidLoad() yy_popBlock = {[weak self] in self?.quitAction(isPop: true) @@ -195,7 +196,38 @@ timer.fire() RunLoop.current.add(timer, forMode: .common) - } + + Services.teamSchedule(type: viewModel.listenType.value, week: viewModel.week.value!, day: viewModel.day.value!).subscribe(onNext: {[weak self] data in + guard let weakSelf = self else { return } + if let model = data.data{ + weakSelf.viewModel.correctNum = weakSelf.viewModel.correctNum + model.correctNumber + weakSelf.viewModel.errorNum = model.answerNumber - model.correctNumber + + //跳转至指定页面 + let page = max(0,model.topicIds.count - 1) + if weakSelf.pageVC.currentPage != page{ + weakSelf.pageVC.scroll(toPage: page, animation: false) + } + + DispatchQueue.main.asyncAfter(wallDeadline: .now()+0.5){ + switch weakSelf.viewModel.listenType.value { + case .lesson1: + let vc = weakSelf.pageVC.currentController as! HomeListenFight_lesson_1_VC + case .lesson2: + let vc = weakSelf.pageVC.currentController as! HomeListenFight_lesson_2_VC + case .lesson3: + let vc = weakSelf.pageVC.currentController as! HomeListenFight_lesson_3_VC + case .lesson4: + let vc = weakSelf.pageVC.currentController as! HomeListenFight_lesson_4_VC + case .lesson5: + let vc = weakSelf.pageVC.currentController as! HomeListenFight_lesson_5_VC + default: + break + } + } + } + }).disposed(by: disposeBag) + } override func setUI() { super.setUI() @@ -298,7 +330,7 @@ case .story1,.story2: if let dict = noti.object as? Dictionary<String,Any>{ let type = weakSelf.viewModel.listenType.value == .story1 ? 1:2 - let accracy = Int(Double(weakSelf.viewModel.correctNum) / Double(weakSelf.viewModel.correctNum + weakSelf.viewModel.errorNum) * 100) + let accracy = String(format: "%.0lf", Double(weakSelf.viewModel.correctNum) / Double(weakSelf.viewModel.correctNum + weakSelf.viewModel.errorNum) * 100).int ?? 0 weakSelf.storyComplete(storyId: dict["storyId"] as! Int, accuracy: accracy, studyTime: weakSelf.viewModel.times, type: type, integral: dict["storyIntegral"] as! Int) } } @@ -362,17 +394,17 @@ /// 学习类完成 /// - Parameter ignorePush: 是否忽略跳转(未完成答题 :true) private func studyComplete(){ - var toalIntegral:Int = 0 + // var toalIntegral:Int = 0 let ids:String = viewModel.answerItems_1.keys.sorted().joined(separator: ",") switch viewModel.listenType.value { case .lesson1,.lesson2,.lesson3,.lesson4,.lesson5: let data = (data as! ListenNewModel).data - toalIntegral = data?.integral ?? 0 + // toalIntegral = data?.integral ?? 0 default:break } //正确率 - let accracy = Int(Double(viewModel.correctNum) / Double(viewModel.correctNum + viewModel.errorNum) * 100) + let accracy = String(format: "%.0lf", Double(viewModel.correctNum) / Double(viewModel.correctNum + viewModel.errorNum) * 100).int ?? 0 Services.completeLearing(type: viewModel.listenType.value.rawValue, studyTime: viewModel.times, studyIds: ids, quarter: viewModel.quarter.value!, week: viewModel.week.value!, day: viewModel.day.value!, accracy: accracy).subscribe(onNext: {data in NotificationCenter.default.post(name: Refresh_ListenSchedule_Noti, object: nil) @@ -381,9 +413,9 @@ timer.invalidate() - toalIntegral = floor(Double(toalIntegral) * (Double(accracy) / 100.0)).int + // toalIntegral = floor(Double(toalIntegral) * (Double(accracy) / 100.0)).int - let vc = HomeStudyCompleteVC(totalCoin: toalIntegral,viewModel: viewModel,studyScheduleModel: studyScheduleModel!) + let vc = HomeStudyCompleteVC(viewModel: viewModel,studyScheduleModel: studyScheduleModel!) vc.title = viewModel.listenType.value.rawTitle vc.viewModel = viewModel push(vc: vc) @@ -395,27 +427,27 @@ var name = "" var accuracy:Int = 0 var totalNum:Double = 0 - var toalIntegral:Int = 0 + // var toalIntegral:Int = 0 if viewModel.listenType.value == .game1{ name = "超级听力" totalNum = Double(viewModel.correctNum + viewModel.errorNum) if totalNum > 0{ - accuracy = Int(Double(viewModel.correctNum) / totalNum * 100) + accuracy = String(format: "%.0lf", Double(viewModel.correctNum) / totalNum * 100).int ?? 0 } - toalIntegral = floor(Double(integral) * (Double(accuracy) / 100.0)).int + // toalIntegral = floor(Double(integral) * (Double(accuracy) / 100.0)).int }else{ name = "超级记忆" let v = viewModel.answerItems.first?.value as! Listen1Model //11887:完成答题页,总题目、错误题目 数量计算逻辑错误(只要是没有答对的题目就算错误题目,不管是否答,相当于错误题目就是总题目减去正确题目) totalNum = Double(v.photoList.count) if totalNum > 0 && viewModel.correctNum > 0 && viewModel.errorNum > 0{ - accuracy = Int(Double(viewModel.correctNum) / Double(totalNum) * 100) + accuracy = String(format: "%.0lf", Double(viewModel.correctNum) / Double(totalNum) * 100).int ?? 0 } viewModel.errorNum = Int(totalNum) - viewModel.correctNum - toalIntegral = floor(Double(integral) * (Double(accuracy) / 100.0)).int + // toalIntegral = floor(Double(integral) * (Double(accuracy) / 100.0)).int } Services.completeGames(gameId: gameId, gameName: name, difficulty: viewModel.gameLevel.value, accuracy: accuracy, useTime: viewModel.times).subscribe(onNext: {data in @@ -425,7 +457,7 @@ timer.invalidate() - let vc = HomeStudyCompleteVC(totalCoin: toalIntegral,totalNum:totalNum.int,viewModel: viewModel,studyScheduleModel: studyScheduleModel!) + let vc = HomeStudyCompleteVC(totalNum:totalNum.int,viewModel: viewModel,studyScheduleModel: studyScheduleModel!) vc.title = viewModel.listenType.value.rawTitle vc.viewModel = viewModel push(vc: vc) @@ -438,7 +470,7 @@ NotificationCenter.default.post(name: StudyCompleteCoinUpdate_Noti, object: data.data ?? 0) }).disposed(by: disposeBag) - let vc = HomeStudyCompleteVC(totalCoin: integral,viewModel: viewModel,studyScheduleModel: studyScheduleModel!) + let vc = HomeStudyCompleteVC(viewModel: viewModel,studyScheduleModel: studyScheduleModel!) vc.title = viewModel.listenType.value.rawTitle vc.viewModel = viewModel push(vc: vc) @@ -456,13 +488,13 @@ CommonAlertView.show(content: "未完成全部答题,确认退出吗?") {[weak self] () in guard let weakSelf = self else { return } for vc in weakSelf.navigationController?.viewControllers ?? []{ - if vc.isKind(of: HomeListenMenuVC.self){ - weakSelf.navigationController?.popToViewController(vc, animated: true);break - } - if vc.isKind(of: HomeListenVC.self){ weakSelf.navigationController?.popToViewController(vc, animated: true);break } + +// if vc.isKind(of: HomeListenMenuVC.self){ +// weakSelf.navigationController?.popToViewController(vc, animated: true);break +// } } } return @@ -477,6 +509,23 @@ storyComplete(storyId: v.data!.id, accuracy: accuracy, studyTime: viewModel.times, type: viewModel.listenType.value == .story1 ? 1:2, integral: v.data!.integral) } }else if btn_exit.titleLabel?.text == "提交"{ + + if isPop{ + CommonAlertView.show(content: "未完成全部答题,确认退出吗?") {[weak self] () in + guard let weakSelf = self else { return } + for vc in weakSelf.navigationController?.viewControllers ?? []{ + if vc.isKind(of: HomeListenVC.self){ + weakSelf.navigationController?.popToViewController(vc, animated: true);break + } + +// if vc.isKind(of: HomeListenMenuVC.self){ +// weakSelf.navigationController?.popToViewController(vc, animated: true);break +// } + } + } + return + } + if viewModel.listenType.value == .game1 || viewModel.listenType.value == .game2{ if let dict = notiObject{ gamesComplete(gameId: dict["gameId"] as! Int,integral: dict["gameIntegral"] as! Int) @@ -513,13 +562,13 @@ }).disposed(by: weakSelf.disposeBag) } for vc in weakSelf.navigationController?.viewControllers ?? []{ - if vc.isKind(of: HomeListenMenuVC.self){ - weakSelf.navigationController?.popToViewController(vc, animated: true);break - } - if vc.isKind(of: HomeListenVC.self){ weakSelf.navigationController?.popToViewController(vc, animated: true);break } +// +// if vc.isKind(of: HomeListenMenuVC.self){ +// weakSelf.navigationController?.popToViewController(vc, animated: true);break +// } } } } @@ -543,8 +592,10 @@ @objc func beforeAction(){ - guard (pageVC.currentController as! HomeListenStory_2_VC).isPlayEnd else { - alert(msg: "请听完");return + if viewModel.listenType.value == .story2{ + guard (pageVC.currentController as! HomeListenStory_2_VC).isPlayEnd else { + alert(msg: "请听完");return + } } listenFightLine = .before diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift index 83d0d92..0c69c28 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift @@ -46,11 +46,11 @@ 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() @@ -240,8 +240,10 @@ //copy试图放在上面进行覆盖 let copyHandleView = studyHandleView.copyView() copyHandleView.view_choose.isHidden = true + copyHandleView.listenType = .lesson2 + copyHandleView.isplaying() copyHandleView.vioceSoundUrl = listenNewModel.subjectList[page][self.viewModel.selectIndex.value!.row].correct - copyHandleView.btn_state.setImage(nil, for: .normal) + copyHandleView.jq_cornerRadius = 0 view.addSubview(copyHandleView) view.layoutIfNeeded() @@ -323,7 +325,7 @@ } } - + func playComplete() { view.isUserInteractionEnabled = true //对已经播放过的View,进行刷新 @@ -337,12 +339,20 @@ } } + + for sub in view.subviews{ + if let v = sub as? StudyHandleView{ + v.resetView() + } + } + + if viewModel.answerType.value == .success{ let v = rootViewModel.answerCount.value rootViewModel.answerCount.accept(v + 1) + viewModel.answerType.accept(.none) DispatchQueue.main.asyncAfter(deadline: .now()+3) { self.resetStackView() - self.viewModel.answerType.accept(.none) } } diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift index 9fb1125..98dd935 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift @@ -239,13 +239,15 @@ rootViewModel.answerCount.accept(v) } + //正确才记录回答 + answerIndexs.insert(answerIndex!) + }else{ answerType = .fail voicePlayer.playFailVoice() rootViewModel.errorNum += 1 } voicePlayer.playerEnd() - answerIndexs.insert(answerIndex!) switch answerType { case .success: @@ -338,6 +340,10 @@ cell.img_state.alpha = 1 cell.img_state.transform = .init(scaleX: 1.0, y: 1.0) } + UIView.animate(withDuration: 0.4, delay: 3.0) { + cell.img_state.alpha = 0 + cell.img_state.transform = .init(scaleX: 0.1, y: 0.1) + } }else{ cell.img_state.alpha = 0 cell.img_state.transform = .init(scaleX: 0.1, y: 0.1) @@ -390,6 +396,10 @@ func playComplete() { self.view.isUserInteractionEnabled = true + if let indexPath = viewModel.selectIndex.value ,let cell = collectionView.cellForItem(at: indexPath) as? ListenFight_lesson_4_CCell{ + cell.playEnd() + } + //回答完成,下一答题 if answerIndexs.count == 2{ voicePlayer.playerEnd() diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_5_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_5_VC.swift index dcad317..a9b2843 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_5_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_5_VC.swift @@ -241,9 +241,11 @@ answterCount += 1 rootViewModel.correctNum += 1 viewModel.answerType.accept(.success) + label_hint.text = "" let copyView = tempSubV.copyView() copyView.listenType = .lesson5 + copyView.jq_cornerRadius = 0 copyView.playUrl = selectAnswer.correct let newRect = tempSubV.convert(tempSubV.bounds, to: self.view) copyView.frame = CGRect(origin: newRect.origin, size: CGSize(width: 159, height: 52)) @@ -258,7 +260,7 @@ if let cell = self.collectionView.dequeueReusableCell(withReuseIdentifier: "_ListenFight_lesson_1_CCell", for: indexPath) as? ListenFight_lesson_1_CCell{ var newRect1 = cell.convert(cell.bounds, to: self.collectionView) newRect1.origin.x += (collectionView.frame.origin.x + 5) - newRect1.origin.y += 94 + 25 + newRect1.origin.y += 94 + 24 UIView.animateKeyframes(withDuration: 0.4, delay: 0,options: .calculationModeLinear) { copyView.frame = CGRect(origin: newRect1.origin, size: CGSize(width: flowLayout.itemSize.width - 10 , height: 40)) diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift index 4b5f75a..bddea29 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift @@ -262,12 +262,15 @@ totalCount += 1 label_class.text = "\(totalCount)" viewModel.answerType.accept(.fail) + timer?.fireDate = .distantFuture + label_hint.text = "准备听题" //移除当前题目 if let c = currentAnswer{ answerSet.remove(c) } collectionView.reloadData() DispatchQueue.main.asyncAfter(deadline: .now()+3) { + self.timer?.fireDate = .distantPast self.times = (self.listen1Model?.data?.time ?? 10) + 1 self.currentAnswer = self.answerSet.randomElement() } @@ -364,7 +367,8 @@ view.isUserInteractionEnabled = false view_studyHandleView.playing() timer?.fireDate = .distantFuture //播放中,暂停计时 - label_hint.text = "播放中" +// label_hint.text = "播放中" + label_hint.text = "" } } diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift index d2c986c..ac21a72 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift @@ -48,6 +48,7 @@ override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) voicePlayer.delegate = self + restore() } override func viewDidDisappear(_ animated: Bool) { @@ -101,6 +102,7 @@ } func restore(){ + isPlayEnd = false viewModel.answerType.accept(.none) setUI() collectionView.reloadData() diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift index 4faca1f..de07a41 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift @@ -26,6 +26,10 @@ alpha = 0 transform = .init(scaleX: 0.1, y: 0.1) layoutIfNeeded() + btn_level1.setTitleColor(.black.withAlphaComponent(0.3), for: .normal) + btn_level2.setTitleColor(.black.withAlphaComponent(0.3), for: .normal) + btn_level3.setTitleColor(.black.withAlphaComponent(0.3), for: .normal) + } static func show(canLevel:Int,clouse:@escaping (Int)->Void,cancelClouse:@escaping()->Void){ @@ -42,21 +46,18 @@ levelView.cancelClouse = cancelClouse sceneDelegate?.window?.addSubview(levelView) levelView.frame = sceneDelegate?.window?.frame ?? .zero - levelView.btn_level1.isEnabled = false - levelView.btn_level2.isEnabled = false - levelView.btn_level3.isEnabled = false switch canLevel { case 2: - levelView.btn_level3.isEnabled = true + levelView.btn_level3.setTitleColor(.black.withAlphaComponent(0.6), for: .normal) fallthrough case 1: - levelView.btn_level2.isEnabled = true + levelView.btn_level2.setTitleColor(.black.withAlphaComponent(0.6), for: .normal) fallthrough case 0: - levelView.btn_level1.isEnabled = true + levelView.btn_level1.setTitleColor(.black.withAlphaComponent(0.6), for: .normal) default: - levelView.btn_level1.isEnabled = true + levelView.btn_level1.setTitleColor(.black.withAlphaComponent(0.6), for: .normal) } UIView.animate(withDuration: 0.4) { @@ -68,6 +69,13 @@ } @IBAction func chooseAction(_ sender: QMUIButton) { + + guard sender.alpha == 1.0 else { + sender.alpha = 0.5 + sender.isSelected = false + alertError(msg: "请先完成上一难度再挑战");return + } + level = sender.tag - 10 for subView in tackView_level.arrangedSubviews as! [QMUIButton]{ subView.isSelected = sender.tag == subView.tag diff --git a/DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.swift b/DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.swift index 48a985c..5c7ed6b 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.swift @@ -23,15 +23,15 @@ @IBOutlet weak var stackView: UIStackView! @IBOutlet weak var btn_back: UIButton! - private var totalCoin:Int = 0 +// private var totalCoin:Int = 0 private var totalNum:Int? //总题目数量 var viewModel:HomeListenFightViewModel! var studyScheduleModel:StudyScheduleModel! - required init(totalCoin:Int,totalNum:Int? = nil,viewModel:HomeListenFightViewModel,studyScheduleModel:StudyScheduleModel){ + required init(totalNum:Int? = nil,viewModel:HomeListenFightViewModel,studyScheduleModel:StudyScheduleModel){ super.init(nibName: nil, bundle: nil) - self.totalCoin = totalCoin +// self.totalCoin = totalCoin self.totalNum = totalNum self.viewModel = viewModel self.studyScheduleModel = studyScheduleModel @@ -48,7 +48,7 @@ self?.backAction() } - label_coin.text = "恭喜您,已完成全部答题!获得\(totalCoin)积分!" + label_coin.text = "恭喜您,已完成全部答题!获得0积分!" label_correctNum.text = "\(viewModel.correctNum)次" label_errorNum.text = "\(viewModel.errorNum)次" label_totalNum.text = "\(viewModel.correctNum + viewModel.errorNum)次" @@ -63,7 +63,7 @@ label_title_totalNum.text = "总题目:" label_title_correctNum.text = "正确题目:" label_title_errorNum.text = "错误题目:" - label_coin.text = "恭喜您,已完成游戏!获得\(totalCoin)积分!" + label_coin.text = "恭喜您,已完成游戏!获得0积分!" label_totalNum.text = "\(totalNum!)" label_correctNum.text = "\(viewModel.correctNum)" @@ -159,7 +159,7 @@ Services.pictureMateVoice(day: viewModel.day.value!, quarter: viewModel.quarter.value!, week: viewModel.week.value!).subscribe(onNext: {[weak self] result in guard let weakSelf = self else { return } if let data = result.data{ - let fightVC = HomeListenFightVC(listenType: .lesson4,quarter:weakSelf.viewModel.quarter.value!,week: weakSelf.viewModel.week.value!,day:weakSelf.viewModel.day.value!) + let fightVC = HomeListenFightVC(listenType: .lesson5,quarter:weakSelf.viewModel.quarter.value!,week: weakSelf.viewModel.week.value!,day:weakSelf.viewModel.day.value!) fightVC.title = ListenType.lesson5.rawTitle fightVC.data = data fightVC.studyScheduleModel = weakSelf.studyScheduleModel diff --git a/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketContentVC.swift b/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketContentVC.swift index 8b3c62e..e0eca5e 100644 --- a/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketContentVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketContentVC.swift @@ -142,9 +142,14 @@ return } - let vc = MarketExchangeVC(viewModel: viewModel) - vc.title = "立即兑换" - push(vc: vc) + Services.redeemNow(goodId: viewModel.detailModel.value!.good!.id).subscribe(onNext: {result in + self.viewModel.detailModel.accept(result.data) + let vc = MarketExchangeVC(viewModel: self.viewModel) + vc.title = "立即兑换" + self.push(vc: vc) + }) { error in + + }.disposed(by: disposeBag) } override func viewDidLayoutSubviews() { diff --git a/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketExchangeVC.swift b/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketExchangeVC.swift index 76a489e..aa1eb06 100644 --- a/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketExchangeVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Market/VC/MarketExchangeVC.swift @@ -44,13 +44,15 @@ override func viewDidLoad() { super.viewDidLoad() - Services.redeemNow(goodId: viewModel.detailModel.value!.good!.id).subscribe(onNext: {result in - self.label_orderNum.text = result.data?.orderNumber ?? "" - self.viewModel.detailModel.accept(result.data) - }) { error in - self.btn_exchange.backgroundColor = .gray.withAlphaComponent(0.5) - self.btn_exchange.isEnabled = false - }.disposed(by: disposeBag) + + label_orderNum.text = viewModel.detailModel.value?.orderNumber ?? "" +// Services.redeemNow(goodId: viewModel.detailModel.value!.good!.id).subscribe(onNext: {result in +// result.data?.orderNumber ?? "" +// self.viewModel.detailModel.accept(result.data) +// }) { error in +// self.btn_exchange.backgroundColor = .gray.withAlphaComponent(0.5) +// self.btn_exchange.isEnabled = false +// }.disposed(by: disposeBag) Services.addressList().subscribe(onNext: {[weak self]result in self?.viewModel.address.accept(result.data ?? []) diff --git a/DolphinEnglishLearnStudent/Moudle/Me/MeVC.swift b/DolphinEnglishLearnStudent/Moudle/Me/MeVC.swift index a49112c..64c7c43 100644 --- a/DolphinEnglishLearnStudent/Moudle/Me/MeVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Me/MeVC.swift @@ -115,4 +115,10 @@ }).disposed(by: self.disposeBag) } } + + @IBAction func becomeVIPAction(_ sender: Any) { + let vc = VIPCenterVC() + vc.title = "会员中心" + push(vc: vc) + } } diff --git a/DolphinEnglishLearnStudent/Moudle/Me/MeVC.xib b/DolphinEnglishLearnStudent/Moudle/Me/MeVC.xib index 47ebb3b..5d92946 100644 --- a/DolphinEnglishLearnStudent/Moudle/Me/MeVC.xib +++ b/DolphinEnglishLearnStudent/Moudle/Me/MeVC.xib @@ -58,10 +58,23 @@ <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="calibratedRGB"/> <nil key="highlightedColor"/> </label> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="l8U-Jk-mSI"> + <rect key="frame" x="774" y="48.5" width="74" height="34"/> + <fontDescription key="fontDescription" type="system" weight="medium" pointSize="18"/> + <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/> + <state key="normal" title="成为会员"> + <color key="titleColor" red="0.25490196079999999" green="0.63529411759999999" blue="0.92156862750000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> + </state> + <connections> + <action selector="becomeVIPAction:" destination="-1" eventType="touchUpInside" id="x97-3g-TlQ"/> + </connections> + </button> </subviews> <color key="backgroundColor" systemColor="systemBackgroundColor"/> <constraints> <constraint firstItem="D0d-O7-Pt2" firstAttribute="leading" secondItem="qXF-FL-HEr" secondAttribute="trailing" constant="18" id="0RC-Ct-neE"/> + <constraint firstAttribute="trailing" secondItem="l8U-Jk-mSI" secondAttribute="trailing" constant="20" id="4r4-96-WXO"/> + <constraint firstItem="l8U-Jk-mSI" firstAttribute="centerY" secondItem="Ora-D0-c8V" secondAttribute="centerY" id="6bS-zc-O8v"/> <constraint firstItem="LJb-Ki-p3S" firstAttribute="top" secondItem="D0d-O7-Pt2" secondAttribute="bottom" constant="10" id="ILj-gS-zIv"/> <constraint firstItem="qXF-FL-HEr" firstAttribute="centerY" secondItem="Ora-D0-c8V" secondAttribute="centerY" id="OLa-Ch-3Ab"/> <constraint firstItem="qXF-FL-HEr" firstAttribute="leading" secondItem="Ora-D0-c8V" secondAttribute="leading" constant="16" id="XVR-3Y-0ky"/> diff --git a/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.swift b/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.swift index ea4653c..202771f 100644 --- a/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.swift +++ b/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.swift @@ -73,7 +73,7 @@ switch exchangeRecordModel!.state{ case 1: - let vc = AddressManageVC(type: .handle) + let vc = AddressManageVC(type: .choose) vc.title = "修改地址" vc.chooseAddress { m in CommonAlertView.show(content: "确认修改当前收货地址吗?") {[weak self] () in diff --git a/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.xib b/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.xib index 706ce29..b326888 100644 --- a/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.xib +++ b/DolphinEnglishLearnStudent/Moudle/Me/TCell/GoodsItemTCell.xib @@ -63,31 +63,8 @@ <color key="textColor" red="0.082352941176470587" green="0.086274509803921567" blue="0.094117647058823528" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> <nil key="highlightedColor"/> </label> - <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" distribution="fillEqually" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="vd5-iK-Ujb"> - <rect key="frame" x="173" y="95.5" width="609" height="61"/> - <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商品数量:-" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PlF-D7-xZD"> - <rect key="frame" x="0.0" y="0.0" width="609" height="17"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/> - <color key="textColor" red="0.082352941176470587" green="0.086274509803921567" blue="0.094117647058823528" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收获信息:-" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qnF-SM-ngM"> - <rect key="frame" x="0.0" y="22" width="609" height="17"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/> - <color key="textColor" red="0.08235294118" green="0.086274509799999996" blue="0.094117647060000004" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> - <nil key="highlightedColor"/> - </label> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="发货信息:-" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cSS-lo-Yba"> - <rect key="frame" x="0.0" y="44" width="609" height="17"/> - <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/> - <color key="textColor" red="0.08235294118" green="0.086274509799999996" blue="0.094117647060000004" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> - <nil key="highlightedColor"/> - </label> - </subviews> - </stackView> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xwt-lH-fyW"> - <rect key="frame" x="703" y="209" width="124" height="40"/> + <rect key="frame" x="703" y="157" width="124" height="40"/> <color key="backgroundColor" red="0.25490196079999999" green="0.63529411759999999" blue="0.92156862750000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstAttribute="width" constant="124" id="3Ct-u1-c4s"/> @@ -106,26 +83,49 @@ <action selector="handleAction:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="dgK-UX-7H1"/> </connections> </button> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商品数量:-" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PlF-D7-xZD"> + <rect key="frame" x="173" y="95.5" width="78" height="17"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/> + <color key="textColor" red="0.082352941176470587" green="0.086274509803921567" blue="0.094117647058823528" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收获信息:-" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qnF-SM-ngM"> + <rect key="frame" x="173" y="117.5" width="609" height="17"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/> + <color key="textColor" red="0.08235294118" green="0.086274509799999996" blue="0.094117647060000004" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="发货信息:-" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cSS-lo-Yba"> + <rect key="frame" x="173" y="139.5" width="660" height="17"/> + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/> + <color key="textColor" red="0.08235294118" green="0.086274509799999996" blue="0.094117647060000004" alpha="0.80000000000000004" colorSpace="custom" customColorSpace="sRGB"/> + <nil key="highlightedColor"/> + </label> </subviews> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <constraints> <constraint firstItem="UdI-oe-WSO" firstAttribute="leading" secondItem="HZS-Oe-5LR" secondAttribute="trailing" constant="17" id="57C-Fp-3AO"/> <constraint firstItem="viA-yT-ZWk" firstAttribute="leading" secondItem="UdI-oe-WSO" secondAttribute="leading" id="6Fj-YY-5Lr"/> <constraint firstAttribute="trailing" secondItem="xwt-lH-fyW" secondAttribute="trailing" constant="11" id="6RI-NH-2my"/> + <constraint firstItem="PlF-D7-xZD" firstAttribute="leading" secondItem="qnF-SM-ngM" secondAttribute="leading" id="8UU-18-mxy"/> <constraint firstItem="9oA-7x-in6" firstAttribute="leading" secondItem="EWl-m5-3O9" secondAttribute="leading" constant="8" id="AHE-Ei-2xt"/> - <constraint firstItem="vd5-iK-Ujb" firstAttribute="leading" secondItem="UdI-oe-WSO" secondAttribute="leading" id="CRk-D7-Sa0"/> + <constraint firstAttribute="trailing" secondItem="qnF-SM-ngM" secondAttribute="trailing" constant="56" id="Ake-gb-ygI"/> + <constraint firstItem="cSS-lo-Yba" firstAttribute="leading" secondItem="qnF-SM-ngM" secondAttribute="leading" id="C17-9I-0U5"/> + <constraint firstItem="PlF-D7-xZD" firstAttribute="top" secondItem="viA-yT-ZWk" secondAttribute="bottom" constant="7" id="Cdf-sE-e8f"/> + <constraint firstAttribute="bottom" secondItem="HZS-Oe-5LR" secondAttribute="bottom" priority="750" constant="18" id="Dbk-Lt-Ude"/> <constraint firstItem="9oA-7x-in6" firstAttribute="top" secondItem="EWl-m5-3O9" secondAttribute="top" constant="19" id="Kd6-sy-ai0"/> <constraint firstAttribute="trailing" secondItem="nMG-SO-H2Z" secondAttribute="trailing" constant="11" id="NXe-Od-1mg"/> + <constraint firstItem="PlF-D7-xZD" firstAttribute="leading" secondItem="UdI-oe-WSO" secondAttribute="leading" id="Sob-lc-V0Q"/> + <constraint firstItem="qnF-SM-ngM" firstAttribute="top" secondItem="PlF-D7-xZD" secondAttribute="bottom" constant="5" id="UAP-dY-8dm"/> + <constraint firstItem="xwt-lH-fyW" firstAttribute="bottom" secondItem="HZS-Oe-5LR" secondAttribute="bottom" id="W7s-Ct-asF"/> <constraint firstItem="UdI-oe-WSO" firstAttribute="top" secondItem="HZS-Oe-5LR" secondAttribute="top" id="ZyM-TK-6FN"/> <constraint firstAttribute="trailing" secondItem="viA-yT-ZWk" secondAttribute="trailing" id="d0F-tv-fNn"/> <constraint firstItem="viA-yT-ZWk" firstAttribute="top" secondItem="UdI-oe-WSO" secondAttribute="bottom" id="fFu-Xa-Vst"/> - <constraint firstAttribute="bottom" secondItem="xwt-lH-fyW" secondAttribute="bottom" constant="18" id="h2F-rW-tSx"/> - <constraint firstItem="vd5-iK-Ujb" firstAttribute="top" secondItem="viA-yT-ZWk" secondAttribute="bottom" constant="7" id="kmP-P0-Yhd"/> - <constraint firstAttribute="bottom" secondItem="vd5-iK-Ujb" secondAttribute="bottom" priority="250" constant="101.5" id="lGT-yn-Kw9"/> + <constraint firstItem="cSS-lo-Yba" firstAttribute="top" secondItem="qnF-SM-ngM" secondAttribute="bottom" constant="5" id="lb9-Qa-LhG"/> <constraint firstItem="nMG-SO-H2Z" firstAttribute="centerY" secondItem="UdI-oe-WSO" secondAttribute="centerY" id="ne0-kd-EzF"/> <constraint firstItem="HZS-Oe-5LR" firstAttribute="top" secondItem="9oA-7x-in6" secondAttribute="bottom" constant="13" id="nvs-xY-hiH"/> <constraint firstItem="HZS-Oe-5LR" firstAttribute="leading" secondItem="EWl-m5-3O9" secondAttribute="leading" constant="8" id="u6c-56-glh"/> - <constraint firstAttribute="trailing" secondItem="vd5-iK-Ujb" secondAttribute="trailing" constant="56" id="ucU-JO-6dg"/> + <constraint firstAttribute="trailing" secondItem="cSS-lo-Yba" secondAttribute="trailing" constant="5" id="wZ2-Yj-Y4L"/> <constraint firstAttribute="trailing" secondItem="UdI-oe-WSO" secondAttribute="trailing" constant="90" id="z0n-ib-Q7m"/> </constraints> </view> diff --git a/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift b/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift index b363718..d79b9e6 100644 --- a/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Me/VC/VIPCenterVC.swift @@ -6,8 +6,12 @@ // import UIKit +import WebKit class VIPCenterVC: BaseVC { + + private var btn_vip:UIButton! + private var webView:WKWebView! override func viewDidLoad() { super.viewDidLoad() @@ -27,10 +31,33 @@ weakSelf.navigationController?.popViewController(animated: true) } } + + Services.vipInfo().subscribe(onNext: {data in + + }).disposed(by: disposeBag) } override func setUI() { - } + webView = WKWebView(frame: .zero) + view.addSubview(webView) + webView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + btn_vip = UIButton(type: .custom) + btn_vip.setTitle("成为会员", for: .normal) + btn_vip.setTitleColor(.white, for: .normal) + btn_vip.backgroundColor = UIColor(hexStr: "#41A2EB") + btn_vip.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium) + btn_vip.jq_cornerRadius = 8 + view.addSubview(btn_vip) + btn_vip.snp.makeConstraints { make in + make.width.equalTo(316) + make.height.equalTo(49) + make.bottom.equalTo(-91) + make.centerX.equalToSuperview() + } + } } diff --git a/DolphinEnglishLearnStudent/Moudle/Me/View/ShareView.swift b/DolphinEnglishLearnStudent/Moudle/Me/View/ShareView.swift index df6bbc6..ac09ae5 100644 --- a/DolphinEnglishLearnStudent/Moudle/Me/View/ShareView.swift +++ b/DolphinEnglishLearnStudent/Moudle/Me/View/ShareView.swift @@ -33,14 +33,6 @@ cons_bottom.constant = -JQ_ScreenW alpha = 0 layoutIfNeeded() - - Services.shareInfo().subscribe(onNext: { data in - if let m = data.data{ - self.shareModel = m - self.label_info.text = m.title - self.img_cover.sd_setImage(with: URL(string: m.img)) - } - }).disposed(by: disposeBag) } static func show(){ @@ -70,18 +62,22 @@ @IBAction func shareAction(_ sender: QMUIButton) { - guard shareModel != nil else {alertError(msg: "数据获取失败");return} - var scene:WXScene! - if sender.tag == 10{ - scene = WXSceneSession - }else{ - scene = WXSceneTimeline - } - showHUD() - SDWebImageDownloader.shared.downloadImage(with: URL(string: shareModel!.img)) { iamge, data, error, state in - hiddenHUD() - guard error == nil else {alert(msg: "图片获取失败");return} - WeChatTools.shareUrl("https://dollearn.com/", title: "海豚智能教育平台", desc: self.shareModel!.title, thumb: iamge!, scene: scene) - } + + Services.shareInfo().subscribe(onNext: { data in + if let m = data.data{ + var scene:WXScene! + if sender.tag == 10{ + scene = WXSceneSession + }else{ + scene = WXSceneTimeline + } + showHUD() + SDWebImageDownloader.shared.downloadImage(with: URL(string: m.img)) { iamge, data, error, state in + hiddenHUD() + guard error == nil else {alert(msg: "图片获取失败");return} + WeChatTools.shareUrl("https://dollearn.com/", title: m.title, desc: "", thumb: iamge!, scene: scene) + } + } + }).disposed(by: disposeBag) } } diff --git a/DolphinEnglishLearnStudent/Services/Services.swift b/DolphinEnglishLearnStudent/Services/Services.swift index 364a399..19a3343 100644 --- a/DolphinEnglishLearnStudent/Services/Services.swift +++ b/DolphinEnglishLearnStudent/Services/Services.swift @@ -158,6 +158,15 @@ return NetworkRequest.request(params: params, method: .get, progress: true) } + class func teamSchedule(type:ListenType,week:Int,day:Int)->Observable<BaseResponse<TeamScheduleModel>>{ + let params = ParamsAppender.build(url: All_Url) + params.interface(url: "/study/base/study/teamSchedule") + params.append(key: "type", value: type.rawValue) + params.append(key: "week", value: week) + params.append(key: "day", value: day) + return NetworkRequest.request(params: params, method: .get, progress: false) + } + class func parentPage()->Observable<BaseResponse<String>>{ let params = ParamsAppender.build(url: All_Url) params.interface(url: "/study/base/user/studyPage") @@ -200,7 +209,7 @@ class func goodRecommend()->Observable<BaseResponse<[RecommendModel]>>{ let params = ParamsAppender.build(url: All_Url) params.interface(url: "/study/base/study/goodRecommend") - return NetworkRequest.request(params: params, method: .get, progress: false) + return NetworkRequest.request(params: params, method: .get, progress: false,ignoreAlert: true) } class func goodsList(keywords:String,page:Int,pageSize:Int = 20,type:[String])->Observable<BaseResponse<BaseResponseList<MarketModel>>>{ @@ -379,6 +388,12 @@ params.interface(url: "/study/base/user/shareInfo") return NetworkRequest.request(params: params, method: .get, progress: false) } + + class func vipInfo()->Observable<BaseResponse<SimpleModel>>{ + let params = ParamsAppender.build(url: All_Url) + params.interface(url: "/study/base/user/vipInfo") + return NetworkRequest.request(params: params, method: .post, progress: false) + } } extension Services{ -- Gitblit v1.7.1