| | |
| | | @IBOutlet weak var tap_sign: TapBtn! |
| | | |
| | | private var clouse:((TreeTeskListSwipe)->Void)? |
| | | private var signClouse:(()->Void)? |
| | | private var disposeBag = DisposeBag() |
| | | |
| | | private var treeInfoModel:TreeInfoModel? |
| | |
| | | self.clouse = clouse |
| | | } |
| | | |
| | | func signSuccess(signClouse:@escaping ()->Void){ |
| | | self.signClouse = signClouse |
| | | } |
| | | |
| | | |
| | | func setTreeInfoModel(_ model:TreeInfoModel){ |
| | | self.treeInfoModel = model |
| | |
| | | } |
| | | |
| | | @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?() |
| | | weakSelf.tap_sign.isUserInteractionEnabled = false |
| | | weakSelf.label_sign.text = "已签到" |
| | | weakSelf.view_sign.backgroundColor = .gray.withAlphaComponent(0.1) |
| | | weakSelf.label_sign.textColor = .white |
| | | weakSelf.view_sign_cricle.jq_borderColor = .gray.withAlphaComponent(0.9) |
| | | |
| | | tap_sign.isUserInteractionEnabled = false |
| | | label_sign.text = "已签到" |
| | | view_sign.backgroundColor = .gray.withAlphaComponent(0.1) |
| | | label_sign.textColor = .white |
| | | view_sign_cricle.jq_borderColor = .gray.withAlphaComponent(0.9) |
| | | let imageView = UIImageView(image: UIImage(named: "icon_signSuccess")) |
| | | imageView.transform = .init(scaleX: 0.1, y: 0.1) |
| | | imageView.alpha = 0 |
| | | sceneDelegate?.window?.addSubview(imageView) |
| | | imageView.snp.makeConstraints { make in |
| | | make.center.equalToSuperview() |
| | | make.width.equalTo(132) |
| | | make.height.equalTo(151) |
| | | } |
| | | |
| | | let imageView = UIImageView(image: UIImage(named: "icon_signSuccess")) |
| | | imageView.transform = .init(scaleX: 0.1, y: 0.1) |
| | | imageView.alpha = 0 |
| | | sceneDelegate?.window?.addSubview(imageView) |
| | | imageView.snp.makeConstraints { make in |
| | | make.center.equalToSuperview() |
| | | make.width.equalTo(132) |
| | | make.height.equalTo(151) |
| | | } |
| | | UIView.animate(withDuration: 0.5, delay: 0.1, usingSpringWithDamping: 0.5, initialSpringVelocity: 1.0, options: .curveEaseIn) { |
| | | imageView.transform = .init(scaleX: 1.0, y: 1.0) |
| | | imageView.alpha = 1 |
| | | } |
| | | |
| | | UIView.animate(withDuration: 0.5, delay: 0.1, usingSpringWithDamping: 0.5, initialSpringVelocity: 1.0, options: .curveEaseIn) { |
| | | imageView.transform = .init(scaleX: 1.0, y: 1.0) |
| | | imageView.alpha = 1 |
| | | } |
| | | DispatchQueue.main.asyncAfter(delay: 2.5) { |
| | | UIView.animate(withDuration: 0.5) { |
| | | imageView.transform = .init(scaleX: 0.1, y: 0.1) |
| | | imageView.alpha = 0 |
| | | } completion: { _ in |
| | | imageView.removeFromSuperview() |
| | | } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | |
| | | DispatchQueue.main.asyncAfter(delay: 2.5) { |
| | | UIView.animate(withDuration: 0.5) { |
| | | imageView.transform = .init(scaleX: 0.1, y: 0.1) |
| | | imageView.alpha = 0 |
| | | } completion: { _ in |
| | | imageView.removeFromSuperview() |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @IBAction func toMuse(_ sender: TapBtn) { |