|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
import UIKit
|
|
|
import YYText
|
|
|
+import GKCycleScrollView
|
|
|
|
|
|
enum QSLTrialVipJumpType: Int {
|
|
|
|
|
|
@@ -19,9 +20,12 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
|
|
|
var type: QSLTrialVipJumpType?
|
|
|
var selectGood: QSLGoodModel?
|
|
|
+ var bannerList : [String] = []
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
super.viewDidLoad()
|
|
|
+ QSEventHandle.eventPush(eventName: QSLGravityConst.activity_exposure_page, eventProps: ["page_type":"activity_page"])
|
|
|
+ QSEventHandle.eventPush(eventName: QSLGravityConst.activity_exposure_page, eventProps: ["page_type":"coupon_popup"])
|
|
|
QSLCountdownManager.shared.addDelegate(self)
|
|
|
setUI()
|
|
|
requestNetwork()
|
|
|
@@ -43,7 +47,7 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
QSLNetwork().request(.wakeupTrialList(dict: ["itemListType": 2])) {[weak self] response in
|
|
|
// 后续逻辑不变...
|
|
|
let list = response.mapArray(QSLGoodModel.self, modelKey: "data>list")
|
|
|
-
|
|
|
+
|
|
|
if list.count > 0 {
|
|
|
self?.selectGood = list[0]
|
|
|
|
|
|
@@ -68,13 +72,25 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
userInfo: ["showCoupon": true, "couponType":"1"]
|
|
|
)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+ let bannerModel = response.mapObject(QSLWakeupBannerModel.self, modelKey: "data")
|
|
|
+ self?.bannerList = bannerModel.banners
|
|
|
+ if(bannerModel.banners.count > 0){
|
|
|
+ self?.bgCenterView.isHidden = true
|
|
|
+ self?.cycleScrollView.isHidden = false
|
|
|
+ self?.cycleScrollView.reloadData()
|
|
|
+ }else{
|
|
|
+ self?.bgCenterView.isHidden = false
|
|
|
+ self?.cycleScrollView.isHidden = true
|
|
|
+ }
|
|
|
+
|
|
|
} fail: { code, error in
|
|
|
self.view.toast(text: "加载商品列表失败")
|
|
|
+ self.bgCenterView.isHidden = false
|
|
|
+ self.cycleScrollView.isHidden = true
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -126,6 +142,20 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
}
|
|
|
|
|
|
@objc func payBtnAction(){
|
|
|
+ QSEventHandle.eventPush(eventName: QSLGravityConst.activity_page_click, eventProps: ["page_type":"activity_page"])
|
|
|
+
|
|
|
+ if(!QSLBaseManager.shared.isLogin()){
|
|
|
+ if(QSLBaseManager.shared.isVip()){
|
|
|
+ QSLJumpManager.shared.pushToLogin(type: .member)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if(QSLConfig.loginPayEnable){
|
|
|
+ QSLJumpManager.shared.pushToLogin(type: .member)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
let memberModel = QSLBaseManager.shared.userModel.memberModel
|
|
|
|
|
|
if let subscriptionExpired = memberModel.subscriptionExpired, !subscriptionExpired {
|
|
|
@@ -144,13 +174,10 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
// 引力传递支付事件
|
|
|
gravityInstance?.trackPayEvent(withAmount: Int32(currentGood.amount), withPayType: "CNY", withOrderId: outTradeNo, withPayReason: currentGood.name, withPayMethod: "apple")
|
|
|
|
|
|
- QSEventHandle.eventPush(eventName: QSLGravityConst.new_vip_result, eventProps: ["is_member":QSLBaseManager.shared.isVip(),"purchase_result": "success","pay_amount":Int32(currentGood.amount)])
|
|
|
-
|
|
|
- QSEventHandle.gravityPush(eventName: QSLGravityConst.vip_submit_success, eventProps: ["id": 01001])
|
|
|
-
|
|
|
+ QSEventHandle.eventPush(eventName: QSLGravityConst.activity_purchase_result, eventProps: ["is_member":QSLBaseManager.shared.isVip(),"purchase_result": "success","pay_amount":Int32(currentGood.amount),"page_type":"activity_page"])
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
|
|
|
NotificationCenter.default.post(name: QSLNotification.QSLRefreshMember, object: nil)
|
|
|
-
|
|
|
+ self.backBtnAction()
|
|
|
if(!QSLBaseManager.shared.isLogin()){
|
|
|
QSLJumpManager.shared.pushToLogin(type: .member)
|
|
|
}
|
|
|
@@ -158,10 +185,10 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
|
|
|
|
|
|
} else if status == .cancel {
|
|
|
- QSEventHandle.eventPush(eventName: QSLGravityConst.new_vip_result, eventProps: ["is_member":QSLBaseManager.shared.isVip(),"purchase_result": "cancel","pay_amount":Int32(currentGood.amount)])
|
|
|
+ QSEventHandle.eventPush(eventName: QSLGravityConst.activity_purchase_result, eventProps: ["is_member":QSLBaseManager.shared.isVip(),"purchase_result": "cancel","pay_amount":Int32(currentGood.amount),"page_type":"activity_page"])
|
|
|
QSLLoading.error(text: "支付取消")
|
|
|
} else if status == .fail {
|
|
|
- QSEventHandle.eventPush(eventName: QSLGravityConst.new_vip_result, eventProps: ["is_member":QSLBaseManager.shared.isVip(),"purchase_result": "fail","pay_amount":Int32(currentGood.amount)])
|
|
|
+ QSEventHandle.eventPush(eventName: QSLGravityConst.activity_purchase_result, eventProps: ["is_member":QSLBaseManager.shared.isVip(),"purchase_result": "fail","pay_amount":Int32(currentGood.amount),"page_type":"activity_page"])
|
|
|
QSLLoading.error(text: "支付失败")
|
|
|
}
|
|
|
}
|
|
|
@@ -223,12 +250,21 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
make.top.equalTo(bgTopTit2View.snp.bottom).offset(6.rpx)
|
|
|
}
|
|
|
|
|
|
+ bgCenterView.isHidden = true
|
|
|
bgImageView.addSubview(bgCenterView)
|
|
|
bgCenterView.snp.makeConstraints { make in
|
|
|
make.centerX.equalTo(bgImageView.snp.centerX)
|
|
|
make.bottom.equalTo(0)
|
|
|
}
|
|
|
|
|
|
+ bgImageView.addSubview(cycleScrollView)
|
|
|
+ cycleScrollView.snp.makeConstraints { make in
|
|
|
+ make.centerX.equalTo(bgImageView.snp.centerX)
|
|
|
+ make.width.equalTo(290.rpx)
|
|
|
+ make.height.equalTo(344.rpx)
|
|
|
+ make.bottom.equalTo(30.rpx)
|
|
|
+ }
|
|
|
+
|
|
|
self.view.addSubview(vipNaviView)
|
|
|
vipNaviView.snp.makeConstraints { make in
|
|
|
make.top.left.right.equalTo(0)
|
|
|
@@ -432,6 +468,7 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
item.contentMode = .scaleAspectFill
|
|
|
item.image = UIImage(named: "vip_trial_bottom_bg")
|
|
|
item.layer.masksToBounds = true
|
|
|
+ item.isUserInteractionEnabled = true
|
|
|
return item
|
|
|
}()
|
|
|
|
|
|
@@ -488,6 +525,48 @@ class QSLVipTrialVC: QSLBaseController {
|
|
|
label.font = UIFont.systemFont(ofSize: 12)
|
|
|
return label
|
|
|
}()
|
|
|
+
|
|
|
+ lazy var cycleScrollView: GKCycleScrollView = {
|
|
|
+
|
|
|
+ let cycleScrollView = GKCycleScrollView()
|
|
|
+ cycleScrollView.dataSource = self
|
|
|
+ cycleScrollView.delegate = self
|
|
|
+ cycleScrollView.isAutoScroll = true
|
|
|
+ cycleScrollView.isInfiniteLoop = true
|
|
|
+ cycleScrollView.isChangeAlpha = false
|
|
|
+ cycleScrollView.leftRightMargin = 0
|
|
|
+ cycleScrollView.topBottomMargin = 0
|
|
|
+
|
|
|
+ return cycleScrollView
|
|
|
+ }()
|
|
|
+}
|
|
|
+
|
|
|
+extension QSLVipTrialVC : GKCycleScrollViewDelegate, GKCycleScrollViewDataSource{
|
|
|
+ func cycleScrollView(_ cycleScrollView: GKCycleScrollView!, cellForViewAt index: Int) -> GKCycleScrollViewCell! {
|
|
|
+ if let cell = cycleScrollView.dequeueReusableCell() {
|
|
|
+ cell.imageView.kf.setImage(with: URL(string: self.bannerList[index]))
|
|
|
+ cell.layer.masksToBounds = true
|
|
|
+ cell.contentMode = .scaleAspectFit
|
|
|
+ return cell
|
|
|
+ }
|
|
|
+
|
|
|
+ let cell = GKCycleScrollViewCell()
|
|
|
+ cell.imageView.kf.setImage(with: URL(string: self.bannerList[index]))
|
|
|
+ cell.layer.masksToBounds = true
|
|
|
+ cell.contentMode = .scaleAspectFit
|
|
|
+ return cell
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ func numberOfCells(in cycleScrollView: GKCycleScrollView!) -> Int {
|
|
|
+ return self.bannerList.count
|
|
|
+ }
|
|
|
+
|
|
|
+ func sizeForCell(in cycleScrollView: GKCycleScrollView!) -> CGSize {
|
|
|
+ return CGSizeMake(290.rpx, 344.rpx);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
extension QSLVipTrialVC : QSLCountdownManagerDelegate{
|