diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 9494afe3..ad2e7fac 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -940,6 +940,17 @@ E8A30BF628534B35003B4873 /* FindNewUserInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BF528534B35003B4873 /* FindNewUserInfoModel.m */; }; E8A30BF928534E48003B4873 /* XPSessionFindNewEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A30BF828534E48003B4873 /* XPSessionFindNewEmptyTableViewCell.m */; }; E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3538428FD67320014A784 /* GiftLuckyBroadcastModel.m */; }; + E8A3538E28FE5CED0014A784 /* Api+WishGift.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3538D28FE5CED0014A784 /* Api+WishGift.m */; }; + 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 */; }; + 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 */; }; + E8A3540428FEB7100014A784 /* XPWishGiftHistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3540328FEB7100014A784 /* XPWishGiftHistoryViewController.m */; }; + E8A3540728FEBD460014A784 /* XPWishGiftCreateItemViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3540628FEBD460014A784 /* XPWishGiftCreateItemViewController.m */; }; + E8A3540A28FEC0510014A784 /* XPWishGiftListView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A3540928FEC0510014A784 /* XPWishGiftListView.m */; }; E8A6C28C27CF436300AC7442 /* XPHomeLikeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A6C28B27CF436300AC7442 /* XPHomeLikeViewController.m */; }; E8A6C28F27CF43D600AC7442 /* XPHomeAttentionTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A6C28E27CF43D600AC7442 /* XPHomeAttentionTableViewCell.m */; }; E8A6C29527CF441200AC7442 /* XPHomeAttentionCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E8A6C29427CF441200AC7442 /* XPHomeAttentionCollectionViewCell.m */; }; @@ -2914,6 +2925,29 @@ E8A30BF828534E48003B4873 /* XPSessionFindNewEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSessionFindNewEmptyTableViewCell.m; sourceTree = ""; }; E8A3538328FD67320014A784 /* GiftLuckyBroadcastModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftLuckyBroadcastModel.h; sourceTree = ""; }; E8A3538428FD67320014A784 /* GiftLuckyBroadcastModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftLuckyBroadcastModel.m; sourceTree = ""; }; + E8A3538C28FE5CED0014A784 /* Api+WishGift.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+WishGift.h"; sourceTree = ""; }; + E8A3538D28FE5CED0014A784 /* Api+WishGift.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+WishGift.m"; sourceTree = ""; }; + E8A3538F28FE5F0F0014A784 /* WishGiftInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WishGiftInfoModel.h; sourceTree = ""; }; + E8A3539028FE5F0F0014A784 /* WishGiftInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WishGiftInfoModel.m; sourceTree = ""; }; + E8A3539228FE605F0014A784 /* WishGiftUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WishGiftUserModel.h; sourceTree = ""; }; + E8A3539328FE605F0014A784 /* WishGiftUserModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WishGiftUserModel.m; sourceTree = ""; }; + E8A3539528FE7C250014A784 /* XPWishGiftPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftPresenter.h; sourceTree = ""; }; + E8A3539628FE7C250014A784 /* XPWishGiftPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftPresenter.m; sourceTree = ""; }; + E8A3539828FE7C4F0014A784 /* XPWishGiftProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftProtocol.h; sourceTree = ""; }; + E8A3539928FE840A0014A784 /* XPWishGIftViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGIftViewController.h; sourceTree = ""; }; + E8A3539A28FE840A0014A784 /* XPWishGIftViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGIftViewController.m; sourceTree = ""; }; + E8A3539E28FE84670014A784 /* XPWishGiftInfoView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftInfoView.h; sourceTree = ""; }; + E8A3539F28FE84670014A784 /* XPWishGiftInfoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftInfoView.m; sourceTree = ""; }; + E8A353A128FE90F60014A784 /* XPWishGiftCreateViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftCreateViewController.h; sourceTree = ""; }; + E8A353A228FE90F60014A784 /* XPWishGiftCreateViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftCreateViewController.m; sourceTree = ""; }; + E8A353FF28FEAC5E0014A784 /* XPWishGiftTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftTableViewCell.h; sourceTree = ""; }; + E8A3540028FEAC5E0014A784 /* XPWishGiftTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftTableViewCell.m; sourceTree = ""; }; + E8A3540228FEB7100014A784 /* XPWishGiftHistoryViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftHistoryViewController.h; sourceTree = ""; }; + E8A3540328FEB7100014A784 /* XPWishGiftHistoryViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftHistoryViewController.m; sourceTree = ""; }; + E8A3540528FEBD460014A784 /* XPWishGiftCreateItemViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftCreateItemViewController.h; sourceTree = ""; }; + E8A3540628FEBD460014A784 /* XPWishGiftCreateItemViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftCreateItemViewController.m; sourceTree = ""; }; + E8A3540828FEC0510014A784 /* XPWishGiftListView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPWishGiftListView.h; sourceTree = ""; }; + E8A3540928FEC0510014A784 /* XPWishGiftListView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPWishGiftListView.m; sourceTree = ""; }; E8A6C28A27CF436300AC7442 /* XPHomeLikeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeLikeViewController.h; sourceTree = ""; }; E8A6C28B27CF436300AC7442 /* XPHomeLikeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeLikeViewController.m; sourceTree = ""; }; E8A6C28D27CF43D600AC7442 /* XPHomeAttentionTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeAttentionTableViewCell.h; sourceTree = ""; }; @@ -7256,6 +7290,92 @@ path = Cell; sourceTree = ""; }; + E8A3538628FE5C5B0014A784 /* WishGift */ = { + isa = PBXGroup; + children = ( + E8A3538728FE5C9B0014A784 /* Model */, + E8A3538B28FE5CC80014A784 /* Api */, + E8A3538A28FE5CB90014A784 /* View */, + E8A3538928FE5CB00014A784 /* Presenter */, + E8A3538828FE5CA70014A784 /* Protocol */, + ); + path = WishGift; + sourceTree = ""; + }; + E8A3538728FE5C9B0014A784 /* Model */ = { + isa = PBXGroup; + children = ( + E8A3538F28FE5F0F0014A784 /* WishGiftInfoModel.h */, + E8A3539028FE5F0F0014A784 /* WishGiftInfoModel.m */, + E8A3539228FE605F0014A784 /* WishGiftUserModel.h */, + E8A3539328FE605F0014A784 /* WishGiftUserModel.m */, + ); + path = Model; + sourceTree = ""; + }; + E8A3538828FE5CA70014A784 /* Protocol */ = { + isa = PBXGroup; + children = ( + E8A3539828FE7C4F0014A784 /* XPWishGiftProtocol.h */, + ); + path = Protocol; + sourceTree = ""; + }; + E8A3538928FE5CB00014A784 /* Presenter */ = { + isa = PBXGroup; + children = ( + E8A3539528FE7C250014A784 /* XPWishGiftPresenter.h */, + E8A3539628FE7C250014A784 /* XPWishGiftPresenter.m */, + ); + path = Presenter; + sourceTree = ""; + }; + E8A3538A28FE5CB90014A784 /* View */ = { + isa = PBXGroup; + children = ( + E8A3539D28FE84470014A784 /* Cell */, + E8A3539C28FE84400014A784 /* View */, + E8A3539928FE840A0014A784 /* XPWishGIftViewController.h */, + E8A3539A28FE840A0014A784 /* XPWishGIftViewController.m */, + E8A353A128FE90F60014A784 /* XPWishGiftCreateViewController.h */, + E8A353A228FE90F60014A784 /* XPWishGiftCreateViewController.m */, + E8A3540228FEB7100014A784 /* XPWishGiftHistoryViewController.h */, + E8A3540328FEB7100014A784 /* XPWishGiftHistoryViewController.m */, + E8A3540528FEBD460014A784 /* XPWishGiftCreateItemViewController.h */, + E8A3540628FEBD460014A784 /* XPWishGiftCreateItemViewController.m */, + ); + path = View; + sourceTree = ""; + }; + E8A3538B28FE5CC80014A784 /* Api */ = { + isa = PBXGroup; + children = ( + E8A3538C28FE5CED0014A784 /* Api+WishGift.h */, + E8A3538D28FE5CED0014A784 /* Api+WishGift.m */, + ); + path = Api; + sourceTree = ""; + }; + E8A3539C28FE84400014A784 /* View */ = { + isa = PBXGroup; + children = ( + E8A3539E28FE84670014A784 /* XPWishGiftInfoView.h */, + E8A3539F28FE84670014A784 /* XPWishGiftInfoView.m */, + E8A3540828FEC0510014A784 /* XPWishGiftListView.h */, + E8A3540928FEC0510014A784 /* XPWishGiftListView.m */, + ); + path = View; + sourceTree = ""; + }; + E8A3539D28FE84470014A784 /* Cell */ = { + isa = PBXGroup; + children = ( + E8A353FF28FEAC5E0014A784 /* XPWishGiftTableViewCell.h */, + E8A3540028FEAC5E0014A784 /* XPWishGiftTableViewCell.m */, + ); + path = Cell; + sourceTree = ""; + }; E8A86DF827BA38A5001C21F9 /* Presenter */ = { isa = PBXGroup; children = ( @@ -7318,6 +7438,7 @@ E8AEAED8271413530017FCE0 /* View */ = { isa = PBXGroup; children = ( + E8A3538628FE5C5B0014A784 /* WishGift */, 9B2F72CD28E45A1C0000E4FA /* QuickMessageView */, 9BA812D328BF52A500783EA7 /* SendRedPacket */, E8751E5128A629EB0056EF44 /* Sailing */, @@ -8982,9 +9103,11 @@ E8998D962859DD6F00C68558 /* UIView+Corner.m in Sources */, E81EF6E8279AC21E00FF3EDE /* Api+LittleGame.m in Sources */, E8EEB91126FC6AE2007C6EBA /* XPMineUserInfoEditProtocol.h in Sources */, + E8A353A328FE90F60014A784 /* XPWishGiftCreateViewController.m in Sources */, 180116FC279E8CCE00F2CBC0 /* NVDate.m in Sources */, E801275827E347FD00BAC3F2 /* RoomPKRecordModel.m in Sources */, E8E0DAE0285C20E500566A2F /* MessageContentFindNewGreetView.m in Sources */, + E8A3540128FEAC5E0014A784 /* XPWishGiftTableViewCell.m in Sources */, E8A86E0427BA38DB001C21F9 /* SudCommon.m in Sources */, E8EEB90326FC31DC007C6EBA /* XPMineUserInfoProtocol.h in Sources */, E8232603274E4AA0003A3332 /* ThemeColor+UserCard.m in Sources */, @@ -9042,6 +9165,8 @@ E8C6FFD72754BC61004DC9F0 /* XPHomeNavView.m in Sources */, E8AC723226F49710007D6E91 /* XPMineNotificationTableViewCell.m in Sources */, E8AC722926F488DA007D6E91 /* XPMineFeedbackProtocol.h in Sources */, + E8A3539128FE5F0F0014A784 /* WishGiftInfoModel.m in Sources */, + E8A3539B28FE840A0014A784 /* XPWishGIftViewController.m in Sources */, E8950183282CAC6A007E459A /* XPMonentsPhotoView.m in Sources */, 9BCF58562798FE86008401A4 /* XPSkillCardPropModel.m in Sources */, E8AC721E26F472BF007D6E91 /* XPMineSettingProtocol.h in Sources */, @@ -9163,6 +9288,7 @@ E80EC8C228ACF97A00D133C5 /* QEEmotionImageView.m in Sources */, E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */, 9B3353BE288156DB00AC2F24 /* XPHomeLivePresenter.m in Sources */, + E8A3538E28FE5CED0014A784 /* Api+WishGift.m in Sources */, 180116F9279E8C4C00F2CBC0 /* PLTimeUtil.m in Sources */, 9BA708A12823D4C900C474A2 /* LittleGameScrollStageView.m in Sources */, E8834E4828003E1E0029CCC1 /* XPGuildMangerListPresenter.m in Sources */, @@ -9193,6 +9319,7 @@ E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */, 9B060B5827BCAEE20001B767 /* AnchorGiftValueView.m in Sources */, E880B3B2278C1D1800A83B0D /* XPAcrossRoomPKRuleView.m in Sources */, + E8A3539428FE605F0014A784 /* WishGiftUserModel.m in Sources */, E81C1B262770663B0020D1E4 /* XPArrangeMicTableViewCell.m in Sources */, E81AF31A27F19265003B9E43 /* XPHomeGradientLabel.m in Sources */, E81A652B2834E4F600F55894 /* XPMonentsAttentionViewController.m in Sources */, @@ -9253,6 +9380,7 @@ E83ABF06280EDE2B00322EE4 /* MessageContentLevelUpgradeView.m in Sources */, 180806D827293794001FD836 /* NSObject+MJExtension.m in Sources */, E88863D3278ED4C0004BCFAB /* Timestamp.m in Sources */, + E8A3540A28FEC0510014A784 /* XPWishGiftListView.m in Sources */, E88863CF278EC393004BCFAB /* XPAcrossRoomPKPrizeView.m in Sources */, E855515E28056F88005F293F /* XPMineHallAnchorIncomeStatisViewController.m in Sources */, 189DD6FF26E20E5900AB55B1 /* HttpRequestHelper.m in Sources */, @@ -9625,6 +9753,7 @@ E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */, E87AE8C5284E1A8400CAFBB3 /* XPRoomNewUserGreetView.m in Sources */, E80CBDF027D0E2C8001E1EC2 /* XPHomeRecommendOtherRoomView.m in Sources */, + E8A3540728FEBD460014A784 /* XPWishGiftCreateItemViewController.m in Sources */, E8001648280426CB00D6D17A /* XPMineAnchorIncomeStatisViewController.m in Sources */, E8F9168427EC913C00F10D8F /* XPHomeLittleGameViewController.m in Sources */, E8E5E1B327C397A400F457D8 /* HomeMenuInfoModel.m in Sources */, @@ -9662,6 +9791,7 @@ E87AE8C1284E184300CAFBB3 /* RoomNewUserGreetModel.m in Sources */, 9BC5C91C277C8A7B007C8719 /* XPReleaseRadioViewController.m in Sources */, 186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */, + E8A3540428FEB7100014A784 /* XPWishGiftHistoryViewController.m in Sources */, E801275527E3326000BAC3F2 /* XPRoomPKUserView.m in Sources */, E8D4824D278D2CE4003C1D08 /* XPAcrossRoomPKInviteResultView.m in Sources */, 9BD8D4E628911F7700AE03FF /* XPMineCollectRoomListPresenter.m in Sources */, @@ -9785,6 +9915,7 @@ 9BB549622782EA1D0090CD26 /* NobleInfo.m in Sources */, E80487652717DDD9008595F2 /* XPRoomMenuItem.m in Sources */, E895018C282D0701007E459A /* XPMoentsTopicView.m in Sources */, + E8A353A028FE84670014A784 /* XPWishGiftInfoView.m in Sources */, E89BD7D4277D471100E31B19 /* XPRoomOnlineTableViewCell.m in Sources */, E8412F9627795E34006E1101 /* XPRoomInviteFansView.m in Sources */, E80CBDE627D0C1CF001E1EC2 /* HomeMenuSourceModel.m in Sources */, @@ -9823,6 +9954,7 @@ 18E7B29026EA0E6B0064BC9B /* FlutterBoost+Xplan.m in Sources */, E8B846DC26FDE24300A777FE /* RechargeListModel.m in Sources */, 9B1B7292280010E8003FACE9 /* Api+FansTeam.m in Sources */, + E8A3539728FE7C250014A784 /* XPWishGiftPresenter.m in Sources */, 9BE01ADE2892A66D00B50299 /* DressUpShopModel.m in Sources */, E851E45B27FF02DF002F3ACB /* XPGuildSearchPresenter.m in Sources */, E884C36C2743951B00E1EBED /* GiftReceiveInfoModel.m in Sources */, diff --git a/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h b/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h index 41e00c35..33d3bf1f 100644 --- a/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h +++ b/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h @@ -52,6 +52,8 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) { RoomMoreMenuType_Room_redPacket = 20, ///扬声器 RoomMoreMenuType_Room_Voice = 21, + ///心愿礼物 + RoomMoreMenuType_Room_Wish_Gift = 22, }; @interface XPRoomMoreItemModel : NSObject diff --git a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m index e455dd83..aa231728 100644 --- a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m +++ b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m @@ -42,6 +42,12 @@ giftEffect.imageName = @"room_more_menu_gift_effect"; giftEffect.type = roomInfo.hasAnimationEffect ? RoomMoreMenuType_Gift_Effect_Close : RoomMoreMenuType_Gift_Effect_Open; giftEffect.titleColor = [ThemeColor roomMoreMenuTextColor]; + + XPRoomMoreItemModel * wishGift = [[XPRoomMoreItemModel alloc] init]; + wishGift.title = @"心愿礼物"; + wishGift.imageName = @"room_more_menu_gift_effect"; + wishGift.type = RoomMoreMenuType_Room_Wish_Gift; + wishGift.titleColor = [ThemeColor roomMoreMenuTextColor]; XPRoomMoreItemModel * dating = [[XPRoomMoreItemModel alloc] init]; dating.title = roomInfo.roomModeType == RoomModeType_Open_Blind ? @"相亲中.." : @"相亲房"; @@ -142,7 +148,13 @@ if (isCreator && roomInfo.type == RoomType_Anchor) { [array addObject:anchorRoomPK]; + } + + if ((isCreator || isManager || isSuperAdmin) && roomInfo.type != RoomType_MiniGame) { + [array addObject:wishGift]; + } + if (isCreator || isManager || isSuperAdmin) { if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor && roomInfo.type != RoomType_MiniGame) { @@ -169,6 +181,7 @@ [array addObject:giftEffect]; } [array addObject:voice]; + [[self getView] getMoreMenuDataSuccess:array]; }]; } diff --git a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m index a65f0941..e028159b 100644 --- a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m +++ b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m @@ -33,6 +33,7 @@ #import "XPRoomPKViewController.h" #import "XPRoomSendRedPacketViewController.h" #import "BaseNavigationController.h" +#import "XPWishGiftCreateViewController.h" ///P #import "XPMoreMenuPresenter.h" #import "XPMoreMenuProtocol.h" @@ -460,6 +461,15 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; item.isSelected = [RtcManager instance].isRemoteMuted; } break; + case RoomMoreMenuType_Room_Wish_Gift: + { + [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_more_tool_click eventAttributes:@{@"roomMoreMenuType" : @"redPacket"}]; + [self dismissViewControllerAnimated:YES completion:nil]; + + XPWishGiftCreateViewController *wishGiftVC = [[XPWishGiftCreateViewController alloc] initWithRoomUid:roomUid]; + [self.hostDelegate.getCurrentNav pushViewController:wishGiftVC animated:YES]; + } + break; default: break; } diff --git a/xplan-ios/Main/Room/View/WishGift/Api/Api+WishGift.h b/xplan-ios/Main/Room/View/WishGift/Api/Api+WishGift.h new file mode 100644 index 00000000..cd4dad04 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Api/Api+WishGift.h @@ -0,0 +1,45 @@ +// +// Api+WishGift.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "Api.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface Api (WishGift) +///添加心愿礼物 +/// @param roomUid 房主的uid ++ (void)wishGiftAdd:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid; +/// 删除心愿礼物 +/// @param completion 完成 +/// @param roomUid 房主的uid +/// @param itemId item id ++ (void)wishGiftDeleteItem:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid itemId:(NSString *)itemId; +/// 创建心愿礼物 +/// @param completion 完成 +/// @param roomUid 房主的uid +/// @param giftId 礼物id +/// @param itemId item id +/// @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; +/// 获取房间心愿礼物列表 +/// @param roomUid 房主的uid ++ (void)wishGiftList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid; +/// 获取房间心愿礼物助力用户列表 +/// @param roomUid 房主的uid ++ (void)wishGiftAssistUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid; +/// 获取心愿礼物配置列表 +/// @param roomUid 房主的uid +/// @param level 等级 ++ (void)wishGiftCondfigList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid level:(NSString *)level; +/// 获取房间历史心愿列表 +/// @param roomUid 房主的uid ++ (void)wishGiftHistoryList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/Api/Api+WishGift.m b/xplan-ios/Main/Room/View/WishGift/Api/Api+WishGift.m new file mode 100644 index 00000000..2ebf3355 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Api/Api+WishGift.m @@ -0,0 +1,62 @@ +// +// Api+WishGift.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "Api+WishGift.h" + +@implementation Api (WishGift) + +///添加心愿礼物 +/// @param roomUid 房主的uid ++ (void)wishGiftAdd:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid { + [self makeRequest:@"wishGift/add" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, nil]; +} + +/// 删除心愿礼物 +/// @param completion 完成 +/// @param roomUid 房主的uid +/// @param itemId item id ++ (void)wishGiftDeleteItem:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid itemId:(NSString *)itemId { + [self makeRequest:@"wishGift/delItem" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, itemId, nil]; +} + +/// 创建心愿礼物 +/// @param completion 完成 +/// @param roomUid 房主的uid +/// @param giftId 礼物id +/// @param itemId item id +/// @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 { + [self makeRequest:@"wishGift/addItem" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, giftId, itemId, seq, targetNum, nil]; +} + +/// 获取房间心愿礼物列表 +/// @param roomUid 房主的uid ++ (void)wishGiftList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid { + [self makeRequest:@"wishGift/list" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil]; +} + +/// 获取房间心愿礼物助力用户列表 +/// @param roomUid 房主的uid ++ (void)wishGiftAssistUserList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid { + [self makeRequest:@"wishGift/listAssistUser" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil]; +} + +/// 获取心愿礼物配置列表 +/// @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]; +} + +/// 获取房间历史心愿列表 +/// @param roomUid 房主的uid ++ (void)wishGiftHistoryList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid { + [self makeRequest:@"wishGift/listWishGiftHistory" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, roomUid, nil]; +} + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/Model/WishGiftInfoModel.h b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftInfoModel.h new file mode 100644 index 00000000..9b0f3bd6 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftInfoModel.h @@ -0,0 +1,31 @@ +// +// WishGiftInfoModel.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface WishGiftInfoModel : NSObject +/// 实际收到数量 +@property (nonatomic, assign) NSInteger actualNum; +///礼物id +@property (nonatomic, assign) NSInteger giftId; +///礼物名称 +@property (nonatomic, copy) NSString *giftName; +/// 礼物价值 +@property (nonatomic, assign) NSInteger goldPrice; +/// 礼物心愿itemid +@property (nonatomic, assign) NSInteger itemId; +/// 目标数量 +@property (nonatomic, assign) NSInteger targetNum; +///礼物图片 +@property (nonatomic,copy) NSString *giftUrl; +///本地字段 +@property (nonatomic,assign) NSInteger row; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/Model/WishGiftInfoModel.m b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftInfoModel.m new file mode 100644 index 00000000..179d570b --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftInfoModel.m @@ -0,0 +1,12 @@ +// +// WishGiftInfoModel.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "WishGiftInfoModel.h" + +@implementation WishGiftInfoModel + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/Model/WishGiftUserModel.h b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftUserModel.h new file mode 100644 index 00000000..c4238bc9 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftUserModel.h @@ -0,0 +1,19 @@ +// +// WishGiftUserModel.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface WishGiftUserModel : NSObject +@property (nonatomic, copy) NSString *avatar; +@property (nonatomic, assign) NSInteger erbanNo; +@property (nonatomic, copy) NSString *nick; +@property (nonatomic, assign) NSInteger uid; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/Model/WishGiftUserModel.m b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftUserModel.m new file mode 100644 index 00000000..f829a03c --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Model/WishGiftUserModel.m @@ -0,0 +1,12 @@ +// +// WishGiftUserModel.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "WishGiftUserModel.h" + +@implementation WishGiftUserModel + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/Presenter/XPWishGiftPresenter.h b/xplan-ios/Main/Room/View/WishGift/Presenter/XPWishGiftPresenter.h new file mode 100644 index 00000000..f92971de --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Presenter/XPWishGiftPresenter.h @@ -0,0 +1,31 @@ +// +// WishGiftPresenter.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "BaseMvpPresenter.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPWishGiftPresenter : BaseMvpPresenter + +/// 添加许愿礼物 +- (void)addWishGift:(NSString *)roomUid; + +///创建心愿礼物 +- (void)createWishGiftItem:(NSString *)roomUid itemId:(NSString *)itemId giftId:(NSString *)giftId seq:(int)seq targetNum:(int)targetNum; +///删除心愿礼物 +- (void)deleteWishGiftItem:(NSString *)roomUid itemId:(NSString *)itemId; +///房间许愿礼物列表 +- (void)wishGiftList:(NSString *)roomUid; +///助理用户列表 +- (void)wishGiftAssistUserList:(NSString *)roomUid; +/// 心愿礼物配置表 +- (void)wishGiftConfigList:(NSString *)roomUid level:(NSString *)level ; +///获取房间历史列表 +- (void)wishGiftHistroyList:(NSString *)roomUid; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/Presenter/XPWishGiftPresenter.m b/xplan-ios/Main/Room/View/WishGift/Presenter/XPWishGiftPresenter.m new file mode 100644 index 00000000..604078a7 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Presenter/XPWishGiftPresenter.m @@ -0,0 +1,63 @@ +// +// WishGiftPresenter.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "XPWishGiftPresenter.h" +#import "Api+WishGift.h" +#import "XPWishGiftProtocol.h" +#import "WishGiftInfoModel.h" +#import "WishGiftUserModel.h" + +@implementation XPWishGiftPresenter + +/// 添加许愿礼物 +- (void)addWishGift:(NSString *)roomUid { + [Api wishGiftAdd:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + [[self getView] addWishGiftSuccess]; + } showLoading:YES] roomUid:roomUid]; +} + +///创建心愿礼物 +- (void)createWishGiftItem:(NSString *)roomUid itemId:(NSString *)itemId giftId:(NSString *)giftId seq:(int)seq targetNum:(int)targetNum { + [Api wishGiftAddItem:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + [[self getView] createWishGiftItemSuccess]; + } showLoading:YES] roomUid:roomUid giftId:giftId itemId:itemId seq:[NSString stringWithFormat:@"%d", seq] targetNum:[NSString stringWithFormat:@"%d", targetNum]]; +} +///删除心愿礼物 +- (void)deleteWishGiftItem:(NSString *)roomUid itemId:(NSString *)itemId { + [Api wishGiftDeleteItem:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + [[self getView] deleteWishGiftItemSuccess]; + } showLoading:YES] roomUid:roomUid itemId:itemId]; +} +///房间许愿礼物列表 +- (void)wishGiftList:(NSString *)roomUid { + [Api wishGiftList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + NSArray * array = [WishGiftInfoModel modelsWithArray:data.data]; + [[self getView] getWishGiftListSuccess:array]; + }] roomUid:roomUid]; +} +///助理用户列表 +- (void)wishGiftAssistUserList:(NSString *)roomUid { + [Api wishGiftAssistUserList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + NSArray * array = [WishGiftUserModel modelsWithArray:data.data]; + [[self getView] getWishGiftAssistUserListSuccess:array]; + }] roomUid:roomUid]; +} +/// 心愿礼物配置表 +- (void)wishGiftConfigList:(NSString *)roomUid level:(NSString *)level { + [Api wishGiftCondfigList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + NSArray * array = [WishGiftInfoModel modelsWithArray:data.data]; + [[self getView] wishGiftConfigListSucces:array]; + }] roomUid:roomUid level:level]; +} +///获取房间历史列表 +- (void)wishGiftHistroyList:(NSString *)roomUid { + [Api wishGiftHistoryList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + + } showLoading:YES] roomUid:roomUid]; +} + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/Protocol/XPWishGiftProtocol.h b/xplan-ios/Main/Room/View/WishGift/Protocol/XPWishGiftProtocol.h new file mode 100644 index 00000000..bdcb496e --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/Protocol/XPWishGiftProtocol.h @@ -0,0 +1,33 @@ +// +// XPWishGiftProtocol.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol XPWishGiftProtocol +@optional +///添加礼物心愿成功 +- (void)addWishGiftSuccess; + +///创建心愿单成功 +- (void)createWishGiftItemSuccess; + +///删除心愿单成功 +- (void)deleteWishGiftItemSuccess; +///获取心愿礼物列表 +- (void)getWishGiftListSuccess:(NSArray *)list; + +///助理用户列表 +- (void)getWishGiftAssistUserListSuccess:(NSArray *)list; + +///礼物配置列表 +- (void)wishGiftConfigListSucces:(NSArray *)list; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/Cell/XPWishGiftTableViewCell.h b/xplan-ios/Main/Room/View/WishGift/View/Cell/XPWishGiftTableViewCell.h new file mode 100644 index 00000000..6f9c8acd --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/Cell/XPWishGiftTableViewCell.h @@ -0,0 +1,28 @@ +// +// XPWishGiftTableViewCell.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class XPWishGiftTableViewCell, WishGiftInfoModel; +@protocol XPWishGiftTableViewCellDelegate + +///更新礼物信息 +- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didUpdateWishGift:(WishGiftInfoModel *)info; + +///删除礼物信息 +- (void)xPWishGiftTableViewCell:(XPWishGiftTableViewCell *)view didClearWishGift:(WishGiftInfoModel *)info; + +@end + +@interface XPWishGiftTableViewCell : UITableViewCell +///代理 +@property (nonatomic,weak) id delegate; +@property (nonatomic,strong) WishGiftInfoModel *giftInfo; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/Cell/XPWishGiftTableViewCell.m b/xplan-ios/Main/Room/View/WishGift/View/Cell/XPWishGiftTableViewCell.m new file mode 100644 index 00000000..1e542576 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/Cell/XPWishGiftTableViewCell.m @@ -0,0 +1,186 @@ +// +// XPWishGiftTableViewCell.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "XPWishGiftTableViewCell.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "UIImage+Utils.h" +#import "NetImageView.h" +#import "WishGiftInfoModel.h" + +@interface XPWishGiftTableViewCell () + +///等级 +@property (nonatomic,strong) UILabel *levleLabel; +///礼物图片 +@property (nonatomic,strong) NetImageView *giftImageView; +///礼物名称 +@property (nonatomic,strong) UILabel *giftLabel; +///目标 +@property (nonatomic,strong) UILabel *targetNumLabel; +///编辑 +@property (nonatomic,strong) UIButton *updateButton; +///删除 +@property (nonatomic,strong) UIButton *clearButton; + +@end +@implementation XPWishGiftTableViewCell + + +- (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.levleLabel]; + [self.contentView addSubview:self.giftImageView]; + [self.contentView addSubview:self.giftLabel]; + [self.contentView addSubview:self.targetNumLabel]; + [self.contentView addSubview:self.updateButton]; + [self.contentView addSubview:self.clearButton]; +} + +- (void)initSubViewConstraints { + [self.levleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.contentView); + make.left.mas_equalTo(self.contentView).offset(15); + }]; + + [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(24, 24)); + make.centerY.mas_equalTo(self.contentView); + make.left.mas_equalTo(self.levleLabel.mas_right).offset(20); + }]; + + [self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.contentView); + make.left.mas_equalTo(self.giftImageView.mas_right).offset(8); + make.right.lessThanOrEqualTo(self.targetNumLabel.mas_left).offset(-5); + }]; + + [self.clearButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(44, 18)); + make.right.mas_equalTo(self.contentView).offset(-15); + make.centerY.mas_equalTo(self.contentView); + }]; + + [self.updateButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(44, 18)); + make.right.mas_equalTo(self.clearButton.mas_left).offset(-4); + make.centerY.mas_equalTo(self.contentView); + }]; + + [self.targetNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.contentView); + make.right.mas_equalTo(self.updateButton.mas_left).offset(-26); + }]; + +} + +#pragma mark - Event Response +- (void)updateButtonAction:(UIButton *)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPWishGiftTableViewCell:didUpdateWishGift:)]) { + [self.delegate xPWishGiftTableViewCell:self didUpdateWishGift:self.giftInfo]; + } +} + + +- (void)clearButtonAction:(UIButton *)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPWishGiftTableViewCell:didClearWishGift:)]) { + [self.delegate xPWishGiftTableViewCell:self didClearWishGift:self.giftInfo]; + } +} + +#pragma mark - Getters And Setters +- (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; +} + +- (UIButton *)updateButton { + if (!_updateButton) { + _updateButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_updateButton setTitle:@"编辑" forState:UIControlStateNormal]; + [_updateButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; + _updateButton.titleLabel.font = [UIFont systemFontOfSize:10]; + [_updateButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor cancelButtonGradientStartColor], [ThemeColor cancelButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + _updateButton.layer.masksToBounds = YES; + _updateButton.layer.cornerRadius = 9; + [_updateButton addTarget:self action:@selector(updateButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _updateButton; +} + +- (UIButton *)clearButton { + if (!_clearButton) { + _clearButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_clearButton setTitle:@"删除" forState:UIControlStateNormal]; + [_clearButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; + _clearButton.titleLabel.font = [UIFont systemFontOfSize:10]; + [_clearButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + _clearButton.layer.masksToBounds = YES; + _clearButton.layer.cornerRadius = 9; + [_clearButton addTarget:self action:@selector(clearButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _clearButton; +} + + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftInfoView.h b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftInfoView.h new file mode 100644 index 00000000..23d8f61c --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftInfoView.h @@ -0,0 +1,18 @@ +// +// XPWishGiftInfoView.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class WishGiftInfoModel; +@interface XPWishGiftInfoView : UIView + +@property (nonatomic,strong) WishGiftInfoModel *giftInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftInfoView.m b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftInfoView.m new file mode 100644 index 00000000..05d2b6b5 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftInfoView.m @@ -0,0 +1,199 @@ +// +// XPWishGiftInfoView.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "XPWishGiftInfoView.h" +///Third +#import +///Tool +#import "NetImageView.h" +#import "ThemeColor.h" +#import "UIImage+Utils.h" +///Model +#import "WishGiftInfoModel.h" + +@interface XPWishGiftInfoView () +///背景 +@property (nonatomic,strong) UIView *bgView; +///礼物的图片 +@property (nonatomic,strong) NetImageView *giftImageView; +///礼物名称 +@property (nonatomic,strong) UILabel *giftLabel; +///价格 +@property (nonatomic,strong) UILabel *priceLabel; +///进度 +@property (nonatomic,strong) UILabel *progressLabel; +///进度条 +@property (nonatomic,strong) UISlider *progressView; +///赠送按钮 +@property (nonatomic,strong) UIButton *senderButton; + +@end + +@implementation XPWishGiftInfoView + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + [self initSubViews]; + [self initSubViewConstraints]; + } + return self; +} + +#pragma mark - Private Method +- (void)initSubViews { + [self addSubview:self.bgView]; + [self.bgView addSubview:self.giftImageView]; + [self.bgView addSubview:self.giftLabel]; + [self.bgView addSubview:self.priceLabel]; + [self.bgView addSubview:self.progressLabel]; + [self.bgView addSubview:self.progressView]; + [self.bgView addSubview:self.senderButton]; +} + +- (void)initSubViewConstraints { + [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self); + }]; + + [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(40, 40)); + make.top.mas_equalTo(self.bgView).offset(10); + make.centerX.mas_equalTo(self.bgView); + }]; + + [self.giftLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self.bgView).inset(2); + make.top.mas_equalTo(self.giftImageView.mas_bottom).offset(10); + }]; + + [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self.bgView).inset(2); + make.top.mas_equalTo(self.giftLabel.mas_bottom).offset(10); + }]; + + [self.progressView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self.bgView).inset(10); + make.top.mas_equalTo(self.priceLabel.mas_bottom).offset(10); + make.height.mas_equalTo(5); + }]; + + [self.progressLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self.bgView); + make.top.mas_equalTo(self.progressView.mas_bottom).offset(5); + }]; + + [self.senderButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(50, 24)); + make.centerX.mas_equalTo(self.bgView); + make.top.mas_equalTo(self.progressLabel.mas_bottom).offset(10); + }]; +} + +- (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]]; + return attribute; +} + +#pragma mark - Event Response +- (void)senderButtonAction:(UIButton *)sender { + +} + +#pragma mark - Getters And Setters +- (void)setGiftInfo:(WishGiftInfoModel *)giftInfo { + _giftInfo = giftInfo; + if (_giftInfo) { +// self.giftImageView.imageUrl = giftInfo. + 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]; + } +} + +- (UIView *)bgView { + if (!_bgView) { + _bgView = [[UIView alloc] init]; + _bgView.backgroundColor = [UIColor clearColor]; + _bgView.layer.masksToBounds = YES; + _bgView.layer.cornerRadius = 10; + } + return _bgView; +} + + +- (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.layer.cornerRadius = 20; + _giftImageView.contentMode = UIViewContentModeScaleAspectFill; + } + return _giftImageView; +} + +- (UILabel *)giftLabel { + if (!_giftLabel) { + _giftLabel = [[UILabel alloc] init]; + _giftLabel.font = [UIFont systemFontOfSize:14]; + _giftLabel.textAlignment = NSTextAlignmentCenter; + _giftLabel.textColor = [UIColor whiteColor]; + } + return _giftLabel; +} + +- (UILabel *)priceLabel { + if (!_priceLabel) { + _priceLabel = [[UILabel alloc] init]; + _priceLabel.font = [UIFont systemFontOfSize:12]; + _priceLabel.textColor = [ThemeColor secondTextColor]; + _priceLabel.textAlignment = NSTextAlignmentCenter; + } + return _priceLabel; +} + +- (UISlider *)progressView { + if(!_progressView) { + _progressView = [[UISlider alloc] init]; + _progressView.tintColor = [UIColor redColor]; + _progressView.thumbTintColor = [UIColor whiteColor]; + } + return _progressView; +} + + +- (UILabel *)progressLabel { + if (!_progressLabel) { + _progressLabel = [[UILabel alloc] init]; + } + return _progressLabel; +} + +- (UIButton *)senderButton { + if (!_senderButton) { + _senderButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_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.layer.masksToBounds = YES; + _senderButton.layer.cornerRadius = 10; + [_senderButton addTarget:self action:@selector(senderButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _senderButton; +} + + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.h b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.h new file mode 100644 index 00000000..167b7e95 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.h @@ -0,0 +1,16 @@ +// +// XPWishGiftListView.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XPWishGiftListView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.m b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.m new file mode 100644 index 00000000..ff3d890d --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/View/XPWishGiftListView.m @@ -0,0 +1,159 @@ +// +// XPWishGiftListView.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "XPWishGiftListView.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "Api+LittleGame.h" +///Model +#import "LittleGameInfoModel.h" +#import "XPLittleGameTableViewCell.h" +@interface XPWishGiftListView () +///容器 +@property (nonatomic,strong) UIStackView *stackView; +///当前游戏的类型 +@property (nonatomic,strong) UIButton *gamePlayButton; +///列表 +@property (nonatomic,strong) UITableView *tableView; +///原始数据源 +@property (nonatomic,strong) NSArray *gameList; +///显示的数据源 +@property (nonatomic,strong) NSArray *datasource; +@end + +@implementation XPWishGiftListView + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self initSubViews]; + [self initSubViewConstraints]; + + } + return self; +} + +#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 addSubview:self.stackView]; + [self.stackView addArrangedSubview:self.gamePlayButton]; + [self.stackView addArrangedSubview:self.tableView]; +} + +- (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); + }]; + + [self.gamePlayButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(25); + }]; + + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(25); + }]; +} + + +#pragma mark - UITableViewDelegate And UITableViewDataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.datasource.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + XPLittleGameTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])]; + if (cell == nil) { + cell = [[XPLittleGameTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPLittleGameTableViewCell class])]; + } + cell.info = [self.datasource objectAtIndex:indexPath.row]; + return cell; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 25; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + if (self.datasource.count > 0) { + self.tableView.hidden = YES; + self.gamePlayButton.selected = NO; + } +} + +#pragma mark - Event Response +- (void)gamePlayButtonAction:(UIButton *)sender { + +} + +#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]; +} + +- (UIStackView *)stackView { + if (!_stackView) { + _stackView = [[UIStackView alloc] init]; + _stackView.axis = UILayoutConstraintAxisVertical; + _stackView.distribution = UIStackViewDistributionFill; + _stackView.alignment = UIStackViewAlignmentFill; + _stackView.spacing = 0; + } + return _stackView; +} + +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.backgroundColor = [UIColor clearColor]; + _tableView.hidden = YES; + if (@available(iOS 11.0, *)) { + _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + [_tableView registerClass:[XPLittleGameTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPLittleGameTableViewCell 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); + } + return _gamePlayButton; +} + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGIftViewController.h b/xplan-ios/Main/Room/View/WishGift/View/XPWishGIftViewController.h new file mode 100644 index 00000000..f65865bb --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGIftViewController.h @@ -0,0 +1,18 @@ +// +// XPWishGIftViewController.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPWishGIftViewController : MvpViewController + + + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGIftViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGIftViewController.m new file mode 100644 index 00000000..ea4441bf --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGIftViewController.m @@ -0,0 +1,21 @@ +// +// 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 diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.h b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.h new file mode 100644 index 00000000..d90b43ea --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.h @@ -0,0 +1,16 @@ +// +// XPWishGiftCreateItemViewController.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPWishGiftCreateItemViewController : MvpViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.m new file mode 100644 index 00000000..8dc225d1 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateItemViewController.m @@ -0,0 +1,22 @@ +// +// XPWishGiftCreateItemViewController.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "XPWishGiftCreateItemViewController.h" + +@interface XPWishGiftCreateItemViewController () +/// +@property (nonatomic,strong) UIView *backView; + +@end + +@implementation XPWishGiftCreateItemViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + +} +@end diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.h b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.h new file mode 100644 index 00000000..cc25d717 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.h @@ -0,0 +1,16 @@ +// +// XPWishGiftCreateViewController.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPWishGiftCreateViewController : MvpViewController +- (instancetype)initWithRoomUid:(NSString *)roomUid; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.m new file mode 100644 index 00000000..9ddbfeca --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftCreateViewController.m @@ -0,0 +1,218 @@ +// +// XPWishGiftCreateViewController.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "XPWishGiftCreateViewController.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "UIImage+Utils.h" +///Model +#import "WishGiftInfoModel.h" +///View +#import "XPWishGiftTableViewCell.h" +#import "XPWishGiftHistoryViewController.h" +///P +#import "XPWishGiftPresenter.h" +#import "XPWishGiftProtocol.h" +@interface XPWishGiftCreateViewController () +///设置心愿 +@property (nonatomic,strong) UILabel *configLabel; +///清除心愿 +@property (nonatomic,strong) UIButton *clearWishButton; +///添加心愿 +@property (nonatomic,strong) UIButton *addWishButton; +///列表 +@property (nonatomic,strong) UITableView *tableView; +///创建 +@property (nonatomic,strong) UIButton *createButton; +///数据源 +@property (nonatomic,strong) NSArray *datasource; +///房主的uid +@property (nonatomic,strong) NSString *roomUid; +@end + +@implementation XPWishGiftCreateViewController + +- (__kindof id)createPresenter { + return [[XPWishGiftPresenter alloc] init]; +} + +- (instancetype)initWithRoomUid:(NSString *)roomUid { + if (self = [super init]) { + self.roomUid = roomUid; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self initSubViews]; + [self initSubViewConstraints]; + [self initWishGiftList]; +} + +#pragma mark - Private Method +- (void)initWishGiftList { + [self.presenter wishGiftList:self.roomUid]; +} + + +- (void)initSubViews { + self.title = @"创建心愿单"; + [self.view addSubview:self.configLabel]; + [self.view addSubview:self.clearWishButton]; + [self.view addSubview:self.addWishButton]; + [self.view addSubview:self.tableView]; + [self.view addSubview:self.createButton]; + [self addNavigationItemWithTitles:@[@"历史心愿"] titleColor:[ThemeColor secondTextColor] isLeft:NO target:self action:@selector(rightButtonAction:) tags:nil]; +} + +- (void)initSubViewConstraints { + [self.configLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.view).offset(24); + make.top.mas_equalTo(self.view).offset(14); + }]; + + [self.clearWishButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(60, 20)); + make.centerY.mas_equalTo(self.configLabel); + make.right.mas_equalTo(self.addWishButton.mas_left).offset(-10); + }]; + + [self.addWishButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(self.configLabel); + make.right.mas_equalTo(self.view).offset(-18); + make.size.mas_equalTo(CGSizeMake(60, 20)); + }]; + + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self.view).inset(15); + make.height.mas_equalTo(135); + make.top.mas_equalTo(self.configLabel.mas_bottom).offset(13); + }]; + + [self.createButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.mas_equalTo(self.view).inset(80); + make.height.mas_equalTo(37); + make.top.mas_equalTo(self.tableView.mas_bottom).offset(48); + }]; +} +#pragma mark - UITableViewDelegate And UITableViewDataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.datasource.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + XPWishGiftTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPWishGiftTableViewCell class])]; + if (cell == nil) { + cell = [[XPWishGiftTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPWishGiftTableViewCell class])]; + } + WishGiftInfoModel *giftInfo = [self.datasource objectAtIndex:indexPath.row]; + giftInfo.row = indexPath.row; + cell.giftInfo = giftInfo; + return cell; +} + +#pragma mark - XPWishGiftProtocol +- (void)getWishGiftListSuccess:(NSArray *)list { + self.datasource = list; + [self.tableView reloadData]; +} + +#pragma mark - Event Response +- (void)rightButtonAction:(UIButton *)sender { + XPWishGiftHistoryViewController * historyVC = [[XPWishGiftHistoryViewController alloc] init]; + [self.navigationController pushViewController:historyVC animated:YES]; +} + +- (void)clearButtonAction:(UIButton *)sender { + //TODO: 清空 +} + +- (void)addWishButtonAction:(UIButton *)sender { + //TODO: 添加心愿 +} + +- (void)createButtonAction:(UIButton *)sender { + //TODO: 创建心愿 +} + +#pragma mark - Getters And Setters +- (UILabel *)configLabel { + if (!_configLabel) { + _configLabel = [[UILabel alloc] init]; + _configLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold]; + _configLabel.textColor = [ThemeColor mainTextColor]; + _configLabel.text = @"设置心愿"; + } + return _configLabel; +} + +- (UIButton *)clearWishButton { + if (!_clearWishButton) { + _clearWishButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_clearWishButton setTitle:@"清空数据" forState:UIControlStateNormal]; + [_clearWishButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _clearWishButton.titleLabel.font = [UIFont systemFontOfSize:10]; + _clearWishButton.backgroundColor = [ThemeColor colorWithHexString:@"#C7DAEA"]; + _clearWishButton.layer.masksToBounds = YES; + _clearWishButton.layer.cornerRadius = 10; + [_clearWishButton addTarget:self action:@selector(clearButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _clearWishButton; +} + +- (UIButton *)addWishButton { + if (!_addWishButton) { + _addWishButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_addWishButton setTitle:@"添加心愿" forState:UIControlStateNormal]; + [_addWishButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _addWishButton.titleLabel.font = [UIFont systemFontOfSize:10]; + [_addWishButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + _addWishButton.layer.masksToBounds = YES; + _addWishButton.layer.cornerRadius = 10; + [_addWishButton addTarget:self action:@selector(addWishButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _addWishButton; +} + + +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.backgroundColor = [UIColor whiteColor]; + _tableView.layer.masksToBounds = YES; + _tableView.layer.cornerRadius = 8; + if (@available(iOS 11.0, *)) { + _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + [_tableView registerClass:[XPWishGiftTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPWishGiftTableViewCell class])]; + } + return _tableView; +} + +- (UIButton *)createButton { + if (!_createButton) { + _createButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_createButton setTitle:@"确定创建" forState:UIControlStateNormal]; + [_createButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _createButton.titleLabel.font = [UIFont systemFontOfSize:12]; + [_createButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + _createButton.layer.masksToBounds = YES; + _createButton.layer.cornerRadius = 37 / 2; + [_createButton addTarget:self action:@selector(createButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _createButton; +} + + +@end diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.h b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.h new file mode 100644 index 00000000..a17db359 --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.h @@ -0,0 +1,16 @@ +// +// XPWishGiftHistoryViewController.h +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPWishGiftHistoryViewController : MvpViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.m b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.m new file mode 100644 index 00000000..c124251d --- /dev/null +++ b/xplan-ios/Main/Room/View/WishGift/View/XPWishGiftHistoryViewController.m @@ -0,0 +1,31 @@ +// +// XPWishGiftHistoryViewController.m +// xplan-ios +// +// Created by 冯硕 on 2022/10/18. +// + +#import "XPWishGiftHistoryViewController.h" + +@interface XPWishGiftHistoryViewController () + +@end + +@implementation XPWishGiftHistoryViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end