|
@@ -35,17 +35,38 @@ class CommunityNavigationBarView: BaseView {
|
|
|
searchBgView.addSubview(searchTextField)
|
|
|
observe = NotificationCenter.default.addObserver(forName: NSNotification.Name("userMemberGetTotalBean"), object: nil, queue: OperationQueue.main) {[weak self] (notification) in
|
|
|
let totalBeanModel = notification.object as? TotalBeanModel
|
|
|
- self?.rightButton.play()
|
|
|
+// self?.rightButton.play()
|
|
|
self?.scrollNumberLabel!.change(to: NSNumber(value: totalBeanModel?.todayBean ?? 0) , animated: true)
|
|
|
|
|
|
- self?.scrollNumberLabel!.snp_remakeConstraints { (make) in
|
|
|
- make.centerY.equalToSuperview()
|
|
|
- make.size.equalTo((self?.scrollNumberLabel!.frame.size)!)
|
|
|
- make.right.equalToSuperview().offset(-14)
|
|
|
+ if totalBeanModel?.todayBean == 0 {
|
|
|
+ self?.scrollNumberLabel?.isHidden = true
|
|
|
+ self?.rightButton.snp.makeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.right.equalTo(-14)
|
|
|
+ make.size.equalTo(25)
|
|
|
+
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ self?.scrollNumberLabel!.snp_remakeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.size.equalTo((self?.scrollNumberLabel!.frame.size)!)
|
|
|
+ make.right.equalToSuperview().offset(-14)
|
|
|
+ }
|
|
|
+ self?.rightButton.snp.remakeConstraints { (make) in
|
|
|
+ make.centerY.equalToSuperview()
|
|
|
+ make.right.equalTo((self?.scrollNumberLabel!.snp_left)!).offset(-2)
|
|
|
+ make.size.equalTo(25)
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
UserMemberTotalBeanViewModel.shared.userMemberGetTotalBeanApi()
|
|
|
UserMemberTotalBeanViewModel.shared.userMemberGetTotalBeanApiInterval()
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ scrollNumberLabel?.isHidden = true
|
|
|
+ }else {
|
|
|
+ scrollNumberLabel?.isHidden = false
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
override func setupLayouts() {
|
|
@@ -58,9 +79,12 @@ class CommunityNavigationBarView: BaseView {
|
|
|
|
|
|
rightButton.snp.makeConstraints { (make) in
|
|
|
make.centerY.equalToSuperview()
|
|
|
- make.right.equalTo(scrollNumberLabel!.snp_left).offset(-2)
|
|
|
- make.height.equalTo(20)
|
|
|
- make.width.equalTo(20)
|
|
|
+ if UserModel.isTokenNil() {
|
|
|
+ make.right.equalTo(-14)
|
|
|
+ }else {
|
|
|
+ make.right.equalTo(scrollNumberLabel!.snp_left).offset(-2)
|
|
|
+ }
|
|
|
+ make.size.equalTo(25)
|
|
|
}
|
|
|
|
|
|
scrollNumberLabel!.snp_makeConstraints { (make) in
|
|
@@ -106,22 +130,29 @@ class CommunityNavigationBarView: BaseView {
|
|
|
return leftButton
|
|
|
}()
|
|
|
|
|
|
- lazy var rightButton: AnimationView = {
|
|
|
- let rightButton = AnimationView()
|
|
|
- let animation = Animation.named("Skittles")
|
|
|
- rightButton.animation = animation
|
|
|
- rightButton.contentMode = .scaleAspectFit
|
|
|
- rightButton.loopMode = .playOnce
|
|
|
+ lazy var rightButton: UIButton = {
|
|
|
+ let rightButton = UIButton()
|
|
|
+ rightButton.setImage(kImage(name: "ico_bean_org"), for: UIControl.State.normal)
|
|
|
rightButton.addTapGesture(1, target: self, action: #selector(skittles))
|
|
|
return rightButton
|
|
|
}()
|
|
|
|
|
|
+// lazy var rightButton: AnimationView = {
|
|
|
+// let rightButton = AnimationView()
|
|
|
+// let animation = Animation.named("Skittles")
|
|
|
+// rightButton.animation = animation
|
|
|
+// rightButton.contentMode = .scaleAspectFit
|
|
|
+// rightButton.loopMode = .playOnce
|
|
|
+// rightButton.addTapGesture(1, target: self, action: #selector(skittles))
|
|
|
+// return rightButton
|
|
|
+// }()
|
|
|
+
|
|
|
typealias RightButtonClosure = () -> Void
|
|
|
|
|
|
var rightButtonClosure : RightButtonClosure?
|
|
|
|
|
|
@objc func skittles() {
|
|
|
- rightButton.play()
|
|
|
+// rightButton.play()
|
|
|
if let rightButtonClosure = rightButtonClosure {
|
|
|
rightButtonClosure()
|
|
|
}
|