fix
无故事王国
2024-06-19 ee4954eb4dc84e0a6c0a784da717f9cc648b106b
fix
19个文件已修改
359 ■■■■■ 已修改文件
DolphinEnglishLearnStudent/Info.plist 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Models/CommonModel.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/HomeListenFight_lesson_1_VC.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_3_VC.swift 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_5_VC.swift 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenSubVC.swift 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.xib 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/Lesson_4_AnswerView.swift 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/Lesson_4_AnswerView.xib 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Services/Services.swift 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Info.plist
@@ -2,6 +2,17 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>dolpinEnglish</string>
            </array>
        </dict>
    </array>
    <key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
DolphinEnglishLearnStudent/Models/CommonModel.swift
@@ -364,6 +364,7 @@
                var userId: Int = 0
                var week: Int = 0
                var weekStudy: Int = 0
                var gameDifficulty:Int = 0
}
class SimpleListenDataModel:HandyJSON,Hashable{
DolphinEnglishLearnStudent/Moudle/Home/HomeListenFight_lesson_1_VC.swift
@@ -38,6 +38,7 @@
                                flowLayout.scrollDirection = .vertical
                                let collection = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
                                collection.register(UINib(nibName: "ListenFight_lesson_1_CCell", bundle: nil), forCellWithReuseIdentifier: "_ListenFight_lesson_1_CCell")
                                collection.isScrollEnabled = false
                                return collection
                }()
DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift
@@ -6,6 +6,7 @@
//
import UIKit
import JQTools
class ListenFight_Game_Pocket_CCell: UICollectionViewCell {
@@ -100,7 +101,7 @@
                                layoutIfNeeded()
                }
                private func cellPlaying(){
                func cellPlaying(){
                                img2.isHidden = false
                                img1.isHidden = true
                                playBtn.isHidden = true
@@ -130,15 +131,17 @@
                                fatalError("init(coder:) has not been implemented")
                }
                @objc func toFromAction(){
                @objc func toFromAction(_ superView:UIView? = nil){
                                superView?.isUserInteractionEnabled = false
                                UIView.transition(from: mask_img, to: answer_img, duration: 0.6, options: [.transitionFlipFromLeft,.showHideTransitionViews]) { _ in
                                                superView?.isUserInteractionEnabled = true
                                }
                }
                @objc func toBackAction(){
                @objc func toBackAction(_ superView:UIView? = nil){
                                superView?.isUserInteractionEnabled = false
                                UIView.transition(from: answer_img, to: mask_img, duration: 0.6,options: [.transitionFlipFromRight,.showHideTransitionViews]){ _ in
                                                superView?.isUserInteractionEnabled = true
                                }
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift
@@ -191,8 +191,8 @@
                }
                private func showGameLevel(){
                                ChooseLevelView.show {[weak self] level in
                private func showGameLevel(canLevel:Int){
                                ChooseLevelView.show(canLevel: canLevel) {[weak self] level in
                                                guard let weakSelf = self else { return }
                                                weakSelf.viewModel.gameLevel.accept(level)
                                                Services.gameHearing(difficulty: level, quarter: weakSelf.viewModel.quarter.value!, week: weakSelf.viewModel.week.value!).subscribe(onNext: {result in
@@ -202,10 +202,10 @@
                                                                                                weakSelf.pageVC.reloadData()
                                                                                }
                                                                }
                                                },onError: { _ in
                                                                weakSelf.showGameLevel()
                                                },onError: {[weak self] _ in
                                                                self?.navigationController?.popViewController(animated: true)
                                                }).disposed(by: weakSelf.disposeBag)
                                } cancelClouse: {[weak self] in
                                } cancelClouse: { [weak self] in
                                                self?.navigationController?.popViewController(animated: true)
                                }
                }
@@ -251,9 +251,8 @@
                                                var asComplete:Bool = false
                                                switch weakSelf.viewModel.listenType.value {
                                                                case .lesson1,.lesson2,.lesson3,.lesson4,.lesson5:asComplete = nextPage >= (weakSelf.data as! ListenNewModel).subjectList.count
                                                                case .game1,.game2:asComplete = true
                                                                case .story1,.story2: asComplete = nextPage >= (weakSelf.data as! Listen1Model).storyList.count
                                                                default:break
                                                }
                                                if asComplete{
@@ -309,7 +308,7 @@
                                                                label_pageNum.isHidden = true
                                                                if viewModel.listenType.value == .game1{
                                                                                showGameLevel()
                                                                                showGameLevel(canLevel: studyScheduleModel?.gameDifficulty ?? 0)
                                                                }
                                                case .story1,.story2:
                                                                let count = (data as! Listen1Model).storyList.count
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_2_VC.swift
@@ -36,6 +36,7 @@
                                flowLayout.scrollDirection = .vertical
                                let collection = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
                                collection.register(UINib(nibName: "ListenFight_lesson_1_CCell", bundle: nil), forCellWithReuseIdentifier: "_ListenFight_lesson_1_CCell")
                                collection.isScrollEnabled = false
                                return collection
                }()
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_3_VC.swift
@@ -20,6 +20,7 @@
                                let collection = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
                                collection.register(UINib(nibName: "ListenFight_lesson_3_CCell", bundle: nil), forCellWithReuseIdentifier: "_ListenFight_lesson_3_CCell")
                                collection.register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header")
                                collection.isScrollEnabled = false
                                return collection
                }()
@@ -151,6 +152,8 @@
                @objc private func chooseAnswerAction(btn:UIButton){
                                guard viewModel.selectIndex != nil else {return}
                                if !islisten{
                                                alertError(msg: "请先听题");return
                                }
@@ -225,6 +228,7 @@
                                                                }
                                                                guard ansterIndePath != nil else {return}
                                                                self.viewModel.selectIndex.accept(nil)
                                                                if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_ListenFight_lesson_3_CCell", for: ansterIndePath!) as? ListenFight_lesson_3_CCell{
                                                                                var newFrame = cell.img_cover.convert(cell.img_cover.bounds, to: self.view)
@@ -235,10 +239,8 @@
                                                                                } completion: { _ in
                                                                                                self.answterCount += 1
                                                                                                self.voicePlayer.playerAt(url: self.listenNewModel.subjectList[self.page][valueIndex].correct)
                                                                                                DispatchQueue.main.asyncAfter(deadline: .now()+1.0) {
                                                                                                                self.setAnswerStackView()
                                                                                                                self.viewModel.selectIndex.accept(nil)
                                                                                                                let v = self.rootViewModel.answerCount.value + 1
                                                                                                                self.rootViewModel.answerCount.accept(v)
                                                                                                                self.collectionView.reloadData()
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_4_VC.swift
@@ -17,7 +17,9 @@
                private var answerIndex:IndexPath? //答案的Index
                private var answerCount:Int = 0 //回答计数
                private var answerIndexs = Set<IndexPath>() //回答过的Index集合
                private var filterItems = [[Listen1SubModel]]() //此类型特殊,需要数据清理
//                private var isPlayedAnsterSet = Set<Int>() //已经播放了的
                private lazy var stackView:UIStackView = {
                                let sta = UIStackView()
@@ -37,6 +39,7 @@
                                collection.contentInset = UIEdgeInsets(top: 33, left: 0, bottom: 0, right: 0)
                                collection.register(UINib(nibName: "ListenFight_lesson_4_CCell", bundle: nil), forCellWithReuseIdentifier: "_ListenFight_lesson_4_CCell")
                                collection.register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header")
                                collection.isScrollEnabled = false
                                return collection
                }()
@@ -58,7 +61,7 @@
                }
                func restore(){
                                answerIndexs.removeAll()
                                answerCount = 0
                                answerIndex = nil
                                for subView in view.subviews{
@@ -142,12 +145,18 @@
                                for i in 0...2{
                                                let answerView = Lesson_4_AnswerView.jq_loadNibView()
                                                answerView.btn_choose.tag = 10 + i
                                                answerView.tag = 20 + i
                                                answerView.voiceUrl = tempVoiceArray[i]
                                                answerView.btn_isAnswer.setImage(viewModel.selectIndex.value?.row == 1 ? UIImage(named: "icon_question"):UIImage(named: "icon_answer"), for: .normal)
                                                answerView.btn_choose.addTarget(self, action: #selector(answerAction), for: .touchUpInside)
                                                answerView.alpha = 0
                                                answerView.snp.makeConstraints { make in
                                                                make.width.equalTo(221)
                                                                make.height.equalTo(52)
                                                }
                                                answerView.btn_choose.isEnabled = false
                                                answerView.playAt { index in
                                                                answerView.btn_choose.isEnabled = true
                                                }
                                                UIView.animate(withDuration: 0.05 + Double(i)) {
@@ -159,6 +168,17 @@
                }
                @objc func answerAction(btn:UIButton){
                                var islistenDone:Int = 0
                                for v in stackView.arrangedSubviews as! [Lesson_4_AnswerView]{
                                                if v.btn_choose.isEnabled == true{
                                                                islistenDone += 1
                                                }
                                }
                                if islistenDone != 3{
                                                alertError(msg: "请先听完");return
                                }
                                guard let selectIndex = viewModel.selectIndex.value else{
                                                alertError(msg: "请先听题");return
@@ -186,16 +206,25 @@
                                if tempSubV?.voiceUrl == answerModel?.correct{
                                                answerType = .success
                                                voicePlayer.playSuccessVoice()
                                                answerCount += 1
                                                rootViewModel.correctNum += 1
                                                let v = rootViewModel.answerCount.value + 1
                                                rootViewModel.answerCount.accept(v)
                                                DispatchQueue.main.asyncAfter(deadline: .now()+2) {
                                                                self.voicePlayer.playerAt(url: tempSubV!.voiceUrl)
                                                }
                                                //防止重复答题造成计数错误的问题
                                                if !answerIndexs.contains(answerIndex!){
                                                                answerCount += 1
                                                                rootViewModel.correctNum += 1
                                                                let v = rootViewModel.answerCount.value + 1
                                                                rootViewModel.answerCount.accept(v)
                                                }
                                }else{
                                                answerType = .fail
                                                voicePlayer.playFailVoice()
                                                rootViewModel.errorNum += 1
                                }
                                voicePlayer.playerEnd()
                                answerIndexs.insert(answerIndex!)
                                switch answerType {
                                                case .success:
@@ -203,8 +232,12 @@
                                                                                if let copyView = tempSubV?.copyView(){
                                                                                                tempSubV?.alpha = 0
                                                                                                let newRect = tempSubV!.view_handle.convert(tempSubV!.bounds, to: self.view)
                                                                                                copyView.frame = CGRect(origin: newRect.origin, size: CGSize(width: 152, height: 52))
                                                                                                copyView.frame = CGRect(origin: newRect.origin, size: CGSize(width: 159, height: 52))
                                                                                                copyView.view_state.isHidden = true
                                                                                                copyView.isCopy = true
                                                                                                copyView.btn_isAnswer.setImage(self.viewModel.selectIndex.value?.row == 1 ? UIImage(named: "icon_question"):UIImage(named: "icon_answer"), for: .normal)
                                                                                                copyView.img_play.alpha = 1
                                                                                                copyView.voiceUrl = tempSubV!.voiceUrl
                                                                                                self.view.addSubview(copyView)
                                                                                                self.view.layoutIfNeeded()
@@ -216,7 +249,7 @@
                                                                                                                self.collectionView.reloadData()
                                                                                                                UIView.animate(withDuration: 0.4) {
                                                                                                                                copyView.frame = CGRect(origin: newRect1.origin, size: CGSize(width: 152, height: 52))
                                                                                                                                copyView.frame = CGRect(origin: newRect1.origin, size: CGSize(width: 159, height: 52))
                                                                                                                } completion: { _ in
                                                                                                                                self.viewModel.selectIndex.accept(nil)
                                                                                                                                for v in self.stackView.subviews{
@@ -225,7 +258,7 @@
                                                                                                                                self.stackView.layoutIfNeeded()
                                                                                                                                //回答完成,下一答题
                                                                                                                                if self.answerCount == 2{
                                                                                                                                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]
@@ -254,9 +287,7 @@
}
extension HomeListenFight_lesson_4_VC:UICollectionViewDelegate{
                func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
//                                viewModel.selectIndex.accept(indexPath)
                }
}
extension HomeListenFight_lesson_4_VC:UICollectionViewDelegateFlowLayout{
@@ -296,14 +327,32 @@
                                                cell.img_state.alpha = 0
                                                cell.img_state.transform = .init(scaleX: 0.1, y: 0.1)
                                }
                                if indexPath.row == 1{
                                                cell.btn_handle.setImage(UIImage(named: "icon_answer"), for: .normal)
                                                cell.view_handle.isHidden = true
                                }else{
                                                cell.btn_handle.setImage(UIImage(named: "icon_question"), for: .normal)
                                                cell.view_handle.isHidden = true
                                }
                                //问题
                                if filterItems[indexPath.section][indexPath.row].isQuestion == 0{
                                                cell.btn_handle.setImage(UIImage(named: "icon_question"), for: .normal)
                                                cell.view_handle.isHidden = true
                                }else{
                                                cell.view_handle.isHidden = false
                                }
                                cell.setModel(m)
                                if answerIndexs.count == 0 && indexPath.section == 1{
                                                cell.view_handle.backgroundColor = .gray.withAlphaComponent(0.5)
                                                cell.btn_play.isEnabled = false
                                }else{
                                                cell.view_handle.backgroundColor = UIColor(hexString: "#41A2EB")
                                                cell.btn_play.isEnabled = true
                                }
                                return cell
                }
@@ -324,10 +373,10 @@
extension HomeListenFight_lesson_4_VC:VoicePlayerDelegate{
                func playComplete() {
                                self.view.isUserInteractionEnabled = true
                }
                
                func playing() {
                                self.view.isUserInteractionEnabled = false
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFight_lesson_5_VC.swift
@@ -29,6 +29,7 @@
                                let collection = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
                                collection.register(UINib(nibName: "ListenFight_lesson_1_CCell", bundle: nil), forCellWithReuseIdentifier: "_ListenFight_lesson_1_CCell")
                                collection.register(UICollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "header")
                                collection.isScrollEnabled = false
                                return collection
                }()
@@ -303,6 +304,7 @@
extension HomeListenFight_lesson_5_VC:VoicePlayerDelegate{
                func playComplete() {
                                view.isUserInteractionEnabled = true
                                isListen = true
                                for subV in stackView.arrangedSubviews as! [VoiceHandleView]{
                                                subV.resetView()
@@ -324,7 +326,7 @@
                }
                
                func playing() {
                                view.isUserInteractionEnabled = false
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift
@@ -53,6 +53,7 @@
                                let collection = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
                                collection.contentInset = UIEdgeInsets(top: 0, left: 35, bottom: 0, right: 35)
                                collection.register(UINib(nibName: "ListenFight_Game_CCell", bundle: nil), forCellWithReuseIdentifier: "_ListenFight_Game_CCell")
                                collection.isScrollEnabled = false
                                return collection
                }()
@@ -94,10 +95,6 @@
    override func viewDidLoad() {
        super.viewDidLoad()
                                #if DEBUG
                                listen1Model?.data?.time = 60
                                #endif
                                if  listen1Model != nil{
                                                times = listen1Model?.data?.time ?? 10
@@ -197,15 +194,17 @@
                                                totalCount += 1
                                                rootViewModel.errorNum += 1
                                                label_class.text = "\(totalCount)"
                                                //答题完成
                                                if self.answerSet.count == 0{completeQuestion()}
                                }
                                //答题完成
                                if self.answerSet.count == 0{
                                                timer?.invalidate()
                                                completeQuestion()
                                }
                }
                private func answerQuestion(){
                                view.layoutIfNeeded()
                                view.isUserInteractionEnabled = false
                                guard let row = viewModel.selectIndex.value?.row else { alertError(msg: "请选择");return  }
                                var answerType:Fight_lessonType = .none
@@ -221,7 +220,6 @@
                                                case .success:
                                                                viewModel.answerType.accept(.success)
                                                                collectionView.reloadData()
                                                                rootViewModel.correctNum += 1
                                                                if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_ListenFight_Game_CCell", for: viewModel.selectIndex.value!) as? ListenFight_Game_CCell{
                                                                                let newRect = cell.contentView.convert(cell.bounds, from: self.collectionView)
                                                                                let x = abs(newRect.origin.x) + self.collectionView.contentInset.left + 5
@@ -238,9 +236,9 @@
                                                                                                                self.voicePlayer.playerAt(url: self.currentAnswer?.correct)
                                                                                                                self.timer?.fireDate = .distantFuture
                                                                                                                //答题完成
                                                                                                                if self.answerSet.count == 0{
                                                                                                                                self.completeQuestion()
                                                                                                                }
//                                                                                                                if self.answerSet.count == 0{
//                                                                                                                                self.completeQuestion()
//                                                                                                                }
                                                                                                }
                                                                                }
                                                                }
@@ -298,6 +296,7 @@
extension HomeListenGame_1_VC:VoicePlayerDelegate{
                func playComplete() {
                                view.isUserInteractionEnabled = true
                                view_studyHandleView.resetView()
                                if viewModel.answerType.value == .success{
@@ -317,9 +316,14 @@
                                                                self.timer?.fireDate = .distantPast
                                                }
                                }
                                //答题完成
                                if self.answerSet.count == 0{completeQuestion()}
                }
                
                func playing() {
                                view.isUserInteractionEnabled = false
                                view_studyHandleView.playing()
                }
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift
@@ -43,6 +43,7 @@
                                let collection = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
                                collection.contentInset = UIEdgeInsets(top: 101, left: 40, bottom: 0, right: 40)
                                collection.register(ListenFight_Game_Pocket_CCell.self, forCellWithReuseIdentifier: "_ListenFight_Game_Pocket_CCell")
                                collection.isScrollEnabled = false
                                return collection
                }()
@@ -148,38 +149,60 @@
                                }
                }
                //判断检查两个Cell情况
                private func checking(){
                private func nextQuesAction(){
                                guard selectModels.count == 2 else {return}
                }
                                let firstM = selectModels.first
                                let lastM = selectModels.last
                private func answerQuestion(){
                                view.layoutIfNeeded()
                                var answerType:Fight_lessonType = .none
                                answerType = .success
                                switch answerType {
                                                case .success:
                                                                voicePlayer.playSuccessVoice()
                                if firstM != nil && lastM != nil{
                                                if firstM!.model.id == lastM!.model.id{
                                                                firstM!.model.isOpen = true
                                                                lastM?.model.isOpen = true
                                                                selectModels.removeAll()
                                                                print("相同")
                                                                viewModel.answerType.accept(.success)
                                                                collectionView.reloadData()
                                                case .fail:
                                                                voicePlayer.playFailVoice()
                                                                rootViewModel.correctNum += 1
                                                                voicePlayer.playSuccessVoice()
                                                                self.selectModels.removeAll()
                                                }else{
                                                                print("不相同")
                                                                viewModel.answerType.accept(.fail)
                                                                collectionView.reloadData()
                                                                DispatchQueue.main.asyncAfter(wallDeadline: .now()+2.5) {
                                                                                self.viewModel.answerType.accept(.none)
                                                                                self.collectionView.reloadData()
                                                                rootViewModel.errorNum += 1
                                                                let firstIndex = firstM!.indexPath
                                                                let secondIndex = lastM!.indexPath
                                                                voicePlayer.playFailVoice()
                                                                let firstIndexCell = self.collectionView.cellForItem(at: firstIndex!) as! ListenFight_Game_Pocket_CCell
                                                                let secondIndexCell = self.collectionView.cellForItem(at: secondIndex!) as! ListenFight_Game_Pocket_CCell
                                                                self.view.isUserInteractionEnabled = false
                                                                DispatchQueue.main.asyncAfter(deadline: .now()+3.0){
                                                                                firstIndexCell.toBackAction(self.view)
                                                                                secondIndexCell.toBackAction(self.view)
                                                                                self.selectModels.removeAll()
                                                                }
                                                case .none:
                                                                break
                                                }
                                }
                                let surplusListCount = datas.filter({$0.isOpen == false}).count
                                if surplusListCount == 0{
                                                NotificationCenter.default.post(name: NextLession_Noti, object: ["gameId":listen1Model.data!.id,"gameIntegral":listen1Model.data!.integral])
                                                rootViewModel.answerItems[0] = self.listen1Model
                                                timer?.invalidate()
                                }
                                print("剩余:\(surplusListCount)")
                }
}
extension HomeListenGame_2_VC:UICollectionViewDelegate{
                func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
                                if voicePlayer.isPlaying{
                                                print("正在播放语音");return
                                }
                                if datas[indexPath.row].isOpen{
                                                print("已经展开过了");return
@@ -201,48 +224,26 @@
                                if selectModels.count == 1{
                                                let cell = self.collectionView.cellForItem(at: indexPath) as! ListenFight_Game_Pocket_CCell
                                                cell.toFromAction()
                                                cell.toFromAction(self.view)
                                                if model.type == 2{
                                                                //播放
                                                                cell.cellPlaying()
                                                                voicePlayer.playerAt(url: model.voice)
                                                }
                                }
                                if selectModels.count == 2{
                                                let cell = self.collectionView.cellForItem(at: indexPath) as! ListenFight_Game_Pocket_CCell
                                                cell.toFromAction()
                                                cell.toFromAction(self.view)
                                                let firstM = selectModels.first
                                                let lastM = selectModels.last
                                                if firstM != nil && lastM != nil{
                                                                if firstM!.model.id == lastM!.model.id{
                                                                                firstM!.model.isOpen = true
                                                                                lastM?.model.isOpen = true
                                                                                selectModels.removeAll()
                                                                                print("相同")
                                                                                rootViewModel.correctNum += 1
                                                                }else{
                                                                                print("不相同")
                                                                                rootViewModel.errorNum += 1
                                                                                let firstIndex = firstM!.indexPath
                                                                                let secondIndex = lastM!.indexPath
                                                                                let firstIndexCell = self.collectionView.cellForItem(at: firstIndex!) as! ListenFight_Game_Pocket_CCell
                                                                                let secondIndexCell = self.collectionView.cellForItem(at: secondIndex!) as! ListenFight_Game_Pocket_CCell
                                                                                DispatchQueue.main.asyncAfter(deadline: .now()+0.5){
                                                                                                firstIndexCell.toBackAction()
                                                                                                secondIndexCell.toBackAction()
                                                                                                self.selectModels.removeAll()
                                                                                }
                                                                }
                                                if model.type == 2{
                                                                //语音先播放,再评估
                                                                cell.cellPlaying()
                                                                voicePlayer.playerAt(url: model.voice)
                                                                return
                                                }
                                                let surplusListCount = datas.filter({$0.isOpen == false}).count
                                                if surplusListCount == 0{
                                                                NotificationCenter.default.post(name: NextLession_Noti, object: ["gameId":listen1Model.data!.id,"gameIntegral":listen1Model.data!.answerIntegral])
                                                                rootViewModel.answerItems[0] = self.listen1Model
                                                                timer?.invalidate()
                                                }
                                                print("剩余:\(surplusListCount)")
                                                checking()
                                }
                }
}
@@ -301,14 +302,17 @@
extension HomeListenGame_2_VC:VoicePlayerDelegate{
                func playComplete() {
                                view.isUserInteractionEnabled = true
                                //正在播放的语音Cell要归位
                                if let index = currentPayCellIndex{
                                                let cell = collectionView.cellForItem(at: index) as! ListenFight_Game_Pocket_CCell
                                                cell.cellResotePay()
                                }
                                checking()
                }
                func playing() {
                                view.isUserInteractionEnabled = false
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift
@@ -66,6 +66,7 @@
                                viewModel.selectIndex.accept(IndexPath(row: 0, section: 0))
                                collectionView.delegate = self
                                collectionView.dataSource = self
                                collectionView.isScrollEnabled = false
                                collectionView.showsVerticalScrollIndicator = false
                                collectionView.backgroundColor = .clear
                                collectionView.jq_addShadows(shadowColor: UIColor.black.withAlphaComponent(0.1), corner: 8, radius: 10, offset: CGSize(width: 0, height: 2), opacity: 1)
@@ -103,6 +104,10 @@
                                                handleView.tag = 20 + index
                                                handleView.chooseClouse {[weak self] btn in
                                                                guard let weakSelf = self else { return }
                                                                if weakSelf.isPlayedSet.count != 3{
                                                                                handleView.btn_choose.isSelected = false
                                                                                alertError(msg: "请听完");return
                                                                }
                                                                var lessionType:Fight_lessonType = .none
                                                                if weakSelf.listen1Model.storyList[weakSelf.page].correct == handleView.vioceSoundUrl{
@@ -226,11 +231,11 @@
extension HomeListenStory_1_VC:VoicePlayerDelegate{
                func playComplete() {
                                view.isUserInteractionEnabled = true
                                if viewModel.answerType.value == .success{
                                                DispatchQueue.main.asyncAfter(delay: 3.0) {
                                                                var dict = Dictionary<String,Any>()
                                                                dict["storyIntegral"] = self.listen1Model.data?.lookIntegral ?? 0
                                                                dict["storyIntegral"] = self.listen1Model.data?.integral ?? 0
                                                                dict["storyId"] = self.listen1Model.data?.id ?? 0
                                                                NotificationCenter.default.post(name: NextLession_Noti, object: dict)
                                                }
@@ -244,6 +249,6 @@
                }
                func playing() {
                                view.isUserInteractionEnabled = false
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift
@@ -47,11 +47,12 @@
                override func viewDidAppear(_ animated: Bool) {
                                super.viewDidAppear(animated)
                                voicePlayer.delegate = self
                }
                override func viewDidDisappear(_ animated: Bool) {
                                super.viewDidDisappear(animated)
                                voicePlayer.delegate = nil
                                voicePlayer.playerInterrupt()
                }
@@ -65,6 +66,7 @@
                                collectionView.showsVerticalScrollIndicator = false
                                collectionView.backgroundColor = .clear
                                collectionView.jq_addShadows(shadowColor: UIColor.black.withAlphaComponent(0.1), corner: 8, radius: 10, offset: CGSize(width: 0, height: 2), opacity: 1)
                                collectionView.isScrollEnabled = false
                                view.addSubview(collectionView)
                                collectionView.snp.makeConstraints { make in
                                                make.top.equalTo(self.view.safeAreaLayoutGuide.snp.top).offset(0)
@@ -129,3 +131,15 @@
                                return 1
                }
}
extension HomeListenStory_2_VC:VoicePlayerDelegate{
                func playComplete() {
                                view.isUserInteractionEnabled = true
                }
                func playing() {
                                view.isUserInteractionEnabled = false
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenSubVC.swift
@@ -72,6 +72,8 @@
extension HomeListenSubVC:UITableViewDelegate{
                func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
                                if page <= 4 && indexPath.section == 0{return}
                                let day = page + 1
                                if page <= 4{
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift
@@ -13,7 +13,10 @@
                @IBOutlet weak var view_container: UIView!
                @IBOutlet weak var tackView_level: UIStackView!
                @IBOutlet weak var btn_level3: QMUIButton!
                @IBOutlet weak var btn_level2: QMUIButton!
                @IBOutlet weak var btn_level1: QMUIButton!
                private var clouseLevel:((Int)->Void)!
                private var cancelClouse:(()->Void)!
                private var level:Int = 0
@@ -25,7 +28,7 @@
                                layoutIfNeeded()
                }
                static func show(clouse:@escaping (Int)->Void,cancelClouse:@escaping()->Void){
                static func show(canLevel:Int,clouse:@escaping (Int)->Void,cancelClouse:@escaping()->Void){
                                var needLoad:Bool = true
                                for v in sceneDelegate?.window?.subviews ?? []{
@@ -39,6 +42,22 @@
                                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 3:
                                                                levelView.btn_level3.isEnabled = true
                                                                fallthrough
                                                case 2:
                                                                levelView.btn_level2.isEnabled = true
                                                                fallthrough
                                                case 1:
                                                                levelView.btn_level1.isEnabled = true
                                                default:
                                                                levelView.btn_level1.isEnabled = true
                                }
                                UIView.animate(withDuration: 0.4) {
                                                levelView.transform = .init(scaleX: 1.0, y: 1.0)
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.xib
@@ -171,6 +171,9 @@
                <constraint firstItem="x4l-72-4Ul" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="vBn-p9-1pN"/>
            </constraints>
            <connections>
                <outlet property="btn_level1" destination="90w-7c-Frs" id="rZH-M7-kAS"/>
                <outlet property="btn_level2" destination="GxK-lP-67f" id="lWd-Ku-ufs"/>
                <outlet property="btn_level3" destination="JeY-VZ-dhW" id="OKo-fk-5fp"/>
                <outlet property="tackView_level" destination="5Gu-z5-bpP" id="mpe-aW-FdQ"/>
                <outlet property="view_container" destination="x4l-72-4Ul" id="twD-2O-23d"/>
            </connections>
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/Lesson_4_AnswerView.swift
@@ -14,24 +14,39 @@
                @IBOutlet weak var btn_choose: UIButton!
                @IBOutlet weak var view_state: UIView!
                @IBOutlet weak var view_handle: UIView!
                @IBOutlet weak var btn_isAnswer: UIButton!
                @IBOutlet weak var img_play: UIImageView!
                var voiceUrl:String?
                var isCopy:Bool = false
                var playAtClouse:((Int)->Void)?
                override func awakeFromNib() {
                                super.awakeFromNib()
                                img_state.alpha = 0
                                img_play.alpha = 0
                                VoicePlayer.share().playEnd {
                                                if self.isCopy{
                                                                self.img_play.alpha = 1
                                                }
                                }
                }
                func copyView()->Lesson_4_AnswerView{
                                let copyV = Lesson_4_AnswerView.jq_loadNibView()
                                copyV.bounds = self.bounds
                                return copyV
                }
                func playAt(_ clouse:@escaping(Int)->Void){
                                self.playAtClouse = clouse
                }
                @IBAction func playAction(_ sender: UIButton) {
                                if let url = voiceUrl{
                                                VoicePlayer.share().playerAt(url: url)
                                                img_play.alpha = 0
                                                playAtClouse?(self.tag)
                                }
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/Lesson_4_AnswerView.xib
@@ -43,14 +43,19 @@
                                        <action selector="playAction:" destination="iN0-l3-epB" eventType="touchUpInside" id="mAa-LF-0SJ"/>
                                    </connections>
                                </button>
                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_play" translatesAutoresizingMaskIntoConstraints="NO" id="YeU-8E-35u">
                                    <rect key="frame" x="102" y="10" width="32" height="32"/>
                                </imageView>
                            </subviews>
                            <color key="backgroundColor" red="0.25490196079999999" green="0.63529411759999999" blue="0.92156862750000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                            <constraints>
                                <constraint firstItem="mba-RI-50M" firstAttribute="leading" secondItem="otl-1Z-qED" secondAttribute="trailing" constant="19" id="0nx-t9-1zV"/>
                                <constraint firstItem="YeU-8E-35u" firstAttribute="centerY" secondItem="tfO-7L-o0T" secondAttribute="centerY" id="2DM-IT-SGr"/>
                                <constraint firstAttribute="width" constant="152" id="3Zx-vg-H2U"/>
                                <constraint firstItem="otl-1Z-qED" firstAttribute="leading" secondItem="qsr-6I-w3R" secondAttribute="leading" constant="18" id="6CA-c8-Zr7"/>
                                <constraint firstAttribute="bottom" secondItem="tfO-7L-o0T" secondAttribute="bottom" id="8ro-2n-YNH"/>
                                <constraint firstAttribute="trailing" secondItem="tfO-7L-o0T" secondAttribute="trailing" id="A2h-po-R4k"/>
                                <constraint firstAttribute="trailing" secondItem="YeU-8E-35u" secondAttribute="trailing" constant="18" id="DAX-dg-Ase"/>
                                <constraint firstItem="mba-RI-50M" firstAttribute="centerY" secondItem="otl-1Z-qED" secondAttribute="centerY" id="FTc-eb-PWk"/>
                                <constraint firstItem="tfO-7L-o0T" firstAttribute="top" secondItem="qsr-6I-w3R" secondAttribute="top" id="HqC-Ia-1OU"/>
                                <constraint firstItem="mkh-g4-79e" firstAttribute="centerY" secondItem="otl-1Z-qED" secondAttribute="centerY" id="N6f-d4-80e"/>
@@ -95,6 +100,8 @@
            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
            <connections>
                <outlet property="btn_choose" destination="v7f-gv-EWR" id="wFE-Gp-xAd"/>
                <outlet property="btn_isAnswer" destination="otl-1Z-qED" id="0Fg-A8-9dl"/>
                <outlet property="img_play" destination="YeU-8E-35u" id="Xvc-ls-0sz"/>
                <outlet property="img_state" destination="mkh-g4-79e" id="IzD-w8-jjK"/>
                <outlet property="view_handle" destination="qsr-6I-w3R" id="ptU-09-NIc"/>
                <outlet property="view_state" destination="Gbs-f8-132" id="Swt-nY-Bpv"/>
@@ -107,6 +114,7 @@
        <image name="btn_radio_u" width="52" height="52"/>
        <image name="icon_answer" width="28" height="14"/>
        <image name="icon_fail" width="80" height="80"/>
        <image name="icon_play" width="32" height="32"/>
        <image name="icon_play_1" width="27" height="27"/>
    </resources>
</document>
DolphinEnglishLearnStudent/Services/Services.swift
@@ -12,8 +12,8 @@
import JQTools
#if DEBUG
let All_Url = "http://192.168.110.237:9000"
//let All_Url = "http://1.95.15.237:9000"
//let All_Url = "http://192.168.110.237:9000"
let All_Url = "http://1.95.15.237:9000"
#else
let All_Url = "http://1.95.15.237:9000"
#endif