Initial commit

This commit is contained in:
ifish
2017-08-15 16:59:01 +08:00
commit bdc83e07ef
5766 changed files with 423223 additions and 0 deletions
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<array>
<dict>
<key>taskId</key>
<string>0</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>everyDaySignin</string>
<key>ruleDetail</key>
<string>小手一抖,金币到手</string>
<key>ruleTitle</key>
<string>签到</string>
</dict>
<dict>
<key>taskId</key>
<string>1</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>readInformation</string>
<key>ruleDetail</key>
<string>阅读一条资讯</string>
<key>ruleTitle</key>
<string>阅读资讯</string>
</dict>
<dict>
<key>taskId</key>
<string>2</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>openGoodsLink</string>
<key>ruleDetail</key>
<string>打开一个商品链接</string>
<key>ruleTitle</key>
<string>查看商品</string>
</dict>
<dict>
<key>taskId</key>
<string>3</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>roomLeaveMsg</string>
<key>ruleDetail</key>
<string>在爱鱼看看中留言</string>
<key>ruleTitle</key>
<string>爱鱼看看</string>
</dict>
<dict>
<key>taskId</key>
<string>5</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>shareIfishApp</string>
<key>ruleDetail</key>
<string>分享爱鱼奇到朋友圈</string>
<key>ruleTitle</key>
<string>分享爱鱼奇</string>
</dict>
<dict>
<key>taskId</key>
<string>4</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>ifishCommunity</string>
<key>ruleDetail</key>
<string>进入爱鱼圈和鱼友交流</string>
<key>ruleTitle</key>
<string>爱鱼圈</string>
</dict>
<dict>
<key>taskId</key>
<string>6</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>shareCameraPicture</string>
<key>ruleDetail</key>
<string>分享图库中的图片到朋友圈(需要摄像头)</string>
<key>ruleTitle</key>
<string>图片分享</string>
</dict>
<dict>
<key>taskId</key>
<string>7</string>
<key>addType</key>
<string>everyDay</string>
<key>ruleType</key>
<string>shareLookReport</string>
<key>ruleDetail</key>
<string>分享看护报告到朋友圈(需要摄像头)</string>
<key>ruleTitle</key>
<string>看护报告</string>
</dict>
<dict>
<key>taskId</key>
<string>8</string>
<key>addType</key>
<string>once</string>
<key>ruleType</key>
<string>rename</string>
<key>ruleDetail</key>
<string>更换在爱鱼奇中的用户名</string>
<key>ruleTitle</key>
<string>更换姓名</string>
</dict>
<dict>
<key>taskId</key>
<string>9</string>
<key>addType</key>
<string>once</string>
<key>ruleType</key>
<string>uploadHeadImg</string>
<key>ruleDetail</key>
<string>上传在爱鱼奇中的显示的头像</string>
<key>ruleTitle</key>
<string>上传头像</string>
</dict>
<dict>
<key>taskId</key>
<string>10</string>
<key>addType</key>
<string>once</string>
<key>ruleType</key>
<string>openShareCamera</string>
<key>ruleDetail</key>
<string>开启爱鱼看看中的分享</string>
<key>ruleTitle</key>
<string>开启分享</string>
</dict>
<dict>
<key>taskId</key>
<string>11</string>
<key>addType</key>
<string>once</string>
<key>ruleType</key>
<string>choiceLookShops</string>
<key>ruleDetail</key>
<string>在优选商家中选择一个看护商家</string>
<key>ruleTitle</key>
<string>优选商家</string>
</dict>
<dict>
<key>taskId</key>
<string>12</string>
<key>addType</key>
<string>once</string>
<key>ruleType</key>
<string>ifishDoctor</string>
<key>ruleDetail</key>
<string>在鱼医生中发起一次提问</string>
<key>ruleTitle</key>
<string>鱼医生</string>
</dict>
</array>
</array>
</plist>
@@ -0,0 +1,20 @@
//
// IfishTaskModel.h
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface IfishTaskModel : NSObject
@property (nonatomic,copy) NSString *addType;
@property (nonatomic,copy) NSString *ruleType;
@property (nonatomic) BOOL isDone;
@property (nonatomic) NSInteger addGoldValue;
-(instancetype)initWithDict:(NSDictionary *)dict;
@end
@@ -0,0 +1,43 @@
//
// IfishTaskModel.m
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "IfishTaskModel.h"
@implementation IfishTaskModel
-(void)encodeWithCoder:(NSCoder*)aCoder{
[aCoder encodeObject:self.addType forKey:@"addType"];
[aCoder encodeObject:self.ruleType forKey:@"ruleType"];
[aCoder encodeBool:self.isDone forKey:@"isFinish"];
[aCoder encodeInteger:self.addGoldValue forKey:@"addValue"];
}
-(id)initWithCoder:(NSCoder*)aDecoder{
if (self= [super init]) {
self.addType=[aDecoder decodeObjectForKey:@"addType"];
self.ruleType=[aDecoder decodeObjectForKey:@"ruleType"];
self.isDone=[aDecoder decodeBoolForKey:@"isFinish"];
self.addGoldValue=[aDecoder decodeIntegerForKey:@"addValue"];
}
return self;
}
-(instancetype)initWithDict:(NSDictionary *)dict{
if (self= [super init]) {
self.addType = [dict objectForKey:@"addType"];
self.ruleType = [dict objectForKey:@"ruleType"];
self.isDone = [[dict objectForKey:@"isFinish"] boolValue];
self.addGoldValue = [[dict objectForKey:@"addValue"] integerValue];
}
return self;
}
@end
@@ -0,0 +1,19 @@
//
// IfishTaskRuletype.h
// Ifish
//
// Created by imac on 17/3/15.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface IfishTaskRuletype : NSObject
@property (nonatomic,copy) NSString *taskId;
@property (nonatomic,copy) NSString *addType;
@property (nonatomic,copy) NSString *ruleType;
@property (nonatomic,copy) NSString *ruleTitle;
@property (nonatomic,copy) NSString *ruleDetail;
-(instancetype)initWithDict:(NSDictionary *)dict;
@end
@@ -0,0 +1,23 @@
//
// IfishTaskRuletype.m
// Ifish
//
// Created by imac on 17/3/15.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "IfishTaskRuletype.h"
@implementation IfishTaskRuletype
-(instancetype)initWithDict:(NSDictionary *)dict{
if (self= [super init]) {
_ruleType = dict[@"ruleType"];
_ruleTitle = dict[@"ruleTitle"];
_ruleDetail = dict[@"ruleDetail"];
_addType = dict[@"addType"];
_taskId = dict[@"taskId"];
}
return self;
}
@end
@@ -0,0 +1,23 @@
//
// IfishTaskViewCell.h
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "IfishTaskModel.h"
#import "IfishTaskRuletype.h"
@interface IfishTaskViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *taskImg;
@property (weak, nonatomic) IBOutlet UILabel *taskTitle;
@property (weak, nonatomic) IBOutlet UILabel *taskaddGold;
@property (weak, nonatomic) IBOutlet UILabel *isDoneTask;
@property (weak, nonatomic) IBOutlet UILabel *taskdetail;
-(void)loadEveryDayDataWith:(IfishTaskRuletype*)model doneTaskArr:(NSArray *)doneTaskArr;
-(void)loadChioceDataWith:(IfishTaskRuletype*)model doneTaskArr:(NSArray *)doneTaskArr
;
@end
@@ -0,0 +1,55 @@
//
// IfishTaskViewCell.m
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "IfishTaskViewCell.h"
@implementation IfishTaskViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
-(void)loadEveryDayDataWith:(IfishTaskRuletype*)model doneTaskArr:(NSArray *)doneTaskArr
{
[self getdataWith:model doneTaskArr:(NSArray *)doneTaskArr];
}
-(void)loadChioceDataWith:(IfishTaskRuletype*)model doneTaskArr:(NSArray *)doneTaskArr
{
[self getdataWith:model doneTaskArr:(NSArray *)doneTaskArr];
}
-(void)getdataWith:(IfishTaskRuletype*)model doneTaskArr:(NSArray *)doneTaskArr
{
self.taskImg.image = [UIImage imageNamed:[NSString stringWithFormat:@"task_%@",model.ruleType]];
self.taskTitle.text = model.ruleTitle;
self.taskdetail.text = model.ruleDetail;
for (IfishTaskModel *task in doneTaskArr) {
if ([task.ruleType isEqualToString:model.ruleType]) {
self.taskaddGold.text = [NSString stringWithFormat:@"+ %ld金币",(long)task.addGoldValue];
self.isDoneTask.text = task.isDone ? @"已领取":@"未完成";
self.isDoneTask.textColor = task.isDone ? RGB(227, 227, 227):RGB(255, 92, 92);
}
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Alignment constraints to the first baseline" minToolsVersion="6.0"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="IfishTaskViewCell" rowHeight="60" id="KGk-i7-Jjw" customClass="IfishTaskViewCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="60"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="59"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="4fu-iT-aSd">
<rect key="frame" x="15" y="10" width="40" height="40"/>
<constraints>
<constraint firstAttribute="width" constant="40" id="vk0-0H-k38"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0o5-Ky-AJw">
<rect key="frame" x="68" y="10" width="38" height="17"/>
<constraints>
<constraint firstAttribute="height" constant="17" id="ral-ys-sH0"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OcM-yp-S2R">
<rect key="frame" x="68" y="33" width="31" height="17"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="未完成" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rxj-36-x7X">
<rect key="frame" x="295" y="6" width="63" height="21"/>
<constraints>
<constraint firstAttribute="height" constant="21" id="EQQ-74-f0R"/>
<constraint firstAttribute="width" constant="63" id="ZJB-ec-0Lf"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<color key="textColor" red="1" green="0.36078431372549019" blue="0.36078431372549019" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="+1金币" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GpX-us-hFd">
<rect key="frame" x="114" y="12" width="41" height="15"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="1" green="0.79607843137254897" blue="0.36078431372549019" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="451-KR-hX0">
<rect key="frame" x="15" y="59" width="360" height="1"/>
<color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.94901960784313721" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="cep-Iv-mDh"/>
</constraints>
</view>
</subviews>
<constraints>
<constraint firstItem="4fu-iT-aSd" firstAttribute="leading" secondItem="451-KR-hX0" secondAttribute="leading" id="0ja-dd-LBN"/>
<constraint firstItem="0o5-Ky-AJw" firstAttribute="firstBaseline" secondItem="GpX-us-hFd" secondAttribute="firstBaseline" id="11T-kH-qy8"/>
<constraint firstAttribute="trailingMargin" secondItem="Rxj-36-x7X" secondAttribute="trailing" constant="9" id="2J5-bn-0Yp"/>
<constraint firstItem="GpX-us-hFd" firstAttribute="baseline" secondItem="Rxj-36-x7X" secondAttribute="baseline" id="Bdr-l1-VDt"/>
<constraint firstItem="451-KR-hX0" firstAttribute="top" secondItem="4fu-iT-aSd" secondAttribute="bottom" constant="9" id="BqD-1i-1hP"/>
<constraint firstItem="OcM-yp-S2R" firstAttribute="bottom" secondItem="4fu-iT-aSd" secondAttribute="bottom" id="Eey-X9-g6s"/>
<constraint firstItem="0o5-Ky-AJw" firstAttribute="baseline" secondItem="GpX-us-hFd" secondAttribute="baseline" id="FCS-ZC-Vfh"/>
<constraint firstAttribute="bottom" secondItem="451-KR-hX0" secondAttribute="bottom" id="GKs-Uz-Gt1"/>
<constraint firstItem="4fu-iT-aSd" firstAttribute="top" secondItem="0o5-Ky-AJw" secondAttribute="top" id="OWZ-JX-peM"/>
<constraint firstAttribute="trailing" secondItem="451-KR-hX0" secondAttribute="trailing" id="U26-MD-icq"/>
<constraint firstItem="OcM-yp-S2R" firstAttribute="top" secondItem="0o5-Ky-AJw" secondAttribute="bottom" constant="6" id="Z9e-ek-Joi"/>
<constraint firstItem="OcM-yp-S2R" firstAttribute="leading" secondItem="0o5-Ky-AJw" secondAttribute="leading" id="c0A-6p-5qG"/>
<constraint firstItem="GpX-us-hFd" firstAttribute="leading" secondItem="0o5-Ky-AJw" secondAttribute="trailing" constant="8" id="ig6-Xi-ABL"/>
<constraint firstItem="OcM-yp-S2R" firstAttribute="leading" secondItem="4fu-iT-aSd" secondAttribute="trailing" constant="13" id="l1T-J2-zim"/>
<constraint firstItem="4fu-iT-aSd" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="pqU-sf-gCL"/>
<constraint firstItem="Rxj-36-x7X" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="-2" id="rJ1-Ha-KUP"/>
<constraint firstItem="451-KR-hX0" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="vPF-qC-2U3"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="isDoneTask" destination="Rxj-36-x7X" id="D3O-4I-hZV"/>
<outlet property="taskImg" destination="4fu-iT-aSd" id="Ugk-Aw-ccI"/>
<outlet property="taskTitle" destination="0o5-Ky-AJw" id="4af-EU-wDc"/>
<outlet property="taskaddGold" destination="GpX-us-hFd" id="O4K-I5-x6v"/>
<outlet property="taskdetail" destination="OcM-yp-S2R" id="Brb-Fu-699"/>
</connections>
<point key="canvasLocation" x="25.5" y="52"/>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,13 @@
//
// TaskHeadViewCell.h
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TaskHeadViewCell : UITableViewCell
@end
@@ -0,0 +1,24 @@
//
// TaskHeadViewCell.m
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "TaskHeadViewCell.h"
@implementation TaskHeadViewCell
- (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
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="TaskHeadViewCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="34.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="完成以下任务,轻松赚取金币" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Tsb-JG-Shx">
<rect key="frame" x="101.5" y="9.5" width="172.5" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="Tsb-JG-Shx" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="EYa-Oi-97T"/>
<constraint firstItem="Tsb-JG-Shx" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="wWd-is-Ek7"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" red="1" green="0.72549019607843135" blue="0.33725490196078434" alpha="0.30146748310810811" colorSpace="calibratedRGB"/>
<point key="canvasLocation" x="24.5" y="51.5"/>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,16 @@
//
// TaskKindViewCell.h
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TaskKindViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UILabel *taskTitle;
@property (weak, nonatomic) IBOutlet UILabel *doneTask;
-(void)setCellDataAt:(NSIndexPath*)indexPath;
@end
@@ -0,0 +1,36 @@
//
// TaskKindViewCell.m
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "TaskKindViewCell.h"
@implementation TaskKindViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
-(void)setCellDataAt:(NSIndexPath*)indexPath{
if (indexPath.section ==1) {
self.taskTitle.text = @"每日任务";
}else if (indexPath.section ==3){
self.taskTitle.text = @"精选任务";
}
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="TaskKindViewCell" rowHeight="44" id="KGk-i7-Jjw" customClass="TaskKindViewCell">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="每日任务" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0RK-zw-ATy">
<rect key="frame" x="27" y="17" width="118" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nhl-YU-I4E">
<rect key="frame" x="297" y="17" width="56" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" red="1" green="0.53725490200000003" blue="0.2274509804" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ja6-jz-Hhm">
<rect key="frame" x="15" y="18" width="4" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" red="1" green="0.53725490196078429" blue="0.22745098039215686" alpha="1" colorSpace="calibratedRGB"/>
</view>
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OTX-Us-fCP">
<rect key="frame" x="0.0" y="43" width="375" height="1"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
</view>
</subviews>
</tableViewCellContentView>
<connections>
<outlet property="doneTask" destination="nhl-YU-I4E" id="Mt5-cc-iGf"/>
<outlet property="taskTitle" destination="0RK-zw-ATy" id="QNb-EW-xMm"/>
</connections>
<point key="canvasLocation" x="24.5" y="52"/>
</tableViewCell>
</objects>
</document>
@@ -0,0 +1,13 @@
//
// WoDeRenWuViewController.h
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "BaseVIewContorller.h"
@interface WoDeRenWuViewController : BaseVIewContorller
@end
@@ -0,0 +1,256 @@
//
// WoDeRenWuViewController.m
// Ifish
//
// Created by imac on 17/3/9.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "WoDeRenWuViewController.h"
#import "TaskHeadViewCell.h"
#import "TaskKindViewCell.h"
#import "IfishTaskViewCell.h"
#import "IfishTaskModel.h"
#import "IfishTaskRuletype.h"
@interface WoDeRenWuViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView *tableView;
@property (nonatomic,strong) NSMutableArray *everyDayTask;
@property (nonatomic,strong) NSArray *doneTasks;
@property (nonatomic,strong) NSMutableArray *chosenTask;
@property (nonatomic) NSInteger everyDayDoneTaskCount;
@property (nonatomic) NSInteger chosenDoneTaskCount;
@end
@implementation WoDeRenWuViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
[self addTitleViewWithTitle:@"我的任务"];
_everyDayTask = [[NSMutableArray alloc] init];
_chosenTask = [[NSMutableArray alloc] init];
_doneTasks = [[NSArray alloc] init];
_everyDayDoneTaskCount = 0;
_chosenDoneTaskCount = 0;
[self creatTab];
//走网络 体验不好 换静态页面 app端处理任务完成数据
//[self getData];
[self initData];
}
-(void)initData
{
_doneTasks =[[DataCenter defaultDtacenter] valueForKey:IFISHTASK_ARR];
if ([_doneTasks count]!=0) {
for (IfishTaskModel *mode in _doneTasks) {
if ([mode.addType isEqualToString:@"everyDay"]) {
if (mode.isDone) {
_everyDayDoneTaskCount ++;
}
}else{
if (mode.isDone) {
_chosenDoneTaskCount ++;
}
}
}
}
NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"IfishTask" ofType:@"plist"];
NSArray *data = [[NSArray alloc] initWithContentsOfFile:plistPath];
for (NSDictionary *listDic in data[0]) {
IfishTaskRuletype *model=[[IfishTaskRuletype alloc] initWithDict:listDic];
if ([model.addType isEqualToString:@"everyDay"]){
[_everyDayTask addObject:model];
}else{
[_chosenTask addObject:model];
}
}
//数组排序
// NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"taskId" ascending:YES];
// NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:&sortDescriptor count:1];
// [_everyDayTask sortUsingDescriptors:sortDescriptors];
//
//数组排序
// NSSortDescriptor *sortDescriptor2 = [[NSSortDescriptor alloc] initWithKey:@"taskId" ascending:YES];
//NSArray *sortDescriptors2 = [[NSArray alloc] initWithObjects:sortDescriptor2,nil];
//_everyDayTask = (NSMutableArray*) [_everyDayTask sortedArrayUsingDescriptors:sortDescriptors2];
[self.tableView reloadData];
}
-(void)getData{
//请求 获取规则金币信息接口
__weak typeof (self) weakSelf =self;
NSString *userId = [dataContorl dataControlGetUserIdInfo];
[AFHttpTool getgGoldRuleInfo:userId success:^(id response) {
NSDictionary *reDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
if ([reDic[@"result"] isEqualToString:@"100"]){
NSDictionary *dataDic = reDic[@"data"];
NSArray *goldRules = dataDic[@"goldRules"];
if (![goldRules isKindOfClass:[NSNull class]]&&goldRules) {
for (NSDictionary *dic in goldRules) {
IfishTaskModel *model = [[IfishTaskModel alloc] initWithDict:dic];
if ([model.addType isEqualToString:@"everyDay"]) {
[_everyDayTask addObject:model];
if (model.isDone) {
_everyDayDoneTaskCount ++;
}
}else{
if (model.isDone) {
_chosenDoneTaskCount ++;
}
[_chosenTask addObject:model];
}
}
[weakSelf.tableView reloadData];
}else{
[self.view makeToast:@"暂无任务"];
}
}else{
[self.view makeToast:@"请求失败"];
}
} failure:^(NSError *err) {
[self.view makeToast:@"请求异常"];
}];
}
-(void)creatTab{
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,self.view.frame.size.height) style:UITableViewStyleGrouped];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.showsVerticalScrollIndicator = NO;
self.tableView.backgroundColor = JWUIColorFromRGB(0xf2f2f2);
[self.view addSubview:self.tableView];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section == 2) {
//return [_everyDayTask count];
return [_everyDayTask count];
}else if (section == 4)
{
return [_chosenTask count];
}
return 1;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 5;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section==0) {
TaskHeadViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskHeadViewCell"];
if(cell==nil){
cell = [[[NSBundle mainBundle]loadNibNamed:@"TaskHeadViewCell" owner:self options:nil]lastObject];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}else if (indexPath.section==1||indexPath.section ==3){
TaskKindViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"TaskKindViewCell"];
if(cell==nil){
cell = [[[NSBundle mainBundle]loadNibNamed:@"TaskKindViewCell" owner:self options:nil]lastObject];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
[cell setCellDataAt:indexPath];
if (indexPath.section ==1) {
cell.doneTask.text =[NSString stringWithFormat:@"%ld/%ld",(long)_everyDayDoneTaskCount,(unsigned long)[_everyDayTask count]];
}else if (indexPath.section ==3){
cell.doneTask.text =[NSString stringWithFormat:@"%ld/%ld",(long)_chosenDoneTaskCount,(unsigned long)[_chosenTask count]];
}
return cell;
}else{
IfishTaskViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishTaskViewCell"];
if(cell==nil){
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishTaskViewCell" owner:self options:nil]lastObject];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
if (indexPath.section ==2) {
IfishTaskRuletype * model =_everyDayTask[indexPath.row];
[cell loadEveryDayDataWith:model doneTaskArr:_doneTasks];
}else{;
IfishTaskRuletype * model =_chosenTask[indexPath.row];
[cell loadChioceDataWith:model doneTaskArr:_doneTasks];
}
return cell;
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section==0) {
return 35*KWidth_Scale;
}else if (indexPath.section==1||indexPath.section ==3){
return 44*KWidth_Scale;
}else{
return 60*KWidth_Scale;
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 0.01f;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if(section ==1){
return 5.0f;
}
return 0.01f;
}
/*
#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