Commit 01f32ebc authored by zhangshuai's avatar zhangshuai

修改福利中心为 原生

parent e8334ec9
This diff is collapsed.
......@@ -144,10 +144,10 @@ NSDictionary* appLaunchOpts;
web.url = WelfareURL;
}
// WelfareCenterVC * vc = [[WelfareCenterVC alloc]init];
WelfareCenterVC * vc = [[WelfareCenterVC alloc]init];
UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:vc];
UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:web];
nav.modalPresentationStyle = UIModalPresentationFullScreen;
[[[self ufw] appController].window.rootViewController presentViewController:nav
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "OpenTreasureChest@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "OpenTreasureChest@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "TreasureChestClose@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "TreasureChestClose@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "arrow_left@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "arrow_left@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
......@@ -13,11 +13,16 @@
#ifndef GYPrefixHeader_pch
#define GYPrefixHeader_pch
//测试
#define ServerReport @"http://reporttest.zhangxinhulian.com"
#define ServerHost @"https://feedapitest.zhangxinhulian.com" // 服务端接口地址
#define ServerAds @"http://bstest.zhangxinhulian.com/v4/ads"
////正式
//#define ServerReport @"http://report.clouddistribute.net"
//#define ServerHost @"https://feedapi.clouddistribute.net" // 服务端接口地址
//#define ServerAds @"http://bs.clouddistribute.net/v4/ads"
//正式
#define ServerReport @"http://report.clouddistribute.net"
#define ServerHost @"https://feedapi.clouddistribute.net" // 服务端接口地址
#define ServerAds @"http://bs.clouddistribute.net/v4/ads"
#define WXAppId @"wxe7a03eb52cce1b51"
#define WXAppSecret @"6fa72a89ea188c4dff5729cff328b587"
......@@ -99,6 +104,14 @@
#import "IOSADManager.h" //AD
#pragma mark - base
#import "BaseViewController.h"
#pragma mark - pod
#import <Masonry/Masonry.h>
#pragma mark - 分类
#import "UIView+HExtension.h"
#import "UIColor+HExtension.h"
//奖励类型 1 水滴 2 果子 3 种子 4 金币 5 加速剂 6 红包
typedef enum : NSUInteger {
......
......@@ -24,6 +24,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) NSInteger targetNum;
@property (nonatomic, copy) NSString * url;
@end
NS_ASSUME_NONNULL_END
......@@ -44,6 +44,9 @@ typedef enum : NSUInteger {
cloudCheck, //云朵加速校验
task_process,// 获取福利中心进度
taskListWithStat,//获取福利中心列表和状态
welfare_task_box,//打开宝箱 福利中心
ddcy_clock_list, //打卡提现-列表
//
......@@ -78,7 +81,11 @@ typedef enum : NSUInteger {
awardMultiple, //领取翻倍奖励v3
adForcePost, // 取消视频播放回调
welfareVideoReport, //福利任务--激励视频任务完成
cash2Coin
cash2Coin, //
complete_task, // 领取任务奖励 福利中心
clock_wd, //打卡提xian - tixian
} TQNetwortPostAction;
......
......@@ -88,11 +88,15 @@ static CGNetworkTools* _tools = nil;
return @"/app/v1/game/farm/rp_list";
case cloudCheck:
return @"/app/v1/game/farm/cloud_check";
case task_process:
return @"/app/v2/novel/taskListWithStat";
case taskListWithStat:
return @"/app/v2/novel/taskListWithStat";
case task_process:
return @"/app/v1/game/task_process";
case welfare_task_box:
return @"/app/v1/game/farm/welfare_task_box";
case ddcy_clock_list:
return @"/app/v1/game/ddcy/clock_list";
default:
return @"";
}
......@@ -151,6 +155,10 @@ static CGNetworkTools* _tools = nil;
return @"/app/v1/game/welfare_video_report";
case cash2Coin:
return @"/app/v1/game/farm/cash2Coin";
case complete_task:
return @"/app/v1/game/complete-task";
case clock_wd:
return @"/app/v1/game/ddcy/clock_wd";
default:
return @"";
}
......@@ -161,8 +169,9 @@ static CGNetworkTools* _tools = nil;
// GET 请求
- (void)getWithAction: (TQNetwortGetAction)action parameters:(id)parameters success: (void(^)(id response))success failure:(void(^)(NSError * error)) failure{
// get 请求
NSString *urlString = [ServerHost stringByAppendingPathComponent: [self convertGetActionToString:action]];
// NSString *urlString = [ServerHost stringByAppendingPathComponent: [self convertGetActionToString:action]];
NSString *urlString = [ServerHost stringByAppendingString:[self convertGetActionToString:action]];
NSDictionary *params = [self setRequestParams: parameters];
[self GET: urlString parameters: params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
......
//
// ESViewController.h
// easysleep
//
// Created by Mazy on 2020/9/8.
// Copyright © 2020 easy sleep. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface BaseViewController : UIViewController
@property (nonatomic,retain)UIImage * backImage;
@property (nonatomic ,assign)BOOL isMember;
//隐藏线
- (void)navbarClearShadow;
- (void)navbarHiddenAanimated:(BOOL)isAnimated;
- (void)navbarShowAanimated:(BOOL)isAnimated;
//添加左侧按钮
- (void)addLeftItme:(UIImage * __nullable)image selecedImage:(UIImage * __nullable)sImage orText:(NSString * __nullable)text selectedText:(NSString * __nullable)sText;
- (void)leftBarButtonItemAction:(UIButton *)btn;
//添加右侧按钮
- (void)addRightItme:(UIImage * __nullable)image selecedImage:(UIImage * __nullable)sImage orText:(NSString * __nullable)text selectedText:(NSString * __nullable)sText;
- (void)rightBarButtonItemAction:(UIButton *)btn;
@end
NS_ASSUME_NONNULL_END
//
// BaseViewController.m
// easysleep
//
// Created by Mazy on 2020/9/8.
// Copyright © 2020 easy sleep. All rights reserved.
//
#import "BaseViewController.h"
@interface BaseViewController ()
@property (nonatomic ,retain)UIButton * rightButton;
@property (nonatomic ,retain)UIButton * leftButton;
@end
@implementation BaseViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.navigationController.navigationBar.translucent=NO;
self.navigationController.navigationBar.barTintColor=[UIColor colorWithHexString:@"#F7BD7C"];
[self navbarSetWhiteTitle];
[self setStatusBarWhite];
[self.navigationController.navigationBar setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:20],NSForegroundColorAttributeName:[UIColor colorWithHexString:@"#333333"]}];
UIImageView * imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
imageView.layer.masksToBounds = YES;
imageView.image = [UIImage imageNamed:@"homebackImage"];
imageView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:imageView];
[self.view sendSubviewToBack:imageView];
// self.view.backgroundColor = [UIColor colorWithPatternImage:imageView.image];
// 老版本scrollview自动下移(消除警告)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
self.automaticallyAdjustsScrollViewInsets = NO;
#pragma clang diagnostic pop
// 设置CGRectZero从导航栏下开始计算
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
{
self.edgesForExtendedLayout = UIRectEdgeNone;
}
}
- (void)dealloc{
NSLog(@"%@ ----dealloc",self);
}
-(BOOL)isMember{
#ifdef DEBUG
return true;
#else
return true;
// return [[HKAccountManager shared] isMember];
#endif
}
- (void)setStatusBarWhite{
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
}
- (void)navbarSetWhiteTitle{
[self.navigationController.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
self.navigationController.navigationBar.tintColor=[UIColor whiteColor];
}
- (void)navbarClearShadow{
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[self.navigationController.navigationBar setShadowImage:[UIImage new]];
}
- (void)navbarHiddenAanimated:(BOOL)isAnimated{
[self.navigationController setNavigationBarHidden:YES animated:isAnimated];
}
- (void)navbarShowAanimated:(BOOL)isAnimated{
[self.navigationController setNavigationBarHidden:NO animated:isAnimated];
}
//添加左侧按钮
- (void)addLeftItme:(UIImage * __nullable)image selecedImage:(UIImage * __nullable)sImage orText:(NSString * __nullable)text selectedText:(NSString * __nullable)sText{
self.leftButton = [[UIButton alloc] init];
if (image == nil) {
if (text == nil) {
text = @"传入文本";
}
if (sText == nil) {
sText = text;
}
[self.leftButton setTitle: text forState:UIControlStateNormal];
[self.leftButton setTitle: sText forState:UIControlStateSelected];
[self.leftButton setTitleColor:[UIColor whiteColor] forState: UIControlStateNormal];
self.leftButton.titleLabel.font = [UIFont systemFontOfSize:17];
}else{
if (sImage == nil) {
sImage = image;
}
[self.leftButton setImage:image forState:UIControlStateNormal];
[self.leftButton setImage: sImage forState:UIControlStateSelected];
}
[self.leftButton addTarget:self action: @selector(leftBarButtonItemAction:) forControlEvents:UIControlEventTouchUpInside];
[self.leftButton sizeToFit];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: self.leftButton];
}
- (void)leftBarButtonItemAction:(UIButton *)btn{
btn.selected = !btn.isSelected;
NSLog(@"leftButton click");
}
//添加右侧按钮
- (void)addRightItme:(UIImage * __nullable)image selecedImage:(UIImage * __nullable)sImage orText:(NSString * __nullable)text selectedText:(NSString * __nullable)sText{
self.rightButton = [[UIButton alloc] init];
if (image == nil) {
if (text == nil) {
text = @"传入文本";
}
if (sText == nil) {
sText = text;
}
[self.rightButton setTitle: text forState:UIControlStateNormal];
[self.rightButton setTitle: sText forState:UIControlStateSelected];
[self.rightButton setTitleColor:[UIColor whiteColor] forState: UIControlStateNormal];
self.rightButton.titleLabel.font = [UIFont systemFontOfSize:17];
}else{
if (sImage == nil) {
sImage = image;
}
[self.rightButton setImage:image forState:UIControlStateNormal];
[self.rightButton setImage: sImage forState:UIControlStateSelected];
}
[self.rightButton addTarget:self action: @selector(rightBarButtonItemAction:) forControlEvents:UIControlEventTouchUpInside];
[self.rightButton sizeToFit];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: self.rightButton];
}
- (void)rightBarButtonItemAction:(UIButton *)btn{
btn.selected = !btn.isSelected;
NSLog(@"rightButton click");
}
@end
//
// WelfareCenterCell.h
// ClockInVC.h
// GYDemo
//
// Created by zhangshuai on 2020/11/17.
// 打卡页
// Created by zhangshuai on 2020/11/19.
//
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface WelfareCenterCell : UITableViewCell
@interface ClockInVC : BaseViewController
@end
......
//
// ClockInVC.m
// GYDemo
//
// Created by zhangshuai on 2020/11/19.
//
#import "ClockInVC.h"
@interface ClockInVC ()
@end
@implementation ClockInVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="WelfareCenterVC">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ClockInVC">
<connections>
<outlet property="tableView" destination="cLQ-3z-U9W" id="lrz-YI-VgV"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -19,30 +15,8 @@
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="cLQ-3z-U9W">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="YN3-rf-K4G"/>
<outlet property="delegate" destination="-1" id="ifg-sF-Ftu"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="Q5M-cg-NOt" firstAttribute="trailing" secondItem="cLQ-3z-U9W" secondAttribute="trailing" id="028-KM-XZz"/>
<constraint firstItem="cLQ-3z-U9W" firstAttribute="leading" secondItem="Q5M-cg-NOt" secondAttribute="leading" id="7pf-5Q-Gok"/>
<constraint firstAttribute="bottom" secondItem="cLQ-3z-U9W" secondAttribute="bottom" id="8VV-5W-bB8"/>
<constraint firstItem="cLQ-3z-U9W" firstAttribute="top" secondItem="Q5M-cg-NOt" secondAttribute="top" id="kEn-qd-C6h"/>
</constraints>
<point key="canvasLocation" x="-146" y="69"/>
</view>
</objects>
<resources>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document>
//
// WelfareCenterCell.h
// GYDemo
//
// Created by zhangshuai on 2020/11/17.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface WelfareCenterCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *subTitle;
@property (weak, nonatomic) IBOutlet UIButton *awardNum;
@property (weak, nonatomic) IBOutlet UIButton *buttonState;
- (IBAction)stateButtonClick:(UIButton *)sender;
@property (nonatomic ,copy) void (^buttonBlock)(WelfareCenterCell * thisCell);
@property (nonatomic ,assign)NSInteger status; // 按钮状态
@end
NS_ASSUME_NONNULL_END
//
// WelfareCenterCell.m
// GYDemo
//
// Created by zhangshuai on 2020/11/17.
//
#import "WelfareCenterCell.h"
@implementation WelfareCenterCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (void)setStatus:(NSInteger)status{
//0 : 去完成 1: 明日再来 2: 立即领取
_status = status;
if (status == 0) {
[self.buttonState setTitle:@"去完成" forState:UIControlStateNormal];
[self.buttonState setBackgroundImage:[UIImage imageNamed:@"ToFinishRed"] forState:UIControlStateNormal];
}else if(status == 1){
[self.buttonState setTitle:@"明日再来" forState:UIControlStateNormal];
[self.buttonState setBackgroundImage:[UIImage imageNamed:@"CollectedGrey"] forState:UIControlStateNormal];
}else if (status == 2){
[self.buttonState setTitle:@"立即领取" forState:UIControlStateNormal];
[self.buttonState setBackgroundImage:[UIImage imageNamed:@"GetItNow"] forState:UIControlStateNormal];
}else{
[self.buttonState setTitle:@"明日再来" forState:UIControlStateNormal];
[self.buttonState setBackgroundImage:[UIImage imageNamed:@"CollectedGrey"] forState:UIControlStateNormal];
}
}
- (IBAction)stateButtonClick:(UIButton *)sender {
if (self.buttonBlock) {
self.buttonBlock(self);
}
}
@end
......@@ -41,6 +41,9 @@
<state key="normal" title="立即领取" backgroundImage="GetItNow">
<color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="stateButtonClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="aP1-iP-3jo"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hkj-qT-nh4">
<rect key="frame" x="223.5" y="53" width="39" height="20"/>
......@@ -53,6 +56,7 @@
<color key="backgroundColor" red="0.99607843137254903" green="0.9882352941176471" blue="0.88627450980392153" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="hkj-qT-nh4" firstAttribute="centerX" secondItem="dyx-aR-S4p" secondAttribute="centerX" id="8HW-1s-Wwg"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Go5-7x-zg8" secondAttribute="bottom" constant="14" id="9Yq-a9-JYg"/>
<constraint firstItem="Go5-7x-zg8" firstAttribute="leading" secondItem="1Hi-6u-Z8f" secondAttribute="leading" id="BQB-Lx-flj"/>
<constraint firstAttribute="bottom" secondItem="dyx-aR-S4p" secondAttribute="bottom" constant="7" id="Ghm-cq-BfQ"/>
<constraint firstItem="Go5-7x-zg8" firstAttribute="top" secondItem="1Hi-6u-Z8f" secondAttribute="bottom" constant="6" id="Nph-zt-FH0"/>
......@@ -69,7 +73,7 @@
</userDefinedRuntimeAttributes>
</view>
</subviews>
<color key="backgroundColor" red="0.96862745098039216" green="0.74117647058823533" blue="0.48627450980392156" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="nDA-SS-B2Z" firstAttribute="top" secondItem="pr8-hQ-LpE" secondAttribute="top" id="8fC-07-6l8"/>
<constraint firstAttribute="trailing" secondItem="nDA-SS-B2Z" secondAttribute="trailing" constant="10" id="HBU-ub-jyU"/>
......@@ -78,6 +82,7 @@
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="pr8-hQ-LpE" secondAttribute="trailing" id="IfP-kb-S0R"/>
<constraint firstItem="pr8-hQ-LpE" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Ih7-S3-ByO"/>
......@@ -86,6 +91,13 @@
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="awardNum" destination="hkj-qT-nh4" id="xia-dl-dpr"/>
<outlet property="buttonState" destination="dyx-aR-S4p" id="CpN-7w-eAq"/>
<outlet property="subTitle" destination="Go5-7x-zg8" id="UZH-Pl-fPU"/>
<outlet property="title" destination="1Hi-6u-Z8f" id="LHG-Gl-5H3"/>
</connections>
<point key="canvasLocation" x="-343" y="69"/>
</tableViewCell>
</objects>
......
......@@ -9,7 +9,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface WelfareCenterVC : UIViewController
@interface WelfareCenterVC : BaseViewController
@end
......
......@@ -6,13 +6,36 @@
//
#import "WelfareCenterVC.h"
#import "WelfareCenterData.h"
#import "WelfareCenterCell.h"
#define Identifier @"WelfareCenterCell"
#define MAXProcess (6)
@interface WelfareCenterVC ()
@property (nonatomic, strong) NSMutableArray * dataArray;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) IBOutletCollection(UIImageView) NSArray *diamondimages;
@property (weak, nonatomic) IBOutlet UIStackView *stackProcess;
@property (weak, nonatomic) IBOutlet UIImageView *imageLine;
@property (weak, nonatomic) IBOutlet UIButton *treasureBox;
@property (weak, nonatomic) IBOutlet UILabel *currentText;
@property (nonatomic ,assign)NSInteger maxProcess;
@property (nonatomic ,assign)NSInteger coinsProcess;
@property (nonatomic ,assign)NSInteger showA;
@property (nonatomic ,retain)WelfareCenterData *currentData;
- (IBAction)treasureBoxClick:(UIButton *)sender;
@end
@implementation WelfareCenterVC
......@@ -30,9 +53,17 @@
}
- (void)viewDidLoad {
[super viewDidLoad];
[self addLeftItme:[UIImage imageNamed:@"arrow_left"] selecedImage:nil orText:@" " selectedText:nil];
self.title = @"福利中心";
[self loadData];
[self initTableView];
[self navbarClearShadow];
self.view.backgroundColor = [UIColor colorWithHexString:@"#F7BD7C"];
UIImage *image = [UIImage imageNamed:@"DottedLine"];
UIImage *newImage = [UIImage imageWithCGImage:[image CGImage] scale:image.scale orientation:image.imageOrientation];
[self.imageLine setBackgroundColor:[UIColor colorWithPatternImage:newImage]];
// Do any additional setup after loading the view from its nib.
......@@ -46,6 +77,18 @@
[self.tableView registerNib:nib forCellReuseIdentifier:Identifier];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}
#pragma - mark 返回
- (void)leftBarButtonItemAction:(UIButton *)btn{
[self dismissViewControllerAnimated:YES completion:^{
}];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
......@@ -56,20 +99,34 @@
}
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
// ESMusicListData * data = [self.dataArray objectAtIndex:indexPath.row];
WelfareCenterData * data = [self.dataArray objectAtIndex:indexPath.row];
WelfareCenterCell * cell = [tableView dequeueReusableCellWithIdentifier:Identifier forIndexPath:indexPath];
// cell.cellType = self.cellType;
// cell.title.text = data.songName;
// cell.content.text = data.musicCategory;
//// [cell.musicImage setImageWithURL:[NSURL URLWithString:data.musicCover] placeholderImage:[UIImage imageNamed:@"home_top_bg"]];
// [cell.musicImage sd_setImageWithURL:[NSURL URLWithString:data.musicCover] placeholderImage:[UIImage imageNamed:@"home_top_bg"]];
//
// cell.isPlaying = [[MMusicManager shareManager]isPlayingWithModel:data listName:self.albumCategory];
// if (cell.isPlaying) {
// self.indexPath = indexPath;
// }
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.title.text = data.title;
cell.subTitle.text = data.description_Content;
cell.status = data.status;
[cell.awardNum setTitle:[NSString stringWithFormat:@"+%@",data.awardCoins] forState:UIControlStateNormal];
WEAKSELF;
cell.buttonBlock = ^(WelfareCenterCell * _Nonnull thisCell) {
NSInteger status = thisCell.status;
NSIndexPath * indexP = [weakSelf.tableView indexPathForCell:thisCell];
WelfareCenterData * data = [weakSelf.dataArray objectAtIndex:indexP.row];
if (status == 0) {
[weakSelf showAD:data];
}else if(status == 1){
[MBProgressHUD showMessage:@"明日再来"];
}else if (status == 2){ //立即领取
[weakSelf receiveThePrize:data];
}else{
[MBProgressHUD showMessage:@"明日再来"];
}
};
return cell;
}
......@@ -116,32 +173,140 @@
- (void)loadData{
WEAKSELF;
[MBProgressHUD showLoading:@"loading"];
NSMutableDictionary * dic = [[NSMutableDictionary alloc]init];
[dic setObject:@"1" forKey:@"type"];
//请求进度
[[CGNetworkTools shared] getWithAction:task_process parameters:@{} success:^(id _Nonnull response) {
[[CGNetworkTools shared] getWithAction:task_process parameters:dic success:^(id _Nonnull response) {
[MBProgressHUD hideHUD];
NSDictionary * dic = response[@"result"][@"data"];
if (dic.count) {
weakSelf.maxProcess = [[dic valueForKey:@"max"] integerValue];
weakSelf.coinsProcess = [[dic valueForKey:@"coins"] integerValue];
weakSelf.showA = [[dic valueForKey:@"show"] integerValue];
[weakSelf updateUI];
}
} failure:^(NSError * _Nonnull error) {
[MBProgressHUD hideHUD];
}];
NSMutableDictionary * dicStat = [[NSMutableDictionary alloc]init];
[dicStat setObject:@"welfare_center_task_list" forKey:@"slotName"];
// 请求列表
[[CGNetworkTools shared] getWithAction:taskListWithStat parameters:@{} success:^(id _Nonnull response) {
[[CGNetworkTools shared] getWithAction:taskListWithStat parameters:dicStat success:^(id _Nonnull response) {
[MBProgressHUD hideHUD];
if (response) {
NSArray * array = response[@"result"][@"data"][@"userTask"];
if (array) {
weakSelf.dataArray = [WelfareCenterData mj_objectArrayWithKeyValuesArray:array];
[weakSelf.tableView reloadData];
}
}
} failure:^(NSError * _Nonnull error) {
[MBProgressHUD hideHUD];
}];
}
//MARK: 更新UI
- (void)updateUI{
for (UIImageView *imageView in self.diamondimages) {
if (imageView.tag <= 1000 + self.coinsProcess) {
[imageView setImage:[UIImage imageNamed:@"FinishedDiamonds"]];
} else {
[imageView setImage:[UIImage imageNamed:@"UnfinishedDiamond"]];
}
if (imageView.tag <= 1000 + MAXProcess) { //[1,10]
imageView.hidden = NO;
}else{
imageView.hidden = YES;
}
}
if (self.coinsProcess >= 6) {
[self.treasureBox setBackgroundImage:[UIImage imageNamed:@"OpenTreasureChest"] forState:UIControlStateNormal];
}else{
[self.treasureBox setBackgroundImage:[UIImage imageNamed:@"TreasureChestClose"] forState:UIControlStateNormal];
}
self.currentText.text = [NSString stringWithFormat:@"%ld",self.coinsProcess];
}
//MARK: 看广告
- (void)showAD:( WelfareCenterData * ) data{
self.currentData = data;
WEAKSELF;
[IOSADManager shareADManager].advertisingSpace = @"play_adVideo_end_welfareTask";
[[IOSADManager shareADManager] showADType:ADType_Video resultBlock:^(BOOL success) {
if (success) {
//2462
[[CGUserManager shared] addLocCollection:@"play_adVideo_end_welfareTask" value:@""];
if (weakSelf.currentData.sid.length > 0) {
[MBProgressHUD showLoading:@"loading"];
[[CGNetworkTools shared] postWithAction:welfareVideoReport parameters:@{@"sid": weakSelf.currentData.sid} success:^(id _Nonnull response) {
[MBProgressHUD hideHUD];
if ([[response objectForKey:@"status"] integerValue] == 200) {
//
NSLog(@"welfare_video_report success");
weakSelf.currentData.status = 2;
[weakSelf.tableView reloadData];
}
} failure:^(NSError * _Nonnull error) {
[MBProgressHUD hideHUD];
}];
}
} else {
// [MBProgressHUD showError:@"抱歉, 请重试"];
}
}];
}
/*
#pragma mark - Navigation
//MARK: 获取奖励
- (void)receiveThePrize:(WelfareCenterData *) data{
self.currentData = data;
WEAKSELF;
[MBProgressHUD showLoading:@"loading"];
[[CGNetworkTools shared] postWithAction:complete_task parameters:@{@"id": weakSelf.currentData.sid} success:^(id _Nonnull response) {
[MBProgressHUD hideHUD];
if ([[response objectForKey:@"status"] integerValue] == 200) {
NSLog(@"welfare_video_report success");
weakSelf.currentData.status = 1;
[weakSelf.tableView reloadData];
}
} failure:^(NSError * _Nonnull error) {
[MBProgressHUD hideHUD];
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}];
}
*/
//MARK: 打开宝箱
- (IBAction)treasureBoxClick:(UIButton *)sender {
if (self.coinsProcess >= 6) {
[[CGNetworkTools shared] getWithAction:welfare_task_box parameters:@{} success:^(id _Nonnull response) {
} failure:^(NSError * _Nonnull error) {
}];
}
[[CGNetworkTools shared] getWithAction:welfare_task_box parameters:@{} success:^(id _Nonnull response) {
} failure:^(NSError * _Nonnull error) {
}];
}
@end
This diff is collapsed.
//
// WelfareCenterData.h
// GYDemo
// 福利中心任务列表
// Created by zhangshuai on 2020/11/19.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface WelfareCenterData : NSObject
@property (nonatomic, copy) NSString * adType; // adType = 1;
@property (nonatomic, copy) NSString * alertRenderType;
@property (nonatomic, copy) NSString * awardCoins;
@property (nonatomic, copy) NSString * awardDesc;
@property (nonatomic, copy) NSString * awardLimit;
@property (nonatomic, copy) NSString * awardParticle;
@property (nonatomic, copy) NSString * awardRenderType;
@property (nonatomic, copy) NSString * awardType;
@property (nonatomic, retain) NSArray * big_images;
@property (nonatomic, copy) NSString * browserCore;
@property (nonatomic, copy) NSString * buttonText; // buttonText = "去观看";
@property (nonatomic, copy) NSString * coins;
@property (nonatomic, copy) NSString * cornerText;
@property (nonatomic, copy) NSString * cpmPrice;
@property (nonatomic, copy) NSString * current_nums;
@property (nonatomic, copy) NSString * desc; // desc = "总可得1金币";
@property (nonatomic, copy) NSString * description_Content; // description = "看完视频即可得金币";
@property (nonatomic, copy) NSString * explorerType;
@property (nonatomic, copy) NSString * ext;
@property (nonatomic, copy) NSString * ifTop;
@property (nonatomic, copy) NSString * image_render_type;
@property (nonatomic, copy) NSString * images;
@property (nonatomic, retain) NSArray * imp_tracking;
@property (nonatomic, retain) NSArray * clk_tracking;
@property (nonatomic, copy) NSString * incentive_level;
@property (nonatomic, copy) NSString * label; // label = "广告";
@property (nonatomic, copy) NSString * opentype;
@property (nonatomic, copy) NSString * pk;
@property (nonatomic, copy) NSString * redPacketFlag;
@property (nonatomic, copy) NSString * reqId;
@property (nonatomic, copy) NSString * sdkShowTimes;
@property (nonatomic, copy) NSString * shareType;
@property (nonatomic, copy) NSString * sid; // 应该是任务ID
@property (nonatomic, copy) NSString * slotName;
@property (nonatomic, copy) NSString * slot_ad_type;
@property (nonatomic, copy) NSString * slot_id;
@property (nonatomic, assign) NSInteger status; //0 : 去完成 1: 明日再来 2: 立即领取
@property (nonatomic, copy) NSString * timeTrigger;
@property (nonatomic, copy) NSString * title; // title = "领今日视频金币";
@property (nonatomic, copy) NSString * type;
@end
NS_ASSUME_NONNULL_END
//
// WelfareCenterData.m
// GYDemo
// 福利中心任务列表
// Created by zhangshuai on 2020/11/19.
//
#import "WelfareCenterData.h"
@implementation WelfareCenterData
+ (NSDictionary *)mj_replacedKeyFromPropertyName{
return @{
@"description_Content" : @"description"//前边的是你想用的key,后边的是返回的key
};
}
@end
//
// WelfareCenterCell.m
// GYDemo
//
// Created by zhangshuai on 2020/11/17.
//
#import "WelfareCenterCell.h"
@implementation WelfareCenterCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment