From a4a30347df295a77657a4b87ee3293ef38ece503 Mon Sep 17 00:00:00 2001
From: 无故事王国 <841720330@qq.com>
Date: 星期四, 04 七月 2024 14:09:56 +0800
Subject: [PATCH] fix bug

---
 DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift b/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift
index 4faca1f..de07a41 100644
--- a/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift
+++ b/DolphinEnglishLearnStudent/Moudle/Home/Listen/View/ChooseLevelView.swift
@@ -26,6 +26,10 @@
 								alpha = 0
 								transform = .init(scaleX: 0.1, y: 0.1)
 								layoutIfNeeded()
+								btn_level1.setTitleColor(.black.withAlphaComponent(0.3), for: .normal)
+								btn_level2.setTitleColor(.black.withAlphaComponent(0.3), for: .normal)
+								btn_level3.setTitleColor(.black.withAlphaComponent(0.3), for: .normal)
+
 				}
 
 				static func show(canLevel:Int,clouse:@escaping (Int)->Void,cancelClouse:@escaping()->Void){
@@ -42,21 +46,18 @@
 								levelView.cancelClouse = cancelClouse
 								sceneDelegate?.window?.addSubview(levelView)
 								levelView.frame = sceneDelegate?.window?.frame ?? .zero
-								levelView.btn_level1.isEnabled = false
-								levelView.btn_level2.isEnabled = false
-								levelView.btn_level3.isEnabled = false
 
 								switch canLevel {
 												case 2:
-																levelView.btn_level3.isEnabled = true
+																levelView.btn_level3.setTitleColor(.black.withAlphaComponent(0.6), for: .normal)
 																fallthrough
 												case 1:
-																levelView.btn_level2.isEnabled = true
+																levelView.btn_level2.setTitleColor(.black.withAlphaComponent(0.6), for: .normal)
 																fallthrough
 												case 0:
-																levelView.btn_level1.isEnabled = true
+																levelView.btn_level1.setTitleColor(.black.withAlphaComponent(0.6), for: .normal)
 												default:
-																levelView.btn_level1.isEnabled = true
+																levelView.btn_level1.setTitleColor(.black.withAlphaComponent(0.6), for: .normal)
 								}
 
 								UIView.animate(withDuration: 0.4) {
@@ -68,6 +69,13 @@
 				}
 
 				@IBAction func chooseAction(_ sender: QMUIButton) {
+
+								guard sender.alpha == 1.0 else {
+												sender.alpha = 0.5
+												sender.isSelected = false
+												alertError(msg: "请先完成上一难度再挑战");return
+								}
+
 								level = sender.tag - 10
 								for subView in tackView_level.arrangedSubviews as! [QMUIButton]{
 												subView.isSelected = sender.tag == subView.tag

--
Gitblit v1.7.1