我的装扮完成

This commit is contained in:
fengshuo
2021-12-16 19:02:31 +08:00
parent 3f0bbf01c9
commit 286d617fba
51 changed files with 1442 additions and 140 deletions

View File

@@ -55,6 +55,8 @@ target 'xplan-ios' do
#UM统计
pod 'UMCommon'
pod 'UMDevice'
#头饰显示
pod 'YYWebImage', '~> 1.0.5'
#调试
pod 'LookinServer', :configurations => ['Debug']

View File

@@ -72,7 +72,14 @@ PODS:
- UMCommon (7.3.5):
- UMDevice
- UMDevice (2.0.5)
- YYCache (1.0.4)
- YYImage (1.0.4):
- YYImage/Core (= 1.0.4)
- YYImage/Core (1.0.4)
- YYText (1.0.7)
- YYWebImage (1.0.5):
- YYCache
- YYImage
DEPENDENCIES:
- AFNetworking
@@ -107,6 +114,7 @@ DEPENDENCIES:
- UMCommon
- UMDevice
- YYText
- YYWebImage (~> 1.0.5)
SPEC REPOS:
trunk:
@@ -140,7 +148,10 @@ SPEC REPOS:
- SZTextView
- UMCommon
- UMDevice
- YYCache
- YYImage
- YYText
- YYWebImage
EXTERNAL SOURCES:
TXLiteAVSDK_TRTC:
@@ -178,8 +189,11 @@ SPEC CHECKSUMS:
TXLiteAVSDK_TRTC: e78365f430926a1064e175fd8d97601559e7d3d1
UMCommon: ab4d875ddefe1b06c60b577e4a58bc4d433ee067
UMDevice: c13bbb2e8ca6c67d1e23e03162553e3ec5a8b5b0
YYCache: 8105b6638f5e849296c71f331ff83891a4942952
YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
YYWebImage: 5f7f36aee2ae293f016d418c7d6ba05c4863e928
PODFILE CHECKSUM: 90bfc18d3332c11bf6da588fa02ae11025118de0
PODFILE CHECKSUM: 0802f53f919b3aa40ea73b6ec4092d32b46b4b46
COCOAPODS: 1.10.1

View File

@@ -165,6 +165,12 @@
E824546426F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E824546326F5FF1C00BE8163 /* XPMineResetPayPasswordPresenter.m */; };
E824546626F5FF6000BE8163 /* XPMineResetPayPasswordProtocol.h in Sources */ = {isa = PBXBuildFile; fileRef = E824546526F5FF5100BE8163 /* XPMineResetPayPasswordProtocol.h */; };
E8252FEE27687DF1002B3164 /* ActivityInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8252FED27687DF1002B3164 /* ActivityInfoModel.m */; };
E82D5C6D276ADCE700858D6D /* XPMineDressEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C6C276ADCE700858D6D /* XPMineDressEmptyTableViewCell.m */; };
E82D5C70276AE60000858D6D /* HeadwearModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C6F276AE60000858D6D /* HeadwearModel.m */; };
E82D5C73276AE94800858D6D /* CarModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C72276AE94800858D6D /* CarModel.m */; };
E82D5C76276AEB5100858D6D /* NameplateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C75276AEB5100858D6D /* NameplateModel.m */; };
E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */; };
E82D5C7D276B343300858D6D /* YYAnimatedImageView+ImageShow.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */; };
E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */ = {isa = PBXBuildFile; fileRef = E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */; };
E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */; };
E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */; };
@@ -664,6 +670,18 @@
E824546526F5FF5100BE8163 /* XPMineResetPayPasswordProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineResetPayPasswordProtocol.h; sourceTree = "<group>"; };
E8252FEC27687DF1002B3164 /* ActivityInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ActivityInfoModel.h; sourceTree = "<group>"; };
E8252FED27687DF1002B3164 /* ActivityInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ActivityInfoModel.m; sourceTree = "<group>"; };
E82D5C6B276ADCE700858D6D /* XPMineDressEmptyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineDressEmptyTableViewCell.h; sourceTree = "<group>"; };
E82D5C6C276ADCE700858D6D /* XPMineDressEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineDressEmptyTableViewCell.m; sourceTree = "<group>"; };
E82D5C6E276AE60000858D6D /* HeadwearModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HeadwearModel.h; sourceTree = "<group>"; };
E82D5C6F276AE60000858D6D /* HeadwearModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HeadwearModel.m; sourceTree = "<group>"; };
E82D5C71276AE94800858D6D /* CarModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CarModel.h; sourceTree = "<group>"; };
E82D5C72276AE94800858D6D /* CarModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CarModel.m; sourceTree = "<group>"; };
E82D5C74276AEB5100858D6D /* NameplateModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NameplateModel.h; sourceTree = "<group>"; };
E82D5C75276AEB5100858D6D /* NameplateModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NameplateModel.m; sourceTree = "<group>"; };
E82D5C78276B25D100858D6D /* SpriteSheetImageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpriteSheetImageManager.h; sourceTree = "<group>"; };
E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpriteSheetImageManager.m; sourceTree = "<group>"; };
E82D5C7B276B343300858D6D /* YYAnimatedImageView+ImageShow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YYAnimatedImageView+ImageShow.h"; sourceTree = "<group>"; };
E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "YYAnimatedImageView+ImageShow.m"; sourceTree = "<group>"; };
E82EE0F6272FDDFA00D15DC1 /* UserPrivacyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserPrivacyView.h; sourceTree = "<group>"; };
E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserPrivacyView.m; sourceTree = "<group>"; };
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPKickUserModel.h; sourceTree = "<group>"; };
@@ -1235,6 +1253,7 @@
189DD52A26DE255300AB55B1 /* Products */,
D09C770DC30B9BAAEAFC7945 /* Pods */,
BFB922F5D81845AC32D1E1ED /* Frameworks */,
E8B35A5E27912E83005F8318 /* Recovered References */,
);
sourceTree = "<group>";
};
@@ -1459,6 +1478,7 @@
189DD5A726DFA09700AB55B1 /* Tool */ = {
isa = PBXGroup;
children = (
E82D5C77276B25B000858D6D /* SpriteSheetManager */,
E865964E2701A1A900846EBD /* StatisticsService */,
E89DA6612700590A008483C1 /* IAPHelper */,
E8B846B926FD7BE600A777FE /* UploadImage */,
@@ -1896,6 +1916,17 @@
path = Cell;
sourceTree = "<group>";
};
E82D5C77276B25B000858D6D /* SpriteSheetManager */ = {
isa = PBXGroup;
children = (
E82D5C78276B25D100858D6D /* SpriteSheetImageManager.h */,
E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */,
E82D5C7B276B343300858D6D /* YYAnimatedImageView+ImageShow.h */,
E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */,
);
path = SpriteSheetManager;
sourceTree = "<group>";
};
E838D99D275E1B6C0079E0B5 /* AnimationView */ = {
isa = PBXGroup;
children = (
@@ -1958,6 +1989,12 @@
E83953272769FFF100CF2F24 /* Model */ = {
isa = PBXGroup;
children = (
E82D5C6E276AE60000858D6D /* HeadwearModel.h */,
E82D5C6F276AE60000858D6D /* HeadwearModel.m */,
E82D5C71276AE94800858D6D /* CarModel.h */,
E82D5C72276AE94800858D6D /* CarModel.m */,
E82D5C74276AEB5100858D6D /* NameplateModel.h */,
E82D5C75276AEB5100858D6D /* NameplateModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -1980,6 +2017,8 @@
E839533B276A0CCD00CF2F24 /* XPMineCarTableViewCell.m */,
E839533D276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.h */,
E839533E276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m */,
E82D5C6B276ADCE700858D6D /* XPMineDressEmptyTableViewCell.h */,
E82D5C6C276ADCE700858D6D /* XPMineDressEmptyTableViewCell.m */,
);
path = Cell;
sourceTree = "<group>";
@@ -2513,6 +2552,13 @@
path = StageView;
sourceTree = "<group>";
};
E8B35A5E27912E83005F8318 /* Recovered References */ = {
isa = PBXGroup;
children = (
);
name = "Recovered References";
sourceTree = "<group>";
};
E8B825BC26E9E520009E8E9F /* Model */ = {
isa = PBXGroup;
children = (
@@ -3081,6 +3127,7 @@
18EE3FF12750D2AD00A452BF /* NIMTimeUtils.m in Sources */,
E839532D276A030F00CF2F24 /* XPMineDressUpListViewController.m in Sources */,
E8B846D826FDE17300A777FE /* XPMineRechargeProtocol.h in Sources */,
E82D5C7D276B343300858D6D /* YYAnimatedImageView+ImageShow.m in Sources */,
E8B846C726FDB45000A777FE /* XPMineUserInfoAlbumProtocol.h in Sources */,
E8DEC992276441AA0078CB70 /* XPCandyTreeAnimationModel.m in Sources */,
E890BC07273CF1800007C46B /* XPGiftCountCollectionViewCell.m in Sources */,
@@ -3192,6 +3239,7 @@
E8AC722726F482A4007D6E91 /* XPMineFeedbackPresenter.m in Sources */,
E8C6FFCC27548120004DC9F0 /* Api+Home.m in Sources */,
186A534E26FC6ED900D67B2C /* TTPopupService.m in Sources */,
E82D5C6D276ADCE700858D6D /* XPMineDressEmptyTableViewCell.m in Sources */,
18A61BD7274F7F6900A09A54 /* NetImageConfig.m in Sources */,
E8C21501274B76F60079E6BF /* XPRoomAnimationHitView.m in Sources */,
E8AC722426F47E5E007D6E91 /* XPMineFeedbackViewController.m in Sources */,
@@ -3242,9 +3290,11 @@
189DD67E26E1FD8900AB55B1 /* UIImage+Utils.m in Sources */,
E824545626F5E51900BE8163 /* XPMineVerifIdentityViewController.m in Sources */,
E8DEC98F27643EB30078CB70 /* XPCandyTreeAnimationManager.m in Sources */,
E82D5C73276AE94800858D6D /* CarModel.m in Sources */,
186A534726FC6ED900D67B2C /* TTAlertConfig.m in Sources */,
18F403EE2758CF2F00A6C548 /* MessageContentImage.m in Sources */,
18E7B31E26F0984C0064BC9B /* UserLevelVo.m in Sources */,
E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */,
E874B88B27215EAF003954B9 /* MicroQueueModel.m in Sources */,
E8EE827D272B9A2300A17217 /* XPRoomSendTextView.m in Sources */,
E8EEB90626FC5772007C6EBA /* XPMineUserInfoEditViewController.m in Sources */,
@@ -3257,6 +3307,7 @@
E8680718271967B00024F48F /* MicroView.m in Sources */,
E8B825CD26EA18C8009E8E9F /* ThemeColor.m in Sources */,
E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */,
E82D5C70276AE60000858D6D /* HeadwearModel.m in Sources */,
E8A03DEC276301EF0098D9EA /* XPCandyTreeRankView.m in Sources */,
18F404C3276098F100A6C548 /* Api+Message.m in Sources */,
E8C6FFED27550CC2004DC9F0 /* HomeSearchResultModel.m in Sources */,
@@ -3353,6 +3404,7 @@
18EE3FDF2750C1F700A452BF /* SessionListCell.m in Sources */,
E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */,
189DD75026E21D9000AB55B1 /* GCDHelper.m in Sources */,
E82D5C76276AEB5100858D6D /* NameplateModel.m in Sources */,
E84B0E422727EE0A008818C6 /* XPRoomMessageHeaderView.m in Sources */,
E8C6FFDD2754CF5D004DC9F0 /* HomeRecommendRoomModel.m in Sources */,
E890BC10273D23F00007C46B /* GiftInfoModel.m in Sources */,
@@ -3364,7 +3416,6 @@
18E7B29026EA0E6B0064BC9B /* FlutterBoost+Xplan.m in Sources */,
E8B846DC26FDE24300A777FE /* RechargeListModel.m in Sources */,
E884C36C2743951B00E1EBED /* GiftReceiveInfoModel.m in Sources */,
E839531E2769CCCE00CF2F24 /* RoomRankModel.m in Sources */,
E8395334276A03C300CF2F24 /* XPMineDressUpPresenter.m in Sources */,
189DD75926E6003C00AB55B1 /* Api.m in Sources */,
E8133916273E532D00708B66 /* XPGiftItemCollectionViewCell.m in Sources */,

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_dressUp_exclusive@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_dressUp_exclusive@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_dressUp_limit@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_dressUp_limit@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 995 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_dressUp_new@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_dressUp_new@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_dressup_give@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_dressup_give@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 902 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_dressup_time@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_dressup_time@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 610 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "mine_normal_my_dressup@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "mine_normal_my_dressup@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,16 @@
//
// SpriteSheetImageManager.h
// XChat
//
// Created by Macx on 2018/5/11.
// Copyright © 2018年 XC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <YYImage/YYSpriteSheetImage.h>
@interface SpriteSheetImageManager : NSObject
- (void)loadSpriteSheetImageWithURL:(NSURL *_Nullable)url
completionBlock:(void ( ^ _Nonnull )(YYSpriteSheetImage * _Nullable sprit))completionBlock
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock;
@end

View File

@@ -0,0 +1,156 @@
//
// SpriteSheetImageManager.m
// XChat
//
// Created by Macx on 2018/5/11.
// Copyright © 2018 XC. All rights reserved.
//
#import "SpriteSheetImageManager.h"
#import <SDWebImage/SDWebImageDownloader.h>
#import <UIImageView+WebCache.h>
#import "YYUtility.h"
#import "XPMacro.h"
#import "GCDHelper.h"
static NSInteger retryCount = 3;
static CGFloat kdeafultFrameDurations = 0.2;
@interface SpriteSheetImageManager()
@property (nonatomic,strong) YYSpriteSheetImage *sprite;
@property (nonatomic,strong) NSMutableDictionary *parserQueue;
@property (nonatomic,strong) NSMutableDictionary *retryCache;
@property (nonatomic, strong) UIImageView *operationImageView;//
@end
@implementation SpriteSheetImageManager
- (void)loadSpriteSheetImageWithURL:(NSURL *_Nullable)url
completionBlock:(void ( ^ _Nonnull )(YYSpriteSheetImage * _Nullable sprit))completionBlock
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock {
if (!url) {
return;
}
@kWeakify(self);
NSString *key = [self cacheURL:url];
[self.operationImageView sd_setImageWithURL:url completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
@kStrongify(self);
if (error) {
if (error) {
if (![self.retryCache objectForKey:key]) {
[self.retryCache setObject:@(0) forKey:key];
}
[self.retryCache setObject:@([[self.retryCache objectForKey:key] integerValue] + 1) forKey:key];
if ([[self.retryCache objectForKey:key] integerValue] < retryCount) {
[self retryWithKey:key completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
completionBlock(sprit);
} failureBlock:^(NSError * _Nullable error) {
failureBlock(error);
}];
}
}
return ;
}
YYSpriteSheetImage *sheetImage = [SpriteSheetImageManager createSpriteSheet:image frameDurations:kdeafultFrameDurations];
dispatch_main_sync_safe(^{
if (sheetImage) {
completionBlock(sheetImage);
[self removeCacheWithKey:key];
[self.retryCache removeObjectForKey:key];
completionBlock(sheetImage);
}
});
}];
}
- (void)retryWithKey:(NSString *)key
completionBlock:(void (^)(YYSpriteSheetImage * _Nullable))completionBlock
failureBlock:(void (^)(NSError * _Nullable))failureBlock {
if (key) {
NSURL *url = [self.parserQueue objectForKey:key];
[self loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
completionBlock(sprit);
} failureBlock:^(NSError * _Nullable error) {
}];
}
}
/**
* UI
* frameDurations
**/
+ (YYSpriteSheetImage *_Nullable)createSpriteSheet:(UIImage *_Nullable)image frameDurations:(CGFloat)frameDurations {
NSMutableArray *contentRects = [NSMutableArray new];
NSMutableArray *durations = [NSMutableArray new];
CGFloat imageHeight = image.size.height;
NSInteger spriteCount = image.size.width/imageHeight;
for (int i = 0; i < spriteCount; i++) {
CGRect rect;
rect.size = CGSizeMake(imageHeight, imageHeight);
rect.origin.x = imageHeight * i;
rect.origin.y = 0;
[contentRects addObject:[NSValue valueWithCGRect:rect]];
if (!frameDurations) {
frameDurations = kdeafultFrameDurations;
}
[durations addObject:@(frameDurations)];
}
YYSpriteSheetImage *sheetImage = [[YYSpriteSheetImage alloc] initWithSpriteSheetImage:image contentRects:contentRects frameDurations:durations loopCount:0];
return sheetImage;
}
- (NSString *)cacheURL:(NSURL *)url {
NSString *key = [self getUUid];
[self.parserQueue setObject:url forKey:key];
return key;
}
- (void)removeCacheWithKey:(NSString *)key {
[self.parserQueue removeObjectForKey:key];
}
- (NSString *)getUUid {
return [UIDevice currentDevice].identifierForVendor.UUIDString;
}
- (NSMutableDictionary *)parserQueue {
if (_parserQueue == nil) {
_parserQueue = [NSMutableDictionary dictionary];
}
return _parserQueue;
}
- (NSMutableDictionary *)retryCache {
if (_retryCache == nil) {
_retryCache = [NSMutableDictionary dictionary];
}
return _retryCache;
}
- (UIImageView *)operationImageView {
if (!_operationImageView) {
_operationImageView = [[UIImageView alloc] init];
}
return _operationImageView;
}
@end

View File

@@ -0,0 +1,16 @@
//
// YYAnimatedImageView+ImageShow.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/16.
//
#import <YYImage/YYImage.h>
NS_ASSUME_NONNULL_BEGIN
@interface YYAnimatedImageView (ImageShow)
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,34 @@
//
// YYAnimatedImageView+ImageShow.m
// xplan-ios
//
// Created by on 2021/12/16.
//
#import "YYAnimatedImageView+ImageShow.h"
#import <objc/runtime.h>
@implementation YYAnimatedImageView (ImageShow)
+ (void)load{
//
Method displayLayerMethod = class_getInstanceMethod(self, @selector(displayLayer:));
//
Method displayLayerNewMethod = class_getInstanceMethod(self, @selector(displayLayerNew:));
//
method_exchangeImplementations(displayLayerMethod, displayLayerNewMethod);
}
- (void)displayLayerNew:(CALayer *)layer{
Ivar imageIvar = class_getInstanceVariable([self class], "_curFrame");
UIImage *image = object_getIvar(self, imageIvar);
if (image){
layer.contents = (__bridge id)image.CGImage;
}else{
if (@available(iOS 14.0, *)){
[super displayLayer:layer];
}
}
}
@end

View File

@@ -30,5 +30,10 @@ typedef NS_ENUM(NSInteger, GenderType) {
GenderType_Female = 2,///女性
};
typedef NS_ENUM(NSInteger, DressUpLabelType) {
DressUpLabelType_New = 1, //新品
DressUpLabelType_Discount = 2, //折扣
DressUpLabelType_Limit = 3,//限定
DressUpLabelType_Exclusive = 4//专属
};
#endif /* XPEnum_h */

View File

@@ -23,6 +23,7 @@ typedef NS_ENUM(NSInteger, XPMineItemType) {
XPMineItemType_Account,///我的账户
XPMineItemType_Invite_Friend,///邀请好友
XPMineItemType_Personinfo,///个人中心
XPMineItemType_My_Dressup,///我的装扮
};

View File

@@ -66,12 +66,17 @@
teenagerItem.itmeImageName = @"mine_normal_teenager";
teenagerItem.type = XPMineItemType_Teenager_Mode;
XPMineItemModel * myDressUp = [[XPMineItemModel alloc] init];
myDressUp.itmeName = @"我的装扮";
myDressUp.itmeImageName = @"mine_normal_my_dressup";
myDressUp.type = XPMineItemType_My_Dressup;
XPMineItemModel * realNameItem = [[XPMineItemModel alloc] init];
realNameItem.itmeName = @"实名认证";
realNameItem.itmeImageName = @"mine_normal_real_name_authentic";
realNameItem.type = XPMineItemType_Real_Name_Authentic;
realNameItem.cornerType = UIRectCornerBottomLeft | UIRectCornerBottomRight;
NSArray * array = @[myRoomItem,teenagerItem, realNameItem];
NSArray * array = @[myRoomItem,teenagerItem, myDressUp, realNameItem];
[[self getView] onGetNormalItemsSuccess:array];
}

View File

@@ -26,7 +26,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param completion 完成
/// @param ticket ticket
/// @param uid uid
+ (void)nameplatList:(HttpRequestHelperCompletion)completion ticket:(NSString *)ticket uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize;
+ (void)nameplateList:(HttpRequestHelperCompletion)completion ticket:(NSString *)ticket uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize;
/// 使用头饰
/// @param completion 完成
@@ -47,7 +47,7 @@ NS_ASSUME_NONNULL_BEGIN
/// @param userNameplateId 座驾id 0 取消使用座驾
/// @param ticket ticket
/// @param uid uid
+ (void)useNamePlate:(HttpRequestHelperCompletion)completion userNameplateId:(NSString *)userNameplateId ticket:(NSString *)ticket uid:(NSString *)uid;
+ (void)useNameplate:(HttpRequestHelperCompletion)completion userNameplateId:(NSString *)userNameplateId ticket:(NSString *)ticket uid:(NSString *)uid;
/// 活动
/// @param completion 完成

View File

@@ -29,7 +29,7 @@
/// @param completion
/// @param ticket ticket
/// @param uid uid
+ (void)nameplatList:(HttpRequestHelperCompletion)completion ticket:(NSString *)ticket uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize {
+ (void)nameplateList:(HttpRequestHelperCompletion)completion ticket:(NSString *)ticket uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize {
[self makeRequest:@"nameplate/userNameplateList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, ticket, uid, page, pageSize, nil];
}
@@ -56,7 +56,7 @@
/// @param userNameplateId id 0 使
/// @param ticket ticket
/// @param uid uid
+ (void)useNamePlate:(HttpRequestHelperCompletion)completion userNameplateId:(NSString *)userNameplateId ticket:(NSString *)ticket uid:(NSString *)uid {
+ (void)useNameplate:(HttpRequestHelperCompletion)completion userNameplateId:(NSString *)userNameplateId ticket:(NSString *)ticket uid:(NSString *)uid {
[self makeRequest:@"nameplate/useNameplate" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, userNameplateId, ticket, uid, nil];
}

View File

@@ -0,0 +1,36 @@
//
// CarModel.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/16.
//
#import <Foundation/Foundation.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
typedef enum {
Dressup_Car_Status_Down = 1, //已下架
Dressup_Car_Status_Expire = 2, //已过期
Dressup_Car_Status_Ok = 3 //正常
}DressupCarStatus;
@interface CarModel : NSObject
@property (nonatomic, assign) DressupCarStatus status; //状态
///座驾图片
@property (nonatomic, strong) NSString *pic;
///id
@property (nonatomic, strong) NSString *carID;
///座驾名称
@property (nonatomic, strong) NSString *name;
///失效时间
@property (nonatomic, assign) NSInteger expireDate;
///是否是赠送的
@property (nonatomic, assign) BOOL isGive;
///是否正在使用
@property (nonatomic, assign) BOOL isUsed;
///标签类型
@property (nonatomic, assign) DressUpLabelType labelType;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// CarModel.m
// xplan-ios
//
// Created by on 2021/12/16.
//
#import "CarModel.h"
@implementation CarModel
+ (NSDictionary *)replacedKeyFromPropertyName {
return @{@"isUsed" : @"using",
@"carID" : @"id"
};
}
@end

View File

@@ -0,0 +1,41 @@
//
// HeadwearModel.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/16.
//
#import <Foundation/Foundation.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, DressupHeadWearStatus) {
Dressup_Headwear_Status_Ok = 1, //有效
Dressup_Headwear_Status_Expire = 2,//已过期
Dressup_Headwear_Status_Down = 3//已下架
};
@interface HeadwearModel : NSObject
///头饰id
@property (nonatomic, strong) NSString *headwearId;
///是否是赠送
@property (nonatomic, assign) BOOL isGive;
///是否正在使用
@property (nonatomic, assign) BOOL isUsed;
///标签类型
@property (nonatomic, assign) DressUpLabelType labelType;
///头饰的名字
@property (nonatomic, strong) NSString *headwearName;
///预览图链接
@property (nonatomic, strong) NSString *pic;
///效果
@property (nonatomic, strong) NSString *effect;
///还有过期
@property (nonatomic, strong) NSString *expireDays;
///状态
@property (nonatomic, assign) DressupHeadWearStatus status;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// HeadwearModel.m
// xplan-ios
//
// Created by on 2021/12/16.
//
#import "HeadwearModel.h"
@implementation HeadwearModel
+ (NSDictionary *)replacedKeyFromPropertyName {
return @{@"isUsed" : @"used",
@"isGive" : @"give"
};
}
@end

View File

@@ -0,0 +1,27 @@
//
// NameplateModel.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/16.
//
#import <Foundation/Foundation.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@interface NameplateModel : NSObject
///是否正在使用
@property (nonatomic, assign) BOOL isUsing;
///id
@property (nonatomic, copy) NSString * nId;
///名字
@property (nonatomic, strong) NSString *nameplateName;
///铭牌的图片
@property (nonatomic, strong) NSString *nameplateImage;
///是否过期
@property (nonatomic, assign) BOOL isExpired;
///过期的天数
@property (nonatomic,copy) NSString *expireDays;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,16 @@
//
// NameplateModel.m
// xplan-ios
//
// Created by on 2021/12/16.
//
#import "NameplateModel.h"
@implementation NameplateModel
+ (NSDictionary *)replacedKeyFromPropertyName {
return @{@"nId": @"id"};
}
@end

View File

@@ -10,7 +10,21 @@
NS_ASSUME_NONNULL_BEGIN
@interface XPMineDressUpPresenter : BaseMvpPresenter
/// 获取用户头饰列表
- (void)getUserHeadwearList;
/// 获取用户座驾列表
- (void)getUserCarList;
/// 获取用户铭牌列表
- (void)getUserNameplateList;
/// 使用头饰
/// @param headwearId 头饰的id 不使用的时候传0
- (void)useHeader:(NSString *)headwearId;
/// 使用座驾
/// @param carId 座驾的id 不使用的时候传0
- (void)useCar:(NSString *)carId;
/// 使用铭牌
/// @param userNameplateId 铭牌的id 不使用的时候传0
- (void)useNameplate:(NSString *)userNameplateId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,7 +6,75 @@
//
#import "XPMineDressUpPresenter.h"
#import "Api+DressUp.h"
#import "XPMineDressUpProtocol.h"
#import "AccountInfoStorage.h"
///Model
#import "HeadwearModel.h"
#import "CarModel.h"
#import "NameplateModel.h"
@implementation XPMineDressUpPresenter
///
- (void)getUserHeadwearList {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api headwearList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [HeadwearModel modelsWithArray:data.data];
[[self getView] getUserHeadwearListSuccess:array];
}] ticket:ticket uid:uid];
}
///
- (void)getUserCarList {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api carList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [CarModel modelsWithArray:data.data];
[[self getView] getUserCarListSuccess:array];
}] ticket:ticket uid:uid];
}
///
- (void)getUserNameplateList {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api nameplateList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
NSArray * array = [NameplateModel modelsWithArray:data.data[@"nameplateList"]];
[[self getView] getUserNameplateListSuccess:array];
}] ticket:ticket uid:uid page:@"1" pageSize:@"500"];
}
/// 使
/// @param headwearId id 使0
- (void)useHeader:(NSString *)headwearId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api useHeadWear:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] useHeadwearSuccess:headwearId];
} showLoading:YES] headwearId:headwearId ticket:ticket uid:uid];
}
/// 使
/// @param carId id 使0
- (void)useCar:(NSString *)carId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api useCar:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] useCarSuccess:carId];
} showLoading:YES] carId:carId ticket:ticket uid:uid];
}
/// 使
/// @param userNameplateId id 使0
- (void)useNameplate:(NSString *)userNameplateId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
[Api useNameplate:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] useNameplateSuccess:userNameplateId];
} showLoading:YES] userNameplateId:userNameplateId ticket:ticket uid:uid];
}
@end

View File

@@ -11,6 +11,18 @@ NS_ASSUME_NONNULL_BEGIN
@protocol XPMineDressUpProtocol <NSObject>
///获取用户头饰列表成功
- (void)getUserHeadwearListSuccess:(NSArray *)array;
///获取用户头饰列表成功
- (void)getUserCarListSuccess:(NSArray *)array;
///获取用户头饰列表成功
- (void)getUserNameplateListSuccess:(NSArray *)array;
///使用头饰成功
- (void)useHeadwearSuccess:(NSString *)headWearId;
///使用座驾成功
- (void)useCarSuccess:(NSString *)carId;
///使用铭牌成功
- (void)useNameplateSuccess:(NSString *)nameplateId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -8,9 +8,16 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class CarModel,XPMineCarTableViewCell;
@protocol XPMineCarTableViewCellDelegate <NSObject>
///使用座驾
- (void)xPMineCarTableViewCell:(XPMineCarTableViewCell *)cell carId:(NSString *)carId;
@end
@interface XPMineCarTableViewCell : UITableViewCell
@property (nonatomic,strong) CarModel *carInfo;
///代理
@property (nonatomic,weak) id<XPMineCarTableViewCellDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,18 +6,257 @@
//
#import "XPMineCarTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
#import "NetImageView.h"
#import "UIImage+Utils.h"
///Model
#import "CarModel.h"
@interface XPMineCarTableViewCell ()
///
@property (nonatomic,strong) NetImageView *carImageView;
///
@property (nonatomic,strong) UIStackView *nameStackView;
///
@property (nonatomic, strong) UIImageView *giveImageView;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UIStackView *timeStackView;
///icon
@property (nonatomic, strong) UIImageView *timeImageView;
///
@property (nonatomic, strong) UILabel *timeLabel;
///使
@property (nonatomic,strong) UIButton *useButton;
///线
@property (nonatomic,strong) UIView * lineView;
///
@property (nonatomic,strong) UIImageView *limitImageView;
@end
@implementation XPMineCarTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];;
[self.contentView addSubview:self.carImageView];
[self.contentView addSubview:self.nameStackView];
[self.contentView addSubview:self.timeStackView];
[self.contentView addSubview:self.useButton];
[self.contentView addSubview:self.lineView];
[self.contentView addSubview:self.limitImageView];
[self.nameStackView addArrangedSubview:self.giveImageView];
[self.nameStackView addArrangedSubview:self.titleLabel];
[self.timeStackView addArrangedSubview:self.timeImageView];
[self.timeStackView addArrangedSubview:self.timeLabel];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
- (void)initSubViewConstraints {
[self.carImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(68);
make.width.mas_equalTo(102);
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.contentView).offset(20);
}];
// Configure the view for the selected state
[self.nameStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.carImageView.mas_right).offset(10);
make.bottom.mas_equalTo(self.carImageView.mas_centerY).offset(-3);
}];
[self.giveImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(11, 11));
}];
[self.timeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.width.mas_equalTo(11);
}];
[self.timeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nameStackView);
make.top.mas_equalTo(self.carImageView.mas_centerY).offset(3);
make.height.mas_equalTo(13);
}];
[self.useButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self);
make.right.mas_equalTo(self.contentView).offset(-15);
make.height.mas_equalTo(33);
make.width.mas_equalTo(85);
}];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.contentView).offset(105);
make.height.mas_equalTo(0.5);
make.bottom.mas_equalTo(self.contentView);
make.right.mas_equalTo(self.contentView).offset(-15);
}];
[self.limitImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.mas_equalTo(self.contentView).offset(20);
make.width.height.mas_equalTo(20);
}];
}
#pragma mark - private
- (void)setCarInfo:(CarModel *)carInfo {
_carInfo = carInfo;
if (_carInfo) {
self.titleLabel.text = _carInfo.name;
self.timeImageView.hidden = _carInfo.status != Dressup_Car_Status_Ok;
self.useButton.hidden = _carInfo.status != Dressup_Car_Status_Ok;
if (_carInfo.status == Dressup_Car_Status_Ok) {
self.timeLabel.text = [NSString stringWithFormat:@"剩余%ld天", _carInfo.expireDate];
} else {
self.timeLabel.text = @"已过期";
}
self.giveImageView.hidden =!_carInfo.isGive;
self.carImageView.imageUrl = _carInfo.pic;
if (_carInfo.isUsed) {
[_useButton setTitle:@"取消使用" forState:UIControlStateNormal];
[_useButton setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateNormal];
[_useButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor], [ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
} else {
[_useButton setTitle:@"使用" forState:UIControlStateNormal];
[_useButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_useButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
}
NSString * typeStr;
if (_carInfo.labelType == DressUpLabelType_New) {
typeStr = @"mine_dressUp_new";
} else if(_carInfo.labelType == DressUpLabelType_Limit) {
typeStr = @"mine_dressUp_limit";
} else if(_carInfo.labelType == DressUpLabelType_Exclusive) {
typeStr = @"mine_dressUp_exclusive";
}
if (typeStr.length > 0) {
self.limitImageView.image = [UIImage imageNamed:typeStr];
}
}
}
#pragma mark - Event Response
- (void)useButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineCarTableViewCell:carId:)]) {
NSString * carId = self.carInfo.carID;;
if (self.carInfo.isUsed) {
carId = @"0";
}
[self.delegate xPMineCarTableViewCell:self carId:carId];
}
}
#pragma mark - Getter && Setter
- (UIStackView *)nameStackView {
if (!_nameStackView) {
_nameStackView = [[UIStackView alloc] init];
_nameStackView.axis = UILayoutConstraintAxisHorizontal;
_nameStackView.distribution = UIStackViewDistributionFill;
_nameStackView.alignment = UIStackViewAlignmentCenter;
_nameStackView.spacing = 2;
}
return _nameStackView;
}
- (UIImageView *)giveImageView {
if (!_giveImageView) {
_giveImageView = [[UIImageView alloc] init];
_giveImageView.userInteractionEnabled = YES;
_giveImageView.image = [UIImage imageNamed:@"mine_dressup_give"];
}
return _giveImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont systemFontOfSize:15];
_titleLabel.textColor = [ThemeColor mainTextColor];
}
return _titleLabel;
}
- (UIButton *)useButton {
if (!_useButton) {
_useButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_useButton setTitle:@"使用" forState:UIControlStateNormal];
[_useButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_useButton addTarget:self action:@selector(useButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_useButton.layer.masksToBounds = YES;
_useButton.layer.cornerRadius = 33/2;
_useButton.titleLabel.font = [UIFont systemFontOfSize:14];
[_useButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
}
return _useButton;
}
- (UIStackView *)timeStackView {
if (!_timeStackView) {
_timeStackView = [[UIStackView alloc] init];
_timeStackView.axis = UILayoutConstraintAxisHorizontal;
_timeStackView.distribution = UIStackViewDistributionFill;
_timeStackView.alignment = UIStackViewAlignmentCenter;
_timeStackView.spacing = 2;
}
return _timeStackView;
}
- (UIImageView *)timeImageView {
if (!_timeImageView) {
_timeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_dressup_time"]];
}
return _timeImageView;
}
- (UILabel *)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.font = [UIFont systemFontOfSize:12];
_timeLabel.textColor = [ThemeColor secondTextColor];
}
return _timeLabel;
}
- (UIView *)lineView {
if (!_lineView) {
_lineView = [[UIView alloc] init];
_lineView.backgroundColor = [ThemeColor dividerColor];
}
return _lineView;
}
- (NetImageView *)carImageView {
if (!_carImageView) {
_carImageView = [[NetImageView alloc] init];
_carImageView.backgroundColor = [ThemeColor appCellBackgroundColor];
_carImageView.layer.masksToBounds = YES;
_carImageView.layer.cornerRadius = 12;
}
return _carImageView;
}
- (UIImageView *)limitImageView {
if (!_limitImageView) {
_limitImageView = [[UIImageView alloc] init];
}
return _limitImageView;
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPMineDressEmptyTableViewCell.h
// xplan-ios
//
// Created by 冯硕 on 2021/12/16.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPMineDressEmptyTableViewCell : UITableViewCell
///标题
@property (nonatomic,copy) NSString *emptyTitle;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,80 @@
//
// XPMineDressEmptyTableViewCell.m
// xplan-ios
//
// Created by on 2021/12/16.
//
#import "XPMineDressEmptyTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "UIImageConstant.h"
@interface XPMineDressEmptyTableViewCell ()
@property (nonatomic,strong) UIImageView *emptyImageView;
@property (nonatomic,strong) UILabel *titleLabel;
@end
@implementation XPMineDressEmptyTableViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.emptyImageView];
[self.contentView addSubview:self.titleLabel];
}
- (void)initSubViewConstraints {
[self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.contentView);
make.top.mas_equalTo(self.contentView).offset(150);
make.size.mas_equalTo(CGSizeMake(100, 100));
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.emptyImageView.mas_bottom).offset(20);
make.left.right.mas_equalTo(self.contentView);
}];
}
#pragma mark - Getters And Setters
- (void)setEmptyTitle:(NSString *)emptyTitle {
_emptyTitle = emptyTitle;
self.titleLabel.text = _emptyTitle;
}
- (UIImageView *)emptyImageView {
if (!_emptyImageView) {
_emptyImageView = [[UIImageView alloc] init];
_emptyImageView.userInteractionEnabled = YES;
_emptyImageView.image = [UIImageConstant defalutEmptyPlaceholder];
_emptyImageView.layer.masksToBounds = YES;
_emptyImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _emptyImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"暂无数据";
_titleLabel.font = [UIFont systemFontOfSize:16];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.textColor = [ThemeColor secondTextColor];
}
return _titleLabel;
}
@end

View File

@@ -8,9 +8,17 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class HeadwearModel, XPMineHeadwearTableViewCell;
@protocol XPMineHeadwearTableViewCellDelegate <NSObject>
///使用头饰
- (void)xPMineHeadwearTableViewCell:(XPMineHeadwearTableViewCell *)view headwearId:(NSString *)headwearId;
@end
@interface XPMineHeadwearTableViewCell : UITableViewCell
@property (nonatomic,strong) HeadwearModel *headwearModel;
///代理
@property (nonatomic,weak) id<XPMineHeadwearTableViewCellDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -6,23 +6,27 @@
//
#import "XPMineHeadwearTableViewCell.h"
///Third
#import <Masonry/Masonry.h>
#import <YYImage/YYAnimatedImageView.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor.h"
#import "NetImageView.h"
#import "UIImage+Utils.h"
#import "SpriteSheetImageManager.h"
///Model
#import "HeadwearModel.h"
@interface XPMineHeadwearTableViewCell ()
///
///
@property (nonatomic,strong) UIStackView *nameStackView;
///
@property (nonatomic, strong) UIImageView *giveImageView;
///
@property (nonatomic, strong) UIView *backView;
///
@property (nonatomic, strong) NetImageView *namePlateImageView;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UIStackView *timeStackView;
///icon
@property (nonatomic, strong) UIImageView *timeImageView;
///
@@ -31,6 +35,12 @@
@property (nonatomic,strong) UIButton *useButton;
///线
@property (nonatomic,strong) UIView * lineView;
///
@property (nonatomic,strong) YYAnimatedImageView *headWearImageView;
///
@property (nonatomic, strong) SpriteSheetImageManager *manager;
///
@property (nonatomic,strong) UIImageView *limitImageView;
@end
@@ -47,39 +57,46 @@
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];;
[self.contentView addSubview:self.backView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.timeImageView];
[self.contentView addSubview:self.timeLabel];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.headWearImageView];
[self.contentView addSubview:self.nameStackView];
[self.contentView addSubview:self.timeStackView];
[self.contentView addSubview:self.useButton];
[self.contentView addSubview:self.lineView];
[self.backView addSubview:self.namePlateImageView];
[self.contentView addSubview:self.limitImageView];
[self.nameStackView addArrangedSubview:self.giveImageView];
[self.nameStackView addArrangedSubview:self.titleLabel];
[self.timeStackView addArrangedSubview:self.timeImageView];
[self.timeStackView addArrangedSubview:self.timeLabel];
}
- (void)initSubViewConstraints {
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.width.mas_equalTo(80);
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.contentView).offset(20);
}];
[self.namePlateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.backView);
[self.nameStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.headWearImageView.mas_right).offset(10);
make.bottom.mas_equalTo(self.headWearImageView.mas_centerY).offset(-3);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backView.mas_right).offset(10);
make.top.mas_equalTo(self.backView).offset(10);
[self.giveImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(11, 11));
}];
[self.timeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel);
make.height.width.mas_equalTo(11);
make.top.mas_equalTo(self.titleLabel.mas_bottom).inset(11);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.timeImageView.mas_right).offset(2);
make.centerY.mas_equalTo(self.timeImageView);
[self.timeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.nameStackView);
make.top.mas_equalTo(self.headWearImageView.mas_centerY).offset(3);
make.height.mas_equalTo(13);
}];
[self.useButton mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -96,53 +113,103 @@
make.right.mas_equalTo(self.contentView).offset(-15);
}];
[self.limitImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.mas_equalTo(self.contentView).offset(20);
make.width.height.mas_equalTo(20);
}];
}
#pragma mark - private
//- (void)pricenamePlate:(UserNamePlateList *)namePlate{
//
// self.namePlate = namePlate;
//
// [self.namePlateIcon qn_setImageImageWithUrl:namePlate.nameplateImage placeholderImage:@"dress_headwear_placehoder" type:ImageTypeRoomFace];
//
// BOOL isUse = namePlate.isUsing;
// NSString *expireDays = [NSString stringWithFormat:@"%ld", namePlate.expireDays];
//
// self.dressUpNameLabel.text = namePlate.nameplateName;
// self.giveIcon.hidden = YES;
//
// //
// BOOL isExpired = namePlate.isExpired;
//
// self.useBtn.hidden = isExpired || isUse;//|使 使
// self.cancelUseBtn.hidden = isExpired || !isUse;//|使 使
//
// self.timeLabel.text = isExpired ? @"已过期" : [NSString stringWithFormat:@"剩余%@天", expireDays];
//
//}
- (void)setHeadwearModel:(HeadwearModel *)headwearModel {
_headwearModel = headwearModel;
if (_headwearModel) {
self.titleLabel.text = _headwearModel.headwearName;
self.timeImageView.hidden = _headwearModel.status != Dressup_Headwear_Status_Ok;
self.useButton.hidden = _headwearModel.status != Dressup_Headwear_Status_Ok;
if (_headwearModel.status == Dressup_Headwear_Status_Ok) {
self.timeLabel.text = [NSString stringWithFormat:@"剩余%@天", _headwearModel.expireDays];
} else {
self.timeLabel.text = @"已过期";
}
self.giveImageView.hidden =!_headwearModel.isGive;
NSString * headurl = _headwearModel.effect.length > 0 ? _headwearModel.effect : _headwearModel.pic;
if (headurl.length >0) {
self.headWearImageView.hidden = NO;
NSURL *url = [NSURL URLWithString:headurl];
@kWeakify(self);
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
@kStrongify(self);
self.headWearImageView.image = sprit;
} failureBlock:^(NSError * _Nullable error) {
}];
} else {
self.headWearImageView.hidden = YES;
}
if (_headwearModel.isUsed) {
[_useButton setTitle:@"取消使用" forState:UIControlStateNormal];
[_useButton setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateNormal];
[_useButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor], [ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
} else {
[_useButton setTitle:@"使用" forState:UIControlStateNormal];
[_useButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_useButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
}
NSString * typeStr;
if (_headwearModel.labelType == DressUpLabelType_New) {
typeStr = @"mine_dressUp_new";
} else if(_headwearModel.labelType == DressUpLabelType_Limit) {
typeStr = @"mine_dressUp_limit";
} else if(_headwearModel.labelType == DressUpLabelType_Exclusive) {
typeStr = @"mine_dressUp_exclusive";
}
if (typeStr.length > 0) {
self.limitImageView.image = [UIImage imageNamed:typeStr];
}
}
}
#pragma mark - Event Response
- (void)useButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineHeadwearTableViewCell:headwearId:)]) {
NSString * headwearId = self.headwearModel.headwearId;
if (self.headwearModel.isUsed) {
headwearId = @"0";
}
[self.delegate xPMineHeadwearTableViewCell:self headwearId:headwearId];
}
}
#pragma mark - Getter && Setter
- (UIView *)backView {
if (!_backView) {
_backView = [[UIView alloc] init];
_backView.backgroundColor = [ThemeColor appCellBackgroundColor];
_backView.layer.masksToBounds = YES;
_backView.layer.cornerRadius = 10;
- (UIStackView *)nameStackView {
if (!_nameStackView) {
_nameStackView = [[UIStackView alloc] init];
_nameStackView.axis = UILayoutConstraintAxisHorizontal;
_nameStackView.distribution = UIStackViewDistributionFill;
_nameStackView.alignment = UIStackViewAlignmentCenter;
_nameStackView.spacing = 2;
}
return _backView;
return _nameStackView;
}
- (NetImageView *)namePlateImageView {
if (!_namePlateImageView) {
_namePlateImageView = [[NetImageView alloc] init];
_namePlateImageView.image = [UIImageConstant defaultAvatarPlaceholder];
- (UIImageView *)giveImageView {
if (!_giveImageView) {
_giveImageView = [[UIImageView alloc] init];
_giveImageView.userInteractionEnabled = YES;
_giveImageView.image = [UIImage imageNamed:@"mine_dressup_give"];
}
return _namePlateImageView;;
return _giveImageView;
}
- (YYAnimatedImageView *)headWearImageView {
if (!_headWearImageView) {
_headWearImageView = [[YYAnimatedImageView alloc] init];
_headWearImageView.backgroundColor = [ThemeColor appCellBackgroundColor];
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
_headWearImageView.layer.masksToBounds = YES;
_headWearImageView.layer.cornerRadius = 10;
}
return _headWearImageView;
}
- (UILabel *)titleLabel {
@@ -168,11 +235,20 @@
return _useButton;
}
- (UIStackView *)timeStackView {
if (!_timeStackView) {
_timeStackView = [[UIStackView alloc] init];
_timeStackView.axis = UILayoutConstraintAxisHorizontal;
_timeStackView.distribution = UIStackViewDistributionFill;
_timeStackView.alignment = UIStackViewAlignmentCenter;
_timeStackView.spacing = 2;
}
return _timeStackView;
}
- (UIImageView *)timeImageView {
if (!_timeImageView) {
_timeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"person_Dressup_time"]];
_timeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_dressup_time"]];
}
return _timeImageView;
}
@@ -194,5 +270,19 @@
return _lineView;
}
- (SpriteSheetImageManager *)manager {
if (!_manager) {
_manager = [[SpriteSheetImageManager alloc] init];
}
return _manager;
}
- (UIImageView *)limitImageView {
if (!_limitImageView) {
_limitImageView = [[UIImageView alloc] init];
}
return _limitImageView;
}
@end

View File

@@ -8,9 +8,16 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class NameplateModel, XPMineNameplateTableViewCell;
@protocol XPMineNameplateTableViewCellDelegate <NSObject>
///使用铭牌
- (void)xPMineNameplateTableViewCell:(XPMineNameplateTableViewCell *)view nameplateId:(NSString *)nameplateId;
@end
@interface XPMineNameplateTableViewCell : UITableViewCell
@property (nonatomic,strong) NameplateModel *nameplateModel;
///代理
@property (nonatomic,weak) id<XPMineNameplateTableViewCellDelegate> delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -12,14 +12,16 @@
#import "ThemeColor.h"
#import "NetImageView.h"
#import "UIImage+Utils.h"
///Model
#import "NameplateModel.h"
@interface XPMineNameplateTableViewCell ()
///
@property (nonatomic, strong) UIView *backView;
///
@property (nonatomic, strong) NetImageView *namePlateImageView;
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UIStackView *timeStackView;
///icon
@property (nonatomic, strong) UIImageView *timeImageView;
///
@@ -44,39 +46,35 @@
#pragma mark - Private Method
- (void)initSubViews {
self.backgroundColor = [UIColor clearColor];;
[self.contentView addSubview:self.backView];
self.selectionStyle = UITableViewCellSelectionStyleNone;
[self.contentView addSubview:self.namePlateImageView];
[self.contentView addSubview:self.titleLabel];
[self.contentView addSubview:self.timeImageView];
[self.contentView addSubview:self.timeLabel];
[self.contentView addSubview:self.timeStackView];
[self.contentView addSubview:self.useButton];
[self.contentView addSubview:self.lineView];
[self.backView addSubview:self.namePlateImageView];
[self.timeStackView addArrangedSubview:self.timeImageView];
[self.timeStackView addArrangedSubview:self.timeLabel];
}
- (void)initSubViewConstraints {
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.width.mas_equalTo(80);
[self.namePlateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(60);
make.width.mas_equalTo(100);
make.centerY.mas_equalTo(self.contentView);
make.left.mas_equalTo(self.contentView).offset(20);
}];
[self.namePlateImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.backView);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backView.mas_right).offset(10);
make.top.mas_equalTo(self.backView).offset(10);
make.left.mas_equalTo(self.namePlateImageView.mas_right).offset(10);
make.bottom.mas_equalTo(self.namePlateImageView.mas_centerY).offset(-3);
}];
[self.timeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel);
make.height.width.mas_equalTo(11);
make.top.mas_equalTo(self.titleLabel.mas_bottom).inset(11);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.timeImageView.mas_right).offset(2);
make.centerY.mas_equalTo(self.timeImageView);
[self.timeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel);
make.top.mas_equalTo(self.namePlateImageView.mas_centerY).offset(3);
}];
[self.useButton mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -97,51 +95,64 @@
#pragma mark - private
//- (void)pricenamePlate:(UserNamePlateList *)namePlate{
//
// self.namePlate = namePlate;
//
// [self.namePlateIcon qn_setImageImageWithUrl:namePlate.nameplateImage placeholderImage:@"dress_headwear_placehoder" type:ImageTypeRoomFace];
//
// BOOL isUse = namePlate.isUsing;
// NSString *expireDays = [NSString stringWithFormat:@"%ld", namePlate.expireDays];
//
// self.dressUpNameLabel.text = namePlate.nameplateName;
// self.giveIcon.hidden = YES;
//
// //
// BOOL isExpired = namePlate.isExpired;
//
// self.useBtn.hidden = isExpired || isUse;//|使 使
// self.cancelUseBtn.hidden = isExpired || !isUse;//|使 使
//
// self.timeLabel.text = isExpired ? @"已过期" : [NSString stringWithFormat:@"剩余%@天", expireDays];
//
//}
- (void)setNameplateModel:(NameplateModel *)nameplateModel {
_nameplateModel = nameplateModel;
if (_nameplateModel) {
self.titleLabel.text = _nameplateModel.nameplateName;
self.timeImageView.hidden = _nameplateModel.isExpired;
self.useButton.hidden = _nameplateModel.isExpired;
if (!_nameplateModel.isExpired) {
self.timeLabel.text = [NSString stringWithFormat:@"剩余%@天", _nameplateModel.expireDays];
} else {
self.timeLabel.text = @"已过期";
}
self.namePlateImageView.imageUrl = _nameplateModel.nameplateImage;
if (_nameplateModel.isUsing) {
[_useButton setTitle:@"取消使用" forState:UIControlStateNormal];
[_useButton setTitleColor:[ThemeColor cancelButtonTextColor] forState:UIControlStateNormal];
[_useButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor], [ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
} else {
[_useButton setTitle:@"使用" forState:UIControlStateNormal];
[_useButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
[_useButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
}
}
}
#pragma mark - Event Response
- (void)useButtonAction:(UIButton *)sender {
if (self.delegate && [self.delegate respondsToSelector:@selector(xPMineNameplateTableViewCell:nameplateId:)]) {
NSString * nameplateId = self.nameplateModel.nId;;
if (self.nameplateModel.isUsing) {
nameplateId = @"0";
}
[self.delegate xPMineNameplateTableViewCell:self nameplateId:nameplateId];
}
}
#pragma mark - Getter && Setter
- (UIView *)backView {
if (!_backView) {
_backView = [[UIView alloc] init];
_backView.backgroundColor = [ThemeColor appCellBackgroundColor];
_backView.layer.masksToBounds = YES;
_backView.layer.cornerRadius = 10;
}
return _backView;
}
- (NetImageView *)namePlateImageView {
if (!_namePlateImageView) {
_namePlateImageView = [[NetImageView alloc] init];
_namePlateImageView.image = [UIImageConstant defaultAvatarPlaceholder];
_namePlateImageView.contentMode = UIViewContentModeScaleAspectFit;
_namePlateImageView.backgroundColor = [ThemeColor appCellBackgroundColor];
_namePlateImageView.layer.masksToBounds = YES;
_namePlateImageView.layer.cornerRadius = 12;
}
return _namePlateImageView;;
}
- (UIStackView *)timeStackView {
if (!_timeStackView) {
_timeStackView = [[UIStackView alloc] init];
_timeStackView.axis = UILayoutConstraintAxisHorizontal;
_timeStackView.distribution = UIStackViewDistributionFill;
_timeStackView.alignment = UIStackViewAlignmentCenter;
_timeStackView.spacing = 2;
}
return _timeStackView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
@@ -165,11 +176,9 @@
return _useButton;
}
- (UIImageView *)timeImageView {
if (!_timeImageView) {
_timeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"person_Dressup_time"]];
_timeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mine_dressup_time"]];
}
return _timeImageView;
}

View File

@@ -6,32 +6,166 @@
//
#import "XPMineDressUpListViewController.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "XPMacro.h"
///View
#import "XPMineHeadwearTableViewCell.h"
#import "XPMineCarTableViewCell.h"
#import "XPMineNameplateTableViewCell.h"
#import "XPMineDressEmptyTableViewCell.h"
///P
#import "XPMineDressUpPresenter.h"
#import "XPMineDressUpProtocol.h"
@interface XPMineDressUpListViewController ()
@interface XPMineDressUpListViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineDressUpProtocol, XPMineNameplateTableViewCellDelegate, XPMineHeadwearTableViewCellDelegate, XPMineCarTableViewCellDelegate>
///
@property (nonatomic,strong) UITableView *tableView;
///
@property (nonatomic,strong) NSArray *datasource;
@end
@implementation XPMineDressUpListViewController
- (XPMineDressUpPresenter *)createPresenter {
return [[XPMineDressUpPresenter alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
[self initSubViewConstraints];
}
#pragma mark - Private Method
- (void)initSubViews {
[self.view addSubview:self.tableView];
}
- (void)initSubViewConstraints {
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self.view);
}];
}
#pragma mark - XPMineNameplateTableViewCellDelegate
- (void)xPMineNameplateTableViewCell:(XPMineNameplateTableViewCell *)view nameplateId:(NSString *)nameplateId {
[self.presenter useNameplate:nameplateId];
}
#pragma mark - XPMineHeadwearTableViewCellDelegate
- (void)xPMineHeadwearTableViewCell:(XPMineHeadwearTableViewCell *)view headwearId:(NSString *)headwearId {
[self.presenter useHeader:headwearId];
}
#pragma mark - XPMineCarTableViewCellDelegate
- (void)xPMineCarTableViewCell:(XPMineCarTableViewCell *)cell carId:(NSString *)carId {
[self.presenter useCar:carId];
}
#pragma mark - XPMineDressUpProtocol
- (void)getUserHeadwearListSuccess:(NSArray *)array {
self.datasource = array;
[self.tableView reloadData];
}
- (void)getUserCarListSuccess:(NSArray *)array {
self.datasource = array;
[self.tableView reloadData];
}
- (void)getUserNameplateListSuccess:(NSArray *)array {
self.datasource = array;
[self.tableView reloadData];
}
- (void)useHeadwearSuccess:(NSString *)headWearId {
[self.presenter getUserHeadwearList];
[self showSuccessToast:headWearId.integerValue == 0 ? @"取消使用头饰成功" : @"头饰使用成功"];
}
- (void)useCarSuccess:(NSString *)carId {
[self.presenter getUserCarList];
[self showSuccessToast:carId.integerValue == 0 ? @"取消使用座驾成功" : @"座驾使用成功"];
}
- (void)useNameplateSuccess:(NSString *)nameplateId {
[self.presenter getUserNameplateList];
[self showSuccessToast:nameplateId.integerValue == 0 ? @"取消使用铭牌成功" : @"铭牌使用成功"];
}
#pragma mark - JXCategoryListContentViewDelegate
- (UIView *)listView {
return self.view;
}
#pragma mark - UITableViewDelegate And UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.datasource.count > 0 ? self.datasource.count : 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return self.datasource.count > 0 ? 120 : (KScreenHeight - kNavigationHeight - 100 -50);
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (self.datasource.count > 0) {
if (self.type == DressUpListType_HeadWear) {
XPMineHeadwearTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineHeadwearTableViewCell class])];
if (cell == nil) {
cell = [[XPMineHeadwearTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineHeadwearTableViewCell class])];
}
cell.headwearModel = [self.datasource objectAtIndex:indexPath.row];
cell.delegate = self;
return cell;
} else if(self.type == DressUpListType_Car) {
XPMineCarTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineCarTableViewCell class])];
if (cell == nil) {
cell = [[XPMineCarTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCarTableViewCell class])];
}
cell.carInfo = [self.datasource objectAtIndex:indexPath.row];
cell.delegate = self;
return cell;
} else {
XPMineNameplateTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineNameplateTableViewCell class])];
if (cell == nil) {
cell = [[XPMineNameplateTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineNameplateTableViewCell class])];
}
cell.nameplateModel = [self.datasource objectAtIndex:indexPath.row];
cell.delegate = self;
return cell;
}
}
XPMineDressEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineDressEmptyTableViewCell class])];
if (cell == nil) {
cell = [[XPMineDressEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineDressEmptyTableViewCell class])];
}
cell.emptyTitle = self.type == DressUpListType_HeadWear ? @"亲爱的用户,你还没有头饰噢!" : self.type == DressUpListType_Car ? @"亲爱的用户,你还没有座驾噢!" : @"亲爱的用户,你还没有铭牌噢!";
return cell;
}
#pragma mark - Getters And Setters
- (void)setType:(DressUpListType)type {
_type = type;
switch (type) {
case DressUpListType_HeadWear:
[self.presenter getUserHeadwearList];
break;
case DressUpListType_Car:
[self.presenter getUserCarList];
break;
case DressUpListType_Nameplate:
[self.presenter getUserNameplateList];
break;
default:
break;
}
}
- (UITableView *)tableView {
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.tableFooterView = [UIView new];
@@ -40,6 +174,10 @@
if (@available(iOS 11.0, *)) {
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
[_tableView registerClass:[XPMineNameplateTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineNameplateTableViewCell class])];
[_tableView registerClass:[XPMineCarTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineCarTableViewCell class])];
[_tableView registerClass:[XPMineHeadwearTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineHeadwearTableViewCell class])];
[_tableView registerClass:[XPMineDressEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineDressEmptyTableViewCell class])];
}
return _tableView;
}

View File

@@ -50,6 +50,7 @@
#pragma mark - Private Method
- (void)initSubViews {
self.title = @"我的装扮";
[self.view addSubview:self.cycleScrollView];
[self.view addSubview:self.titleView];
[self.view addSubview:self.contentView];
@@ -79,6 +80,11 @@
[Api dressupBannerList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray <ActivityInfoModel *>* array = [ActivityInfoModel modelsWithArray:data.data];
if (array.count <= 0) {
[self.cycleScrollView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(0);
}];
}
if (array.count <=0) return;
self.activityList = array;
NSMutableArray * picList = [NSMutableArray array];
@@ -94,6 +100,10 @@
} else {
[self.cycleScrollView setAutoScroll:NO];
}
} else {
[self.cycleScrollView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(0);
}];
}
} type:@"3"];
}
@@ -112,6 +122,13 @@
return self.nameplateView;
}
//
- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index {
//
self.navigationController.interactivePopGestureRecognizer.enabled = (index == 0);
}
#pragma mark - SDCycleScrollViewDelegate
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
if (self.activityList.count > index) {
ActivityInfoModel * info = [self.activityList objectAtIndex:index];
@@ -153,6 +170,7 @@
- (JXCategoryListContainerView *)contentView {
if (!_contentView) {
_contentView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
_contentView.scrollView.backgroundColor = [UIColor clearColor];
_contentView.defaultSelectedIndex = 0;
}
return _contentView;
@@ -192,12 +210,10 @@
_cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
_cycleScrollView.currentPageDotColor = [UIColor whiteColor];
_cycleScrollView.pageDotColor = [UIColor colorWithWhite:1 alpha:0.15];
_cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"room_activity_banner_select"];
_cycleScrollView.pageDotImage = [UIImage imageNamed:@"room_activity_banner_normal"];
_cycleScrollView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.00];
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
_cycleScrollView.pageControlBottomOffset = -20;
_cycleScrollView.hidden = YES;
_cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
_cycleScrollView.layer.masksToBounds = YES;
_cycleScrollView.layer.cornerRadius = 12;
}
return _cycleScrollView;
}

View File

@@ -30,6 +30,7 @@
#import "XPMineRechargeViewController.h"
#import "XPWebViewController.h"
#import "XPRoomViewController.h"
#import "XPMineDressUpViewController.h"
@interface XPMineViewController ()<UITableViewDelegate, UITableViewDataSource, XPMineProtocol, XPMineMatchTableViewCellDelegate, XPMineHeadViewDelegate>
@@ -147,6 +148,12 @@
[XPRoomViewController openRoom:roomUid viewController:self];
}
break;
case XPMineItemType_My_Dressup:
{
XPMineDressUpViewController * dressUpVC = [[XPMineDressUpViewController alloc] init];
[self.navigationController pushViewController:dressUpVC animated:YES];
}
break;
default:
break;
}