From 3385e4826f8fd5970b99efd12eb221a676e8481e Mon Sep 17 00:00:00 2001 From: chenguilong <598604202@qq.com> Date: Wed, 12 Oct 2022 15:30:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=BF=E9=97=B4=E6=94=B6=E8=97=8F=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xplan-ios.xcodeproj/project.pbxproj | 34 ++ .../Mine/collectRoom/Contents.json | 6 + .../Contents.json | 22 ++ .../collect_room_edit_selected@2x.png | Bin 0 -> 395 bytes .../collect_room_edit_selected@3x.png | Bin 0 -> 604 bytes .../Contents.json | 22 ++ .../collect_room_edit_selected@2x.png | Bin 0 -> 495 bytes .../collect_room_edit_selected@3x.png | Bin 0 -> 774 bytes .../Main/Home/Model/HomeCollectRoomModel.h | 3 + xplan-ios/Main/Mine/Api/Api+Mine.h | 3 +- xplan-ios/Main/Mine/Api/Api+Mine.m | 5 +- .../XPMineCollectRoomListPresenter.h | 6 +- .../XPMineCollectRoomListPresenter.m | 15 +- .../Mine/Presenter/XPMineFootPrintPresenter.m | 2 +- .../Protocol/XPMineCollectRoomListProtocol.h | 3 + .../CollectRoom/Cell/XPMineCollectRoomCell.h | 19 + .../CollectRoom/Cell/XPMineCollectRoomCell.m | 126 +++++++ .../Cell/XPMineCollectRoomEditCell.h | 18 + .../Cell/XPMineCollectRoomEditCell.m | 145 +++++++ .../XPMineCollectPartyRoomViewController.h | 32 ++ .../XPMineCollectPartyRoomViewController.m | 226 +++++++++++ .../XPMineCollectRoomListViewController.m | 354 ++++++++++++------ xplan-ios/Main/Room/Api/Api+Room.h | 6 +- xplan-ios/Main/Room/Api/Api+Room.m | 7 +- .../Room/View/RoomHeaderView/RoomHeaderView.m | 2 +- 25 files changed, 930 insertions(+), 126 deletions(-) create mode 100644 xplan-ios/Assets.xcassets/Mine/collectRoom/Contents.json create mode 100644 xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/Contents.json create mode 100644 xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/collect_room_edit_selected@2x.png create mode 100644 xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/collect_room_edit_selected@3x.png create mode 100644 xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/Contents.json create mode 100644 xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/collect_room_edit_selected@2x.png create mode 100644 xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/collect_room_edit_selected@3x.png create mode 100644 xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.h create mode 100644 xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.m create mode 100644 xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.h create mode 100644 xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.m create mode 100644 xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.h create mode 100644 xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index d937058b..a1290897 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -272,6 +272,8 @@ 9BC5C91F277C902B007C8719 /* XPReleaseRadioView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC5C91E277C902B007C8719 /* XPReleaseRadioView.m */; }; 9BC8C83028090C9200C24F85 /* XPRoomAnchorRankBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC8C82F28090C9200C24F85 /* XPRoomAnchorRankBannerView.m */; }; 9BC9DAEF27E33B3F009EE409 /* XPRoomGiftAnimationParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC9DAEE27E33B3F009EE409 /* XPRoomGiftAnimationParser.m */; }; + 9BCB99A028F571B500466D64 /* XPMineCollectPartyRoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCB999F28F571B500466D64 /* XPMineCollectPartyRoomViewController.m */; }; + 9BCB99A628F582EC00466D64 /* XPMineCollectRoomEditCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCB99A528F582EC00466D64 /* XPMineCollectRoomEditCell.m */; }; 9BCD02C72796C02800F396AA /* MicroNobleWaveView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCD02C62796C02800F396AA /* MicroNobleWaveView.m */; }; 9BCE6144277D657600CC0358 /* XPReleaseRadioTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE6143277D657600CC0358 /* XPReleaseRadioTableViewCell.m */; }; 9BCE6147277D665600CC0358 /* XPReleaseRadioCellModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BCE6146277D665600CC0358 /* XPReleaseRadioCellModel.m */; }; @@ -315,6 +317,7 @@ 9BE29A6B27D1BFF700446AB5 /* anchor_room_speak.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9BE29A6927D1BFF700446AB5 /* anchor_room_speak.svga */; }; 9BE29A6D27D210A500446AB5 /* anchor_room_bg.svga in Resources */ = {isa = PBXBuildFile; fileRef = 9BE29A6C27D210A500446AB5 /* anchor_room_bg.svga */; }; 9BE2FA90288010D300EF3D83 /* AnchorRoomSrollTipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE2FA8F288010D300EF3D83 /* AnchorRoomSrollTipView.m */; }; + 9BE570BC28F65B7200D491A5 /* XPMineCollectRoomCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE570BB28F65B7200D491A5 /* XPMineCollectRoomCell.m */; }; 9BE9F0F927FED12D00667200 /* XPAnchorFansPrivilegeModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE9F0F827FED12D00667200 /* XPAnchorFansPrivilegeModel.m */; }; 9BE9F0FC27FED2E100667200 /* XPAnchorFansJoinModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE9F0FB27FED2E100667200 /* XPAnchorFansJoinModel.m */; }; 9BE9F0FF27FED76500667200 /* XPAnchorFansTaskModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE9F0FE27FED76500667200 /* XPAnchorFansTaskModel.m */; }; @@ -1720,6 +1723,10 @@ 9BC8C82F28090C9200C24F85 /* XPRoomAnchorRankBannerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomAnchorRankBannerView.m; sourceTree = ""; }; 9BC9DAED27E33B3F009EE409 /* XPRoomGiftAnimationParser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomGiftAnimationParser.h; sourceTree = ""; }; 9BC9DAEE27E33B3F009EE409 /* XPRoomGiftAnimationParser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomGiftAnimationParser.m; sourceTree = ""; }; + 9BCB999E28F571B500466D64 /* XPMineCollectPartyRoomViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectPartyRoomViewController.h; sourceTree = ""; }; + 9BCB999F28F571B500466D64 /* XPMineCollectPartyRoomViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCollectPartyRoomViewController.m; sourceTree = ""; }; + 9BCB99A428F582EC00466D64 /* XPMineCollectRoomEditCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectRoomEditCell.h; sourceTree = ""; }; + 9BCB99A528F582EC00466D64 /* XPMineCollectRoomEditCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCollectRoomEditCell.m; sourceTree = ""; }; 9BCD02C52796C02800F396AA /* MicroNobleWaveView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroNobleWaveView.h; sourceTree = ""; }; 9BCD02C62796C02800F396AA /* MicroNobleWaveView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroNobleWaveView.m; sourceTree = ""; }; 9BCE6142277D657600CC0358 /* XPReleaseRadioTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPReleaseRadioTableViewCell.h; sourceTree = ""; }; @@ -1810,6 +1817,8 @@ 9BE29A6C27D210A500446AB5 /* anchor_room_bg.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = anchor_room_bg.svga; sourceTree = ""; }; 9BE2FA8E288010D300EF3D83 /* AnchorRoomSrollTipView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorRoomSrollTipView.h; sourceTree = ""; }; 9BE2FA8F288010D300EF3D83 /* AnchorRoomSrollTipView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorRoomSrollTipView.m; sourceTree = ""; }; + 9BE570BA28F65B7200D491A5 /* XPMineCollectRoomCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineCollectRoomCell.h; sourceTree = ""; }; + 9BE570BB28F65B7200D491A5 /* XPMineCollectRoomCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineCollectRoomCell.m; sourceTree = ""; }; 9BE9F0F727FED12D00667200 /* XPAnchorFansPrivilegeModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorFansPrivilegeModel.h; sourceTree = ""; }; 9BE9F0F827FED12D00667200 /* XPAnchorFansPrivilegeModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorFansPrivilegeModel.m; sourceTree = ""; }; 9BE9F0FA27FED2E100667200 /* XPAnchorFansJoinModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorFansJoinModel.h; sourceTree = ""; }; @@ -4878,6 +4887,16 @@ path = Presenter; sourceTree = ""; }; + 9BCB999D28F5716E00466D64 /* CollectRoom */ = { + isa = PBXGroup; + children = ( + 9BE570B928F65B6000D491A5 /* Cell */, + 9BCB999E28F571B500466D64 /* XPMineCollectPartyRoomViewController.h */, + 9BCB999F28F571B500466D64 /* XPMineCollectPartyRoomViewController.m */, + ); + path = CollectRoom; + sourceTree = ""; + }; 9BD2ECCF288F832300F5CD9A /* FootPrint */ = { isa = PBXGroup; children = ( @@ -5016,6 +5035,17 @@ path = Cell; sourceTree = ""; }; + 9BE570B928F65B6000D491A5 /* Cell */ = { + isa = PBXGroup; + children = ( + 9BE570BA28F65B7200D491A5 /* XPMineCollectRoomCell.h */, + 9BE570BB28F65B7200D491A5 /* XPMineCollectRoomCell.m */, + 9BCB99A428F582EC00466D64 /* XPMineCollectRoomEditCell.h */, + 9BCB99A528F582EC00466D64 /* XPMineCollectRoomEditCell.m */, + ); + path = Cell; + sourceTree = ""; + }; 9BFB10172897C95200B3985E /* NewUserRecharge */ = { isa = PBXGroup; children = ( @@ -8201,6 +8231,7 @@ E8E70D7126F2EB4900F03460 /* View */ = { isa = PBXGroup; children = ( + 9BCB999D28F5716E00466D64 /* CollectRoom */, E8E20BDF281695430033B688 /* Setting */, E800805227FD33950055A8AB /* Guild */, E896EF912771AA6C00AD2CC1 /* Friend */, @@ -9016,6 +9047,7 @@ E86A16C52856DBEC004228B8 /* FindNewGreetListModel.m in Sources */, E81366F826F0C12A0076364C /* LoginFullInfoProtocol.h in Sources */, 9BBC028E2786FA060007C24B /* NobleCardModel.m in Sources */, + 9BCB99A628F582EC00466D64 /* XPMineCollectRoomEditCell.m in Sources */, E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */, E8751E6E28A64F990056EF44 /* XPSailingEmptyTableViewCell.m in Sources */, 9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */, @@ -9053,6 +9085,7 @@ E81C1B1F27705F7A0020D1E4 /* XPArrangeMicViewController.m in Sources */, E8B825C726EA0D9A009E8E9F /* LoginVerifCodeProtocol.h in Sources */, 9BAC92F528E6E63000147DD8 /* XPRoomInsideOperationCell.m in Sources */, + 9BE570BC28F65B7200D491A5 /* XPMineCollectRoomCell.m in Sources */, E86A16C22856D635004228B8 /* XPSessionFindNewGreetTableViewCell.m in Sources */, E824544E26F5BC1A00BE8163 /* XPMineModifPayPwdView.m in Sources */, E86E79CD28A4E045006DAF48 /* MessageContentRiskAlertView.m in Sources */, @@ -9238,6 +9271,7 @@ E852D74728633E92001465ED /* MonentsCommentReplyModel.m in Sources */, 186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */, E8B3E80C2848BA40009746AB /* NewUserGreetModel.m in Sources */, + 9BCB99A028F571B500466D64 /* XPMineCollectPartyRoomViewController.m in Sources */, E81C27AE26EF39AB0031E639 /* AppDelegate+ThirdConfig.m in Sources */, E8AB631028ADD92D0023B0D2 /* XPMonentsTopicRecommondViewController.m in Sources */, E877A7F127842B2F00EFACED /* XPRoomDatingWebAlertView.m in Sources */, diff --git a/xplan-ios/Assets.xcassets/Mine/collectRoom/Contents.json b/xplan-ios/Assets.xcassets/Mine/collectRoom/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/collectRoom/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/Contents.json new file mode 100644 index 00000000..7758741f --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "collect_room_edit_selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "collect_room_edit_selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/collect_room_edit_selected@2x.png b/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_normal.imageset/collect_room_edit_selected@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..76ee2881ff4b3dfac6b1b864660bce266191c79b GIT binary patch literal 395 zcmeAS@N?(olHy`uVBq!ia0vp^Iv~u!3?wz9Rv7~+rvRT2S0Fue=FF*6r*?F702#Bu zV9Jy!KsE%-m@xy+07_1qHVq~NQVe9b^oQC5O%W{#@(X6TEzWvjc^c>U&+m@U&57|e z(N!)jvC!US2~_ad)5S5w;`H6Ao|Bjrd05;P7JNVY_Rs(D=g%&hu(hwd#@WH+5ES^Q z#@XiD5@DZN*WBm#-0tbD?9MF{mk73V>Unq~ljWv#Mx;ZLA$Meg=KC89c+TJ6_)+S@ zhc?kCYo_}9Z zPIgY3Syh6L?T(&5FH=;%nof>5Yw`VIPFZlDUCn~^A6;G?ZhUFl_QUb{gQnQ)1*$K! z=C0OUS61EfWYP-nKl9R`R&LPK{xHiYH$MFMzCXuaY>(ML^ZNZG;z#t$mhvx{9J%i^ P(7Oztu6{1-oD!M)2G8lfDE7rgo{Q3)dNLQ?6e3kJ8g}5x8En+U|?XJ;_2cT5^?y=w3F-BD2TZ7ug$m_vU*zD z-~ajhmbm%riXNJK=gB%nflc2N4?F(*p{rqU`b~&uM#09jPo^$;$QGUX&pEuTK$B}; z_+hr<+GARpvl!(6mReT}+He1QT(D)?1de;*aU|6DFkHQ<|HZd%O$ znN=%=g}1ULch8N?cDUZ27Q-I0_|{d6Fo)-SCM8l<`s_dWO17_dzPjLTXK1SFmFn&| zsW&fIR&xK^T0Bd&L`$hccFOzptvj5bsxrkN{5$)WTe4eclF5r_-Fq0igXE@(94dP& ze9B2l)2kxSskAk2(aVRs_--WZu%7s~_OlrOblNz{R zWJ+@F@DLJ@a69az>v<*NdiAzRF1xSECQMUFF@XN@bv$Go|!lP37c|X;PdUGf6pI0=>C+S^Ta$*BVR*tR<_ZP z+1W-9o=H9JbvreC-4yc$nt8{9@6BAW!`r#=c-N literal 0 HcmV?d00001 diff --git a/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/Contents.json b/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/Contents.json new file mode 100644 index 00000000..7758741f --- /dev/null +++ b/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "collect_room_edit_selected@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "collect_room_edit_selected@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/collect_room_edit_selected@2x.png b/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/collect_room_edit_selected@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..fba0a927579e6bec22b8074c095e6267548735f1 GIT binary patch literal 495 zcmVG=E8@%YZ~_QdSUp z17tntr$yg13#KscHC*b|{zA3Gg8=VBf4_;>4-lB)-jCERVcG5jF;4>Zx084b*c1{= zH;;VjjBN?EDeXvFWaM_Yy|febO8Ov4J$rj l{)5pya{Y%n{hN4#{sGzvK8-UC0@nZl002ovPDHLkV1ljq`GNod literal 0 HcmV?d00001 diff --git a/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/collect_room_edit_selected@3x.png b/xplan-ios/Assets.xcassets/Mine/collectRoom/collect_room_edit_selected.imageset/collect_room_edit_selected@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..1001c1d60148b364e4f799910a83472f0f6d4981 GIT binary patch literal 774 zcmV+h1Nr=kP)Ud`lM$l+_)@?gOKU(DrS%j93oV9VoR&gEar z;$Y6@U&`WN(C1pi;Z@AtTgc>J%;f+7|NZ{|YS89k&E)C$`|tYw!|e5})gV^eP*6Ewz?=bKp&Hw-a z8FW%kQvmngm0cML1oHCa)XBcBpMQ62SUxKe4;(&lwS@ox0s~1zK~z}7?U(CzsxS~n zPq-*5s8nhDA%frq>s{af;ZBv7TCE{Q#SpVJ4aU`{TFJu>;HW35!lnGMsj$hL=7X>Ay%EZ({-p zWc=1-cppK5(R)J-BLW4;s5Xx77>bO$b(JJggw)h@+J`dzX=O(Z(Sl)Bk68pQAXdd( z7-)qd&WjHPqBKd;2oHQ=x(6zT#VibGDIN^I&;F#RVA##VPZB!&lW&zU6=Prum>oV3 z7cw^cyMZMFm(L_1QUi@4+(jrL0pAo-!+{z;GCbj1gDb^6%jV#jr)$9glT&!*vhCw| zAMu6*GcY_(VStf_pDd!X;YbauoNG`{;ee5Z4@c>H$7NyIUQx#36etlF|Bl7+tiv`3 zPpu-QwLff%EN(Q0_<|;dQ_+QCQPW#O>mV2$p`6U|5f-`J<2Ws;;VRC%_*0oucCm&b+SCdNPyKKb!`xz}TT6b$V6m0tqa-FkJdF~I+kt4RMs)W4SXmjnG3 zMSoG!U)S`PM*Y=Qe}UFtG?vG!>e_cl7 *micUsers; +///是否选中 +@property (nonatomic, assign) BOOL isSelected; + @end NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/Api/Api+Mine.h b/xplan-ios/Main/Mine/Api/Api+Mine.h index b1a90be7..36b4ad69 100644 --- a/xplan-ios/Main/Mine/Api/Api+Mine.h +++ b/xplan-ios/Main/Mine/Api/Api+Mine.h @@ -268,7 +268,8 @@ NS_ASSUME_NONNULL_BEGIN /// @param uid 用户的uid /// @param page 当前页数 /// @param pageSize 一页多少个 -+ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize; +/// @param roomType 类型:4:个播房;其他:派对房;不传:所有房间 ++ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize roomType:(NSString *)roomType; @end diff --git a/xplan-ios/Main/Mine/Api/Api+Mine.m b/xplan-ios/Main/Mine/Api/Api+Mine.m index ae8c5c59..c2f605d1 100644 --- a/xplan-ios/Main/Mine/Api/Api+Mine.m +++ b/xplan-ios/Main/Mine/Api/Api+Mine.m @@ -297,8 +297,9 @@ /// @param uid 用户的uid /// @param page 当前页数 /// @param pageSize 一页多少个 -+ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize { - [self makeRequest:@"fans/fansRoomList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,uid , page, pageSize,nil]; +/// @param roomType 类型:4:个播房;其他:派对房;不传:所有房间 ++ (void)requestMineCollectRoomList:(HttpRequestHelperCompletion)completion uid:(NSString *)uid page:(NSString *)page pageSize:(NSString *)pageSize roomType:(NSString *)roomType { + [self makeRequest:@"fans/fansRoomList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__,uid , page, pageSize, roomType, nil]; } @end diff --git a/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.h b/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.h index 0c47be79..579496fe 100644 --- a/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.h +++ b/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.h @@ -14,7 +14,11 @@ NS_ASSUME_NONNULL_BEGIN /// 获取收藏房间列表 /// @param page 当前的页数 /// @param pageSize 一页多少个 -- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state; +/// @param type 类型:4:个播房;其他:派对房;不传:所有房间 +- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state type:(NSString *)type; + +///批量删除收藏的房间 +- (void)deletecollectRoomWithRoomUids:(NSString *)roomUids; @end diff --git a/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.m b/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.m index eb0672f6..9746e835 100644 --- a/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.m +++ b/xplan-ios/Main/Mine/Presenter/XPMineCollectRoomListPresenter.m @@ -7,6 +7,7 @@ #import "XPMineCollectRoomListPresenter.h" #import "Api+Mine.h" +#import "Api+Room.h" #import "XPMineCollectRoomListProtocol.h" #import "AccountInfoStorage.h" #import "HomeCollectRoomModel.h" @@ -16,14 +17,24 @@ /// 获取收藏房间列表 /// @param page 当前的页数 /// @param pageSize 一页多少个 -- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state { +/// @param type 类型:4:个播房;其他:派对房;不传:所有房间 +- (void)getCollectRoomList:(int)page pageSize:(int)pageSize state:(int)state type:(NSString *)type { NSString * uid = [AccountInfoStorage instance].getUid; [Api requestMineCollectRoomList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { NSArray * array = [HomeCollectRoomModel modelsWithArray:data.data[@"fansRoomList"]]; [[self getView] onGetCollectRoomListSuccess:array state:state]; } fail:^(NSInteger code, NSString * _Nullable msg) { [[self getView] getCollectRoomListFail:state]; - }] uid:uid page:[NSString stringWithFormat:@"%d", page] pageSize:[NSString stringWithFormat:@"%d", pageSize]]; + }] uid:uid page:[NSString stringWithFormat:@"%d", page] pageSize:[NSString stringWithFormat:@"%d", pageSize] roomType:type.length ? type : NULL]; +} + +///批量删除收藏的房间 +- (void)deletecollectRoomWithRoomUids:(NSString *)roomUids { + NSString * type = @"3"; + NSString * uid = [AccountInfoStorage instance].getUid; + [Api collectRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + [[self getView] deleteCollectRoomSuccess]; + }] roomUid:@"" uid:uid type:type roomUids:roomUids]; } @end diff --git a/xplan-ios/Main/Mine/Presenter/XPMineFootPrintPresenter.m b/xplan-ios/Main/Mine/Presenter/XPMineFootPrintPresenter.m index db9e409e..cfe36cde 100644 --- a/xplan-ios/Main/Mine/Presenter/XPMineFootPrintPresenter.m +++ b/xplan-ios/Main/Mine/Presenter/XPMineFootPrintPresenter.m @@ -43,7 +43,7 @@ NSString * uid = [AccountInfoStorage instance].getUid; [Api collectRoom:[self createHttpCompletion:^(BaseModel * _Nonnull data) { [[self getView] collectRoomSuccess]; - }] roomUid:roomUid uid:uid type:type]; + }] roomUid:roomUid uid:uid type:type roomUids:NULL]; } @end diff --git a/xplan-ios/Main/Mine/Protocol/XPMineCollectRoomListProtocol.h b/xplan-ios/Main/Mine/Protocol/XPMineCollectRoomListProtocol.h index d16b55ea..49c9da83 100644 --- a/xplan-ios/Main/Mine/Protocol/XPMineCollectRoomListProtocol.h +++ b/xplan-ios/Main/Mine/Protocol/XPMineCollectRoomListProtocol.h @@ -15,4 +15,7 @@ ///获取收藏房间列表失败 - (void)getCollectRoomListFail:(int)state; +///批量删除收藏的房间成功 +- (void)deleteCollectRoomSuccess; + @end diff --git a/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.h b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.h new file mode 100644 index 00000000..ef9b05f2 --- /dev/null +++ b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.h @@ -0,0 +1,19 @@ +// +// XPMineCollectRoomCell.h +// xplan-ios +// +// Created by GreenLand on 2022/10/12. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class HomeCollectRoomModel; +@interface XPMineCollectRoomCell : UITableViewCell + +@property (nonatomic,strong) HomeCollectRoomModel *roomInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.m b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.m new file mode 100644 index 00000000..bf166a9d --- /dev/null +++ b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomCell.m @@ -0,0 +1,126 @@ +// +// XPMineCollectRoomCell.m +// xplan-ios +// +// Created by GreenLand on 2022/10/12. +// + +#import "XPMineCollectRoomCell.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "NetImageView.h" +#import "UIImage+Utils.h" +///Model +#import "HomeCollectRoomModel.h" + +@interface XPMineCollectRoomCell () + +///显示头像 +@property (nonatomic,strong) NetImageView *avatarImageView; +///显示名字 +@property (nonatomic,strong) UILabel *nickLabel; +///显示id +@property (nonatomic,strong) UILabel *idLabel; +///分割线 +@property (nonatomic, strong) UIView *devideView; + +@end + +@implementation XPMineCollectRoomCell + +- (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.avatarImageView]; + [self.contentView addSubview:self.nickLabel]; + [self.contentView addSubview:self.idLabel]; + [self.contentView addSubview:self.devideView]; +} + +- (void)initSubViewConstraints { + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(44, 44)); + make.left.mas_equalTo(self.contentView).offset(15); + make.centerY.mas_equalTo(self.contentView); + }]; + [self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.avatarImageView.mas_right).offset(7); + make.top.mas_equalTo(self.avatarImageView).offset(2); + make.right.mas_equalTo(-15); + make.height.mas_equalTo(14); + }]; + [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nickLabel.mas_bottom).mas_offset(8); + make.left.mas_equalTo(self.nickLabel); + make.height.mas_equalTo(14); + }]; + + [self.devideView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nickLabel); + make.height.mas_equalTo(0.5); + make.right.bottom.mas_equalTo(0); + }]; + +} + +#pragma mark - Getters And Setters +- (void)setRoomInfo:(HomeCollectRoomModel *)roomInfo { + _roomInfo = roomInfo; + if (_roomInfo) { + self.avatarImageView.imageUrl = _roomInfo.roomAvatar; + self.nickLabel.text = _roomInfo.roomName; + self.idLabel.text = [NSString stringWithFormat:@"ID:%@", _roomInfo.erbanNo]; + } +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.imageType = ImageTypeUserIcon; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.layer.masksToBounds = YES; + _avatarImageView.layer.cornerRadius = 22; + _avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor; + } + return _avatarImageView; +} + +- (UILabel *)nickLabel { + if (!_nickLabel) { + _nickLabel = [[UILabel alloc] init]; + _nickLabel.font = [UIFont systemFontOfSize:14]; + _nickLabel.textColor = [ThemeColor mainTextColor]; + } + return _nickLabel; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [[UILabel alloc] init]; + _idLabel.font = [UIFont systemFontOfSize:12]; + _idLabel.textColor = [ThemeColor secondTextColor]; + } + return _idLabel; +} + +- (UIView *)devideView { + if (!_devideView) { + _devideView = [[UIView alloc] init]; + _devideView.backgroundColor = UIColorFromRGB(0xEAEAF1); + } + return _devideView; +} + +@end diff --git a/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.h b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.h new file mode 100644 index 00000000..da114775 --- /dev/null +++ b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.h @@ -0,0 +1,18 @@ +// +// XPMineCollectRoomEditCell.h +// xplan-ios +// +// Created by GreenLand on 2022/10/11. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class HomeCollectRoomModel; +@interface XPMineCollectRoomEditCell : UITableViewCell +@property (nonatomic,strong) HomeCollectRoomModel *roomInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.m b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.m new file mode 100644 index 00000000..0c6adc7b --- /dev/null +++ b/xplan-ios/Main/Mine/View/CollectRoom/Cell/XPMineCollectRoomEditCell.m @@ -0,0 +1,145 @@ +// +// XPMineCollectRoomEditCell.m +// xplan-ios +// +// Created by GreenLand on 2022/10/11. +// + +#import "XPMineCollectRoomEditCell.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "NetImageView.h" +#import "UIImage+Utils.h" +///Model +#import "HomeCollectRoomModel.h" + +@interface XPMineCollectRoomEditCell () + +///显示头像 +@property (nonatomic,strong) NetImageView *avatarImageView; +///显示名字 +@property (nonatomic,strong) UILabel *nickLabel; +///显示id +@property (nonatomic,strong) UILabel *idLabel; +///选中按钮 +@property (nonatomic, strong) UIButton *selectBtn; +///分割线 +@property (nonatomic, strong) UIView *devideView; + +@end + +@implementation XPMineCollectRoomEditCell + +- (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.avatarImageView]; + [self.contentView addSubview:self.nickLabel]; + [self.contentView addSubview:self.idLabel]; + [self.contentView addSubview:self.devideView]; + [self.contentView addSubview:self.selectBtn]; +} + +- (void)initSubViewConstraints { + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(44, 44)); + make.left.mas_equalTo(self.selectBtn.mas_right).offset(15); + make.centerY.mas_equalTo(self.contentView); + }]; + [self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.avatarImageView.mas_right).offset(7); + make.top.mas_equalTo(self.avatarImageView).offset(2); + make.right.mas_equalTo(-15); + make.height.mas_equalTo(14); + }]; + [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nickLabel.mas_bottom).mas_offset(8); + make.left.mas_equalTo(self.nickLabel); + make.height.mas_equalTo(14); + }]; + + [self.devideView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nickLabel); + make.height.mas_equalTo(0.5); + make.right.bottom.mas_equalTo(0); + }]; + + [self.selectBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(20, 20)); + make.left.mas_equalTo(15); + make.centerY.mas_equalTo(self.contentView); + }]; +} + +#pragma mark - Getters And Setters +- (void)setRoomInfo:(HomeCollectRoomModel *)roomInfo { + _roomInfo = roomInfo; + if (_roomInfo) { + self.avatarImageView.imageUrl = _roomInfo.roomAvatar; + self.nickLabel.text = _roomInfo.roomName; + self.idLabel.text = [NSString stringWithFormat:@"ID:%@", _roomInfo.erbanNo]; + self.selectBtn.selected = roomInfo.isSelected; + } +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.imageType = ImageTypeUserIcon; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.layer.masksToBounds = YES; + _avatarImageView.layer.cornerRadius = 22; + _avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor; + } + return _avatarImageView; +} + +- (UILabel *)nickLabel { + if (!_nickLabel) { + _nickLabel = [[UILabel alloc] init]; + _nickLabel.font = [UIFont systemFontOfSize:14]; + _nickLabel.textColor = [ThemeColor mainTextColor]; + } + return _nickLabel; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [[UILabel alloc] init]; + _idLabel.font = [UIFont systemFontOfSize:12]; + _idLabel.textColor = [ThemeColor secondTextColor]; + } + return _idLabel; +} + +- (UIButton *)selectBtn { + if (!_selectBtn) { + _selectBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + [_selectBtn setImage:[UIImage imageNamed:@"collect_room_edit_normal"] forState:UIControlStateNormal]; + [_selectBtn setImage:[UIImage imageNamed:@"collect_room_edit_selected"] forState:UIControlStateSelected]; + _selectBtn.userInteractionEnabled = NO; + } + return _selectBtn; +} + +- (UIView *)devideView { + if (!_devideView) { + _devideView = [[UIView alloc] init]; + _devideView.backgroundColor = UIColorFromRGB(0xEAEAF1); + } + return _devideView; +} + +@end diff --git a/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.h b/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.h new file mode 100644 index 00000000..cacf4c0f --- /dev/null +++ b/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.h @@ -0,0 +1,32 @@ +// +// XPMineCollectPartyRoomViewController.h +// xplan-ios +// +// Created by GreenLand on 2022/10/11. +// + +#import "MvpViewController.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, MineCollectRoomType) { + MineCollectRoomTypeParty, + MineCollectRoomTypeAnchor +}; + +@interface XPMineCollectPartyRoomViewController : MvpViewController + +@property (nonatomic, assign) MineCollectRoomType type; +///数据源 +@property (nonatomic,strong, readonly) NSMutableArray *datasource; +///是否为编辑模式 +@property (nonatomic, assign) BOOL isEdit; +///是否选中所有 +@property (nonatomic, assign) BOOL isSelectAll; +///刷新数据 +- (void)headerRefresh; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m b/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m new file mode 100644 index 00000000..f0c20031 --- /dev/null +++ b/xplan-ios/Main/Mine/View/CollectRoom/XPMineCollectPartyRoomViewController.m @@ -0,0 +1,226 @@ +// +// XPMineCollectPartyRoomViewController.m +// xplan-ios +// +// Created by GreenLand on 2022/10/11. +// + +#import "XPMineCollectPartyRoomViewController.h" +///Third +#import +#import +///Tool +#import "ThemeColor.h" +#import "XPMacro.h" +///Model +#import "HomeCollectRoomModel.h" +///P +#import "XPMineCollectRoomListPresenter.h" +#import "XPMineCollectRoomListProtocol.h" +///View +#import "XPMineCollectRoomCell.h" +#import "XPMineVisitorEmptyTableViewCell.h" +#import "XPMineCollectRoomEditCell.h" +///VC +#import "XPRoomViewController.h" + +@interface XPMineCollectPartyRoomViewController () + +///列表 +@property (nonatomic,strong) UITableView *tableView; +///数据源 +@property (nonatomic,strong) NSMutableArray *datasource; +///当前页数 +@property (nonatomic,assign) int page; +///更多数据 +@property (nonatomic,assign) BOOL hasNoMoreData; + +@end + +@implementation XPMineCollectPartyRoomViewController + +#pragma mark - JXCategoryListContentViewDelegate +- (UIView *)listView { + return self.view; +} + +- (XPMineCollectRoomListPresenter *)createPresenter { + return [[XPMineCollectRoomListPresenter alloc] init]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self initHeaderAndFooterRrfresh]; + [self initSubViews]; + [self initSubViewConstraints]; +} + +#pragma mark - 下拉刷新 +- (void)initHeaderAndFooterRrfresh { + MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)]; + header.stateLabel.font = [UIFont systemFontOfSize:10.0]; + header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0]; + header.stateLabel.textColor = [ThemeColor secondTextColor]; + header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor]; + self.tableView.mj_header = header; + + MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)]; + footer.stateLabel.textColor = [ThemeColor secondTextColor]; + footer.stateLabel.font = [UIFont systemFontOfSize:10.0]; + self.tableView.mj_footer = footer; + + [self headerRefresh]; +} + +#pragma mark - 刷新的fangfa +- (void)headerRefresh { + self.page = 1; + [self.presenter getCollectRoomList:self.page pageSize:20 state:0 type:self.type == MineCollectRoomTypeParty ? @"1" : @"4"]; +} + +- (void)footerRefresh { + if (self.hasNoMoreData) { + [self showErrorToast:@"没有更多收藏记录了"]; + return; + } + self.page++; + [self.presenter getCollectRoomList:self.page pageSize:20 state:1 type:self.type == MineCollectRoomTypeParty ? @"1" : @"4"]; +} + +#pragma mark - Private Method +- (void)initSubViews { + self.title = @"收藏的房间"; + [self.view addSubview:self.tableView]; +} + +- (void)initSubViewConstraints { + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.view); + }]; +} + +#pragma mark - XPMineCollectRoomListProtocol +///获取访客列表成功 +- (void)onGetCollectRoomListSuccess:(NSArray *)array state:(int)state { + if (state == 0) { + [self.datasource removeAllObjects]; + [self.tableView.mj_header endRefreshing]; + } + [self.tableView.mj_footer endRefreshing]; + if (array.count > 0) { + self.hasNoMoreData = NO; + [self.datasource addObjectsFromArray:array]; + } else { + self.hasNoMoreData = YES; + [self.tableView.mj_footer endRefreshingWithNoMoreData]; + } + [self.tableView reloadData]; +} + +///获取访客列表失败 +- (void)getCollectRoomListFail:(int)state { + if (state == 0) { + [self.tableView.mj_header endRefreshing]; + } else { + [self.tableView.mj_footer endRefreshing]; + } +} + +#pragma mark - UITableViewDelegate And UITableViewDataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.datasource.count > 0 ? self.datasource.count : 1; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + if (self.datasource.count > 0) { + if (self.isEdit) { + XPMineCollectRoomEditCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineCollectRoomEditCell class])]; + if (cell == nil) { + cell = [[XPMineCollectRoomEditCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCollectRoomEditCell class])]; + } + cell.roomInfo = [self.datasource objectAtIndex:indexPath.row]; + return cell; + } else { + XPMineCollectRoomCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineCollectRoomCell class])]; + if (cell == nil) { + cell = [[XPMineCollectRoomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineCollectRoomCell class])]; + } + cell.roomInfo = [self.datasource objectAtIndex:indexPath.row]; + return cell; + } + } + + XPMineVisitorEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])]; + if (cell == nil) { + cell = [[XPMineVisitorEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])]; + } + cell.emptyTitle = @"暂无收藏的房间"; + return cell; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 68; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + HomeCollectRoomModel * roomInfo = [self.datasource objectAtIndex:indexPath.row]; + if (self.isEdit) { + roomInfo.isSelected = !roomInfo.isSelected; + [tableView reloadData]; + } else { + if (roomInfo.roomUid.integerValue > 0) { + [XPRoomViewController openRoom:roomInfo.roomUid viewController:self]; + } + } +} + +- (void)setIsEdit:(BOOL)isEdit { + _isEdit = isEdit; + for (HomeCollectRoomModel *model in self.datasource) { + model.isSelected = NO; + } + [self.tableView reloadData]; +} + +- (void)setIsSelectAll:(BOOL)isSelectAll { + _isSelectAll = isSelectAll; + if (isSelectAll) { + for (HomeCollectRoomModel *model in self.datasource) { + model.isSelected = YES; + } + } else { + for (HomeCollectRoomModel *model in self.datasource) { + model.isSelected = NO; + } + } + [self.tableView reloadData]; +} + +#pragma mark - Getters And Setters +- (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]; + if (@available(iOS 11.0, *)) { + _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + _tableView.contentInset = UIEdgeInsetsMake(8, 0, 0, 0); + [_tableView registerClass:[XPMineVisitorEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])]; + [_tableView registerClass:[XPMineCollectRoomCell class] forCellReuseIdentifier:NSStringFromClass([XPMineCollectRoomCell class])]; + [_tableView registerClass:[XPMineCollectRoomEditCell class] forCellReuseIdentifier:NSStringFromClass([XPMineCollectRoomEditCell class])]; + } + return _tableView; +} + +- (NSMutableArray *)datasource { + if (!_datasource) { + _datasource = [NSMutableArray array]; + } + return _datasource; +} + +@end diff --git a/xplan-ios/Main/Mine/View/XPMineCollectRoomListViewController.m b/xplan-ios/Main/Mine/View/XPMineCollectRoomListViewController.m index ae54f2e9..ae166328 100644 --- a/xplan-ios/Main/Mine/View/XPMineCollectRoomListViewController.m +++ b/xplan-ios/Main/Mine/View/XPMineCollectRoomListViewController.m @@ -9,8 +9,12 @@ ///Third #import #import +#import +#import ///Tool #import "ThemeColor.h" +#import "XPMacro.h" +#import "UIImage+Utils.h" ///Model #import "HomeCollectRoomModel.h" ///View @@ -21,16 +25,32 @@ #import "XPMineCollectRoomListProtocol.h" ///VC #import "XPRoomViewController.h" +#import "XPMineCollectPartyRoomViewController.h" + +///记录最后选中的tab +static NSString *lastSelectTab = @"lastSelectTab"; + +@interface XPMineCollectRoomListViewController () + +@property (nonatomic, strong) JXCategoryListContainerView *listContainerView; +///标题 +@property (nonatomic,strong) NSArray *titles; +///滑块 +@property (nonatomic,strong) JXCategoryTitleView *titleView; + +@property (nonatomic,strong) XPMineCollectPartyRoomViewController *partyVC; +///个播房的 +@property (nonatomic, strong) XPMineCollectPartyRoomViewController *anchorRoomListVC; -@interface XPMineCollectRoomListViewController () -///列表 -@property (nonatomic,strong) UITableView *tableView; -///数据源 -@property (nonatomic,strong) NSMutableArray *datasource; -///当前页数 -@property (nonatomic,assign) int page; ///更多数据 @property (nonatomic,assign) BOOL hasNoMoreData; +///底部编辑容器 +@property (nonatomic, strong) UIView *bottomView; +///全选按钮 +@property (nonatomic, strong) UIButton *allSelectBtn; +///删除按钮 +@property (nonatomic, strong) UIButton *deleteBtn; + @end @implementation XPMineCollectRoomListViewController @@ -41,141 +61,249 @@ - (void)viewDidLoad { [super viewDidLoad]; - [self initHeaderAndFooterRrfresh]; [self initSubViews]; [self initSubViewConstraints]; + [self addNavigationItemWithTitles:@[@"管理"] titleColor:UIColorFromRGB(0x999999) isLeft:NO target:self action:@selector(managerButtonClick:) tags:nil]; } -#pragma mark - 下拉刷新 -- (void)initHeaderAndFooterRrfresh { - MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)]; - header.stateLabel.font = [UIFont systemFontOfSize:10.0]; - header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0]; - header.stateLabel.textColor = [ThemeColor secondTextColor]; - header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor]; - self.tableView.mj_header = header; - - MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)]; - footer.stateLabel.textColor = [ThemeColor secondTextColor]; - footer.stateLabel.font = [UIFont systemFontOfSize:10.0]; - self.tableView.mj_footer = footer; - - [self headerRefresh]; -} - -#pragma mark - 刷新的fangfa -- (void)headerRefresh { - self.page = 1; - [self.presenter getCollectRoomList:self.page pageSize:20 state:0]; -} - -- (void)footerRefresh { - if (self.hasNoMoreData) { - [self showErrorToast:@"没有更多收藏记录了"]; - return; +- (void)managerButtonClick:(UIButton *)sender { + sender.selected = !sender.isSelected; + if (sender.isSelected) {//开始编辑 + self.partyVC.isEdit = YES; + self.anchorRoomListVC.isEdit = YES; + [sender setTitle:@"完成" forState:UIControlStateSelected]; + [sender setTitleColor:UIColorFromRGB(0x999999) forState:UIControlStateSelected]; + self.bottomView.hidden = NO; + } else {//完成编辑 + [sender setTitle:@"管理" forState:UIControlStateNormal]; + [sender setTitleColor:UIColorFromRGB(0x999999) forState:UIControlStateNormal]; + self.bottomView.hidden = YES; + self.allSelectBtn.selected = NO; + self.partyVC.isEdit = NO; + self.anchorRoomListVC.isEdit = NO; + self.allSelectBtn.selected = NO; } - self.page++; - [self.presenter getCollectRoomList:self.page pageSize:20 state:1]; +} + +#pragma mark - JXCategoryListContainerViewDelegate +- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView { + return self.titles.count; +} + +// 根据下标 index 返回对应遵守并实现 `JXCategoryListContentViewDelegate` 协议的列表实例 +- (id)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index { + if (index == 0) { + return self.partyVC; + }else if (index == 1) { + return self.anchorRoomListVC; + } + return nil; +} + +#pragma mark - JXCategoryViewDelegate +- (void)categoryView:(JXCategoryBaseView *)categoryView didSelectedItemAtIndex:(NSInteger)index { + //记录最后选中的index + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + [defaults setObject:@(index) forKey:lastSelectTab]; + [defaults synchronize]; +} + +#pragma mark - XPMineCollectRoomListProtocol +- (void)deleteCollectRoomSuccess { + [self showSuccessToast:@"取消收藏成功"]; + if (self.titleView.selectedIndex == 0) { + [self.partyVC headerRefresh]; + } else { + [self.anchorRoomListVC headerRefresh]; + } + self.allSelectBtn.selected = NO; } #pragma mark - Private Method - (void)initSubViews { self.title = @"收藏的房间"; - [self.view addSubview:self.tableView]; + [self.view addSubview:self.titleView]; + [self.view addSubview:self.listContainerView]; + [self.view addSubview:self.bottomView]; + [self.bottomView addSubview:self.allSelectBtn]; + [self.bottomView addSubview:self.deleteBtn]; } - (void)initSubViewConstraints { - [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { - make.edges.mas_equalTo(self.view); + [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.view); + make.width.mas_equalTo(180); + make.top.mas_equalTo(0); + make.height.mas_equalTo(44); + }]; + [self.listContainerView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.bottom.mas_equalTo(self.view); + make.top.mas_equalTo(self.titleView.mas_bottom); + }]; + [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(64+kSafeAreaBottomHeight); + make.left.bottom.right.mas_equalTo(0); + }]; + [self.allSelectBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(64); + make.height.mas_equalTo(22); + make.left.mas_equalTo(15); + make.top.mas_equalTo(18); + }]; + [self.deleteBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-15); + make.centerY.mas_equalTo(self.allSelectBtn); + make.size.mas_equalTo(CGSizeMake(72, 24)); }]; } -#pragma mark - XPMineCollectRoomListProtocol - -///获取访客列表成功 -- (void)onGetCollectRoomListSuccess:(NSArray *)array state:(int)state { - if (state == 0) { - [self.datasource removeAllObjects]; - [self.tableView.mj_header endRefreshing]; - } - [self.tableView.mj_footer endRefreshing]; - if (array.count > 0) { - self.hasNoMoreData = NO; - [self.datasource addObjectsFromArray:array]; +#pragma mark - action +- (void)allSelectBtnAction:(UIButton *)sender { + sender.selected = !sender.selected; + if (self.titleView.selectedIndex == 0) { + self.partyVC.isSelectAll = sender.selected; } else { - self.hasNoMoreData = YES; - [self.tableView.mj_footer endRefreshingWithNoMoreData]; - } - [self.tableView reloadData]; -} - -///获取访客列表失败 -- (void)getCollectRoomListFail:(int)state { - if (state == 0) { - [self.tableView.mj_header endRefreshing]; - } else { - [self.tableView.mj_footer endRefreshing]; + self.anchorRoomListVC.isSelectAll = sender.selected; } } -#pragma mark - UITableViewDelegate And UITableViewDataSource -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return self.datasource.count > 0 ? self.datasource.count : 1; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - if (self.datasource.count > 0) { - XPHomeCollectRoomTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPHomeCollectRoomTableViewCell class])]; - if (cell == nil) { - cell = [[XPHomeCollectRoomTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPHomeCollectRoomTableViewCell class])]; +- (void)deleteBtnAction:(UIButton *)sender { + if (self.titleView.selectedIndex == 0) { + NSMutableArray *roomUidsArray = [NSMutableArray array]; + for (HomeCollectRoomModel *model in self.partyVC.datasource) { + if (model.isSelected) { + [roomUidsArray addObject:model.roomUid]; + } + } + if (roomUidsArray.count) { + NSString *roomUids = [roomUidsArray componentsJoinedByString:@","]; + [self.presenter deletecollectRoomWithRoomUids:roomUids]; + } else { + [self showErrorToast:@"请选择房间"]; + } + } else { + NSMutableArray *roomUidsArray = [NSMutableArray array]; + for (HomeCollectRoomModel *model in self.anchorRoomListVC.datasource) { + if (model.isSelected) { + [roomUidsArray addObject:model.roomUid]; + } + } + if (roomUidsArray.count) { + NSString *roomUids = [roomUidsArray componentsJoinedByString:@","]; + [self.presenter deletecollectRoomWithRoomUids:roomUids]; + } else { + [self showErrorToast:@"请选择房间"]; } - cell.roomInfo = [self.datasource objectAtIndex:indexPath.row]; - return cell; } - - XPMineVisitorEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])]; - if (cell == nil) { - cell = [[XPMineVisitorEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])]; - } - cell.emptyTitle = @"暂无收藏的房间"; - return cell; -} - -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 66 + 8 + 10; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - HomeCollectRoomModel * roomInfo = [self.datasource objectAtIndex:indexPath.row]; - if (roomInfo.roomUid.integerValue > 0) { - [XPRoomViewController openRoom:roomInfo.roomUid viewController:self]; - } } #pragma mark - Getters And Setters -- (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]; - if (@available(iOS 11.0, *)) { - _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } - _tableView.contentInset = UIEdgeInsetsMake(8, 0, 0, 0); - [_tableView registerClass:[XPMineVisitorEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineVisitorEmptyTableViewCell class])]; - [_tableView registerClass:[XPHomeCollectRoomTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPHomeCollectRoomTableViewCell class])]; +- (UIView *)bottomView { + if (!_bottomView) { + _bottomView = [[UIView alloc] init]; + _bottomView.backgroundColor = [UIColor whiteColor]; + _bottomView.hidden = YES; + UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, 64+kSafeAreaBottomHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)]; + CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init]; + maskLayer.frame = CGRectMake(0, 0, KScreenWidth, 64+kSafeAreaBottomHeight); + maskLayer.path = maskPath.CGPath; + _bottomView.layer.mask = maskLayer; } - return _tableView; + return _bottomView; } -- (NSMutableArray *)datasource { - if (!_datasource) { - _datasource = [NSMutableArray array]; +- (UIButton *)allSelectBtn { + if (!_allSelectBtn) { + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + button.titleLabel.font = [UIFont systemFontOfSize:16]; + [button addTarget:self action:@selector(allSelectBtnAction:) forControlEvents:UIControlEventTouchUpInside]; + [button setTitle:@"全选" forState:UIControlStateNormal]; + [button setTitleColor:[ThemeColor mainTextColor] forState:UIControlStateNormal]; + [button setImage:[UIImage imageNamed:@"collect_room_edit_normal"] forState:UIControlStateNormal]; + [button setImage:[UIImage imageNamed:@"collect_room_edit_selected"] forState:UIControlStateSelected]; + _allSelectBtn = button; } - return _datasource; + return _allSelectBtn; +} + +- (UIButton *)deleteBtn { + if (!_deleteBtn) { + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + button.titleLabel.font = [UIFont systemFontOfSize:14]; + [button addTarget:self action:@selector(deleteBtnAction:) forControlEvents:UIControlEventTouchUpInside]; + [button setTitle:@"删除" forState:UIControlStateNormal]; + [button setTitleColor:UIColorFromRGB(0xFB486A) forState:UIControlStateNormal]; + button.layer.cornerRadius = 12; + button.layer.masksToBounds = YES; + button.layer.borderWidth = 1; + button.layer.borderColor = UIColorFromRGB(0xFB486A).CGColor; + _deleteBtn = button; + } + return _deleteBtn; +} + +#pragma mark - Getters And Setters +- (JXCategoryListContainerView *)listContainerView { + if (!_listContainerView) { + _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self]; + _listContainerView.scrollView.scrollEnabled = YES; + _listContainerView.scrollView.tag = 1000; + _listContainerView.listCellBackgroundColor = [UIColor clearColor]; + } + return _listContainerView; +} + +- (XPMineCollectPartyRoomViewController *)partyVC { + if (!_partyVC) { + _partyVC = [[XPMineCollectPartyRoomViewController alloc] init]; + _partyVC.type = MineCollectRoomTypeParty; + } + return _partyVC; +} + +- (XPMineCollectPartyRoomViewController *)anchorRoomListVC { + if (!_anchorRoomListVC) { + _anchorRoomListVC = [[XPMineCollectPartyRoomViewController alloc] init]; + _anchorRoomListVC.type = MineCollectRoomTypeAnchor; + } + return _anchorRoomListVC; +} + +- (NSArray *)titles { + if (!_titles) { + _titles = @[@"派对房", @"直播房"]; + } + return _titles; +} + +- (JXCategoryTitleView *)titleView { + if (!_titleView) { + _titleView = [[JXCategoryTitleView alloc] initWithFrame:CGRectZero]; + _titleView.backgroundColor =[UIColor clearColor]; + _titleView.titleColor = [ThemeColor secondTextColor]; + _titleView.titleSelectedColor = [ThemeColor mainTextColor]; + _titleView.titleFont = [UIFont systemFontOfSize:14 weight:UIFontWeightSemibold]; + _titleView.titleSelectedFont = [UIFont systemFontOfSize:14 weight:UIFontWeightHeavy]; + _titleView.titleLabelAnchorPointStyle = JXCategoryTitleLabelAnchorPointStyleCenter; + _titleView.contentScrollViewClickTransitionAnimationEnabled = NO; + _titleView.averageCellSpacingEnabled = YES; + _titleView.listContainer = self.listContainerView; + _titleView.titles = self.titles; + _titleView.delegate = self; + + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + NSNumber *index = [defaults objectForKey:lastSelectTab]; + _titleView.defaultSelectedIndex = index.intValue; + + JXCategoryIndicatorImageView *lineView = [[JXCategoryIndicatorImageView alloc] init]; + lineView.indicatorImageViewSize = CGSizeMake(50, 8); + lineView.verticalMargin = 12; + lineView.indicatorImageView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x5BC8F8),UIColorFromRGB(0x66D9D9)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(50, 8)]; + lineView.indicatorImageView.layer.masksToBounds = YES; + lineView.indicatorImageView.layer.cornerRadius = 4; + _titleView.indicators = @[lineView]; + } + return _titleView; } @end diff --git a/xplan-ios/Main/Room/Api/Api+Room.h b/xplan-ios/Main/Room/Api/Api+Room.h index fc9a3627..9cb15de2 100644 --- a/xplan-ios/Main/Room/Api/Api+Room.h +++ b/xplan-ios/Main/Room/Api/Api+Room.h @@ -95,11 +95,13 @@ NS_ASSUME_NONNULL_BEGIN /// @param completion 完成 /// @param roomUid 房间的uid /// @param uid uid -/// @param type 1 收藏 2 取消收藏 +/// @param type 1 收藏 2 取消收藏 3:批量取消收藏 +/// @param roomUids 批量删除的房间uid,用逗号隔开 + (void)collectRoom:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid - type:(NSString *)type; + type:(NSString *)type + roomUids:(NSString *)roomUids; /// 改变相亲的状态的 /// @param completion 完成 diff --git a/xplan-ios/Main/Room/Api/Api+Room.m b/xplan-ios/Main/Room/Api/Api+Room.m index 3f58121b..a7782791 100644 --- a/xplan-ios/Main/Room/Api/Api+Room.m +++ b/xplan-ios/Main/Room/Api/Api+Room.m @@ -105,9 +105,10 @@ /// @param completion 完成 /// @param roomUid 房间的uid /// @param uid uid -/// @param type 1 收藏 2 取消收藏 -+ (void)collectRoom:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid type:(NSString *)type { - [self makeRequest:@"fans/fansRoom" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, uid, type, nil]; +/// @param type 1 收藏 2 取消收藏 3:批量取消收藏 +/// @param roomUids 批量删除的房间uid,用逗号隔开 ++ (void)collectRoom:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid uid:(NSString *)uid type:(NSString *)type roomUids:(NSString *)roomUids { + [self makeRequest:@"fans/fansRoom" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roomUid, uid, type, roomUids, nil]; } diff --git a/xplan-ios/Main/Room/View/RoomHeaderView/RoomHeaderView.m b/xplan-ios/Main/Room/View/RoomHeaderView/RoomHeaderView.m index 6e6eff6b..5bfd03cc 100644 --- a/xplan-ios/Main/Room/View/RoomHeaderView/RoomHeaderView.m +++ b/xplan-ios/Main/Room/View/RoomHeaderView/RoomHeaderView.m @@ -300,7 +300,7 @@ } else { [XCHUDTool showErrorWithMessage:msg]; } - } roomUid:roomUid uid:uid type:type]; + } roomUid:roomUid uid:uid type:type roomUids:NULL]; } #pragma mark - XCShareViewDelegate