From 59bd9f792891efa0d0d69f256e1a146c44c944db Mon Sep 17 00:00:00 2001 From: 无故事王国 <841720330@qq.com> Date: 星期三, 24 七月 2024 09:45:41 +0800 Subject: [PATCH] fix bug --- DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift | 4 DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift | 4 DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenVC.swift | 12 ++-- DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift | 61 +++++++++++++------- DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_CCell.swift | 4 DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift | 2 DolphinEnglishLearnStudent/Moudle/Home/HomeVC.xib | 53 +++-------------- 7 files changed, 63 insertions(+), 77 deletions(-) diff --git a/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift b/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift index 307b07d..f962d03 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.swift @@ -10,7 +10,7 @@ class HomeVC: BaseVC { - @IBOutlet weak var view_menu: UIView! +// @IBOutlet weak var view_menu: UIView! override func viewDidLoad() { super.viewDidLoad() @@ -40,7 +40,7 @@ } override func viewDidLayoutSubviews() { - view_menu.jq_gradientColor(colorArr: [UIColor(hexString: "#F9F5E0")!.cgColor,UIColor(hexString: "#EBF6FF")!.cgColor], cornerRadius: 8, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: nil,locations: [NSNumber(value: 0.35)]) +// view_menu.jq_gradientColor(colorArr: [UIColor(hexString: "#F9F5E0")!.cgColor,UIColor(hexString: "#EBF6FF")!.cgColor], cornerRadius: 8, startPoint: CGPoint(x: 0, y: 0), endPoint: CGPoint(x: 0, y: 1), bounds: nil,locations: [NSNumber(value: 0.35)]) } @IBAction func listenAction(_ sender: UIButton) { diff --git a/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.xib b/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.xib index 97d2133..70fc10f 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.xib +++ b/DolphinEnglishLearnStudent/Moudle/Home/HomeVC.xib @@ -12,7 +12,6 @@ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="HomeVC" customModule="DolphinEnglishLearnStudent" customModuleProvider="target"> <connections> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> - <outlet property="view_menu" destination="NVz-Oq-gpf" id="PbF-g0-AZ0"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> @@ -21,13 +20,13 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u25-QY-P0i"> - <rect key="frame" x="0.0" y="0.0" width="285" height="780"/> + <rect key="frame" x="0.0" y="0.0" width="299.5" height="820"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="3du-Pw-IgI"> - <rect key="frame" x="70.5" y="40" width="144" height="136"/> + <rect key="frame" x="77.5" y="40" width="144" height="136"/> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="欢迎使用哆能智学!" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nUx-UB-L4X"> - <rect key="frame" x="18" y="193" width="249" height="33.5"/> + <rect key="frame" x="18" y="193" width="263.5" height="33.5"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="28"/> <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <nil key="highlightedColor"/> @@ -78,7 +77,7 @@ </constraints> </view> <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="8a7-s7-2fd"> - <rect key="frame" x="318" y="276" width="380" height="88"/> + <rect key="frame" x="332.5" y="199" width="380" height="88"/> <subviews> <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="A0m-iE-WEq"> <rect key="frame" x="0.0" y="0.0" width="380" height="59"/> @@ -225,64 +224,32 @@ </view> </subviews> </stackView> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_longLine" translatesAutoresizingMaskIntoConstraints="NO" id="3HS-lN-rlw"> - <rect key="frame" x="857" y="48" width="1" height="676"/> - <constraints> - <constraint firstAttribute="width" constant="1" id="JcY-vf-7Yr"/> - </constraints> - </imageView> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="placeH" translatesAutoresizingMaskIntoConstraints="NO" id="dB6-vc-74T"> - <rect key="frame" x="679" y="510" width="178" height="250"/> - </imageView> - <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NVz-Oq-gpf"> - <rect key="frame" x="912" y="48" width="238" height="676"/> - <subviews> - <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bg_abc" translatesAutoresizingMaskIntoConstraints="NO" id="nrV-nb-Vpp"> - <rect key="frame" x="36" y="530" width="166" height="115"/> - </imageView> - </subviews> - <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <rect key="frame" x="864" y="442" width="254" height="358"/> <constraints> - <constraint firstAttribute="bottom" secondItem="nrV-nb-Vpp" secondAttribute="bottom" constant="31" id="Mui-vu-cFz"/> - <constraint firstAttribute="width" constant="238" id="QCl-EW-dU6"/> - <constraint firstAttribute="width" secondItem="NVz-Oq-gpf" secondAttribute="height" multiplier="0.352:1" id="jiO-AC-0WN"/> - <constraint firstItem="nrV-nb-Vpp" firstAttribute="leading" secondItem="NVz-Oq-gpf" secondAttribute="leading" constant="36" id="sJB-cO-qax"/> - <constraint firstAttribute="trailing" secondItem="nrV-nb-Vpp" secondAttribute="trailing" constant="36" id="shp-pp-EFk"/> + <constraint firstAttribute="width" constant="254" id="GPi-Rj-Pet"/> + <constraint firstAttribute="height" constant="358" id="Wfv-ly-SSv"/> </constraints> - <userDefinedRuntimeAttributes> - <userDefinedRuntimeAttribute type="boolean" keyPath="ld_maskToBoundsXIB" value="YES"/> - <userDefinedRuntimeAttribute type="number" keyPath="ld_cornerRadiusXIB"> - <real key="value" value="8"/> - </userDefinedRuntimeAttribute> - </userDefinedRuntimeAttributes> - </view> + </imageView> </subviews> <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/> <color key="backgroundColor" systemColor="systemBackgroundColor"/> <constraints> - <constraint firstItem="8a7-s7-2fd" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="252" id="4SC-Gm-a5y"/> + <constraint firstItem="8a7-s7-2fd" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" constant="175" id="4SC-Gm-a5y"/> + <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="dB6-vc-74T" secondAttribute="trailing" constant="62" id="4h9-Dx-RHg"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="dB6-vc-74T" secondAttribute="bottom" id="5rR-7n-uKm"/> - <constraint firstItem="NVz-Oq-gpf" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="48" id="9rj-9T-mc5"/> <constraint firstAttribute="bottom" secondItem="u25-QY-P0i" secondAttribute="bottom" id="CfI-2x-pVb"/> - <constraint firstItem="NVz-Oq-gpf" firstAttribute="bottom" secondItem="3HS-lN-rlw" secondAttribute="bottom" id="GK6-yS-c1H"/> - <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="NVz-Oq-gpf" secondAttribute="bottom" constant="36" id="MKK-qg-4Pp"/> <constraint firstItem="u25-QY-P0i" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="QEu-6j-zme"/> - <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="NVz-Oq-gpf" secondAttribute="trailing" constant="30" id="Wif-ad-6Fo"/> - <constraint firstItem="NVz-Oq-gpf" firstAttribute="leading" secondItem="3HS-lN-rlw" secondAttribute="trailing" constant="54" id="YdZ-Wt-PDn"/> - <constraint firstItem="3HS-lN-rlw" firstAttribute="leading" secondItem="dB6-vc-74T" secondAttribute="trailing" id="h3G-Yy-yuZ"/> <constraint firstItem="8a7-s7-2fd" firstAttribute="leading" secondItem="u25-QY-P0i" secondAttribute="trailing" constant="33" id="lge-cR-TPq"/> <constraint firstItem="u25-QY-P0i" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="snI-gI-0vp"/> - <constraint firstItem="NVz-Oq-gpf" firstAttribute="top" secondItem="3HS-lN-rlw" secondAttribute="top" id="x7g-LJ-Sk4"/> </constraints> <point key="canvasLocation" x="44.745762711864408" y="19.756097560975608"/> </view> </objects> <resources> - <image name="bg_abc" width="166" height="115"/> <image name="home_arrow_up" width="20" height="37"/> <image name="home_listen" width="42" height="28"/> <image name="home_read" width="37" height="37"/> - <image name="icon_longLine" width="1" height="676"/> <image name="logo" width="144" height="136"/> <image name="placeH" width="178" height="250"/> <systemColor name="systemBackgroundColor"> diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_CCell.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_CCell.swift index c4939fd..aa2d956 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_CCell.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_CCell.swift @@ -33,7 +33,7 @@ self.img_state.alpha = 1 self.img_state.transform = .init(scaleX: 1, y: 1) } - DispatchQueue.main.asyncAfter(deadline: .now()+3) { + DispatchQueue.main.asyncAfter(deadline: .now()+1) { UIView.animate(withDuration: 0.6) { self.img_state.alpha = 0 self.img_state.transform = .init(scaleX: 0.1, y: 0.1) @@ -45,7 +45,7 @@ self.img_state.alpha = 1 self.img_state.transform = .init(scaleX: 1, y: 1) } - DispatchQueue.main.asyncAfter(deadline: .now()+3) { + DispatchQueue.main.asyncAfter(deadline: .now()+1) { UIView.animate(withDuration: 0.6) { self.img_state.alpha = 0 self.img_state.transform = .init(scaleX: 0.1, y: 0.1) 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 f92d910..84ab1a9 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift @@ -142,7 +142,7 @@ self.stateImg.transform = .init(scaleX: 1.0, y: 1.0) } completion: { state in if state{ - DispatchQueue.main.asyncAfter(wallDeadline: .now()+3){ + DispatchQueue.main.asyncAfter(wallDeadline: .now()+0.5){ UIView.animate(withDuration: 0.5) { self.stateImg.alpha = 0 self.stateImg.transform = .init(scaleX: 0.1, y: 0.1) diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift index abeba3e..a43cc66 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift @@ -251,8 +251,27 @@ UIView.animate(withDuration: 0.5) { copyView.frame = CGRect(x: x, y: y, width: layout.itemSize.width - 10, height: 40) } completion: { _ in - DispatchQueue.main.asyncAfter(deadline: .now()+0.5) { - self.voicePlayer.playerAt(url: self.currentAnswer?.correct) +// DispatchQueue.main.asyncAfter(deadline: .now()+0.5) { +// self.voicePlayer.playerAt(url: self.currentAnswer?.correct) +// } + + if self.viewModel.answerType.value == .success{ + self.timer?.fireDate = .distantFuture + DispatchQueue.main.asyncAfter(deadline: .now()+1) { + self.times = (self.listen1Model?.data?.time ?? 10) + 1 + self.totalCount += 1 + self.rootViewModel.correctNum += 1 + self.label_class.text = "\(self.totalCount)" + + if let currentA = self.currentAnswer{ + self.answerSet.remove(currentA) + } + + self.currentAnswer = self.answerSet.randomElement() + self.viewModel.answerType.accept(.none) + print("--->下一题:\(self.currentAnswer?.id ?? 0) 剩余\(self.answerSet.count) 计数:\(self.totalCount)") + self.timer?.fireDate = .distantPast + } } } } @@ -269,7 +288,7 @@ answerSet.remove(c) } collectionView.reloadData() - DispatchQueue.main.asyncAfter(deadline: .now()+3) { + DispatchQueue.main.asyncAfter(deadline: .now()+1) { self.timer?.fireDate = .distantPast self.times = (self.listen1Model?.data?.time ?? 10) + 1 self.currentAnswer = self.answerSet.randomElement() @@ -339,24 +358,24 @@ self.label_hint.text = "准备听题" - if viewModel.answerType.value == .success{ - timer?.fireDate = .distantFuture - DispatchQueue.main.asyncAfter(deadline: .now()+3) { - self.times = (self.listen1Model?.data?.time ?? 10) + 1 - self.totalCount += 1 - self.rootViewModel.correctNum += 1 - self.label_class.text = "\(self.totalCount)" - - if let currentA = self.currentAnswer{ - self.answerSet.remove(currentA) - } - - self.currentAnswer = self.answerSet.randomElement() - self.viewModel.answerType.accept(.none) - print("--->下一题:\(self.currentAnswer?.id ?? 0) 剩余\(self.answerSet.count) 计数:\(self.totalCount)") - self.timer?.fireDate = .distantPast - } - } +// if viewModel.answerType.value == .success{ +// timer?.fireDate = .distantFuture +// DispatchQueue.main.asyncAfter(deadline: .now()+1) { +// self.times = (self.listen1Model?.data?.time ?? 10) + 1 +// self.totalCount += 1 +// self.rootViewModel.correctNum += 1 +// self.label_class.text = "\(self.totalCount)" +// +// if let currentA = self.currentAnswer{ +// self.answerSet.remove(currentA) +// } +// +// self.currentAnswer = self.answerSet.randomElement() +// self.viewModel.answerType.accept(.none) +// print("--->下一题:\(self.currentAnswer?.id ?? 0) 剩余\(self.answerSet.count) 计数:\(self.totalCount)") +// self.timer?.fireDate = .distantPast +// } +// } //答题完成 diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift index 2b19d99..66b6f63 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift @@ -189,12 +189,12 @@ secondIndexCell.setState(success: false) self.view.isUserInteractionEnabled = false - DispatchQueue.main.asyncAfter(deadline: .now()+3.0){ + DispatchQueue.main.asyncAfter(deadline: .now()+1.0){ firstIndexCell.toBackAction(self.view) secondIndexCell.toBackAction(self.view) self.selectModels.removeAll() } - DispatchQueue.main.asyncAfter(wallDeadline: .now()+3.7){ + DispatchQueue.main.asyncAfter(wallDeadline: .now()+1.7){ self.view.isUserInteractionEnabled = true } } diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenVC.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenVC.swift index 25f44f9..756085a 100644 --- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenVC.swift +++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenVC.swift @@ -67,12 +67,8 @@ let total = studyScheduleModel.pair + studyScheduleModel.induction + studyScheduleModel.listen + studyScheduleModel.look + studyScheduleModel.answer if self.limitDay == 5 && total == 500 { - self.limitDay = Int.max + self.limitDay = 6 } - - // #if DEBUG - // self.limitDay = Int.max - // #endif for (index,titleL) in (self.menu.subviews.last?.subviews[1].subviews ?? []).filter({$0 is UIButton}).enumerated(){ if let btn = titleL as? UIButton{ @@ -87,7 +83,11 @@ } self.pageVC.reloadData() - self.pageVC.scroll(toPage: self.limitDay - 1, animation: true) + if limitDay == 6{ + self.pageVC.scroll(toPage: 4, animation: true) + }else{ + self.pageVC.scroll(toPage: self.limitDay - 1, animation: true) + } } override func setUI() { -- Gitblit v1.7.1