心愿礼物面板的部分UI
@@ -914,6 +914,9 @@
|
||||
E89DA66727006443008483C1 /* RechargeStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DA66627006443008483C1 /* RechargeStorage.m */; };
|
||||
E89DA67227008D59008483C1 /* WalletInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DA67127008D59008483C1 /* WalletInfoModel.m */; };
|
||||
E89DA67527009ACD008483C1 /* XPMineRechargeNavView.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DA67427009ACD008483C1 /* XPMineRechargeNavView.m */; };
|
||||
E89DCF5428FFEC67001647EC /* XPWishGiftHistoryTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DCF5328FFEC67001647EC /* XPWishGiftHistoryTableViewCell.m */; };
|
||||
E89DCF5728FFF076001647EC /* XPWishGiftEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DCF5628FFF076001647EC /* XPWishGiftEmptyTableViewCell.m */; };
|
||||
E89DCF5A28FFF1AD001647EC /* XPWishGiftSectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = E89DCF5928FFF1AD001647EC /* XPWishGiftSectionView.m */; };
|
||||
E8A03DE22762FA000098D9EA /* XPCandyTreeMoreView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A03DE12762FA000098D9EA /* XPCandyTreeMoreView.m */; };
|
||||
E8A03DE9276301CC0098D9EA /* XPCandyRankContainerView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A03DE8276301CC0098D9EA /* XPCandyRankContainerView.m */; };
|
||||
E8A03DEC276301EF0098D9EA /* XPCandyTreeRankView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A03DEB276301EF0098D9EA /* XPCandyTreeRankView.m */; };
|
||||
@@ -944,7 +947,7 @@
|
||||
E8A3539128FE5F0F0014A784 /* WishGiftInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3539028FE5F0F0014A784 /* WishGiftInfoModel.m */; };
|
||||
E8A3539428FE605F0014A784 /* WishGiftUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3539328FE605F0014A784 /* WishGiftUserModel.m */; };
|
||||
E8A3539728FE7C250014A784 /* XPWishGiftPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3539628FE7C250014A784 /* XPWishGiftPresenter.m */; };
|
||||
E8A3539B28FE840A0014A784 /* XPWishGIftViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3539A28FE840A0014A784 /* XPWishGIftViewController.m */; };
|
||||
E8A3539B28FE840A0014A784 /* XPWishGiftViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3539A28FE840A0014A784 /* XPWishGiftViewController.m */; };
|
||||
E8A353A028FE84670014A784 /* XPWishGiftInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3539F28FE84670014A784 /* XPWishGiftInfoView.m */; };
|
||||
E8A353A328FE90F60014A784 /* XPWishGiftCreateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A353A228FE90F60014A784 /* XPWishGiftCreateViewController.m */; };
|
||||
E8A3540128FEAC5E0014A784 /* XPWishGiftTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3540028FEAC5E0014A784 /* XPWishGiftTableViewCell.m */; };
|
||||
@@ -2874,6 +2877,12 @@
|
||||
E89DA67127008D59008483C1 /* WalletInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WalletInfoModel.m; sourceTree = "<group>"; };
|
||||
E89DA67327009ACD008483C1 /* XPMineRechargeNavView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineRechargeNavView.h; sourceTree = "<group>"; };
|
||||
E89DA67427009ACD008483C1 /* XPMineRechargeNavView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineRechargeNavView.m; sourceTree = "<group>"; };
|
||||
E89DCF5228FFEC67001647EC /* XPWishGiftHistoryTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftHistoryTableViewCell.h; sourceTree = "<group>"; };
|
||||
E89DCF5328FFEC67001647EC /* XPWishGiftHistoryTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftHistoryTableViewCell.m; sourceTree = "<group>"; };
|
||||
E89DCF5528FFF076001647EC /* XPWishGiftEmptyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftEmptyTableViewCell.h; sourceTree = "<group>"; };
|
||||
E89DCF5628FFF076001647EC /* XPWishGiftEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftEmptyTableViewCell.m; sourceTree = "<group>"; };
|
||||
E89DCF5828FFF1AD001647EC /* XPWishGiftSectionView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftSectionView.h; sourceTree = "<group>"; };
|
||||
E89DCF5928FFF1AD001647EC /* XPWishGiftSectionView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftSectionView.m; sourceTree = "<group>"; };
|
||||
E8A03DE02762FA000098D9EA /* XPCandyTreeMoreView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeMoreView.h; sourceTree = "<group>"; };
|
||||
E8A03DE12762FA000098D9EA /* XPCandyTreeMoreView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeMoreView.m; sourceTree = "<group>"; };
|
||||
E8A03DE7276301CC0098D9EA /* XPCandyRankContainerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCandyRankContainerView.h; sourceTree = "<group>"; };
|
||||
@@ -2934,8 +2943,8 @@
|
||||
E8A3539528FE7C250014A784 /* XPWishGiftPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftPresenter.h; sourceTree = "<group>"; };
|
||||
E8A3539628FE7C250014A784 /* XPWishGiftPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftPresenter.m; sourceTree = "<group>"; };
|
||||
E8A3539828FE7C4F0014A784 /* XPWishGiftProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftProtocol.h; sourceTree = "<group>"; };
|
||||
E8A3539928FE840A0014A784 /* XPWishGIftViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGIftViewController.h; sourceTree = "<group>"; };
|
||||
E8A3539A28FE840A0014A784 /* XPWishGIftViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGIftViewController.m; sourceTree = "<group>"; };
|
||||
E8A3539928FE840A0014A784 /* XPWishGiftViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftViewController.h; sourceTree = "<group>"; };
|
||||
E8A3539A28FE840A0014A784 /* XPWishGiftViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftViewController.m; sourceTree = "<group>"; };
|
||||
E8A3539E28FE84670014A784 /* XPWishGiftInfoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftInfoView.h; sourceTree = "<group>"; };
|
||||
E8A3539F28FE84670014A784 /* XPWishGiftInfoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftInfoView.m; sourceTree = "<group>"; };
|
||||
E8A353A128FE90F60014A784 /* XPWishGiftCreateViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftCreateViewController.h; sourceTree = "<group>"; };
|
||||
@@ -7335,8 +7344,8 @@
|
||||
children = (
|
||||
E8A3539D28FE84470014A784 /* Cell */,
|
||||
E8A3539C28FE84400014A784 /* View */,
|
||||
E8A3539928FE840A0014A784 /* XPWishGIftViewController.h */,
|
||||
E8A3539A28FE840A0014A784 /* XPWishGIftViewController.m */,
|
||||
E8A3539928FE840A0014A784 /* XPWishGiftViewController.h */,
|
||||
E8A3539A28FE840A0014A784 /* XPWishGiftViewController.m */,
|
||||
E8A353A128FE90F60014A784 /* XPWishGiftCreateViewController.h */,
|
||||
E8A353A228FE90F60014A784 /* XPWishGiftCreateViewController.m */,
|
||||
E8A3540228FEB7100014A784 /* XPWishGiftHistoryViewController.h */,
|
||||
@@ -7363,6 +7372,8 @@
|
||||
E8A3539F28FE84670014A784 /* XPWishGiftInfoView.m */,
|
||||
E8A3540828FEC0510014A784 /* XPWishGiftListView.h */,
|
||||
E8A3540928FEC0510014A784 /* XPWishGiftListView.m */,
|
||||
E89DCF5828FFF1AD001647EC /* XPWishGiftSectionView.h */,
|
||||
E89DCF5928FFF1AD001647EC /* XPWishGiftSectionView.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@@ -7372,6 +7383,10 @@
|
||||
children = (
|
||||
E8A353FF28FEAC5E0014A784 /* XPWishGiftTableViewCell.h */,
|
||||
E8A3540028FEAC5E0014A784 /* XPWishGiftTableViewCell.m */,
|
||||
E89DCF5228FFEC67001647EC /* XPWishGiftHistoryTableViewCell.h */,
|
||||
E89DCF5328FFEC67001647EC /* XPWishGiftHistoryTableViewCell.m */,
|
||||
E89DCF5528FFF076001647EC /* XPWishGiftEmptyTableViewCell.h */,
|
||||
E89DCF5628FFF076001647EC /* XPWishGiftEmptyTableViewCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
@@ -9166,7 +9181,7 @@
|
||||
E8AC723226F49710007D6E91 /* XPMineNotificationTableViewCell.m in Sources */,
|
||||
E8AC722926F488DA007D6E91 /* XPMineFeedbackProtocol.h in Sources */,
|
||||
E8A3539128FE5F0F0014A784 /* WishGiftInfoModel.m in Sources */,
|
||||
E8A3539B28FE840A0014A784 /* XPWishGIftViewController.m in Sources */,
|
||||
E8A3539B28FE840A0014A784 /* XPWishGiftViewController.m in Sources */,
|
||||
E8950183282CAC6A007E459A /* XPMonentsPhotoView.m in Sources */,
|
||||
9BCF58562798FE86008401A4 /* XPSkillCardPropModel.m in Sources */,
|
||||
E8AC721E26F472BF007D6E91 /* XPMineSettingProtocol.h in Sources */,
|
||||
@@ -9636,6 +9651,7 @@
|
||||
9B1B729D28002264003FACE9 /* XPMineAnchorFansTeamModel.m in Sources */,
|
||||
E8C6FFE02754EEF9004DC9F0 /* XPHomeSearchViewController.m in Sources */,
|
||||
E8AE427327153A3500BEEBB2 /* XPRoomActivityContainerView.m in Sources */,
|
||||
E89DCF5428FFEC67001647EC /* XPWishGiftHistoryTableViewCell.m in Sources */,
|
||||
9BB89DC627FEB9E100586A83 /* XPAnchorFansTaskViewController.m in Sources */,
|
||||
E86596432701611A00846EBD /* UIImage+ImageEffects.m in Sources */,
|
||||
E8ACEFE927C8BC1600F66D1A /* XPHomeRecommendHeaderView.m in Sources */,
|
||||
@@ -10000,6 +10016,7 @@
|
||||
9BE2FA90288010D300EF3D83 /* AnchorRoomSrollTipView.m in Sources */,
|
||||
E87E91522796A15500A7B3F2 /* MicroExtModel.m in Sources */,
|
||||
E8788948273A55D000BF1D57 /* XPGiftBarView.m in Sources */,
|
||||
E89DCF5728FFF076001647EC /* XPWishGiftEmptyTableViewCell.m in Sources */,
|
||||
9BA8A47227C5D590000365A3 /* XPVoiceCardCircleLayer.m in Sources */,
|
||||
E81A65422835120200F55894 /* XPMonentsInteractivePresenter.m in Sources */,
|
||||
9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */,
|
||||
@@ -10007,6 +10024,7 @@
|
||||
E8664EE627E482EF000171BA /* RoomPKTeamModel.m in Sources */,
|
||||
9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */,
|
||||
E8C167332806CADF00ECB15C /* XPGuildSuperAdminMenuView.m in Sources */,
|
||||
E89DCF5A28FFF1AD001647EC /* XPWishGiftSectionView.m in Sources */,
|
||||
E81A654C28351D9900F55894 /* XPMonentsTopicCollectionViewCell.m in Sources */,
|
||||
E800808527FD8FC20055A8AB /* ClanMemberDetailInfoModel.m in Sources */,
|
||||
9B4769AD28DB270F00CCD312 /* XPHomePartyNavView.m in Sources */,
|
||||
|
6
xplan-ios/Assets.xcassets/Room/WishGift/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_create_arrow.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_create_arrow@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_create_arrow@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 279 B |
After Width: | Height: | Size: 348 B |
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_add.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_add@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_add@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_add.imageset/room_wish_gift_add@2x.png
vendored
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_add.imageset/room_wish_gift_add@3x.png
vendored
Normal file
After Width: | Height: | Size: 3.2 KiB |
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_completion.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_completion@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_completion@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 409 B |
After Width: | Height: | Size: 653 B |
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_panel_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_panel_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_panel_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 44 KiB |
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_panel_gift_bg.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_panel_gift_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_panel_gift_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 17 KiB |
22
xplan-ios/Assets.xcassets/Room/WishGift/room_wish_gift_subtract.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_subtract@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_wish_gift_subtract@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 2.1 KiB |
@@ -77,6 +77,7 @@
|
||||
#import "XPRoomHalfMessageView.h"
|
||||
#import "XPAcrossRoomPKCountDownView.h"
|
||||
#import "XPNewUserRoomGiftView.h"
|
||||
#import "XPWishGiftViewController.h"
|
||||
///个播PK
|
||||
#import "XPAnchorFansTeamEntranceView.h"
|
||||
#import "XPAnchorFansTeamViewController.h"
|
||||
@@ -135,6 +136,9 @@
|
||||
///获取新用户礼物倒计时3s
|
||||
@property (nonatomic, strong) dispatch_source_t userGiftTimer;
|
||||
|
||||
///许愿礼物
|
||||
@property (nonatomic,strong) UIView *wishGiftView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomFunctionContainerView
|
||||
@@ -233,6 +237,8 @@
|
||||
[self addSubview:self.topicStackView];
|
||||
[self.topicStackView addArrangedSubview:self.topicLabel];
|
||||
[self.topicStackView addArrangedSubview:self.editButton];
|
||||
|
||||
[self addSubview:self.wishGiftView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -248,6 +254,12 @@
|
||||
make.height.mas_equalTo(15);
|
||||
make.top.mas_equalTo(50 + 5 + 6 + 12 + 3 + kNavigationHeight);
|
||||
}];
|
||||
|
||||
[self.wishGiftView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(100, 40));
|
||||
make.right.mas_equalTo(self);
|
||||
make.top.mas_equalTo(self).offset(kNavigationHeight + 50);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)showLittleGameMiniView:(RoomType)type micCount:(NSInteger)micCount {
|
||||
@@ -1635,6 +1647,14 @@
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 心愿礼物
|
||||
- (void)tapWishGift {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||
XPWishGiftViewController * vc = [[XPWishGiftViewController alloc] initWithRoomUid:roomUid];
|
||||
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
[self.delegate.getCurrentNav presentViewController:vc animated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (XPRoomRankEntranceView *)contributeEnterView {
|
||||
if (!_contributeEnterView) {
|
||||
@@ -1797,4 +1817,14 @@
|
||||
return _acrossPKCountView;
|
||||
}
|
||||
|
||||
- (UIView *)wishGiftView {
|
||||
if (!_wishGiftView) {
|
||||
_wishGiftView = [[UIView alloc] init];
|
||||
_wishGiftView.backgroundColor = [UIColor clearColor];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapWishGift)];
|
||||
[_wishGiftView addGestureRecognizer:tap];
|
||||
}
|
||||
return _wishGiftView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -31,6 +31,14 @@
|
||||
/// @param seq 编号 1 2 3
|
||||
/// @param targetNum 目标数量
|
||||
+ (void)wishGiftAddItem:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid giftId:(NSString *)giftId itemId:(NSString *)itemId seq:(NSString *)seq targetNum:(NSString *)targetNum {
|
||||
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
||||
if (itemId.length > 0) {
|
||||
[dic setValue:itemId forKey:@"itemId"];
|
||||
}
|
||||
[dic setValue:roomUid forKey:@"roomUid"];
|
||||
[dic setValue:giftId forKey:@"giftId"];
|
||||
[dic setValue:seq forKey:@"seq"];
|
||||
[dic setValue:targetNum forKey:@"targetNum"];
|
||||
[self makeRequest:@"wishGift/addItem" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, giftId, itemId, seq, targetNum, nil];
|
||||
}
|
||||
|
||||
@@ -50,7 +58,7 @@
|
||||
/// @param roomUid 房主的uid
|
||||
/// @param level 等级
|
||||
+ (void)wishGiftCondfigList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid level:(NSString *)level {
|
||||
[self makeRequest:@"wishGift/listConfig" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil];
|
||||
[self makeRequest:@"wishGift/listConfig" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, level, nil];
|
||||
}
|
||||
|
||||
/// 获取房间历史心愿列表
|
||||
|
@@ -9,6 +9,12 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(int, WishGiftLevel) {
|
||||
WishGiftLevel_Normal = 1,
|
||||
WishGiftLevel_Middle = 2,
|
||||
WishGiftLevel_High = 3
|
||||
};
|
||||
|
||||
@interface WishGiftInfoModel : NSObject
|
||||
/// 实际收到数量
|
||||
@property (nonatomic, assign) NSInteger actualNum;
|
||||
@@ -26,6 +32,12 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,copy) NSString *giftUrl;
|
||||
///本地字段
|
||||
@property (nonatomic,assign) NSInteger row;
|
||||
///创建的时间
|
||||
@property (nonatomic,strong) NSString *createTime;
|
||||
///等级的名称
|
||||
@property (nonatomic,copy) NSString *levelName;
|
||||
///等级
|
||||
@property (nonatomic,assign) WishGiftLevel level;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -50,13 +50,14 @@
|
||||
- (void)wishGiftConfigList:(NSString *)roomUid level:(NSString *)level {
|
||||
[Api wishGiftCondfigList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
NSArray * array = [WishGiftInfoModel modelsWithArray:data.data];
|
||||
[[self getView] wishGiftConfigListSucces:array];
|
||||
[[self getView] wishGiftConfigListSucces:array level:level];
|
||||
}] roomUid:roomUid level:level];
|
||||
}
|
||||
///获取房间历史列表
|
||||
- (void)wishGiftHistroyList:(NSString *)roomUid {
|
||||
[Api wishGiftHistoryList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
|
||||
NSArray * array = [WishGiftUserModel modelsWithArray:data.data];
|
||||
[[self getView] wishGiftHistroyListSuccess:array];
|
||||
} showLoading:YES] roomUid:roomUid];
|
||||
}
|
||||
|
||||
|
@@ -26,8 +26,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)getWishGiftAssistUserListSuccess:(NSArray *)list;
|
||||
|
||||
///礼物配置列表
|
||||
- (void)wishGiftConfigListSucces:(NSArray *)list;
|
||||
- (void)wishGiftConfigListSucces:(NSArray *)list level:(NSString *)level;
|
||||
|
||||
///历史心愿成功
|
||||
- (void)wishGiftHistroyListSuccess:(NSArray *)list;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPWishGiftEmptyTableViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/19.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPWishGiftEmptyTableViewCell : UITableViewCell
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// XPWishGiftEmptyTableViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/19.
|
||||
//
|
||||
|
||||
#import "XPWishGiftEmptyTableViewCell.h"
|
||||
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImageConstant.h"
|
||||
|
||||
@interface XPWishGiftEmptyTableViewCell ()
|
||||
@property (nonatomic,strong) UIImageView *emptyImageView;
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
@end
|
||||
|
||||
@implementation XPWishGiftEmptyTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[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.top.mas_equalTo(self.contentView).offset(150);
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.size.mas_equalTo(CGSizeMake(200, 200));
|
||||
}];
|
||||
|
||||
[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
|
||||
- (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
|
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// XPWishGiftHistoryTableViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/19.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class WishGiftInfoModel;
|
||||
@interface XPWishGiftHistoryTableViewCell : UITableViewCell
|
||||
///是不是第一个
|
||||
@property (nonatomic,assign) BOOL isTop;
|
||||
///是不是底部
|
||||
@property (nonatomic,assign) BOOL isBottom;
|
||||
@property (nonatomic,strong) WishGiftInfoModel *giftInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,165 @@
|
||||
//
|
||||
// XPWishGiftHistoryTableViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/19.
|
||||
//
|
||||
|
||||
#import "XPWishGiftHistoryTableViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "NetImageView.h"
|
||||
#import "WishGiftInfoModel.h"
|
||||
#import "UIView+Corner.h"
|
||||
#import "XPMacro.h"
|
||||
|
||||
@interface XPWishGiftHistoryTableViewCell ()
|
||||
///容器
|
||||
@property (nonatomic,strong) UIView *backView;
|
||||
///等级
|
||||
@property (nonatomic,strong) UILabel *levleLabel;
|
||||
///礼物图片
|
||||
@property (nonatomic,strong) NetImageView *giftImageView;
|
||||
///礼物名称
|
||||
@property (nonatomic,strong) UILabel *giftLabel;
|
||||
///目标
|
||||
@property (nonatomic,strong) UILabel *targetNumLabel;
|
||||
///分割下
|
||||
@property (nonatomic,strong) UIView *lineView;
|
||||
|
||||
@end
|
||||
@implementation XPWishGiftHistoryTableViewCell
|
||||
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
[self.contentView addSubview:self.backView];
|
||||
|
||||
[self.backView addSubview:self.levleLabel];
|
||||
[self.backView addSubview:self.giftImageView];
|
||||
[self.backView addSubview:self.giftLabel];
|
||||
[self.backView addSubview:self.targetNumLabel];
|
||||
[self.backView addSubview:self.lineView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.equalTo(self.contentView).inset(15);
|
||||
make.top.bottom.mas_equalTo(self.contentView);
|
||||
}];
|
||||
|
||||
[self.levleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.backView);
|
||||
make.left.mas_equalTo(self.backView).offset(15);
|
||||
}];
|
||||
|
||||
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(24, 24));
|
||||
make.centerY.mas_equalTo(self.backView);
|
||||
make.left.mas_equalTo(self.levleLabel.mas_right).offset(20);
|
||||
}];
|
||||
|
||||
[self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.backView);
|
||||
make.left.mas_equalTo(self.giftImageView.mas_right).offset(8);
|
||||
make.right.lessThanOrEqualTo(self.targetNumLabel.mas_left).offset(-5);
|
||||
}];
|
||||
|
||||
[self.targetNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.backView);
|
||||
make.right.mas_equalTo(self.backView).offset(-15);
|
||||
}];
|
||||
|
||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView).inset(13);
|
||||
make.bottom.mas_equalTo(self.backView);
|
||||
make.height.mas_equalTo(1);
|
||||
}];
|
||||
|
||||
}
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setIsTop:(BOOL)isTop {
|
||||
_isTop = isTop;
|
||||
if(_isTop) {
|
||||
[self.backView setCornerWithLeftTopCorner:8 rightTopCorner:8 bottomLeftCorner:0 bottomRightCorner:0 size:(CGSizeMake(KScreenWidth - 30, 44))];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setIsBottom:(BOOL)isBottom {
|
||||
_isBottom = isBottom;
|
||||
if (_isBottom) {
|
||||
[self.backView setCornerWithLeftTopCorner:0 rightTopCorner:0 bottomLeftCorner:8 bottomRightCorner:8 size:(CGSizeMake(KScreenWidth - 30, 44))];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setGiftInfo:(WishGiftInfoModel *)giftInfo {
|
||||
_giftInfo = giftInfo;
|
||||
if (_giftInfo) {
|
||||
self.levleLabel.text = [NSString stringWithFormat:@"%ld", _giftInfo.row];
|
||||
self.giftImageView.imageUrl = _giftInfo.giftUrl;
|
||||
self.giftLabel.text = _giftInfo.giftName;
|
||||
self.targetNumLabel.text = [NSString stringWithFormat:@"%ld/%ld", _giftInfo.actualNum, _giftInfo.targetNum];
|
||||
}
|
||||
}
|
||||
|
||||
- (UILabel *)levleLabel {
|
||||
if (!_levleLabel) {
|
||||
_levleLabel = [[UILabel alloc] init];
|
||||
_levleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
|
||||
_levleLabel.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _levleLabel;
|
||||
}
|
||||
|
||||
- (NetImageView *)giftImageView {
|
||||
if (!_giftImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_giftImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_giftImageView.layer.masksToBounds = YES;
|
||||
_giftImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _giftImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)giftLabel {
|
||||
if (!_giftLabel) {
|
||||
_giftLabel = [[UILabel alloc] init];
|
||||
_giftLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold];
|
||||
_giftLabel.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _giftLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)targetNumLabel {
|
||||
if (!_targetNumLabel) {
|
||||
_targetNumLabel = [[UILabel alloc] init];
|
||||
_targetNumLabel.font = [UIFont systemFontOfSize:14];
|
||||
_targetNumLabel.textColor = [ThemeColor textThirdColor];
|
||||
}
|
||||
return _targetNumLabel;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = [ThemeColor dividerColor];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
||||
@end
|
@@ -28,6 +28,8 @@
|
||||
@property (nonatomic,strong) UIButton *updateButton;
|
||||
///删除
|
||||
@property (nonatomic,strong) UIButton *clearButton;
|
||||
///分割下
|
||||
@property (nonatomic,strong) UIView *lineView;
|
||||
|
||||
@end
|
||||
@implementation XPWishGiftTableViewCell
|
||||
@@ -51,6 +53,7 @@
|
||||
[self.contentView addSubview:self.targetNumLabel];
|
||||
[self.contentView addSubview:self.updateButton];
|
||||
[self.contentView addSubview:self.clearButton];
|
||||
[self.contentView addSubview:self.lineView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -88,6 +91,12 @@
|
||||
make.right.mas_equalTo(self.updateButton.mas_left).offset(-26);
|
||||
}];
|
||||
|
||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.contentView).inset(13);
|
||||
make.bottom.mas_equalTo(self.contentView);
|
||||
make.height.mas_equalTo(1);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
@@ -182,5 +191,13 @@
|
||||
return _clearButton;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = [ThemeColor dividerColor];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -8,11 +8,21 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class WishGiftInfoModel;
|
||||
@class WishGiftInfoModel, XPWishGiftInfoView;
|
||||
|
||||
@protocol XPWishGiftInfoView <NSObject>
|
||||
|
||||
- (void)xPWishGiftInfoView:(XPWishGiftInfoView *)view didClickSender:(WishGiftInfoModel *)info;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPWishGiftInfoView : UIView
|
||||
|
||||
@property (nonatomic,strong) WishGiftInfoModel *giftInfo;
|
||||
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPWishGiftInfoView> delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
@interface XPWishGiftInfoView ()
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView *bgView;
|
||||
@property (nonatomic,strong) UIImageView *bgView;
|
||||
///礼物的图片
|
||||
@property (nonatomic,strong) NetImageView *giftImageView;
|
||||
///礼物名称
|
||||
@@ -30,6 +30,8 @@
|
||||
@property (nonatomic,strong) UISlider *progressView;
|
||||
///赠送按钮
|
||||
@property (nonatomic,strong) UIButton *senderButton;
|
||||
///完成按钮
|
||||
@property (nonatomic,strong) UIImageView *completionImageView;
|
||||
|
||||
@end
|
||||
|
||||
@@ -95,41 +97,56 @@
|
||||
}
|
||||
|
||||
- (NSAttributedString *)createProgressAttribute {
|
||||
NSString * targetNum = [NSString stringWithFormat:@"%ld", self.giftInfo.targetNum];
|
||||
NSString * actualNum = [NSString stringWithFormat:@"%ld", self.giftInfo.actualNum];
|
||||
NSString * title = [NSString stringWithFormat:@"%@/%@", targetNum, actualNum];
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName:[UIColor whiteColor]}];
|
||||
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor appMainColor] range:[actualNum rangeOfString:title]];
|
||||
NSString * targetNum = [NSString stringWithFormat:@"/%ld", self.giftInfo.targetNum];
|
||||
NSString * actualNum = (self.giftInfo.actualNum > self.giftInfo.targetNum) ? [NSString stringWithFormat:@"%ld+", self.giftInfo.targetNum] : [NSString stringWithFormat:@"%ld", self.giftInfo.actualNum];
|
||||
NSString * title = [NSString stringWithFormat:@"%@%@", actualNum, targetNum];
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:10], NSForegroundColorAttributeName:[ThemeColor colorWithHexString:@"#FFA0C3"]}];
|
||||
if (self.giftInfo.targetNum == self.giftInfo.actualNum) {
|
||||
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#FFA0C3"] range:[targetNum rangeOfString:title]];
|
||||
} else {
|
||||
[attribute addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithWhite:1 alpha:0.5] range:[targetNum rangeOfString:title]];
|
||||
}
|
||||
return attribute;
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)senderButtonAction:(UIButton *)sender {
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPWishGiftInfoView:didClickSender:)]) {
|
||||
[self.delegate xPWishGiftInfoView:self didClickSender:self.giftInfo];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setGiftInfo:(WishGiftInfoModel *)giftInfo {
|
||||
_giftInfo = giftInfo;
|
||||
if (_giftInfo) {
|
||||
// self.giftImageView.imageUrl = giftInfo.
|
||||
self.giftImageView.imageUrl = giftInfo.giftUrl;
|
||||
self.giftLabel.text = _giftInfo.giftName;
|
||||
self.priceLabel.text = [NSString stringWithFormat:@"%ld钻石", _giftInfo.goldPrice];
|
||||
self.progressView.value = (CGFloat)giftInfo.actualNum / (CGFloat)_giftInfo.targetNum;
|
||||
self.priceLabel.attributedText = [self createProgressAttribute];
|
||||
self.completionImageView.hidden = _giftInfo.targetNum != _giftInfo.actualNum;
|
||||
}
|
||||
}
|
||||
|
||||
- (UIView *)bgView {
|
||||
- (UIImageView *)bgView {
|
||||
if (!_bgView) {
|
||||
_bgView = [[UIView alloc] init];
|
||||
_bgView.backgroundColor = [UIColor clearColor];
|
||||
_bgView.layer.masksToBounds = YES;
|
||||
_bgView.layer.cornerRadius = 10;
|
||||
_bgView = [[UIImageView alloc] init];
|
||||
_bgView.userInteractionEnabled = YES;
|
||||
_bgView.image = [UIImage imageNamed:@"room_wish_gift_panel_gift_bg"];
|
||||
}
|
||||
return _bgView;
|
||||
}
|
||||
|
||||
- (UIImageView *)completionImageView {
|
||||
if (!_completionImageView) {
|
||||
_completionImageView = [[UIImageView alloc] init];
|
||||
_completionImageView.userInteractionEnabled = YES;
|
||||
_completionImageView.image = [UIImage imageNamed:@"room_wish_gift_completion"];
|
||||
}
|
||||
return _completionImageView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)giftImageView {
|
||||
if (!_giftImageView) {
|
||||
@@ -158,7 +175,7 @@
|
||||
if (!_priceLabel) {
|
||||
_priceLabel = [[UILabel alloc] init];
|
||||
_priceLabel.font = [UIFont systemFontOfSize:12];
|
||||
_priceLabel.textColor = [ThemeColor secondTextColor];
|
||||
_priceLabel.textColor = [UIColor colorWithWhite:1 alpha:0.5];
|
||||
_priceLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _priceLabel;
|
||||
@@ -168,7 +185,9 @@
|
||||
if(!_progressView) {
|
||||
_progressView = [[UISlider alloc] init];
|
||||
_progressView.tintColor = [UIColor redColor];
|
||||
_progressView.thumbTintColor = [UIColor whiteColor];
|
||||
_progressView.enabled = NO;
|
||||
_progressView.minimumValueImage = [UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFA0C3"], [ThemeColor colorWithHexString:@"#C176FF"]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(1, 1)];
|
||||
_progressView.maximumValueImage = [UIImage imageWithColor:[ThemeColor colorWithHexString:@"#17093E"]];
|
||||
}
|
||||
return _progressView;
|
||||
}
|
||||
@@ -187,9 +206,9 @@
|
||||
[_senderButton setTitle:@"赠送" forState:UIControlStateNormal];
|
||||
[_senderButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
_senderButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_senderButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_senderButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor colorWithHexString:@"#FFA0C3"], [ThemeColor colorWithHexString:@"#C176FF"]] gradientType:GradientTypeUpleftToLowright imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
_senderButton.layer.masksToBounds = YES;
|
||||
_senderButton.layer.cornerRadius = 10;
|
||||
_senderButton.layer.cornerRadius = 11;
|
||||
[_senderButton addTarget:self action:@selector(senderButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _senderButton;
|
||||
|
@@ -8,9 +8,23 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class WishGiftInfoModel, XPWishGiftListView;
|
||||
|
||||
@interface XPWishGiftListView : UIView
|
||||
@protocol XPWishGiftListViewDelegate <NSObject>
|
||||
|
||||
///点击了某个item
|
||||
- (void)xPWishGiftListView:(XPWishGiftListView *)view didSelectItem:(WishGiftInfoModel *)info;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPWishGiftListView : UIView
|
||||
|
||||
///显示的数据源
|
||||
@property (nonatomic,strong) NSArray *datasource;
|
||||
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPWishGiftListViewDelegate> delegate;
|
||||
- (void)configDefaultInfo:(WishGiftInfoModel *)giftInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -12,19 +12,70 @@
|
||||
#import "ThemeColor.h"
|
||||
#import "Api+LittleGame.h"
|
||||
///Model
|
||||
#import "LittleGameInfoModel.h"
|
||||
#import "XPLittleGameTableViewCell.h"
|
||||
#import "WishGiftInfoModel.h"
|
||||
|
||||
@interface XPWishGiftListTableViewCell : UITableViewCell
|
||||
///显示内容
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
@end
|
||||
|
||||
@implementation XPWishGiftListTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.contentView).inset(13);
|
||||
make.centerY.mas_equalTo(self.contentView);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
_titleLabel.textColor = [ThemeColor secondTextColor];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface XPWishGiftListView ()<UITableViewDelegate, UITableViewDataSource>
|
||||
///容器
|
||||
@property (nonatomic,strong) UIStackView *stackView;
|
||||
///当前游戏的类型
|
||||
@property (nonatomic,strong) UIButton *gamePlayButton;
|
||||
///选中的背景
|
||||
@property (nonatomic,strong) UIView *leftView;
|
||||
///选中的背景
|
||||
@property (nonatomic,strong) UIView *rightView;
|
||||
///选中的时候容器
|
||||
@property (nonatomic,strong) UIStackView *selectStackView;
|
||||
///标题
|
||||
@property (nonatomic,strong) UILabel *titlelable;
|
||||
///箭头
|
||||
@property (nonatomic,strong) UIImageView *arrowImageView;
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///原始数据源
|
||||
@property (nonatomic,strong) NSArray *gameList;
|
||||
///显示的数据源
|
||||
@property (nonatomic,strong) NSArray *datasource;
|
||||
///s是否选择
|
||||
@property (nonatomic,assign) BOOL isSelect;
|
||||
@end
|
||||
|
||||
@implementation XPWishGiftListView
|
||||
@@ -39,35 +90,58 @@
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Public Method
|
||||
- (void)configDefaultInfo:(WishGiftInfoModel *)giftInfo {
|
||||
if (giftInfo.level) {
|
||||
self.titlelable.text = giftInfo.levelName;
|
||||
} else {
|
||||
self.titlelable.text = giftInfo.giftName;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.layer.cornerRadius = 12.5;
|
||||
self.layer.masksToBounds = YES;
|
||||
self.layer.borderWidth = 0.5;
|
||||
self.layer.borderColor = UIColorRGBAlpha(0xffffff, 0.6).CGColor;
|
||||
self.backgroundColor = UIColorRGBAlpha(0x000000, 0.2);
|
||||
self.layer.cornerRadius = 4;
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.gamePlayButton];
|
||||
[self.stackView addArrangedSubview:self.selectStackView];
|
||||
[self.stackView addArrangedSubview:self.tableView];
|
||||
|
||||
[self.selectStackView addArrangedSubview:self.leftView];
|
||||
[self.selectStackView addArrangedSubview:self.titlelable];
|
||||
[self.selectStackView addArrangedSubview:self.arrowImageView];
|
||||
[self.selectStackView addArrangedSubview:self.rightView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(80);
|
||||
make.bottom.mas_equalTo(self.stackView.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self);
|
||||
make.left.right.mas_equalTo(self);
|
||||
make.top.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.gamePlayButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(25);
|
||||
[self.selectStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(25);
|
||||
make.height.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
[self.arrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(22, 22));
|
||||
}];
|
||||
|
||||
[self.leftView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(13);
|
||||
}];
|
||||
|
||||
[self.rightView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(13);
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -78,37 +152,56 @@
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
XPLittleGameTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])];
|
||||
XPWishGiftListTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPWishGiftListTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPLittleGameTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])];
|
||||
cell = [[XPWishGiftListTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPWishGiftListTableViewCell class])];
|
||||
}
|
||||
if (self.datasource.count > 0 ) {
|
||||
WishGiftInfoModel * giftInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
if (giftInfo.level > 0) {
|
||||
cell.titleLabel.text = giftInfo.levelName;
|
||||
} else {
|
||||
cell.titleLabel.text = giftInfo.giftName;
|
||||
}
|
||||
}
|
||||
cell.info = [self.datasource objectAtIndex:indexPath.row];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
return 25;
|
||||
return 36;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
self.tableView.hidden = YES;
|
||||
self.gamePlayButton.selected = NO;
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPWishGiftListView:didSelectItem:)]) {
|
||||
WishGiftInfoModel * giftInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
[self configDefaultInfo:giftInfo];
|
||||
[self.delegate xPWishGiftListView:self didSelectItem:giftInfo];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)gamePlayButtonAction:(UIButton *)sender {
|
||||
|
||||
self.isSelect = !self.isSelect;
|
||||
self.tableView.hidden = !self.isSelect;
|
||||
if (!self.tableView.hidden) {
|
||||
if (_datasource.count > 0 && _datasource.count < 4) {
|
||||
[self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(36 * self.datasource.count);
|
||||
}];
|
||||
} else {
|
||||
[self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(36 * 3);
|
||||
}];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
||||
- (void)setDatasource:(NSArray *)datasource {
|
||||
_datasource = datasource;
|
||||
[self.tableView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(25 * self.datasource.count);
|
||||
}];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
@@ -123,6 +216,22 @@
|
||||
return _stackView;
|
||||
}
|
||||
|
||||
- (UIView *)leftView {
|
||||
if (!_leftView) {
|
||||
_leftView = [[UIView alloc] init];
|
||||
_leftView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _leftView;
|
||||
}
|
||||
|
||||
- (UIView *)rightView {
|
||||
if (!_rightView) {
|
||||
_rightView = [[UIView alloc] init];
|
||||
_rightView.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
return _rightView;
|
||||
}
|
||||
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
||||
@@ -130,30 +239,46 @@
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
_tableView.backgroundColor = [ThemeColor colorWithHexString:@"#F4F4F4"];
|
||||
_tableView.hidden = YES;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPLittleGameTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])];
|
||||
[_tableView registerClass:[XPWishGiftListTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPWishGiftListTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
- (UIButton *)gamePlayButton {
|
||||
if (!_gamePlayButton) {
|
||||
_gamePlayButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_gamePlayButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_gamePlayButton setImage:[UIImage imageNamed:@"room_info_little_game_down_arrow"] forState:UIControlStateNormal];
|
||||
[_gamePlayButton setImage:[UIImage imageNamed:@"room_info_little_game_up_arrow"] forState:UIControlStateSelected];
|
||||
_gamePlayButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_gamePlayButton setTitle:@"扩列交友" forState:UIControlStateNormal];
|
||||
_gamePlayButton.selected = NO;
|
||||
[_gamePlayButton addTarget:self action:@selector(gamePlayButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_gamePlayButton.semanticContentAttribute = UISemanticContentAttributeForceRightToLeft;
|
||||
_gamePlayButton.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
|
||||
|
||||
- (UIStackView *)selectStackView {
|
||||
if (!_selectStackView) {
|
||||
_selectStackView = [[UIStackView alloc] init];
|
||||
_selectStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_selectStackView.distribution = UIStackViewDistributionFillProportionally;
|
||||
_selectStackView.alignment = UIStackViewAlignmentCenter;
|
||||
_selectStackView.backgroundColor = [ThemeColor colorWithHexString:@"#E4E4E4"];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gamePlayButtonAction:)];
|
||||
[_selectStackView addGestureRecognizer:tap];
|
||||
}
|
||||
return _gamePlayButton;
|
||||
return _selectStackView;
|
||||
}
|
||||
|
||||
- (UIImageView *)arrowImageView {
|
||||
if (!_arrowImageView) {
|
||||
_arrowImageView = [[UIImageView alloc] init];
|
||||
_arrowImageView.userInteractionEnabled = YES;
|
||||
_arrowImageView.image = [UIImage imageNamed:@"room_wish_create_arrow"];
|
||||
}
|
||||
return _arrowImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titlelable {
|
||||
if (!_titlelable) {
|
||||
_titlelable = [[UILabel alloc] init];
|
||||
_titlelable.font = [UIFont systemFontOfSize:14];
|
||||
_titlelable.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _titlelable;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPWishGiftSectionView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/19.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPWishGiftSectionView : UIView
|
||||
@property (nonatomic,copy) NSString *title;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,55 @@
|
||||
//
|
||||
// XPWishGiftSectionView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/19.
|
||||
//
|
||||
|
||||
#import "XPWishGiftSectionView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
|
||||
@interface XPWishGiftSectionView ()
|
||||
///标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
@end
|
||||
|
||||
@implementation XPWishGiftSectionView
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.titleLabel];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self).offset(24);
|
||||
make.centerY.mas_equalTo(self);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)setTitle:(NSString *)title {
|
||||
_title = title;
|
||||
self.titleLabel.text = _title;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_titleLabel.textColor = [ThemeColor mainTextColor];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// XPWishGIftViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/18.
|
||||
//
|
||||
|
||||
#import "XPWishGIftViewController.h"
|
||||
|
||||
@interface XPWishGIftViewController ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPWishGIftViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
}
|
||||
|
||||
@end
|
@@ -10,7 +10,11 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPWishGiftCreateItemViewController : MvpViewController
|
||||
///房主的uid
|
||||
@property (nonatomic,strong) NSString *roomUid;
|
||||
|
||||
///创建完成
|
||||
@property (nonatomic,copy) void(^Dismiss)(BOOL finish);
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -6,17 +6,425 @@
|
||||
//
|
||||
|
||||
#import "XPWishGiftCreateItemViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
///View
|
||||
#import "XPWishGiftListView.h"
|
||||
#import "WishGiftInfoModel.h"
|
||||
///P
|
||||
#import "XPWishGiftPresenter.h"
|
||||
#import "XPWishGiftProtocol.h"
|
||||
|
||||
@interface XPWishGiftCreateItemViewController ()
|
||||
///
|
||||
@interface XPWishGiftCreateItemViewController ()<XPWishGiftProtocol, XPWishGiftListViewDelegate>
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView *topView;
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView * bottomView;
|
||||
///背景
|
||||
@property (nonatomic,strong) UIView *backView;
|
||||
|
||||
///等级
|
||||
@property (nonatomic,strong) XPWishGiftListView *levelView;
|
||||
///礼物
|
||||
@property (nonatomic,strong) XPWishGiftListView *giftView;
|
||||
///数量
|
||||
@property (nonatomic,strong) UIStackView *numberStackView;
|
||||
///减
|
||||
@property (nonatomic,strong) UIButton *subtractButton;
|
||||
///输入框
|
||||
@property (nonatomic,strong) UITextField *textField;
|
||||
///添加
|
||||
@property (nonatomic,strong) UIButton *addButton;
|
||||
///关闭按钮
|
||||
@property (nonatomic,strong) UIButton *sureButton;
|
||||
///个数
|
||||
@property (nonatomic,assign) int number;
|
||||
///礼物等级
|
||||
@property (nonatomic,strong) NSArray *levelLists;
|
||||
///礼物等级
|
||||
@property (nonatomic,strong) WishGiftInfoModel *levleInfo;
|
||||
///礼物信息
|
||||
@property (nonatomic,strong) WishGiftInfoModel *giftInfo;
|
||||
///初级礼物
|
||||
@property (nonatomic,strong) NSArray *levelOneGiftList;
|
||||
///中级礼物
|
||||
@property (nonatomic,strong) NSArray *levelTwoGiftList;
|
||||
///高级礼物
|
||||
@property (nonatomic,strong) NSArray *levelThirdGiftList;
|
||||
@end
|
||||
|
||||
@implementation XPWishGiftCreateItemViewController
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPWishGiftPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.view.backgroundColor = UIColorRGBAlpha(0x000000, 0.5);
|
||||
[self initWishGiftCongifList];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initWishGiftCongifList {
|
||||
self.number = 1;
|
||||
self.levleInfo = self.levelLists.firstObject;
|
||||
[self handleLevleDatasource:self.levleInfo.level];
|
||||
[self.levelView configDefaultInfo:self.levleInfo];
|
||||
[self.presenter wishGiftConfigList:self.roomUid level:@"1"];
|
||||
[self.presenter wishGiftConfigList:self.roomUid level:@"2"];
|
||||
[self.presenter wishGiftConfigList:self.roomUid level:@"3"];
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.topView];
|
||||
[self.view addSubview:self.backView];
|
||||
[self.view addSubview:self.bottomView];
|
||||
|
||||
[self.backView addSubview:self.sureButton];
|
||||
[self.backView addSubview:self.numberStackView];
|
||||
[self.backView addSubview:self.giftView];
|
||||
[self.backView addSubview:self.levelView];
|
||||
|
||||
[self.numberStackView addArrangedSubview:self.subtractButton];
|
||||
[self.numberStackView addArrangedSubview:self.textField];
|
||||
[self.numberStackView addArrangedSubview:self.addButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.top.left.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.backView.mas_top);
|
||||
}];
|
||||
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.view).inset(38);
|
||||
make.height.mas_equalTo(245);
|
||||
make.centerY.mas_equalTo(self.view);
|
||||
}];
|
||||
|
||||
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
make.top.mas_equalTo(self.backView.mas_bottom);
|
||||
}];
|
||||
|
||||
[self.levelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView).inset(30);
|
||||
make.top.mas_equalTo(self.backView).offset(36);
|
||||
}];
|
||||
|
||||
|
||||
[self.giftView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backView).inset(30);
|
||||
make.top.mas_equalTo(self.backView).offset(84);
|
||||
}];
|
||||
|
||||
[self.numberStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.levelView);
|
||||
make.height.mas_equalTo(36);
|
||||
make.bottom.mas_equalTo(self.sureButton.mas_top).offset(-20);
|
||||
}];
|
||||
|
||||
[self.subtractButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
[self.addButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(36);
|
||||
}];
|
||||
|
||||
[self.sureButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(129, 37));
|
||||
make.centerX.mas_equalTo(self.backView);
|
||||
make.bottom.mas_equalTo(self.backView.mas_bottom).offset(-20);
|
||||
}];
|
||||
}
|
||||
|
||||
- (int)addMaxCount {
|
||||
if ([self.levleInfo.levelName isEqualToString:@"普通礼物"]) {
|
||||
return 999;
|
||||
} else if ([self.levleInfo.levelName isEqualToString:@"中级礼物"]) {
|
||||
return 99;
|
||||
} else {
|
||||
return 30;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canAddMaxCount:(int)count {
|
||||
if ([self.levleInfo.levelName isEqualToString:@"普通礼物"]) {
|
||||
return count < 999;
|
||||
} else if ([self.levleInfo.levelName isEqualToString:@"中级礼物"]) {
|
||||
return count < 99;
|
||||
} else {
|
||||
return count < 1;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)canSubtractMinCount:(int)count {
|
||||
if ([self.levleInfo.levelName isEqualToString:@"普通礼物"]) {
|
||||
return count > 10;
|
||||
} else if ([self.levleInfo.levelName isEqualToString:@"中级礼物"]) {
|
||||
return count > 10;
|
||||
} else {
|
||||
return count > 1;
|
||||
}
|
||||
}
|
||||
|
||||
- (int)subtractMinCount {
|
||||
if ([self.levleInfo.levelName isEqualToString:@"普通礼物"]) {
|
||||
return 10;
|
||||
} else if ([self.levleInfo.levelName isEqualToString:@"中级礼物"]) {
|
||||
return 10;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handleLevleDatasource:(WishGiftLevel)levele {
|
||||
NSMutableArray * array = [self.levelLists mutableCopy];
|
||||
for (int i = 0;i < self.levelLists.count;i++) {
|
||||
WishGiftInfoModel * infor = [self.levelLists objectAtIndex:i];
|
||||
if (infor.level == levele) {
|
||||
[array removeObject:infor];
|
||||
}
|
||||
}
|
||||
self.levelView.datasource = array.copy;
|
||||
}
|
||||
|
||||
- (void)handleGiftDatasource:(NSArray *)levels giftId:(NSInteger)giftId {
|
||||
NSMutableArray * array = [levels mutableCopy];
|
||||
for (int i = 0;i < levels.count;i++) {
|
||||
WishGiftInfoModel * infor = [levels objectAtIndex:i];
|
||||
if (infor.giftId == giftId) {
|
||||
[array removeObject:infor];
|
||||
}
|
||||
}
|
||||
self.giftView.datasource = array.copy;
|
||||
}
|
||||
|
||||
#pragma mark - XPWishGiftListViewDelegate
|
||||
- (void)xPWishGiftListView:(XPWishGiftListView *)view didSelectItem:(WishGiftInfoModel *)info {
|
||||
if (view == self.levelView) {
|
||||
self.levleInfo = info;
|
||||
///处理等级
|
||||
[self handleLevleDatasource:info.level];
|
||||
WishGiftInfoModel * info;
|
||||
if (info.level == WishGiftLevel_Normal) {
|
||||
///处理等级对应的礼物
|
||||
if (self.levelOneGiftList.count > 0) {
|
||||
info = self.levelOneGiftList.firstObject;
|
||||
}
|
||||
self.giftView.datasource = self.levelOneGiftList;
|
||||
self.textField.text = @"10";
|
||||
} else if (info.level == WishGiftLevel_Middle) {
|
||||
if (self.levelTwoGiftList.count > 0) {
|
||||
info = self.levelTwoGiftList.firstObject;
|
||||
}
|
||||
self.giftView.datasource = self.levelTwoGiftList;
|
||||
self.textField.text = @"10";
|
||||
} else {
|
||||
if (self.levelThirdGiftList.count > 0) {
|
||||
info = self.levelThirdGiftList.firstObject;
|
||||
}
|
||||
self.giftView.datasource = self.levelThirdGiftList;
|
||||
self.textField.text = @"1";
|
||||
}
|
||||
self.number = self.textField.text.intValue;
|
||||
[self.giftView configDefaultInfo:info];
|
||||
[self handleLevleDatasource:info.level];
|
||||
} else {
|
||||
self.giftInfo = info;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPWishGiftProtocol
|
||||
- (void)wishGiftConfigListSucces:(NSArray *)list level:(NSString *)level {
|
||||
if (level.intValue == 1) {
|
||||
self.levelOneGiftList = list;
|
||||
if (list.count > 0) {
|
||||
self.giftInfo = list.firstObject;
|
||||
[self.giftView configDefaultInfo:list.firstObject];
|
||||
self.giftView.datasource = self.levelOneGiftList;
|
||||
}
|
||||
} else if (level.intValue == 2) {
|
||||
self.levelTwoGiftList = list;
|
||||
} else {
|
||||
self.levelThirdGiftList = list;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createWishGiftItemSuccess {
|
||||
[self disMissView];
|
||||
if(self.Dismiss) {
|
||||
self.Dismiss(YES);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)subtractButtonAction:(UIButton *)sener {
|
||||
if([self canSubtractMinCount:self.number]) {
|
||||
self.number --;
|
||||
} else {
|
||||
self.number = [self subtractMinCount];
|
||||
}
|
||||
self.textField.text = [NSString stringWithFormat:@"%d", self.number];
|
||||
}
|
||||
|
||||
- (void)addButtonAction:(UIButton *)sener {
|
||||
if([self canAddMaxCount:self.number]) {
|
||||
self.number ++;
|
||||
} else {
|
||||
self.number = [self addMaxCount];
|
||||
}
|
||||
self.textField.text = [NSString stringWithFormat:@"%d", self.number];
|
||||
}
|
||||
|
||||
- (void)textFieldDidChanged:(UITextField *)textField {
|
||||
int number = textField.text.intValue;
|
||||
if (![self canAddMaxCount:number]) {
|
||||
textField.text = [NSString stringWithFormat:@"%d", [self addMaxCount]];
|
||||
}
|
||||
|
||||
if (![self canSubtractMinCount:number]) {
|
||||
textField.text = [NSString stringWithFormat:@"%d", [self subtractMinCount]];
|
||||
}
|
||||
self.number = textField.text.intValue;
|
||||
}
|
||||
|
||||
- (void)disMissView {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
#pragma mark - Event Response
|
||||
- (void)sureButtonAction:(UIButton *)sender {
|
||||
[self.presenter createWishGiftItem:self.roomUid itemId:@"" giftId:[NSString stringWithFormat:@"%ld", self.giftInfo.giftId] seq:self.levleInfo.level targetNum:self.number];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)topView {
|
||||
if (!_topView) {
|
||||
_topView = [[UIView alloc] init];
|
||||
_topView.backgroundColor = [UIColor clearColor];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissView)];
|
||||
[_topView addGestureRecognizer:tap];
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
|
||||
- (UIView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIView alloc] init];
|
||||
_backView.layer.masksToBounds = YES;
|
||||
_backView.layer.cornerRadius = 20;
|
||||
_backView.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
- (XPWishGiftListView *)levelView {
|
||||
if(!_levelView) {
|
||||
_levelView = [[XPWishGiftListView alloc] init];
|
||||
_levelView.delegate = self;
|
||||
}
|
||||
return _levelView;
|
||||
}
|
||||
|
||||
- (XPWishGiftListView *)giftView {
|
||||
if(!_giftView) {
|
||||
_giftView = [[XPWishGiftListView alloc] init];
|
||||
_giftView.delegate = self;
|
||||
}
|
||||
return _giftView;
|
||||
}
|
||||
|
||||
- (UIButton *)subtractButton {
|
||||
if (!_subtractButton) {
|
||||
_subtractButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_subtractButton setImage:[UIImage imageNamed:@"room_wish_gift_subtract"] forState:UIControlStateNormal];
|
||||
[_subtractButton setImage:[UIImage imageNamed:@"room_wish_gift_subtract"] forState:UIControlStateSelected];
|
||||
[_subtractButton addTarget:self action:@selector(subtractButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _subtractButton;
|
||||
}
|
||||
|
||||
|
||||
- (UIButton *)addButton {
|
||||
if (!_addButton) {
|
||||
_addButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_addButton setImage:[UIImage imageNamed:@"room_wish_gift_add"] forState:UIControlStateNormal];
|
||||
[_addButton setImage:[UIImage imageNamed:@"room_wish_gift_add"] forState:UIControlStateSelected];
|
||||
[_addButton addTarget:self action:@selector(addButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _addButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)numberStackView {
|
||||
if (!_numberStackView) {
|
||||
_numberStackView = [[UIStackView alloc] init];
|
||||
_numberStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_numberStackView.distribution = UIStackViewDistributionFill;
|
||||
_numberStackView.alignment = UIStackViewAlignmentFill;
|
||||
_numberStackView.spacing = 10;
|
||||
}
|
||||
return _numberStackView;
|
||||
}
|
||||
|
||||
- (UITextField *)textField {
|
||||
if (!_textField) {
|
||||
_textField = [[UITextField alloc] init];
|
||||
_textField.layer.cornerRadius = 4;
|
||||
_textField.layer.masksToBounds = YES;
|
||||
_textField.tintColor = [ThemeColor secondTextColor];
|
||||
_textField.textColor = [ThemeColor mainTextColor];
|
||||
_textField.backgroundColor = [UIColor clearColor];
|
||||
_textField.font = [UIFont systemFontOfSize:10];
|
||||
_textField.clearButtonMode = UITextFieldViewModeWhileEditing;
|
||||
_textField.returnKeyType = UIReturnKeySearch;
|
||||
_textField.enablesReturnKeyAutomatically = YES;
|
||||
_textField.text = @"10";
|
||||
_textField.textAlignment = NSTextAlignmentCenter;
|
||||
_textField.backgroundColor = [ThemeColor colorWithHexString:@"#E4E4E4"];
|
||||
[_textField addTarget:self action:@selector(textFieldDidChanged:) forControlEvents:UIControlEventEditingChanged];
|
||||
}
|
||||
return _textField;
|
||||
}
|
||||
|
||||
- (UIButton *)sureButton {
|
||||
if (!_sureButton) {
|
||||
_sureButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_sureButton setTitle:@"确定" forState:UIControlStateNormal];
|
||||
[_sureButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
|
||||
_sureButton.titleLabel.font = [UIFont systemFontOfSize:14];
|
||||
[_sureButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
_sureButton.layer.masksToBounds = YES;
|
||||
_sureButton.layer.cornerRadius = 10;
|
||||
[_sureButton addTarget:self action:@selector(sureButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _sureButton;
|
||||
}
|
||||
|
||||
- (NSArray *)levelLists {
|
||||
if (!_levelLists) {
|
||||
WishGiftInfoModel * levelOne = [[WishGiftInfoModel alloc] init];
|
||||
levelOne.levelName = @"普通礼物";
|
||||
levelOne.level = WishGiftLevel_Normal;
|
||||
|
||||
WishGiftInfoModel * levelTwo = [[WishGiftInfoModel alloc] init];
|
||||
levelTwo.levelName = @"中级礼物";
|
||||
levelTwo.level = WishGiftLevel_Middle;
|
||||
|
||||
WishGiftInfoModel * levelThree = [[WishGiftInfoModel alloc] init];
|
||||
levelThree.levelName = @"高级礼物";
|
||||
levelThree.level = WishGiftLevel_High;
|
||||
_levelLists = @[levelOne, levelTwo, levelThree];
|
||||
}
|
||||
return _levelLists;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -11,15 +11,18 @@
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "TTPopup.h"
|
||||
#import "XPMacro.h"
|
||||
///Model
|
||||
#import "WishGiftInfoModel.h"
|
||||
///View
|
||||
#import "XPWishGiftTableViewCell.h"
|
||||
#import "XPWishGiftHistoryViewController.h"
|
||||
#import "XPWishGiftCreateItemViewController.h"
|
||||
///P
|
||||
#import "XPWishGiftPresenter.h"
|
||||
#import "XPWishGiftProtocol.h"
|
||||
@interface XPWishGiftCreateViewController ()<UITableViewDelegate, UITableViewDataSource, XPWishGiftProtocol>
|
||||
@interface XPWishGiftCreateViewController ()<UITableViewDelegate, UITableViewDataSource, XPWishGiftProtocol, XPWishGiftTableViewCellDelegate>
|
||||
///设置心愿
|
||||
@property (nonatomic,strong) UILabel *configLabel;
|
||||
///清除心愿
|
||||
@@ -45,6 +48,7 @@
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid {
|
||||
if (self = [super init]) {
|
||||
self.roomUid = roomUid;
|
||||
[self initWishGiftList];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -53,7 +57,6 @@
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self initWishGiftList];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
@@ -115,15 +118,38 @@
|
||||
WishGiftInfoModel *giftInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
giftInfo.row = indexPath.row;
|
||||
cell.giftInfo = giftInfo;
|
||||
cell.delegate = self;
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - XPWishGiftTableViewCellDelegate
|
||||
- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didClearWishGift:(WishGiftInfoModel *)info {
|
||||
if (info) {
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"";
|
||||
config.message = @"确认删除该条数据?";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self.presenter deleteWishGiftItem:self.roomUid itemId:[NSString stringWithFormat:@"%ld", info.itemId]];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didUpdateWishGift:(WishGiftInfoModel *)info {
|
||||
//TODO: 修改心愿单
|
||||
}
|
||||
|
||||
#pragma mark - XPWishGiftProtocol
|
||||
- (void)getWishGiftListSuccess:(NSArray *)list {
|
||||
self.datasource = list;
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)deleteWishGiftItemSuccess {
|
||||
[self initWishGiftList];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)rightButtonAction:(UIButton *)sender {
|
||||
XPWishGiftHistoryViewController * historyVC = [[XPWishGiftHistoryViewController alloc] init];
|
||||
@@ -131,15 +157,37 @@
|
||||
}
|
||||
|
||||
- (void)clearButtonAction:(UIButton *)sender {
|
||||
//TODO: 清空
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"";
|
||||
config.message = @"确认清空当前数据?";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self.presenter deleteWishGiftItem:self.roomUid itemId:@"-1"];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)addWishButtonAction:(UIButton *)sender {
|
||||
//TODO: 添加心愿
|
||||
XPWishGiftCreateItemViewController * createItemVC = [[XPWishGiftCreateItemViewController alloc] init];
|
||||
createItemVC.roomUid = self.roomUid;
|
||||
@kWeakify(self);
|
||||
createItemVC.Dismiss = ^(BOOL finish) {
|
||||
@kStrongify(self);
|
||||
[self initWishGiftList];
|
||||
};
|
||||
createItemVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
[self.navigationController presentViewController:createItemVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)createButtonAction:(UIButton *)sender {
|
||||
//TODO: 创建心愿
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.title = @"";
|
||||
config.message = @"确认创建当前心愿? \n创建后当日不可在编辑或删除";
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
[self.presenter addWishGift:self.roomUid];
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
|
@@ -10,7 +10,7 @@
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPWishGiftHistoryViewController : MvpViewController
|
||||
|
||||
@property (nonatomic,strong) NSString *roomUid;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -6,26 +6,140 @@
|
||||
//
|
||||
|
||||
#import "XPWishGiftHistoryViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XPMacro.h"
|
||||
///View
|
||||
#import "XPWishGiftHistoryTableViewCell.h"
|
||||
#import "XPWishGiftEmptyTableViewCell.h"
|
||||
#import "XPWishGiftSectionView.h"
|
||||
///P
|
||||
#import "XPWishGiftPresenter.h"
|
||||
#import "XPWishGiftProtocol.h"
|
||||
|
||||
@interface XPWishGiftHistoryViewController ()
|
||||
|
||||
@interface XPWishGiftHistoryViewController ()<UITableViewDelegate, UITableViewDataSource, XPWishGiftProtocol>
|
||||
///列表
|
||||
@property (nonatomic,strong) UITableView *tableView;
|
||||
///数据源
|
||||
@property (nonatomic,strong) NSMutableArray<NSArray<WishGiftInfoModel *> *> *datasource;
|
||||
@end
|
||||
|
||||
@implementation XPWishGiftHistoryViewController
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPWishGiftPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
- (void)initSubViews {
|
||||
[self.view addSubview:self.tableView];
|
||||
}
|
||||
*/
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.equalTo(self.view);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)initWishGiftHistoryList {
|
||||
[self.presenter wishGiftHistroyList:self.roomUid];
|
||||
}
|
||||
|
||||
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
return 44;
|
||||
}
|
||||
return (KScreenHeight - kNavigationHeight);
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
if (self.datasource.count > 0) {
|
||||
NSArray * array = [self.datasource objectAtIndex:section];
|
||||
return array.count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPWishGiftHistoryTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPWishGiftHistoryTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPWishGiftHistoryTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPWishGiftHistoryTableViewCell class])];
|
||||
}
|
||||
NSArray * array = [self.datasource objectAtIndex:indexPath.section];
|
||||
WishGiftInfoModel * info= [array objectAtIndex:indexPath.row];
|
||||
cell.giftInfo = info;
|
||||
if (indexPath.row == 0) {
|
||||
cell.isTop = YES;
|
||||
} else {
|
||||
cell.isTop = NO;
|
||||
}
|
||||
|
||||
if (indexPath.row == array.count -1) {
|
||||
cell.isBottom = YES;
|
||||
} else {
|
||||
cell.isBottom = false;
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
XPWishGiftEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPWishGiftEmptyTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPWishGiftEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPWishGiftEmptyTableViewCell class])];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
|
||||
return 0.01;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
|
||||
return [[UIView alloc] init];;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? 45 : 0.01;
|
||||
}
|
||||
|
||||
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
|
||||
XPWishGiftSectionView * view = [[XPWishGiftSectionView alloc] init];
|
||||
view.frame = CGRectMake(0, 0, KScreenWidth, 45);
|
||||
return view;
|
||||
}
|
||||
|
||||
#pragma mark - XPWishGiftProtocol
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
_tableView.tableFooterView = [UIView new];
|
||||
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
_tableView.backgroundColor = [UIColor clearColor];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPWishGiftHistoryTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPWishGiftHistoryTableViewCell class])];
|
||||
[self.tableView registerClass:[XPWishGiftEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPWishGiftEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
@@ -9,9 +9,9 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPWishGIftViewController : MvpViewController
|
||||
|
||||
@interface XPWishGiftViewController : MvpViewController
|
||||
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid;
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,330 @@
|
||||
//
|
||||
// XPWishGIftViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2022/10/18.
|
||||
//
|
||||
|
||||
#import "XPWishGiftViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "NetImageView.h"
|
||||
///View
|
||||
#import "XPWishGiftInfoView.h"
|
||||
///Model
|
||||
#import "WishGiftInfoModel.h"
|
||||
#import "WishGiftUserModel.h"
|
||||
///P
|
||||
#import "XPWishGiftPresenter.h"
|
||||
#import "XPWishGiftProtocol.h"
|
||||
@interface XPWishGiftViewController ()<XPWishGiftProtocol>
|
||||
///顶部的view
|
||||
@property (nonatomic,strong) UIView *topView;
|
||||
///背景
|
||||
@property (nonatomic,strong) UIImageView *backImageView;
|
||||
///显示标题
|
||||
@property (nonatomic,strong) UILabel *titleLabel;
|
||||
///提示
|
||||
@property (nonatomic,strong) UILabel *tipsLbel;
|
||||
///分割线
|
||||
@property (nonatomic,strong) UIView *lineView;
|
||||
///头像的容器
|
||||
@property (nonatomic,strong) UIStackView *userStackView;
|
||||
///第一个头像
|
||||
@property (nonatomic,strong) NetImageView *firstAvatarImageView;
|
||||
///第二个头像
|
||||
@property (nonatomic,strong) NetImageView *secondAvatarImageView;
|
||||
///第三个头像
|
||||
@property (nonatomic,strong) NetImageView *thirdAvatarImageView;
|
||||
///贡献的人数
|
||||
@property (nonatomic,strong) UILabel *assistNumLabel;
|
||||
///礼物
|
||||
@property (nonatomic,strong) UIStackView *giftStackView;
|
||||
///第一个
|
||||
@property (nonatomic,strong) XPWishGiftInfoView *firstView;
|
||||
///第二个
|
||||
@property (nonatomic,strong) XPWishGiftInfoView *secondView;
|
||||
///第三个
|
||||
@property (nonatomic,strong) XPWishGiftInfoView *thirdView;
|
||||
///礼物数组
|
||||
@property (nonatomic,strong) NSArray *giftViews;
|
||||
///房主的uid
|
||||
@property (nonatomic,strong) NSString *roomUid;
|
||||
@end
|
||||
|
||||
@implementation XPWishGiftViewController
|
||||
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid {
|
||||
if (self = [super init]) {
|
||||
[self initDefaultData];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (__kindof id)createPresenter {
|
||||
return [[XPWishGiftPresenter alloc] init];
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
}
|
||||
|
||||
- (void)initDefaultData {
|
||||
[self.presenter wishGiftAssistUserList:self.roomUid];
|
||||
[self.presenter wishGiftList:self.roomUid];
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.topView];
|
||||
[self.view addSubview:self.backImageView];
|
||||
[self.backImageView addSubview:self.titleLabel];
|
||||
[self.backImageView addSubview:self.tipsLbel];
|
||||
[self.backImageView addSubview:self.lineView];
|
||||
[self.backImageView addSubview:self.userStackView];
|
||||
[self.backImageView addSubview:self.assistNumLabel];
|
||||
[self.backImageView addSubview:self.giftStackView];
|
||||
|
||||
[self.userStackView addArrangedSubview:self.firstView];
|
||||
[self.userStackView addArrangedSubview:self.secondView];
|
||||
[self.userStackView addArrangedSubview:self.thirdView];
|
||||
|
||||
[self.giftStackView addArrangedSubview:self.firstView];
|
||||
[self.giftStackView addArrangedSubview:self.secondView];
|
||||
[self.giftStackView addArrangedSubview:self.thirdView];
|
||||
self.giftViews = @[self.firstView, self.secondView, self.thirdView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.right.equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.backImageView.mas_top);
|
||||
}];
|
||||
|
||||
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(320);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.backImageView);
|
||||
make.top.mas_equalTo(self.backImageView).offset(16);
|
||||
}];
|
||||
|
||||
[self.tipsLbel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.backImageView);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(8);
|
||||
}];
|
||||
|
||||
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.mas_equalTo(self.backImageView);
|
||||
make.top.mas_equalTo(self.tipsLbel.mas_bottom).offset(12);
|
||||
make.height.mas_equalTo(0.5);
|
||||
}];
|
||||
|
||||
[self.userStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(28);
|
||||
make.left.mas_equalTo(self.backImageView).offset(16);
|
||||
make.top.mas_equalTo(self.lineView.mas_bottom).offset(10);
|
||||
}];
|
||||
|
||||
[self.assistNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.backImageView).offset(-15);
|
||||
make.centerY.mas_equalTo(self.userStackView);
|
||||
}];
|
||||
|
||||
[self.giftStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.backImageView);
|
||||
make.height.mas_equalTo(165);
|
||||
make.bottom.mas_equalTo(self.backImageView).offset(-46);
|
||||
}];
|
||||
|
||||
[self.firstView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(106);
|
||||
}];
|
||||
|
||||
[self.secondView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(106);
|
||||
}];
|
||||
|
||||
[self.secondView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(106);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - XPWishGiftProtocol
|
||||
- (void)getWishGiftAssistUserListSuccess:(NSArray *)list {
|
||||
for (int i = 0; i < self.userStackView.subviews.count; i++) {
|
||||
NetImageView * imageView = [self.userStackView.subviews objectAtIndex:i];
|
||||
if (i < list.count) {
|
||||
WishGiftUserModel * userInfo = [list objectAtIndex:i];
|
||||
imageView.hidden = NO;
|
||||
imageView.imageUrl = userInfo.avatar;
|
||||
}else {
|
||||
imageView.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
NSString * number = [NSString stringWithFormat:@"%ld", list.count];
|
||||
NSString * title = [NSString stringWithFormat:@"%@%@", number, @"人已助力"];
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12], NSForegroundColorAttributeName:[ThemeColor textThirdColor]}];
|
||||
[attribute addAttribute:NSForegroundColorAttributeName value:[ThemeColor colorWithHexString:@"#FFC300"] range:[number rangeOfString:title]];
|
||||
self.assistNumLabel.attributedText = attribute;
|
||||
}
|
||||
|
||||
- (void)getWishGiftListSuccess:(NSArray *)list {
|
||||
int finishNumber = 0;
|
||||
for (WishGiftInfoModel * info in list) {
|
||||
if (info.actualNum == info.targetNum) {
|
||||
finishNumber ++;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < self.giftViews.count; i++) {
|
||||
XPWishGiftInfoView * view = [self.giftViews objectAtIndex:i];
|
||||
if(i < list.count) {
|
||||
WishGiftInfoModel * info = [list objectAtIndex:i];
|
||||
view.giftInfo = info;
|
||||
view.hidden = NO;
|
||||
} else {
|
||||
view.hidden = YES;
|
||||
}
|
||||
}
|
||||
|
||||
self.titleLabel.text = [NSString stringWithFormat:@"%d/%ld",finishNumber,list.count];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)disMissView {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIView *)topView {
|
||||
if (!_topView) {
|
||||
_topView = [[UIView alloc] init];
|
||||
_topView.backgroundColor = [UIColor clearColor];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissView)];
|
||||
[_topView addGestureRecognizer:tap];
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
|
||||
- (UIImageView *)backImageView {
|
||||
if (!_backImageView) {
|
||||
_backImageView = [[UIImageView alloc] init];
|
||||
_backImageView.userInteractionEnabled = YES;
|
||||
_backImageView.image = [UIImage imageNamed:@"room_wish_gift_panel_bg"];
|
||||
}
|
||||
return _backImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_titleLabel.textColor = [UIColor whiteColor];
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)tipsLbel {
|
||||
if (!_tipsLbel) {
|
||||
_tipsLbel = [[UILabel alloc] init];
|
||||
_tipsLbel.font = [UIFont systemFontOfSize:10];
|
||||
_tipsLbel.text = @"-当日设置的心愿,会在次日0点失效-";
|
||||
_tipsLbel.textColor = [ThemeColor textThirdColor];
|
||||
}
|
||||
return _tipsLbel;
|
||||
}
|
||||
|
||||
- (UIView *)lineView {
|
||||
if (!_lineView) {
|
||||
_lineView = [[UIView alloc] init];
|
||||
_lineView.backgroundColor = [UIColor colorWithWhite:1 alpha:0.1];
|
||||
}
|
||||
return _lineView;
|
||||
}
|
||||
|
||||
- (UIStackView *)userStackView {
|
||||
if (!_userStackView) {
|
||||
_userStackView = [[UIStackView alloc] init];
|
||||
_userStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_userStackView.distribution = UIStackViewDistributionFill;
|
||||
_userStackView.alignment = UIStackViewAlignmentFill;
|
||||
_userStackView.spacing = 4;
|
||||
}
|
||||
return _userStackView;
|
||||
}
|
||||
|
||||
- (NetImageView *)firstAvatarImageView {
|
||||
if (!_firstAvatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_firstAvatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_firstAvatarImageView.layer.masksToBounds = YES;
|
||||
_firstAvatarImageView.layer.cornerRadius = 28/2;
|
||||
}
|
||||
return _firstAvatarImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)secondAvatarImageView {
|
||||
if (!_firstAvatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_secondAvatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_secondAvatarImageView.layer.masksToBounds = YES;
|
||||
_secondAvatarImageView.layer.cornerRadius = 28/2;
|
||||
}
|
||||
return _secondAvatarImageView;
|
||||
}
|
||||
|
||||
|
||||
- (NetImageView *)thirdAvatarImageView {
|
||||
if (!_thirdAvatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_thirdAvatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_thirdAvatarImageView.layer.masksToBounds = YES;
|
||||
_thirdAvatarImageView.layer.cornerRadius = 28/2;
|
||||
}
|
||||
return _thirdAvatarImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)assistNumLabel {
|
||||
if (!_assistNumLabel) {
|
||||
_assistNumLabel = [[UILabel alloc] init];
|
||||
}
|
||||
return _assistNumLabel;
|
||||
}
|
||||
|
||||
- (XPWishGiftInfoView *)firstView {
|
||||
if(!_firstView) {
|
||||
_firstView = [[XPWishGiftInfoView alloc] init];
|
||||
}
|
||||
return _firstView;
|
||||
}
|
||||
|
||||
- (XPWishGiftInfoView *)secondView {
|
||||
if(!_secondView) {
|
||||
_secondView = [[XPWishGiftInfoView alloc] init];
|
||||
}
|
||||
return _secondView;
|
||||
}
|
||||
|
||||
- (XPWishGiftInfoView *)thirdView {
|
||||
if(!_thirdView) {
|
||||
_thirdView = [[XPWishGiftInfoView alloc] init];
|
||||
}
|
||||
return _thirdView;
|
||||
}
|
||||
|
||||
|
||||
@end
|