fix
无故事王国
2024-06-13 5c9191f42013d24360a3ef9e7ddd701c5a1a6209
fix
17个文件已修改
529 ■■■■ 已修改文件
DolphinEnglishLearnStudent.xcodeproj/project.pbxproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Config/VoicePlayer.swift 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Models/CommonModel.swift 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_CCell.swift 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/TCell/HomeListen_process_TCell.swift 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift 93 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift 67 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenSubVC.swift 37 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenVC.swift 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.swift 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.xib 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent/Other/UIView/StudyHandleView.swift 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DolphinEnglishLearnStudent.xcodeproj/project.pbxproj
@@ -947,9 +947,11 @@
            buildSettings = {
                ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
                ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
                "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
                CODE_SIGN_STYLE = Manual;
                CURRENT_PROJECT_VERSION = 1;
                DEVELOPMENT_TEAM = "";
                "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 5ZV937VB25;
                ENABLE_USER_SCRIPT_SANDBOXING = NO;
                GENERATE_INFOPLIST_FILE = YES;
                INFOPLIST_FILE = DolphinEnglishLearnStudent/Info.plist;
@@ -967,6 +969,7 @@
                PRODUCT_BUNDLE_IDENTIFIER = com.sinata.dollearn.test;
                PRODUCT_NAME = "$(TARGET_NAME)";
                PROVISIONING_PROFILE_SPECIFIER = "";
                "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = dev_dollearn;
                SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
                SUPPORTS_MACCATALYST = NO;
                SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
DolphinEnglishLearnStudent/Config/VoicePlayer.swift
@@ -87,7 +87,6 @@
                func playerEnd(){
                                player?.stop()
                                playComplete?()
                }
                func playEnd(course:@escaping ()->Void){
DolphinEnglishLearnStudent/Models/CommonModel.swift
@@ -239,10 +239,28 @@
                var week = 0
}
class ListenNewModel:HandyJSON{
                var data:ListenNewDataModel?
                var subjectList = [[Listen1SubModel]]()
                required init(){}
}
class ListenNewDataModel:HandyJSON{
                var id = 0
                var integral = 0
                required init(){}
}
class Listen1Model:HandyJSON{
                var data:Listen1DataModel?
                var subjectList = [Listen1SubModel]()
                var storyList = [Listen1SubModel]()
                //超级记忆专用
                var photoList = [SimpleListenDataModel]()
                var voiceList = [SimpleListenDataModel]()
                required init(){}
}
@@ -329,6 +347,7 @@
struct StudyScheduleModel:HandyJSON{
                var answer: Int = 0
                var day: Int = 0
                var computeSchedule:Int = 0
                var id: Int = 0
                var induction: Int = 0
                var listen: Int = 0
@@ -342,3 +361,24 @@
                var week: Int = 0
                var weekStudy: Int = 0
}
class SimpleListenDataModel:HandyJSON,Hashable{
                required init() {}
                static func == (lhs: SimpleListenDataModel, rhs: SimpleListenDataModel) -> Bool {
                                return lhs.id == rhs.id
                }
                func hash(into hasher: inout Hasher) {
                }
                var id = 0
                var photo = ""
                var voice = ""
                //游戏类型2专用
                var isOpen:Bool = false
                var type = 0 // 1:图片 2:音频
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_CCell.swift
@@ -20,7 +20,9 @@
    }
                func setState(state:Fight_lessonType){
                                img_state.alpha = 0
                                img_state.transform = .init(scaleX: 0.1, y: 0.1)
                                img_state.layoutIfNeeded()
                                switch state {
                                                case .success:
                                                                img_state.image = UIImage(named: "icon_success")
@@ -28,6 +30,12 @@
                                                                                self.img_state.alpha = 1
                                                                                self.img_state.transform = .init(scaleX: 1, y: 1)
                                                                }
                                                                DispatchQueue.main.asyncAfter(deadline: .now()+3) {
                                                                                UIView.animate(withDuration: 0.6) {
                                                                                                self.img_state.alpha = 0
                                                                                                self.img_state.transform = .init(scaleX: 0.1, y: 0.1)
                                                                                }
                                                                }
                                                case .fail:
                                                                img_state.image = UIImage(named: "icon_fail")
                                                                UIView.animate(withDuration: 0.6, delay: 0, usingSpringWithDamping: 0.3, initialSpringVelocity: 0.4, options: .layoutSubviews) {
DolphinEnglishLearnStudent/Moudle/Home/Listen/CCell/ListenFight_Game_Pocket_CCell.swift
@@ -29,8 +29,14 @@
                                return voiceView
                }()
                private var model:Listen1SubModel!
                let img1 = UIImageView(image: UIImage(named: "icon_play_1")!.withTintColor(UIColor(hexString: "#41A2EB")!))
                let img2 = UIImageView(image: UIImage(named: "icon_playing")!.withTintColor(UIColor(hexString: "#41A2EB")!))
                let playBtn = UIButton(type: .custom)
                private var model:SimpleListenDataModel!
                var indexPath:IndexPath!
                private var playIndexClouse:((IndexPath)->Void)?
                override init(frame: CGRect) {
                                super.init(frame: frame)
@@ -61,8 +67,6 @@
                                                make.bottom.equalTo(-55)
                                }
                                let img1 = UIImageView(image: UIImage(named: "icon_play_1")!.withTintColor(UIColor(hexString: "#41A2EB")!))
                                contentVoiceView.addSubview(img1)
                                img1.snp.makeConstraints { make in
                                                make.left.equalTo(23)
@@ -70,7 +74,14 @@
                                                make.centerY.equalToSuperview()
                                }
                                let playBtn = UIButton(type: .custom)
                                contentVoiceView.addSubview(img2)
                                img2.snp.makeConstraints { make in
                                                make.width.equalTo(45)
                                                make.height.equalTo(31)
                                                make.center.equalToSuperview()
                                }
                                playBtn.addTarget(self, action: #selector(playAction), for: .touchUpInside)
                                playBtn.setImage(UIImage(named: "icon_play")?.withTintColor(UIColor(hexString: "#41A2EB")!), for: .normal)
                                contentVoiceView.addSubview(playBtn)
@@ -79,17 +90,40 @@
                                                make.width.height.equalTo(32)
                                                make.centerY.equalToSuperview()
                                }
                                cellResotePay()
                }
                func cellResotePay(){
                                img2.isHidden = true
                                img1.isHidden = false
                                playBtn.isHidden = false
                                layoutIfNeeded()
                }
                private func cellPlaying(){
                                img2.isHidden = false
                                img1.isHidden = true
                                playBtn.isHidden = true
                                playIndexClouse?(indexPath)
                }
                func cellPayatIndex(_ clouse:@escaping (IndexPath)->Void){
                                self.playIndexClouse = clouse
                }
                @objc func playAction(){
                                VoicePlayer.share().playerEnd()
                                VoicePlayer.share().playerAt(url: model.correct)
                                VoicePlayer.share().playerAt(url: model.voice)
                                cellPlaying()
                }
                func setModel(_ model:Listen1SubModel){
                func setSimpleModel(_ model:SimpleListenDataModel){
                                self.model = model
                                answer_img.sd_setImage(with: URL(string: model.img))
                                if model.type == 1{
                                                voice_view.isHidden = true
                                                answer_img.sd_setImage(with: URL(string: model.photo))
                                }else{
                                                voice_view.isHidden = false
                                }
                }
                required init?(coder: NSCoder) {
DolphinEnglishLearnStudent/Moudle/Home/Listen/TCell/HomeListen_process_TCell.swift
@@ -24,8 +24,9 @@
                                                                                .add(string: "|今日学习", withFont: .systemFont(ofSize: 16), withColor: UIColor(hexString: "#2B3648")!)
                                                                                .add(string: "\(m.todayStudy)小时", withFont: .systemFont(ofSize: 16, weight: .medium), withColor: UIColor(hexString: "#2B3648")!).mutableAttributedString
                                                                cons_progress.constant = ((JQ_ScreenW - 234 * 2 - 44) / 100) * Double(m.day)
                                                                label_completeProgress.text = "已完成:\(m.day)%"
                                                                cons_progress.constant = ((JQ_ScreenW - 234 * 2 - 44) / 100) * Double(m.computeSchedule)
                                                                label_completeProgress.text = "已完成:\(m.computeSchedule)%"
                                                }
                                }
                }
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenFightVC.swift
@@ -462,6 +462,13 @@
                                                if let vc = pageViewController.currentController as? HomeListenFight_lesson_5_VC{
                                                                vc.restore()
                                                }
                                                if let vc = pageViewController.currentController as? HomeListenStory_1_VC{
                                                                vc.restore()
                                                }
                                                if let vc = pageViewController.currentController as? HomeListenStory_2_VC{
                                                                vc.restore()
                                                }
                                }
                }
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_1_VC.swift
@@ -38,9 +38,8 @@
                                return label
                }()
                private lazy var view_studyHandleView:StudyHandleView = {
                                let studyHandleView = StudyHandleView.jq_loadNibView()
                                studyHandleView.view_choose.isHidden = true
                private lazy var view_studyHandleView:VoiceHandleView = {
                                let studyHandleView = VoiceHandleView()
                                return studyHandleView
                }()
@@ -58,14 +57,16 @@
                }()
                private var timer:Timer?
                private var times:Int = 60
                private var times:Int = 10
                private var voicePlayer = VoicePlayer.share()
                private var answerSet = Set<Listen1SubModel>()
                private var currentAnswer:Listen1SubModel?{
                                didSet{
                                                if let v = currentAnswer{
                                                                view_studyHandleView.vioceSoundUrl = v.correct
                                                                view_studyHandleView.voicePlayer.playerAt(url: v.correct)
                                                                view_studyHandleView.playUrl = v.correct
                                                                voicePlayer.playerAt(url: v.correct)
                                                                viewModel.answerType.accept(.none)
                                                }
                                }
                }
@@ -79,22 +80,38 @@
                                fatalError("init(coder:) has not been implemented")
                }
                override func viewDidDisappear(_ animated: Bool) {
                                super.viewDidDisappear(animated)
                                timer?.invalidate()
                                voicePlayer.playerEnd()
                }
    override func viewDidLoad() {
        super.viewDidLoad()
                                #if DEBUG
                                listen1Model?.data?.time = 60
                                #endif
                                if  listen1Model != nil{
                                                times = listen1Model?.data?.time ?? 10
                                                collectionView.reloadData()
                                                label_hint.isHidden = false
                                                label_hint.text = "\(totalCount)"
                                                if timer == nil{startTimer()}
                                                label_hint.text = "准备听题"
                                                for v in listen1Model?.subjectList ?? []{
                                                                answerSet.insert(v)
                                                }
                                                print("--->开始答题:剩余:\(answerSet.count)")
                                                currentAnswer = answerSet.randomElement() //随机
                                                DispatchQueue.main.asyncAfter(deadline: .now()+3) {
                                                                self.currentAnswer = self.answerSet.randomElement() //随机
                                                                if self.timer == nil{self.startTimer()}
                                                }
                                }
                                voicePlayer.delegate = self
    }
                override func setUI() {
@@ -168,11 +185,12 @@
                                                if let c = currentAnswer{
                                                                answerSet.remove(c)
                                                }
                                                                currentAnswer = answerSet.randomElement() //随机
                                                            times = listen1Model?.data?.time ?? 0
                                                            timer?.fireDate = .distantPast
                                                            totalCount += 1
                                                            label_class.text = "\(totalCount)"
                                                currentAnswer = answerSet.randomElement() //随机
                                                times = listen1Model?.data?.time ?? 0
                                                timer?.fireDate = .distantPast
                                                totalCount += 1
                                                rootViewModel.errorNum += 1
                                                label_class.text = "\(totalCount)"
                                                //答题完成
                                                if self.answerSet.count == 0{completeQuestion()}
@@ -202,22 +220,15 @@
                                                                                let y = abs(newRect.origin.y) + 99 + 5
                                                                                let layout = self.collectionView.collectionViewLayout as! UICollectionViewFlowLayout
                                                                                let copyView = view_studyHandleView.copyView()
                                                                                copyView.view_choose.isHidden = true
                                                                                view.addSubview(copyView)
                                                                                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.viewModel.answerType.accept(.none)
                                                                                                                self.collectionView.reloadData()
                                                                                                                self.times = self.listen1Model?.data?.time ?? 10
                                                                                                                self.totalCount += 1
                                                                                                                self.label_class.text = "\(self.totalCount)"
                                                                                                                self.answerSet.remove(self.currentAnswer!)
                                                                                                                self.currentAnswer = self.answerSet.randomElement()
                                                                                                                print("--->下一题:\(self.currentAnswer?.id ?? 0) 剩余\(self.answerSet.count)  计数:\(self.totalCount)")
//                                                                                                                self.collectionView.reloadData()
                                                                                                                self.voicePlayer.playerAt(url: self.currentAnswer?.correct)
                                                                                                                self.timer?.fireDate = .distantFuture
                                                                                                                //答题完成
                                                                                                                if self.answerSet.count == 0{
                                                                                                                                self.completeQuestion()
@@ -230,6 +241,9 @@
                                                                rootViewModel.errorNum += 1
                                                                viewModel.answerType.accept(.fail)
                                                                collectionView.reloadData()
                                                                DispatchQueue.main.asyncAfter(deadline: .now()+3) {
                                                                                self.currentAnswer = self.answerSet.randomElement()
                                                                }
                                                case .none:
                                                                break
                                }
@@ -273,3 +287,32 @@
                                return listen1Model?.subjectList.count ?? 0
                }
}
extension HomeListenGame_1_VC:VoicePlayerDelegate{
                func playComplete() {
                                view_studyHandleView.resetView()
                                if viewModel.answerType.value == .success{
                                                self.label_hint.text = "准备请听下一题"
                                                DispatchQueue.main.asyncAfter(deadline: .now()+3) {
                                                                self.times = self.listen1Model?.data?.time ?? 10
#if DEBUG
                                                                self.times = 60
#endif
                                                                self.totalCount += 1
                                                                self.rootViewModel.correctNum += 1
                                                                self.label_class.text = "\(self.totalCount)"
                                                                self.answerSet.remove(self.currentAnswer!)
                                                                self.currentAnswer = self.answerSet.randomElement()
                                                                self.viewModel.answerType.accept(.none)
                                                                print("--->下一题:\(self.currentAnswer?.id ?? 0) 剩余\(self.answerSet.count)  计数:\(self.totalCount)")
                                                                self.timer?.fireDate = .distantPast
                                                }
                                }
                }
                func playing() {
                                view_studyHandleView.playing()
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenGame_2_VC.swift
@@ -9,7 +9,7 @@
struct Game_2_SelectModel:Hashable{
                var indexPath:IndexPath!
                var model:Listen1SubModel!
                var model:SimpleListenDataModel!
}
class HomeListenGame_2_VC: BaseVC {
@@ -18,6 +18,10 @@
                var rootViewModel:HomeListenFightViewModel!
                private var listen1Model:Listen1Model!
                private var selectModels = [Game_2_SelectModel]()
                private var datas = [SimpleListenDataModel]()
                private var currentPayCellIndex:IndexPath?
                private lazy var label_time:UILabel = {
                                let label = UILabel()
@@ -44,15 +48,38 @@
                private var timer:Timer?
                private var times:Int = 600
                private var voicePlayer = VoicePlayer.share()
                required init(listen1Model:Listen1Model){
                                super.init(nibName: nil, bundle: nil)
                                self.listen1Model = listen1Model
                                self.listen1Model.subjectList.shuffle()
                                for v in listen1Model.photoList{
                                                v.type = 1 // 图片标识
                                }
                                for v in listen1Model.voiceList{
                                                v.type = 2 // 音频标识
                                }
                                datas.append(contentsOf: listen1Model.photoList)
                                datas.append(contentsOf: listen1Model.voiceList)
                                datas.shuffle()
                }
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
                override func viewDidAppear(_ animated: Bool) {
                                super.viewDidAppear(animated)
                                voicePlayer.delegate = self
                }
                override func viewDidDisappear(_ animated: Bool) {
                                super.viewDidDisappear(animated)
                                voicePlayer.delegate = nil
                                timer?.invalidate()
                }
                override func viewDidLoad() {
@@ -82,7 +109,7 @@
                                                make.centerY.equalTo(label_surplusTitle)
                                                make.height.equalTo(44)
                                }
                                collectionView.delegate = self
                                collectionView.dataSource = self
@@ -120,6 +147,7 @@
                                }
                }
                private func nextQuesAction(){
                }
@@ -150,7 +178,7 @@
extension HomeListenGame_2_VC:UICollectionViewDelegate{
                func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
                                if listen1Model.subjectList[indexPath.row].isOpen{
                                if datas[indexPath.row].isOpen{
                                                print("已经展开过了");return
                                }
@@ -158,7 +186,7 @@
                                                print("重复点击");return
                                }
                                let model = listen1Model.subjectList[indexPath.row]
                                let model = datas[indexPath.row]
                                if selectModels.count >= 2{
                                                selectModels.removeFirst()
@@ -204,9 +232,9 @@
                                                                }
                                                }
                                                let surplusListCount = listen1Model.subjectList.filter({$0.isOpen == false}).count
                                                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])
                                                                NotificationCenter.default.post(name: NextLession_Noti, object: ["gameId":listen1Model.data!.id,"gameIntegral":listen1Model.data!.answerIntegral])
                                                                rootViewModel.answerItems[0] = self.listen1Model
                                                                timer?.invalidate()
                                                }
@@ -218,15 +246,18 @@
extension HomeListenGame_2_VC:UICollectionViewDataSource{
                func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
                                let model = listen1Model.subjectList[indexPath.row]
                                let model = datas[indexPath.row]
                                let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_ListenFight_Game_Pocket_CCell", for: indexPath) as! ListenFight_Game_Pocket_CCell
                                cell.setModel(model)
                                cell.voice_view.isHidden = model.correct.isEmpty
                                cell.indexPath = indexPath
                                cell.setSimpleModel(model)
                                cell.cellPayatIndex {[weak self] index in
                                                self?.currentPayCellIndex = index
                                }
                                return cell
                }
                func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
                                return listen1Model.subjectList.count
                                return datas.count
                }
}
@@ -264,3 +295,17 @@
                                }
                }
}
extension HomeListenGame_2_VC:VoicePlayerDelegate{
                func playComplete() {
                                if let index = currentPayCellIndex{
                                                let cell = collectionView.cellForItem(at: index) as! ListenFight_Game_Pocket_CCell
                                                cell.cellResotePay()
                                }
                }
                func playing() {
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_1_VC.swift
@@ -34,10 +34,25 @@
                                return collection
                }()
                private var voicePlayer = VoicePlayer.share()
                private var isPlayedSet = Set<Int>()
                required init(page:Int,listen1Model:Listen1Model){
                                super.init(nibName: nil, bundle: nil)
                                self.page = page
                                self.listen1Model = listen1Model
                }
                override func viewDidAppear(_ animated: Bool) {
                                super.viewDidAppear(animated)
                                voicePlayer.delegate = self
                }
                override func viewDidDisappear(_ animated: Bool) {
                                super.viewDidDisappear(animated)
                                voicePlayer.delegate = nil
                }
                required init?(coder: NSCoder) {
@@ -84,6 +99,7 @@
                                                                handleView.vioceSoundUrl = listen1Model.storyList[page].error.components(separatedBy: ",").last
                                                }
                                                handleView.btn_choose.tag = 10 + index
                                                handleView.tag = 20 + index
                                                handleView.chooseClouse {[weak self] btn in
                                                                guard let weakSelf = self else { return }
@@ -96,42 +112,85 @@
                                                                switch lessionType {
                                                                                case .success:
                                                                                                weakSelf.viewModel.answerType.accept(.success)
                                                                                                weakSelf.rootViewModel.correctNum += 1
                                                                                                handleView.btn_choose.isSelected = true
                                                                                                handleView.btn_state.setImage(UIImage(named: "icon_success_small"), for: .normal)
                                                                                                UIView.animate(withDuration: 0.5) {
                                                                                                                handleView.btn_state.alpha = 1
                                                                                                }
                                                                                                weakSelf.voicePlayer.playerAt(url: handleView.vioceSoundUrl)
                                                                                                let copyView = handleView.copyView()
                                                                                                copyView.btn_choose.alpha = 0
                                                                                                copyView.listenType = .lesson2
                                                                                                copyView.resetView()
                                                                                                let newRect = handleView.convert(handleView.bounds, to: weakSelf.view)
                                                                                                weakSelf.view.addSubview(copyView)
                                                                                                copyView.snp.makeConstraints { make in
                                                                                                                make.top.equalTo(newRect.origin.y)
                                                                                                                make.left.equalTo(newRect.origin.x)
                                                                                                                make.width.equalTo(221)
                                                                                                                make.height.equalTo(52)
                                                                                                }
                                                                                                weakSelf.view.layoutIfNeeded()
                                                                                                DispatchQueue.main.asyncAfter(delay: 1.0) {
                                                                                                                var dict = Dictionary<String,Any>()
                                                                                                                dict["storyIntegral"] = weakSelf.listen1Model.data?.lookIntegral ?? 0
                                                                                                                dict["storyId"] = weakSelf.listen1Model.data?.id ?? 0
                                                                                                                NotificationCenter.default.post(name: NextLession_Noti, object: dict)
                                                                                                                VoicePlayer.share().playerEnd()
                                                                                                                return
                                                                                                let rect = weakSelf.collectionView.convert(weakSelf.collectionView.bounds, to: weakSelf.view)
                                                                                                UIView.animate(withDuration: 0.5) {
                                                                                                                copyView.snp.remakeConstraints { make in
                                                                                                                                make.top.equalTo(rect.origin.y + 135)
                                                                                                                                make.centerX.equalToSuperview().offset(30)
                                                                                                                                make.width.equalTo((JQ_ScreenW - 210 * 2))
                                                                                                                                make.height.equalTo(52)
                                                                                                                }
                                                                                                                weakSelf.view.layoutIfNeeded()
                                                                                                }
                                                                                case .fail:
                                                                                                weakSelf.viewModel.answerType.accept(.fail)
                                                                                                weakSelf.rootViewModel.errorNum += 1
                                                                                                handleView.btn_state.setImage(UIImage(named: "icon_waring_small"), for: .normal)
                                                                                                UIView.animate(withDuration: 0.5) {
                                                                                                                handleView.btn_state.alpha = 1
                                                                                                }
                                                                                                DispatchQueue.main.asyncAfter(deadline:.now()+3) {
                                                                                                                UIView.animate(withDuration: 0.5) {
                                                                                                                                handleView.btn_state.alpha = 0
                                                                                                                                handleView.btn_choose.isSelected = false
                                                                                                                }
                                                                                                }
                                                                                default:
                                                                                                handleView.btn_state.setImage(nil, for: .normal)
                                                                }
                                                }
                                                handleView.playAt {[weak self] index in
                                                                self?.isPlayedSet.insert(index)
                                                                print("播放过的\(index)")
                                                }
                                                handleView.snp.makeConstraints { make in
                                                                make.height.equalTo(52)
                                                                make.width.greaterThanOrEqualTo(159)
                                                                make.width.greaterThanOrEqualTo(221)
                                                }
                                                tempHandleViews.append(handleView)
                                }
                                tempHandleViews.shuffle()
                                stackView.addArrangedSubviews(tempHandleViews)
                }
                func restore(){
                                viewModel.answerType.accept(.none)
                                isPlayedSet.removeAll()
                                for v in stackView.arrangedSubviews as! [StudyHandleView]{
                                                v.resetView()
                                                v.view_choose.alpha = 0
                                }
                                setUI()
                                collectionView.reloadData()
                }
}
@@ -161,3 +220,27 @@
                }
}
extension HomeListenStory_1_VC:VoicePlayerDelegate{
                func playComplete() {
                                if viewModel.answerType.value == .success{
                                                DispatchQueue.main.asyncAfter(delay: 3.0) {
                                                                var dict = Dictionary<String,Any>()
                                                                dict["storyIntegral"] = self.listen1Model.data?.lookIntegral ?? 0
                                                                dict["storyId"] = self.listen1Model.data?.id ?? 0
                                                                NotificationCenter.default.post(name: NextLession_Noti, object: dict)
                                                }
                                                return
                                }
                                for v in stackView.arrangedSubviews as! [StudyHandleView]{
                                                v.resetView()
                                                v.view_choose.alpha = isPlayedSet.contains(v.tag) ? 1:0
                                }
                }
                func playing() {
                }
}
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenStory_2_VC.swift
@@ -10,11 +10,11 @@
class HomeListenStory_2_VC: BaseVC {
                private var viewModel = FightAnswerViewModel()
                private var listen1Model:Listen1Model!
                private var page:Int!
                var rootViewModel:HomeListenFightViewModel!
                private var voicePlayer = VoicePlayer.share()
                private lazy var stackView:UIStackView = {
                                let stackView = UIStackView()
@@ -43,6 +43,11 @@
                required init?(coder: NSCoder) {
                                fatalError("init(coder:) has not been implemented")
                }
                override func viewDidAppear(_ animated: Bool) {
                                super.viewDidAppear(animated)
                }
@@ -75,39 +80,43 @@
                                                subV.removeFromSuperview()
                                }
                                let handleView = StudyHandleView.jq_loadNibView()
                                handleView.listenType = .lesson1
                                let handleView = VoiceHandleView()
                                DispatchQueue.main.asyncAfter(wallDeadline: .now()+2){
                                                handleView.vioceSoundUrl = self.listen1Model.storyList[self.page].correct
                                                handleView.playUrl = self.listen1Model.storyList[self.page].correct
                                }
                                handleView.btn_choose.tag = 10
                                handleView.chooseClouse {[weak self] btn in
                                                guard let weakSelf = self else { return }
                                                var lessionType:Fight_lessonType = .none
                                                lessionType = .success
                                                switch lessionType {
                                                                case .success:
                                                                                handleView.btn_choose.isSelected = true
                                                                                handleView.btn_state.setImage(UIImage(named: "icon_success_small"), for: .normal)
                                                                                UIView.animate(withDuration: 0.5) {
                                                                                                handleView.btn_state.alpha = 1
                                                                                }
                                                                case .fail:
                                                                                handleView.btn_state.setImage(UIImage(named: "icon_waring_small"), for: .normal)
                                                                                UIView.animate(withDuration: 0.5) {
                                                                                                handleView.btn_state.alpha = 1
                                                                                }
                                                                default:
                                                                                handleView.btn_state.setImage(nil, for: .normal)
                                                }
                                }
//                                handleView.chooseClouse {[weak self] btn in
////                                                guard let weakSelf = self else { return }
//                                                var lessionType:Fight_lessonType = .none
//                                                lessionType = .success
//                                                switch lessionType {
//                                                                case .success:
//                                                                                handleView.btn_choose.isSelected = true
//                                                                                handleView.btn_state.setImage(UIImage(named: "icon_success_small"), for: .normal)
//                                                                                UIView.animate(withDuration: 0.5) {
//                                                                                                handleView.btn_state.alpha = 1
//                                                                                }
//                                                                case .fail:
//                                                                                handleView.btn_state.setImage(UIImage(named: "icon_waring_small"), for: .normal)
//                                                                                UIView.animate(withDuration: 0.5) {
//                                                                                                handleView.btn_state.alpha = 1
//                                                                                }
//                                                                default:
//                                                                                handleView.btn_state.setImage(nil, for: .normal)
//                                                }
//                                }
                                handleView.snp.makeConstraints { make in
                                                make.height.equalTo(52)
                                                make.width.greaterThanOrEqualTo(159)
                                                make.width.greaterThanOrEqualTo(221)
                                }
                                stackView.addArrangedSubview(handleView)
                }
                func restore(){
                                viewModel.answerType.accept(.none)
                                setUI()
                                collectionView.reloadData()
                }
}
extension HomeListenStory_2_VC:UICollectionViewDelegate{
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenSubVC.swift
@@ -61,6 +61,12 @@
                                                self.tableView.reloadData()
                                }).disposed(by: disposeBag)
                }
                func jumpAt(listenType:ListenType){
                                let row = listenType.rawValue - 1
                                var jumpIndex:IndexPath = IndexPath(row: row, section: 0)
                                tableView(self.tableView, didSelectRowAt: jumpIndex)
                }
}
extension HomeListenSubVC:UITableViewDelegate{
@@ -222,23 +228,44 @@
                                                                                case 0:
                                                                                                cell.label_title.text = "自主学习1-听音选图"
                                                                                                cell.view_bg2.backgroundColor = UIColor(hexString: "#6EC3FF")
                                                                                                cell.setProgress(progress: studyScheduleModel?.listen ?? 0)
                                                                                                if  (studyScheduleModel?.day ?? 0) > (page + 1){
                                                                                                                cell.setProgress(progress: 100)
                                                                                                }else{
                                                                                                                cell.setProgress(progress: studyScheduleModel?.listen ?? 0)
                                                                                                }
                                                                                case 1:
                                                                                                cell.label_title.text = "自主学习2-看图选音"
                                                                                                cell.view_bg2.backgroundColor = UIColor(hexString: "#FF9A85")
                                                                                                cell.setProgress(progress: studyScheduleModel?.look ?? 0)
                                                                                                if  (studyScheduleModel?.day ?? 0) > (page + 1){
                                                                                                                cell.setProgress(progress: 100)
                                                                                                }else{
                                                                                                                cell.setProgress(progress: studyScheduleModel?.look ?? 0)
                                                                                                }
                                                                                case 2:
                                                                                                cell.label_title.text = "自主学习3-归纳排除"
                                                                                                cell.view_bg2.backgroundColor = UIColor(hexString: "#28C8C5")
                                                                                                cell.setProgress(progress: studyScheduleModel?.induction ?? 0)
                                                                                                if  (studyScheduleModel?.day ?? 0) > (page + 1){
                                                                                                                cell.setProgress(progress: 100)
                                                                                                }else{
                                                                                                                cell.setProgress(progress: studyScheduleModel?.induction ?? 0)
                                                                                                }
                                                                                case 3:
                                                                                                cell.label_title.text = "自主学习4-有问有答"
                                                                                                cell.view_bg2.backgroundColor = UIColor(hexString: "#F8A169")
                                                                                                cell.setProgress(progress: studyScheduleModel?.answer ?? 0)
                                                                                                if  (studyScheduleModel?.day ?? 0) > (page + 1){
                                                                                                                cell.setProgress(progress: 100)
                                                                                                }else{
                                                                                                                cell.setProgress(progress: studyScheduleModel?.answer ?? 0)
                                                                                                }
                                                                                case 4:
                                                                                                cell.label_title.text = "自主学习5-音图相配"
                                                                                                cell.view_bg2.backgroundColor = UIColor(hexString: "#92CADB")
                                                                                                cell.setProgress(progress: studyScheduleModel?.pair ?? 0)
                                                                                                if  (studyScheduleModel?.day ?? 0) > (page + 1){
                                                                                                                cell.setProgress(progress: 100)
                                                                                                }else{
                                                                                                                cell.setProgress(progress: studyScheduleModel?.pair ?? 0)
                                                                                                }
                                                                                default:break
                                                                }
                                                }
DolphinEnglishLearnStudent/Moudle/Home/Listen/VC/HomeListenVC.swift
@@ -63,8 +63,8 @@
                                                for (index,titleL) in (self.menu.subviews.last?.subviews[1].subviews ?? []).filter({$0 is UIButton}).enumerated(){
                                                                if let btn = titleL as?  UIButton{
                                                                                btn.setTitleColor(index < (self.limitDay - 1) ? .black:.black.withAlphaComponent(0.33), for: .normal)
                                                                                self.menu.setEnabled(index < (self.limitDay - 1), forItemAt: UInt(index))
                                                                                btn.setTitleColor(index < (self.limitDay) ? .black:.black.withAlphaComponent(0.33), for: .normal)
                                                                                self.menu.setEnabled(index < (self.limitDay), forItemAt: UInt(index))
                                                                }
                                                }
                                                self.pageVC.reloadData()
@@ -112,6 +112,17 @@
                                                }
                                }
                }
                override func setRx() {
                                NotificationCenter.default.rx.notification(StudyCompleteNextLession_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self] noti in
                                                guard let weakSelf = self else { return }
                                                if let type = noti.object as? ListenType{
                                                                let homelistenSubVC = weakSelf.pageVC.currentController as! HomeListenSubVC
                                                                homelistenSubVC.jumpAt(listenType: type)
                                                }
                                }).disposed(by: disposeBag)
                }
}
extension HomeListenVC:SPPageMenuDelegate{
DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift
@@ -39,7 +39,7 @@
                }
                @IBAction func chooseAction(_ sender: QMUIButton) {
                                level = sender.tag - 9
                                level = sender.tag - 10
                                for subView in tackView_level.arrangedSubviews as! [QMUIButton]{
                                                subView.isSelected = sender.tag == subView.tag
                                }
DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.swift
@@ -7,6 +7,8 @@
import UIKit
let StudyCompleteNextLession_Noti = Notification.Name.init("StudyCompleteNextLession_Noti")
class HomeStudyCompleteVC: BaseVC {
                @IBOutlet weak var label_coin: UILabel!
                @IBOutlet weak var label_correctNum: UILabel!
@@ -14,6 +16,8 @@
                @IBOutlet weak var label_errorNum: UILabel!
                @IBOutlet weak var label_ratioNum: UILabel!
                @IBOutlet weak var btn_next: UIButton!
                @IBOutlet weak var stackView: UIStackView!
                @IBOutlet weak var btn_back: UIButton!
                
                private var correctNum:Int = 0
                private var errorNum:Int = 0
@@ -40,6 +44,11 @@
                                label_errorNum.text = "\(errorNum)次"
                                label_totalNum.text = "\(correctNum + errorNum)次"
                                label_ratioNum.text = String(format: "正确率:%.0lf%%", Double(correctNum) / Double(correctNum + errorNum) * 100)
                                btn_next.isHidden = listenType.rawValue >= 5
                                stackView.isHidden = listenType == .story2
                                label_ratioNum.isHidden = listenType == .story2
    }
                override func setUI() {
@@ -51,10 +60,29 @@
                                                if vc.isKind(of: HomeListenMenuVC.self){
                                                                navigationController?.popToViewController(vc, animated: true);break
                                                }
                                                if vc.isKind(of: HomeListenVC.self){
                                                                navigationController?.popToViewController(vc, animated: true);break
                                                }
                                }
                }
                @IBAction func nextAction(_ sender: UIButton) {
                                var toVC:UIViewController?
                                for subv in self.navigationController?.viewControllers ?? []{
                                                if subv is HomeListenVC{
                                                                toVC = subv;break
                                                }
                                }
                                if toVC == nil{
                                                self.navigationController?.popToRootViewController(animated: true)
                                }else{
                                                self.navigationController?.popToViewController(toVC!, animated: true)
                                                let nextType = ListenType(rawValue: listenType.rawValue + 1)
                                                NotificationCenter.default.post(name: StudyCompleteNextLession_Noti, object: nextType)
                                }
                }
}
DolphinEnglishLearnStudent/Moudle/Home/VC/HomeStudyCompleteVC.xib
@@ -11,12 +11,14 @@
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="HomeStudyCompleteVC" customModule="DolphinEnglishLearnStudent" customModuleProvider="target">
            <connections>
                <outlet property="btn_back" destination="LBK-Yn-Ayv" id="EKb-rd-Clp"/>
                <outlet property="btn_next" destination="gcd-t9-jC7" id="GUH-Wl-YUg"/>
                <outlet property="label_coin" destination="0Rg-U5-bnk" id="Ue5-07-HUP"/>
                <outlet property="label_correctNum" destination="GyL-R8-T1w" id="ljq-bs-33V"/>
                <outlet property="label_errorNum" destination="8Lo-W3-dxd" id="y0q-RX-MkE"/>
                <outlet property="label_ratioNum" destination="4uZ-XC-Xc3" id="cSZ-ND-O0D"/>
                <outlet property="label_totalNum" destination="EAE-ID-4sP" id="Xpa-MR-y2Y"/>
                <outlet property="stackView" destination="ENd-BH-G5Q" id="zS4-oH-pyo"/>
                <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
            </connections>
        </placeholder>
DolphinEnglishLearnStudent/Other/UIView/StudyHandleView.swift
@@ -28,11 +28,6 @@
                                super.awakeFromNib()
                                btn_state.alpha = 0
                                view_choose.alpha = 0
//                                voicePlayer.playEnd {[weak self] in
//                                                guard let weakSelf = self else { return }
//                                                weakSelf.resetView()
//                                }
                }
                func chooseClouse(callback:@escaping (UIButton)->Void){
@@ -53,7 +48,7 @@
                func resetView(){
                                switch listenType {
                                                case .lesson1,.lesson5:
                                                case .lesson1,.lesson5,.game1:
                                                                UIView.animate(withDuration: 0.25) {
                                                                                self.btn_state.setImage(UIImage(named: "icon_play"), for: .normal)
                                                                                self.btn_voice.alpha = 1
@@ -77,7 +72,7 @@
                                voicePlayer.playerAt(url: v)
                                playAtClouse?(self.tag)
                                switch listenType {
                                                case .lesson1,.lesson5:
                                                case .lesson1,.lesson5,.game1:
                                                                UIView.animate(withDuration: 0.25) {
                                                                                self.btn_state.setImage(UIImage(named: "icon_playing"), for: .normal)
                                                                                self.btn_voice.alpha = 0