From 0fb7413df54760ac6bd15b90b738e0706de1629e Mon Sep 17 00:00:00 2001 From: 杨锴 <841720330@qq.com> Date: 星期二, 05 十一月 2024 19:03:09 +0800 Subject: [PATCH] fix bug --- XQMuse/Root/TreeGroup/View/TreeTeskListView.swift | 161 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 94 insertions(+), 67 deletions(-) diff --git a/XQMuse/Root/TreeGroup/View/TreeTeskListView.swift b/XQMuse/Root/TreeGroup/View/TreeTeskListView.swift index c5dbf38..66fde61 100644 --- a/XQMuse/Root/TreeGroup/View/TreeTeskListView.swift +++ b/XQMuse/Root/TreeGroup/View/TreeTeskListView.swift @@ -10,90 +10,112 @@ import RxSwift enum TreeTeskListSwipe{ - case up - case down + case up + case down } class TreeTeskListView: UIView,JQNibView{ - @IBOutlet weak var view_sign: UIView! - @IBOutlet weak var view_sign_cricle: UIView! - @IBOutlet weak var label_sign: UILabel! - @IBOutlet weak var tap_sign: TapBtn! - - private var clouse:((TreeTeskListSwipe)->Void)? + @IBOutlet weak var view_sign: UIView! + @IBOutlet weak var view_sign_cricle: UIView! + @IBOutlet weak var label_sign: UILabel! + @IBOutlet weak var tap_sign: TapBtn! + + @IBOutlet weak var view_task1: UIView! + @IBOutlet weak var label_task1: UILabel! + @IBOutlet weak var view_task1_cricle: UIView! + + @IBOutlet weak var view_task2: UIView! + @IBOutlet weak var label_task2: UILabel! + @IBOutlet weak var view_task2_cricle: UIView! + + + private var clouse:((TreeTeskListSwipe)->Void)? private var signClouse:(()->Void)? - private var disposeBag = DisposeBag() + private var disposeBag = DisposeBag() - private var treeInfoModel:TreeInfoModel? + private var treeInfoModel:TreeInfoModel? - override func awakeFromNib() { - super.awakeFromNib() + override func awakeFromNib() { + super.awakeFromNib() - //添加一个上滑手势 - let swipe = UISwipeGestureRecognizer() - swipe.direction = .up - swipe.numberOfTouchesRequired = 1 - self.addGestureRecognizer(swipe) + //添加一个上滑手势 + let swipe = UISwipeGestureRecognizer() + swipe.direction = .up + swipe.numberOfTouchesRequired = 1 + self.addGestureRecognizer(swipe) - //手势响应 - swipe.rx.event - .subscribe(onNext: {[unowned self] recognizer in - //这个点是滑动的起点 - let point = recognizer.location(in: recognizer.view) - print(point) - if point.y <= 50{ - self.clouse?(.up) - } - }).disposed(by: disposeBag) + //手势响应 + swipe.rx.event + .subscribe(onNext: {[unowned self] recognizer in + //这个点是滑动的起点 + let point = recognizer.location(in: recognizer.view) + print(point) + if point.y <= 50{ + self.clouse?(.up) + } + }).disposed(by: disposeBag) - //添加一个上滑手势 - let swipeDown = UISwipeGestureRecognizer() - swipeDown.direction = .down - swipeDown.numberOfTouchesRequired = 1 - self.addGestureRecognizer(swipeDown) + //添加一个上滑手势 + let swipeDown = UISwipeGestureRecognizer() + swipeDown.direction = .down + swipeDown.numberOfTouchesRequired = 1 + self.addGestureRecognizer(swipeDown) - //手势响应 - swipeDown.rx.event - .subscribe(onNext: { recognizer in - //这个点是滑动的起点 - let point = recognizer.location(in: recognizer.view) - print(point) - if point.y <= 50{ - self.clouse?(.down) - } - }).disposed(by: disposeBag) - } + //手势响应 + swipeDown.rx.event + .subscribe(onNext: { recognizer in + //这个点是滑动的起点 + let point = recognizer.location(in: recognizer.view) + print(point) + if point.y <= 50{ + self.clouse?(.down) + } + }).disposed(by: disposeBag) + } - func swipeClouse(clouse:@escaping (TreeTeskListSwipe)->Void){ - self.clouse = clouse - } + func swipeClouse(clouse:@escaping (TreeTeskListSwipe)->Void){ + self.clouse = clouse + } func signSuccess(signClouse:@escaping ()->Void){ self.signClouse = signClouse } - func setTreeInfoModel(_ model:TreeInfoModel){ - self.treeInfoModel = model + func setTreeInfoModel(_ model:TreeInfoModel){ + self.treeInfoModel = model - if model.isSign == .yes{ - tap_sign.isUserInteractionEnabled = false - label_sign.text = "已签到" - view_sign.backgroundColor = .gray.withAlphaComponent(0.2) - label_sign.textColor = .white - view_sign_cricle.jq_borderColor = .gray.withAlphaComponent(0.2) - }else{ - tap_sign.isUserInteractionEnabled = true - label_sign.text = "打卡签到" - view_sign.backgroundColor = .white - label_sign.textColor = UIColor(hexString: "#4E4E4E") - } - } + if model.isSign == .yes{ + tap_sign.isUserInteractionEnabled = false + label_sign.text = "已签到" + view_sign.backgroundColor = .gray.withAlphaComponent(0.2) + label_sign.textColor = .white + view_sign_cricle.jq_borderColor = .gray.withAlphaComponent(0.2) + } + // else{ + // tap_sign.isUserInteractionEnabled = true + // label_sign.text = "打卡签到" + // view_sign.backgroundColor = .white + // label_sign.textColor = UIColor(hexString: "#4E4E4E") + // } - @IBAction func signAction(_ sender: TapBtn) { + if model.taskOne == .yes{ + view_task1.backgroundColor = .gray.withAlphaComponent(0.2) + label_task1.textColor = .white + view_task1_cricle.jq_borderColor = .gray.withAlphaComponent(0.2) + } + + if model.taskTwo == .yes{ + view_task2.backgroundColor = .gray.withAlphaComponent(0.2) + label_task2.textColor = .white + view_task2_cricle.jq_borderColor = .gray.withAlphaComponent(0.2) + } + } + + @IBAction func signAction(_ sender: TapBtn) { guard sceneDelegate!.checkisLoginState() else {return} - + Services.treeTaskSign().subscribe(onNext: {[weak self] _ in guard let weakSelf = self else { return } weakSelf.signClouse?() @@ -127,11 +149,16 @@ } } }).disposed(by: disposeBag) + } + @IBAction func toMuse1(_ sender: TapBtn) { + guard treeInfoModel?.taskOne == .no else {return} + JQ_currentViewController().tabBarController?.selectedIndex = 0 + } - } + @IBAction func toMuse2(_ sender: TapBtn) { + guard treeInfoModel?.taskTwo == .no else {return} + JQ_currentViewController().tabBarController?.selectedIndex = 0 + } - @IBAction func toMuse(_ sender: TapBtn) { - JQ_currentViewController().tabBarController?.selectedIndex = 0 - } } -- Gitblit v1.7.1