diff --git a/Podfile b/Podfile index 1a658245..24b68af3 100644 --- a/Podfile +++ b/Podfile @@ -55,6 +55,8 @@ target 'xplan-ios' do #UM统计 pod 'UMCommon' pod 'UMDevice' + #头饰显示 + pod 'YYWebImage', '~> 1.0.5' #调试 pod 'LookinServer', :configurations => ['Debug'] diff --git a/Podfile.lock b/Podfile.lock index 882a2d57..9d03ab4b 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -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 diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index aa0c945a..96ca37c2 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -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 = ""; }; E8252FEC27687DF1002B3164 /* ActivityInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ActivityInfoModel.h; sourceTree = ""; }; E8252FED27687DF1002B3164 /* ActivityInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ActivityInfoModel.m; sourceTree = ""; }; + E82D5C6B276ADCE700858D6D /* XPMineDressEmptyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineDressEmptyTableViewCell.h; sourceTree = ""; }; + E82D5C6C276ADCE700858D6D /* XPMineDressEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineDressEmptyTableViewCell.m; sourceTree = ""; }; + E82D5C6E276AE60000858D6D /* HeadwearModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HeadwearModel.h; sourceTree = ""; }; + E82D5C6F276AE60000858D6D /* HeadwearModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HeadwearModel.m; sourceTree = ""; }; + E82D5C71276AE94800858D6D /* CarModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CarModel.h; sourceTree = ""; }; + E82D5C72276AE94800858D6D /* CarModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CarModel.m; sourceTree = ""; }; + E82D5C74276AEB5100858D6D /* NameplateModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NameplateModel.h; sourceTree = ""; }; + E82D5C75276AEB5100858D6D /* NameplateModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NameplateModel.m; sourceTree = ""; }; + E82D5C78276B25D100858D6D /* SpriteSheetImageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpriteSheetImageManager.h; sourceTree = ""; }; + E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpriteSheetImageManager.m; sourceTree = ""; }; + E82D5C7B276B343300858D6D /* YYAnimatedImageView+ImageShow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YYAnimatedImageView+ImageShow.h"; sourceTree = ""; }; + E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "YYAnimatedImageView+ImageShow.m"; sourceTree = ""; }; E82EE0F6272FDDFA00D15DC1 /* UserPrivacyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserPrivacyView.h; sourceTree = ""; }; E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserPrivacyView.m; sourceTree = ""; }; E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPKickUserModel.h; sourceTree = ""; }; @@ -1235,6 +1253,7 @@ 189DD52A26DE255300AB55B1 /* Products */, D09C770DC30B9BAAEAFC7945 /* Pods */, BFB922F5D81845AC32D1E1ED /* Frameworks */, + E8B35A5E27912E83005F8318 /* Recovered References */, ); sourceTree = ""; }; @@ -1459,6 +1478,7 @@ 189DD5A726DFA09700AB55B1 /* Tool */ = { isa = PBXGroup; children = ( + E82D5C77276B25B000858D6D /* SpriteSheetManager */, E865964E2701A1A900846EBD /* StatisticsService */, E89DA6612700590A008483C1 /* IAPHelper */, E8B846B926FD7BE600A777FE /* UploadImage */, @@ -1896,6 +1916,17 @@ path = Cell; sourceTree = ""; }; + E82D5C77276B25B000858D6D /* SpriteSheetManager */ = { + isa = PBXGroup; + children = ( + E82D5C78276B25D100858D6D /* SpriteSheetImageManager.h */, + E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */, + E82D5C7B276B343300858D6D /* YYAnimatedImageView+ImageShow.h */, + E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */, + ); + path = SpriteSheetManager; + sourceTree = ""; + }; 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 = ""; @@ -1980,6 +2017,8 @@ E839533B276A0CCD00CF2F24 /* XPMineCarTableViewCell.m */, E839533D276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.h */, E839533E276A0CDB00CF2F24 /* XPMineNameplateTableViewCell.m */, + E82D5C6B276ADCE700858D6D /* XPMineDressEmptyTableViewCell.h */, + E82D5C6C276ADCE700858D6D /* XPMineDressEmptyTableViewCell.m */, ); path = Cell; sourceTree = ""; @@ -2513,6 +2552,13 @@ path = StageView; sourceTree = ""; }; + E8B35A5E27912E83005F8318 /* Recovered References */ = { + isa = PBXGroup; + children = ( + ); + name = "Recovered References"; + sourceTree = ""; + }; 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 */, diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/Contents.json b/xplan-ios/Assets.xcassets/Mine/DressUp/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/DressUp/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/Contents.json new file mode 100644 index 00000000..d82ae82e --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/Contents.json @@ -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 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/mine_dressUp_exclusive@2x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/mine_dressUp_exclusive@2x.png new file mode 100644 index 00000000..9bf6decb Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/mine_dressUp_exclusive@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/mine_dressUp_exclusive@3x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/mine_dressUp_exclusive@3x.png new file mode 100644 index 00000000..474c6130 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_exclusive.imageset/mine_dressUp_exclusive@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/Contents.json new file mode 100644 index 00000000..634583d6 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/Contents.json @@ -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 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/mine_dressUp_limit@2x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/mine_dressUp_limit@2x.png new file mode 100644 index 00000000..f42e7833 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/mine_dressUp_limit@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/mine_dressUp_limit@3x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/mine_dressUp_limit@3x.png new file mode 100644 index 00000000..794c0d01 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_limit.imageset/mine_dressUp_limit@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/Contents.json new file mode 100644 index 00000000..cbe423c0 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/Contents.json @@ -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 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/mine_dressUp_new@2x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/mine_dressUp_new@2x.png new file mode 100644 index 00000000..8f0ddd3f Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/mine_dressUp_new@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/mine_dressUp_new@3x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/mine_dressUp_new@3x.png new file mode 100644 index 00000000..412343c5 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressUp_new.imageset/mine_dressUp_new@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/Contents.json new file mode 100644 index 00000000..d33867cc --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/Contents.json @@ -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 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/mine_dressup_give@2x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/mine_dressup_give@2x.png new file mode 100644 index 00000000..e718ccca Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/mine_dressup_give@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/mine_dressup_give@3x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/mine_dressup_give@3x.png new file mode 100644 index 00000000..0641e5ef Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_give.imageset/mine_dressup_give@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/Contents.json new file mode 100644 index 00000000..30c46d43 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/Contents.json @@ -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 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/mine_dressup_time@2x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/mine_dressup_time@2x.png new file mode 100644 index 00000000..155df507 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/mine_dressup_time@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/mine_dressup_time@3x.png b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/mine_dressup_time@3x.png new file mode 100644 index 00000000..95e56a38 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/DressUp/mine_dressup_time.imageset/mine_dressup_time@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/Contents.json new file mode 100644 index 00000000..7a8586c8 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/Contents.json @@ -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 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/mine_normal_my_dressup@2x.png b/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/mine_normal_my_dressup@2x.png new file mode 100644 index 00000000..6f9a0870 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/mine_normal_my_dressup@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/mine_normal_my_dressup@3x.png b/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/mine_normal_my_dressup@3x.png new file mode 100644 index 00000000..797997bd Binary files /dev/null and b/xplan-ios/Assets.xcassets/Mine/mine_normal_my_dressup.imageset/mine_normal_my_dressup@3x.png differ diff --git a/xplan-ios/Base/Tool/SpriteSheetManager/SpriteSheetImageManager.h b/xplan-ios/Base/Tool/SpriteSheetManager/SpriteSheetImageManager.h new file mode 100644 index 00000000..90c2fc8b --- /dev/null +++ b/xplan-ios/Base/Tool/SpriteSheetManager/SpriteSheetImageManager.h @@ -0,0 +1,16 @@ +// +// SpriteSheetImageManager.h +// XChat +// +// Created by Macx on 2018/5/11. +// Copyright © 2018年 XC. All rights reserved. +// + +#import +#import + +@interface SpriteSheetImageManager : NSObject +- (void)loadSpriteSheetImageWithURL:(NSURL *_Nullable)url + completionBlock:(void ( ^ _Nonnull )(YYSpriteSheetImage * _Nullable sprit))completionBlock + failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock; +@end diff --git a/xplan-ios/Base/Tool/SpriteSheetManager/SpriteSheetImageManager.m b/xplan-ios/Base/Tool/SpriteSheetManager/SpriteSheetImageManager.m new file mode 100644 index 00000000..61d8d52c --- /dev/null +++ b/xplan-ios/Base/Tool/SpriteSheetManager/SpriteSheetImageManager.m @@ -0,0 +1,156 @@ +// +// SpriteSheetImageManager.m +// XChat +// +// Created by Macx on 2018/5/11. +// Copyright © 2018年 XC. All rights reserved. +// + +#import "SpriteSheetImageManager.h" +#import +#import +#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 diff --git a/xplan-ios/Base/Tool/SpriteSheetManager/YYAnimatedImageView+ImageShow.h b/xplan-ios/Base/Tool/SpriteSheetManager/YYAnimatedImageView+ImageShow.h new file mode 100644 index 00000000..40b8d9ce --- /dev/null +++ b/xplan-ios/Base/Tool/SpriteSheetManager/YYAnimatedImageView+ImageShow.h @@ -0,0 +1,16 @@ +// +// YYAnimatedImageView+ImageShow.h +// xplan-ios +// +// Created by 冯硕 on 2021/12/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface YYAnimatedImageView (ImageShow) + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Base/Tool/SpriteSheetManager/YYAnimatedImageView+ImageShow.m b/xplan-ios/Base/Tool/SpriteSheetManager/YYAnimatedImageView+ImageShow.m new file mode 100644 index 00000000..5fdde4ac --- /dev/null +++ b/xplan-ios/Base/Tool/SpriteSheetManager/YYAnimatedImageView+ImageShow.m @@ -0,0 +1,34 @@ +// +// YYAnimatedImageView+ImageShow.m +// xplan-ios +// +// Created by 冯硕 on 2021/12/16. +// + +#import "YYAnimatedImageView+ImageShow.h" +#import + +@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 diff --git a/xplan-ios/Global/XPEnum.h b/xplan-ios/Global/XPEnum.h index af98daaf..3c9c6804 100644 --- a/xplan-ios/Global/XPEnum.h +++ b/xplan-ios/Global/XPEnum.h @@ -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 */ diff --git a/xplan-ios/Main/Mine/Model/XPMineItemModel.h b/xplan-ios/Main/Mine/Model/XPMineItemModel.h index 30ef432c..575893b2 100644 --- a/xplan-ios/Main/Mine/Model/XPMineItemModel.h +++ b/xplan-ios/Main/Mine/Model/XPMineItemModel.h @@ -23,6 +23,7 @@ typedef NS_ENUM(NSInteger, XPMineItemType) { XPMineItemType_Account,///我的账户 XPMineItemType_Invite_Friend,///邀请好友 XPMineItemType_Personinfo,///个人中心 + XPMineItemType_My_Dressup,///我的装扮 }; diff --git a/xplan-ios/Main/Mine/Presenter/XPMinePresent.m b/xplan-ios/Main/Mine/Presenter/XPMinePresent.m index 01a4eaca..2231222e 100644 --- a/xplan-ios/Main/Mine/Presenter/XPMinePresent.m +++ b/xplan-ios/Main/Mine/Presenter/XPMinePresent.m @@ -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]; } diff --git a/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.h b/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.h index 4b1b778c..14dc7ae3 100644 --- a/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.h +++ b/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.h @@ -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 完成 diff --git a/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.m b/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.m index fe9d8ee6..e9c7c749 100644 --- a/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.m +++ b/xplan-ios/Main/Mine/View/DressUp/Api/Api+DressUp.m @@ -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]; } diff --git a/xplan-ios/Main/Mine/View/DressUp/Model/CarModel.h b/xplan-ios/Main/Mine/View/DressUp/Model/CarModel.h new file mode 100644 index 00000000..b792272d --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/Model/CarModel.h @@ -0,0 +1,36 @@ +// +// CarModel.h +// xplan-ios +// +// Created by 冯硕 on 2021/12/16. +// + +#import +#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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Model/CarModel.m b/xplan-ios/Main/Mine/View/DressUp/Model/CarModel.m new file mode 100644 index 00000000..6c89f190 --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/Model/CarModel.m @@ -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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Model/HeadwearModel.h b/xplan-ios/Main/Mine/View/DressUp/Model/HeadwearModel.h new file mode 100644 index 00000000..608d7e06 --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/Model/HeadwearModel.h @@ -0,0 +1,41 @@ +// +// HeadwearModel.h +// xplan-ios +// +// Created by 冯硕 on 2021/12/16. +// + +#import +#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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Model/HeadwearModel.m b/xplan-ios/Main/Mine/View/DressUp/Model/HeadwearModel.m new file mode 100644 index 00000000..c40045fa --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/Model/HeadwearModel.m @@ -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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Model/NameplateModel.h b/xplan-ios/Main/Mine/View/DressUp/Model/NameplateModel.h new file mode 100644 index 00000000..1f8d3f20 --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/Model/NameplateModel.h @@ -0,0 +1,27 @@ +// +// NameplateModel.h +// xplan-ios +// +// Created by 冯硕 on 2021/12/16. +// + +#import +#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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Model/NameplateModel.m b/xplan-ios/Main/Mine/View/DressUp/Model/NameplateModel.m new file mode 100644 index 00000000..43f6da49 --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/Model/NameplateModel.m @@ -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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.h b/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.h index e1b2990b..cfa2cf3e 100644 --- a/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.h +++ b/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.h @@ -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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.m b/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.m index e822ed44..377d962f 100644 --- a/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.m +++ b/xplan-ios/Main/Mine/View/DressUp/Presenter/XPMineDressUpPresenter.m @@ -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 diff --git a/xplan-ios/Main/Mine/View/DressUp/Protocol/XPMineDressUpProtocol.h b/xplan-ios/Main/Mine/View/DressUp/Protocol/XPMineDressUpProtocol.h index 9ab53ba7..eb5e6420 100644 --- a/xplan-ios/Main/Mine/View/DressUp/Protocol/XPMineDressUpProtocol.h +++ b/xplan-ios/Main/Mine/View/DressUp/Protocol/XPMineDressUpProtocol.h @@ -11,6 +11,18 @@ NS_ASSUME_NONNULL_BEGIN @protocol XPMineDressUpProtocol +///获取用户头饰列表成功 +- (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 diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.h b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.h index b3dbd320..157ff952 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.h +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.h @@ -8,9 +8,16 @@ #import NS_ASSUME_NONNULL_BEGIN +@class CarModel,XPMineCarTableViewCell; +@protocol XPMineCarTableViewCellDelegate +///使用座驾 +- (void)xPMineCarTableViewCell:(XPMineCarTableViewCell *)cell carId:(NSString *)carId; +@end @interface XPMineCarTableViewCell : UITableViewCell - +@property (nonatomic,strong) CarModel *carInfo; +///代理 +@property (nonatomic,weak) id delegate; @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.m b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.m index 87b93826..7fef63be 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineCarTableViewCell.m @@ -6,18 +6,257 @@ // #import "XPMineCarTableViewCell.h" +///Third +#import +///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 diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineDressEmptyTableViewCell.h b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineDressEmptyTableViewCell.h new file mode 100644 index 00000000..8eb5fcd4 --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineDressEmptyTableViewCell.h @@ -0,0 +1,17 @@ +// +// XPMineDressEmptyTableViewCell.h +// xplan-ios +// +// Created by 冯硕 on 2021/12/16. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XPMineDressEmptyTableViewCell : UITableViewCell +///标题 +@property (nonatomic,copy) NSString *emptyTitle; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineDressEmptyTableViewCell.m b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineDressEmptyTableViewCell.m new file mode 100644 index 00000000..c0cb1f1e --- /dev/null +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineDressEmptyTableViewCell.m @@ -0,0 +1,80 @@ +// +// XPMineDressEmptyTableViewCell.m +// xplan-ios +// +// Created by 冯硕 on 2021/12/16. +// + +#import "XPMineDressEmptyTableViewCell.h" +///Third +#import +///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 diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.h b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.h index e1caef8e..98894de9 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.h +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.h @@ -8,9 +8,17 @@ #import NS_ASSUME_NONNULL_BEGIN +@class HeadwearModel, XPMineHeadwearTableViewCell; +@protocol XPMineHeadwearTableViewCellDelegate +///使用头饰 +- (void)xPMineHeadwearTableViewCell:(XPMineHeadwearTableViewCell *)view headwearId:(NSString *)headwearId; + +@end @interface XPMineHeadwearTableViewCell : UITableViewCell - +@property (nonatomic,strong) HeadwearModel *headwearModel; +///代理 +@property (nonatomic,weak) id delegate; @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.m b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.m index 8ae77fbf..e816262b 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineHeadwearTableViewCell.m @@ -6,23 +6,27 @@ // #import "XPMineHeadwearTableViewCell.h" - ///Third #import +#import ///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 diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.h b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.h index f7e92047..a5d0d948 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.h +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.h @@ -8,9 +8,16 @@ #import NS_ASSUME_NONNULL_BEGIN +@class NameplateModel, XPMineNameplateTableViewCell; +@protocol XPMineNameplateTableViewCellDelegate +///使用铭牌 +- (void)xPMineNameplateTableViewCell:(XPMineNameplateTableViewCell *)view nameplateId:(NSString *)nameplateId; +@end @interface XPMineNameplateTableViewCell : UITableViewCell - +@property (nonatomic,strong) NameplateModel *nameplateModel; +///代理 +@property (nonatomic,weak) id delegate; @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.m b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.m index 0597a7cd..11de59f6 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/Cell/XPMineNameplateTableViewCell.m @@ -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; } diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m index 5913210d..2efabeed 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpListViewController.m @@ -6,32 +6,166 @@ // #import "XPMineDressUpListViewController.h" +///Third +#import +///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 () ///列表 @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; } diff --git a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m index 57d2bad3..d83dec9b 100644 --- a/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m +++ b/xplan-ios/Main/Mine/View/DressUp/View/XPMineDressUpViewController.m @@ -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 * 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; } diff --git a/xplan-ios/Main/Mine/View/XPMineViewController.m b/xplan-ios/Main/Mine/View/XPMineViewController.m index c7be05bb..024f10fa 100644 --- a/xplan-ios/Main/Mine/View/XPMineViewController.m +++ b/xplan-ios/Main/Mine/View/XPMineViewController.m @@ -30,6 +30,7 @@ #import "XPMineRechargeViewController.h" #import "XPWebViewController.h" #import "XPRoomViewController.h" +#import "XPMineDressUpViewController.h" @interface XPMineViewController () @@ -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; }