首页UI
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
|
||||
import UIKit
|
||||
import NIMSDK
|
||||
|
||||
import Nuke
|
||||
|
||||
class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
|
||||
var page:Int = 1
|
||||
@@ -45,7 +45,7 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
|
||||
|
||||
}
|
||||
|
||||
RequestGet(path: "special/gift/get", parma: ["pageNum":"\(self.page)","pageSize":"30"]) { data in
|
||||
RequestGet(path: "special/gift/get", parma: [:]) { data in
|
||||
if let model = Deserialized<PlanetStarModel>.toModel(with: data) {
|
||||
self.giftModel = model
|
||||
}
|
||||
@@ -68,25 +68,79 @@ class PlanetStarVC: BaseViewController,HiddenNavigationBarProtocol {
|
||||
view.addSubview(backgroundView)
|
||||
view.addSubview(bgRadiusView)
|
||||
bgRadiusView.frame = self.view.frame
|
||||
|
||||
activityView.center = self.view.center
|
||||
activityView.startAnimating()
|
||||
backgroundView.snp.makeConstraints { make in
|
||||
make.edges.equalTo(self.view)
|
||||
}
|
||||
|
||||
|
||||
bgRadiusView.refreshBlcok = {[weak self] uid in
|
||||
guard let _uid = uid else {
|
||||
bgRadiusView.refreshBlcok = {[weak self] (uid,type,name) in
|
||||
if type == 0{
|
||||
self?.page = (self?.page ?? 1) + 1
|
||||
self?.requestData()
|
||||
return
|
||||
}else if type == 1{
|
||||
guard let _uid = uid else {return}
|
||||
let session = NIMSession.init(_uid, type: .P2P)
|
||||
let chatVC = ChatVC.init(session: session)
|
||||
self?.navigationController?.pushViewController(chatVC, animated: true)
|
||||
}else{
|
||||
guard let _uid = uid else {return}
|
||||
let giftName = self?.giftModel?.giftName ?? ""
|
||||
let giftNum = self?.giftModel?.goldPrice ?? "0"
|
||||
let text = "确认赠送 \(giftName)(\(giftNum)钻石)给\(name)吗"
|
||||
let alert = UIAlertController.init(title: "提示", message:text , preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.init(title: "取消", style: .cancel, handler: { action in
|
||||
|
||||
}))
|
||||
alert.addAction(UIAlertAction.init(title: "确认", style: .default, handler: {[weak self] action in
|
||||
self?.view.addSubview(self!.activityView)
|
||||
RequestGet(path: "special/gift/get", parma: ["targetId":_uid]) { data in
|
||||
self?.activityView.removeFromSuperview()
|
||||
if let _ = Deserialized<PlanetStarModel>.toModel(with: data) {
|
||||
HUDTool.show(with: "送礼成功")
|
||||
let imageView = UIImageView(frame: CGRect(x: ScreenWidth/2-50, y: -100, width: 0, height: 0))
|
||||
|
||||
Nuke.loadImage(with: self?.giftModel?.picUrl ?? "", into: imageView)
|
||||
self?.view.addSubview(imageView)
|
||||
UIView.animate(withDuration: 2) {
|
||||
imageView.frame = CGRect(x: ScreenWidth/2-50, y: ScreenHeight/3 * 2, width: 100, height: 100)
|
||||
|
||||
}completion: { isC in
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
|
||||
UIView.animate(withDuration: 1) {
|
||||
let x = self?.bgRadiusView.imageView.frame.origin.x ?? 0
|
||||
let y = self?.bgRadiusView.imageView.frame.origin.y ?? 0
|
||||
imageView.frame = CGRect(x: x + 50, y: y + 50, width: 10, height: 10)
|
||||
|
||||
}completion: { isC in
|
||||
imageView.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} fail: { code, data in
|
||||
self?.activityView.removeFromSuperview()
|
||||
if code == 31005{
|
||||
let alert = UIAlertController.init(title: "提示", message:"钻石余额不足" , preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.init(title: "取消", style: .cancel, handler: { action in
|
||||
|
||||
}))
|
||||
alert.addAction(UIAlertAction.init(title: "确认", style: .default, handler: {[weak self] action in
|
||||
let vc = UserPayViewController()
|
||||
self?.navigationController?.pushViewController(vc, animated: true)
|
||||
}))
|
||||
self?.present(alert, animated: true)
|
||||
}
|
||||
}
|
||||
}))
|
||||
self?.present(alert, animated: true)
|
||||
}
|
||||
let session = NIMSession.init(_uid, type: .P2P)
|
||||
let chatVC = ChatVC.init(session: session)
|
||||
self?.navigationController?.pushViewController(chatVC, animated: true)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
let activityView:UIActivityIndicatorView = UIActivityIndicatorView(style: .medium)
|
||||
var giftModel:PlanetStarModel?
|
||||
private lazy var backgroundView:UIImageView = {
|
||||
let _backgroundView = UIImageView()
|
||||
|
Reference in New Issue
Block a user