MOGuildApplyVC.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. //
  2. // MOGuildApplyVC.m
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/10/26.
  6. //
  7. #import "MOGuildApplyVC.h"
  8. #import "MOGuildInputBaseCell.h"
  9. #import "MOGuildImageOrTextBaseCell.h"
  10. #import "MOGuildImageArrCell.h"
  11. #import "MOImagePickerController.h"
  12. #import "MOSelectPartitionVC.h"
  13. #import "MOUserGuild.h"
  14. #import "MOGuildNewInputCell.h"
  15. #import "MOGuildPhoneNumCell.h"
  16. #import "MOGuildAppInfoCell.h"
  17. #import "MOGuildRequireInfoCell.h"
  18. #import "MOGuildSureCell.h"
  19. #import "UIImage+YYAdd.h"
  20. #define AvatarIndexPathRow 5
  21. #define AnchorPhotosIndexPathRow 6
  22. #define ApplyBtnPathRow 8
  23. @interface MOGuildApplyVC ()<UITableViewDelegate,UITableViewDataSource,TZImagePickerControllerDelegate>
  24. @property (weak, nonatomic) IBOutlet UIImageView *bgImgView;
  25. @property (weak, nonatomic) IBOutlet UITableView *tableView;
  26. #pragma mark - 请求参数
  27. @property (nonatomic, copy) NSString *guildNameString;
  28. @property (nonatomic, copy) NSString *phoneCodeString;
  29. @property (nonatomic, copy) NSString *phoneNumString;
  30. @property (nonatomic, copy) NSString *whatsAppString;
  31. @property (nonatomic, copy) NSString *anchorNumString;
  32. @property (nonatomic, copy) NSString *otherAppNameString;
  33. @property (nonatomic, copy) NSString *otherAppImgString;
  34. /** 图片展示数组 */
  35. @property (nonatomic, strong) NSMutableArray *showArr;
  36. /** 是否是进行选择头像操作 */
  37. @property (nonatomic, assign) BOOL isAvatarPicker;
  38. @property (nonatomic, assign) NSInteger imgNum;
  39. @property (nonatomic, assign) BOOL applyBtnCanClick;
  40. @end
  41. @implementation MOGuildApplyVC
  42. - (void)viewWillAppear:(BOOL)animated
  43. {
  44. [super viewWillAppear:animated];
  45. [self.navigationController setNavigationBarHidden:NO animated:animated];
  46. [self mo_v2_setNavLeftItemWithImage:[UIImage imageNamed:@"v_2_icon_new_back_black"] andBackgroundImg:nil AndBgColor:nil];
  47. }
  48. - (void)viewDidLoad {
  49. [super viewDidLoad];
  50. // Do any additional setup after loading the view from its nib.
  51. self.navigationItem.title = NSLocalString(@"mimo_guild_set_in");
  52. [self setupUI];
  53. self.isAvatarPicker = NO;
  54. self.imgNum = 0;
  55. if(self.isApply){
  56. [self getApplyInfo];
  57. }
  58. }
  59. - (void)getApplyInfo{
  60. WEAKSELF
  61. [kHttpManager toGuildApplyAuditingWithParams:nil andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  62. if(kCode_Success){
  63. MOLogV(@"%@",[[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:data options:0 error:nil] encoding:NSUTF8StringEncoding]);
  64. MOUserGuild *baseData = [MOUserGuild modelWithJSON:data[@"data"]];
  65. [weakSelf updataUIWith:baseData];
  66. }
  67. else{
  68. MOLogV(@"getApplyInfo 接口报错了");
  69. kShowNetError(data)
  70. }
  71. }];
  72. }
  73. - (void)updataUIWith:(MOUserGuild *)baseModel{
  74. self.guildNameString = baseModel.name;
  75. self.otherAppImgString = baseModel.logo;
  76. self.anchorNumString = [NSString stringWithFormat:@"%.f",baseModel.anchorNum];
  77. NSMutableArray *tempArr = [NSMutableArray array];
  78. for (NSString *object in baseModel.pictures) {
  79. MOMineItemModel *itemModel = [[MOMineItemModel alloc] init];
  80. itemModel.placeholderImgString = @"";
  81. itemModel.imgString = object;
  82. [tempArr addObject:itemModel];
  83. }
  84. self.showArr = [tempArr copy];
  85. [self.tableView reloadData];
  86. }
  87. - (void)toUpdateTheApplyBtnStatus{
  88. //申请中
  89. if(self.isApply){
  90. return;
  91. }
  92. if(self.guildNameString.length > 0 &&
  93. self.phoneNumString.length > 0 &&
  94. self.whatsAppString.length > 0){
  95. self.applyBtnCanClick = YES;
  96. }
  97. else{
  98. self.applyBtnCanClick = NO;
  99. }
  100. NSIndexPath *applyIndexPath = [NSIndexPath indexPathForRow:ApplyBtnPathRow inSection:0];
  101. [self.tableView reloadRowsAtIndexPaths:@[applyIndexPath] withRowAnimation:UITableViewRowAnimationNone];
  102. }
  103. - (void)applyBtnClick:(id)sender {
  104. if(self.isApply){
  105. //审核中
  106. [self toShowTipView];
  107. return;
  108. }
  109. if(self.guildNameString.length == 0){
  110. [MBProgressHUD showTipMessageInView:NSLocalString(@"mimo_guild_guild_name_invalide")];
  111. return;
  112. }
  113. if(self.anchorNumString.length == 0){
  114. self.anchorNumString = @"0";
  115. }
  116. NSInteger anchorNum = [self.anchorNumString integerValue];
  117. NSMutableArray *pictureArr = [NSMutableArray array];
  118. for (MOMineItemModel *imgModel in self.showArr) {
  119. if(imgModel.isAddBtn == NO){
  120. [pictureArr addObject:imgModel.imgString];
  121. }
  122. }
  123. if(self.phoneNumString.length == 0){
  124. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_guild_set_req_phone_tip")];
  125. return;
  126. }
  127. if(self.whatsAppString.length == 0){
  128. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_guild_set_req_whatsapp_tip")];
  129. return;
  130. }
  131. NSDictionary *mobileDict = @{@"num":self.phoneNumString,
  132. @"code":self.phoneCodeString};
  133. NSMutableDictionary *theReqDict = [NSMutableDictionary dictionary];
  134. [theReqDict setObject:self.guildNameString forKey:@"name"];
  135. [theReqDict setObject:mobileDict forKey:@"mobile"];
  136. [theReqDict setObject:self.whatsAppString forKey:@"whatsApp"];
  137. if(anchorNum > 0){
  138. [theReqDict setObject:@(anchorNum) forKey:@"anchorNum"];
  139. }
  140. if(self.otherAppNameString.length > 0){
  141. [theReqDict setObject:self.otherAppNameString forKey:@"otherApp"];
  142. }
  143. if(self.otherAppImgString.length > 0){
  144. [theReqDict setObject:self.otherAppImgString forKey:@"otherProve"];
  145. }
  146. if(pictureArr.count > 0){
  147. [theReqDict setObject:pictureArr forKey:@"pictures"];
  148. }
  149. WEAKSELF
  150. [kHttpManager theGuild2ToApplySubmit2WithParams:theReqDict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  151. if(kCode_Success){
  152. [MBProgressHUD showTipMessageInView:NSLocalString(@"mimo_common_success")];
  153. [weakSelf toShowTipView];
  154. }
  155. else{
  156. kShowNetError(data)
  157. }
  158. }];
  159. }
  160. - (void)toShowTipView{
  161. WEAKSELF
  162. MOTitleNormalAlertView *alertView = [[MOTitleNormalAlertView alloc] init];
  163. alertView.titleLabel.text = NSLocalString(@"mimo_alert_normal_tip");
  164. alertView.subTitleLabel.text = NSLocalString(@"mimo_guild_set_req_success_tip");
  165. alertView.isSingleBtn = YES;
  166. alertView.isStrongBg = YES;
  167. [alertView.confirmBtn setTitle:NSLocalString(@"mimo_TipPleaseConfirm") forState:UIControlStateNormal];
  168. alertView.confirmBlock = ^{
  169. [weakSelf toRootVC];
  170. };
  171. [alertView show];
  172. }
  173. - (void)toRootVC{
  174. [self.navigationController popToRootViewControllerAnimated:YES];
  175. }
  176. - (void)showCardType{
  177. NSMutableArray *dataArr = [NSMutableArray array];
  178. NSDictionary *createDict = @{@"title":@"Bank Card"
  179. };
  180. [dataArr addObject:createDict];
  181. NSDictionary *setDict = @{@"title":@"Dana"
  182. };
  183. [dataArr addObject:setDict];
  184. NSDictionary *ruleDict = @{@"title":@"GCash"
  185. };
  186. [dataArr addObject:ruleDict];
  187. MOImageTitleAlertView *alertView = [[MOImageTitleAlertView alloc] initForOperateSuccessWithFrame:CGRectMake(0.0, 0.0, SCREENWIDTH, SCREENHEIGHT) ViewType:MOOnlyTextCellType DataArray:dataArr];
  188. WEAKSELF
  189. alertView.cellClickBlock = ^(NSInteger index) {
  190. [weakSelf.tableView reloadData];
  191. };
  192. [alertView show];
  193. }
  194. #pragma mark - UITableViewDelegate,UITableViewDataSource
  195. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  196. return 1;
  197. }
  198. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  199. return 9.0;
  200. }
  201. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  202. if(indexPath.row == AnchorPhotosIndexPathRow){
  203. CGFloat cellHeight = [MOGuildImageArrCell getCellHeightWithDataArrCount:self.showArr.count];
  204. return cellHeight;
  205. }
  206. if(indexPath.row == AvatarIndexPathRow){
  207. return kScaleWidth(192.0);
  208. }
  209. else if (indexPath.row == 4){
  210. return 112.0;
  211. }
  212. else if (indexPath.row == 7){
  213. return 160.0;
  214. }
  215. else if (indexPath.row == ApplyBtnPathRow){
  216. return 80.0;
  217. }
  218. else{
  219. return 82.0;
  220. }
  221. }
  222. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  223. UITableViewCell *baseCell = nil;
  224. switch (indexPath.row) {
  225. case 0:
  226. {
  227. //Guild Name
  228. MOGuildNewInputCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildNewInputCell_ID];
  229. cell.titleLab.text = NSLocalString(@"mimo_guild_set_name");
  230. cell.isHaveRedTip = YES;
  231. cell.inputTxf.text = self.guildNameString;
  232. WEAKSELF
  233. cell.returnTxFText = ^(NSString * _Nonnull txfString) {
  234. weakSelf.guildNameString = txfString;
  235. [weakSelf toUpdateTheApplyBtnStatus];
  236. };
  237. cell.bgView.layer.cornerRadius = 16.0;
  238. cell.bgView.layer.masksToBounds = YES;
  239. cell.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  240. baseCell = cell;
  241. }
  242. break;
  243. case 1:
  244. {
  245. //Phone Num
  246. MOGuildPhoneNumCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildPhoneNumCell_ID];
  247. cell.titleLab.text = NSLocalString(@"mimo_guild_set_phone_num");
  248. cell.inputTxf.text = self.phoneNumString;
  249. [cell.codeBtn setTitle:self.phoneCodeString forState:UIControlStateNormal];
  250. [cell toCheckHaveRedTip];
  251. WEAKSELF
  252. cell.returnTxFText = ^(NSString * _Nonnull txfString) {
  253. weakSelf.phoneNumString = txfString;
  254. [weakSelf toUpdateTheApplyBtnStatus];
  255. };
  256. cell.getCodeBlock = ^{
  257. //获取国际区号
  258. MOSelectPartitionVC *vc = [[MOSelectPartitionVC alloc] init];
  259. //MARK: 选择区号回调
  260. vc.selectCellBlock = ^(MOCountryList * _Nonnull model) {
  261. weakSelf.phoneCodeString = model.num;
  262. [weakSelf.tableView reloadData];
  263. };
  264. [weakSelf.navigationController pushViewController:vc animated:YES];
  265. };
  266. baseCell = cell;
  267. }
  268. break;
  269. case 2:
  270. {
  271. //WhatsApp
  272. MOGuildNewInputCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildNewInputCell_ID];
  273. cell.titleLab.text = NSLocalString(@"mimo_guild_set_whatsapp");
  274. cell.isHaveRedTip = YES;
  275. cell.inputTxf.text = self.whatsAppString;
  276. [cell toCheckHaveRedTip];
  277. WEAKSELF
  278. cell.returnTxFText = ^(NSString * _Nonnull txfString) {
  279. weakSelf.whatsAppString = txfString;
  280. [weakSelf toUpdateTheApplyBtnStatus];
  281. };
  282. cell.bgView.layer.cornerRadius = 0.0;
  283. cell.bgView.layer.masksToBounds = YES;
  284. cell.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  285. baseCell = cell;
  286. }
  287. break;
  288. case 3:
  289. {
  290. //旗下主播数量
  291. MOGuildNewInputCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildNewInputCell_ID];
  292. cell.titleLab.text = NSLocalString(@"mimo_guild_set_anchor_num");
  293. cell.isHaveRedTip = NO;
  294. cell.inputTxf.text = self.anchorNumString;
  295. [cell toCheckHaveRedTip];
  296. WEAKSELF
  297. cell.returnTxFText = ^(NSString * _Nonnull txfString) {
  298. weakSelf.anchorNumString = txfString;
  299. };
  300. cell.bgView.layer.cornerRadius = 0.0;
  301. cell.bgView.layer.masksToBounds = YES;
  302. cell.bgView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
  303. baseCell = cell;
  304. }
  305. break;
  306. case 4:
  307. {
  308. //其他APP合作经验
  309. MOGuildNewInputCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildNewInputCell_ID];
  310. cell.titleLab.text = NSLocalString(@"mimo_guild_set_other_app_tip_one");
  311. cell.bottomTipLab.text = NSLocalString(@"mimo_guild_set_other_app_tip_two");
  312. cell.isHaveRedTip = NO;
  313. cell.inputTxf.text = self.otherAppNameString;
  314. WEAKSELF
  315. cell.returnTxFText = ^(NSString * _Nonnull txfString) {
  316. weakSelf.otherAppNameString = txfString;
  317. };
  318. cell.bgView.layer.cornerRadius = 16.0;
  319. cell.bgView.layer.masksToBounds = YES;
  320. cell.bgView.layer.maskedCorners = kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner;
  321. baseCell = cell;
  322. }
  323. break;
  324. case AvatarIndexPathRow:
  325. {
  326. //其他APP合作经验图片
  327. MOGuildAppInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildAppInfoCell_ID];
  328. cell.titleLab.text = NSLocalString(@"mimo_guild_set_other_app_tip_three");
  329. cell.tipLab.text = NSLocalString(@"mimo_guild_set_other_app_tip_four");
  330. [cell.theImg sd_setImageWithURL:[NSURL URLWithString:self.otherAppImgString] placeholderImage:[[UIImage imageNamed:@"icon_wish_add"] imageByTintColor:[MOTools colorWithHexString:@"#878A99" alpha:1.0]]];
  331. WEAKSELF
  332. cell.imgClickBlock = ^{
  333. __strong typeof(weakSelf) self = weakSelf;
  334. MOImagePickerController *imagePickerController = [[MOImagePickerController alloc] initWithMaxImagesCount:1 columnNumber:4 delegate:self pushPhotoPickerVc:YES];
  335. self.isAvatarPicker = YES;
  336. [self presentViewController:imagePickerController animated:YES completion:nil];
  337. };
  338. baseCell = cell;
  339. }
  340. break;
  341. case AnchorPhotosIndexPathRow:
  342. {
  343. //Upload Anchor Photos
  344. MOGuildImageArrCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildImageArrCell_ID];
  345. if (cell == nil){
  346. cell = [[MOGuildImageArrCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MOGuildImageArrCell_ID];
  347. }
  348. cell.showArr = [self.showArr copy];
  349. WEAKSELF
  350. //MARK: 相册选择
  351. cell.itemBlock = ^(MOMineItemModel * _Nonnull model) {
  352. __strong typeof(weakSelf) self = weakSelf;
  353. MOImagePickerController *imagePickerController = [[MOImagePickerController alloc] initWithMaxImagesCount:(15 - self.showArr.count) columnNumber:4 delegate:self pushPhotoPickerVc:YES];
  354. self.isAvatarPicker = NO;
  355. [self presentViewController:imagePickerController animated:YES completion:nil];
  356. };
  357. cell.deleteImgBlock = ^(NSIndexPath * _Nonnull cellIndexPath) {
  358. //内部cell
  359. [weakSelf.showArr removeObjectAtIndex:cellIndexPath.row];
  360. //外部刷新
  361. NSIndexPath *indexPathNew = [NSIndexPath indexPathForRow:AnchorPhotosIndexPathRow inSection:0];
  362. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPathNew] withRowAnimation:UITableViewRowAnimationNone];
  363. };
  364. baseCell = cell;
  365. }
  366. break;
  367. case 7:
  368. {
  369. //申请要求
  370. MOGuildRequireInfoCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildRequireInfoCell_ID];
  371. baseCell = cell;
  372. }
  373. break;
  374. case ApplyBtnPathRow:
  375. {
  376. MOGuildSureCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildSureCell_ID];
  377. if (cell == nil){
  378. cell = [[MOGuildSureCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MOGuildSureCell_ID];
  379. }
  380. cell.isApply = self.isApply;
  381. cell.canClick = self.applyBtnCanClick;
  382. WEAKSELF
  383. cell.applyBtnClickBlcok = ^{
  384. [weakSelf applyBtnClick:nil];
  385. };
  386. baseCell = cell;
  387. }
  388. break;
  389. default:
  390. {
  391. MOGuildInputBaseCell *cell = [tableView dequeueReusableCellWithIdentifier:MOGuildInputBaseCell_ID];
  392. baseCell = cell;
  393. }
  394. break;
  395. }
  396. return baseCell;
  397. }
  398. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  399. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  400. }
  401. - (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto infos:(NSArray<NSDictionary *> *)infos{
  402. self.imgNum = photos.count;
  403. [MBProgressHUD showActivityMessageInView:@""];
  404. for (UIImage *selectImg in photos) {
  405. [self uploadBgImgWith:selectImg];
  406. }
  407. }
  408. - (void)uploadBgImgWith:(UIImage *)image{
  409. NSDictionary *dict = @{@"type":@(1),
  410. @"suffix":@"jpg"};
  411. WEAKSELF
  412. [kHttpManager getBaseOssS3WithParams:dict andBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  413. if(kCode_Success){
  414. NSDictionary *tempDict = data[@"data"];
  415. NSString *baseUrl = [MODataManager objectOrNilForKey:@"preSignUrl" fromDictionary:tempDict];
  416. NSString *bgImgUrl = [MODataManager objectOrNilForKey:@"fileUrl" fromDictionary:tempDict];
  417. NSData *imageData = UIImageJPEGRepresentation(image, 0.4);
  418. [kHttpManager sendSingleChatImage:imageData params:nil type:@"image/jpg" andBaseUrl:baseUrl withUploadProgressHandler:^(NSProgress * uploadProgress) {
  419. float progress = 1.0*uploadProgress.completedUnitCount/uploadProgress.totalUnitCount;
  420. MOLogV(@"Image upload Progress: %.2f%%", progress * 100);
  421. } andCompletionBlock:^(id _Nonnull data, NSError * _Nonnull error) {
  422. weakSelf.imgNum = weakSelf.imgNum - 1;
  423. if(error == nil){
  424. MOLogV(@"图片上传成功~");
  425. if(weakSelf.isAvatarPicker){
  426. //选择工会头像
  427. weakSelf.otherAppImgString = bgImgUrl;
  428. NSIndexPath *indexPathNew = [NSIndexPath indexPathForRow:AvatarIndexPathRow inSection:0];
  429. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPathNew] withRowAnimation:UITableViewRowAnimationNone];
  430. }
  431. else{
  432. //选择主播照片
  433. if(weakSelf.showArr.count == 15){
  434. MOMineItemModel *lastModel = weakSelf.showArr.lastObject;
  435. if(lastModel.isAddBtn){
  436. [weakSelf.showArr removeObject:lastModel];
  437. }
  438. }
  439. MOMineItemModel *itemModel = [[MOMineItemModel alloc] init];
  440. itemModel.placeholderImgString = @"";
  441. itemModel.imgString = bgImgUrl;
  442. [weakSelf.showArr insertObject:itemModel atIndex:(weakSelf.showArr.count - 1)];
  443. NSIndexPath *indexPathNew = [NSIndexPath indexPathForRow:AnchorPhotosIndexPathRow inSection:0];
  444. [weakSelf.tableView reloadRowsAtIndexPaths:@[indexPathNew] withRowAnimation:UITableViewRowAnimationNone];
  445. }
  446. }
  447. }];
  448. }
  449. else{
  450. kShowNetError(data)
  451. weakSelf.imgNum = weakSelf.imgNum - 1;
  452. }
  453. }];
  454. }
  455. - (void)setImgNum:(NSInteger)imgNum{
  456. _imgNum = imgNum;
  457. if(imgNum == 0){
  458. [MBProgressHUD hideHUD];
  459. }
  460. }
  461. #pragma mark - Set UI
  462. - (void)setupUI{
  463. self.guildNameString = @"";
  464. self.phoneCodeString = @"+62";
  465. self.phoneNumString = @"";
  466. self.whatsAppString = @"";
  467. self.anchorNumString = @"";
  468. self.otherAppNameString = @"";
  469. self.otherAppImgString = @"";
  470. NSArray *colorArr = @[[MOTools colorWithHexString:@"#F3F4FA" alpha:1.0],[MOTools colorWithHexString:@"#F3F4FA" alpha:1.0]];
  471. UIImage *image = [MOTools createGradientRectImageWithBounds:CGRectMake(0, 0, SCREENWIDTH, (SCREENHEIGHT - NAV_BAR_HEIGHT)) Colors:colorArr GradientType:1];
  472. [self.bgImgView setImage:image];
  473. self.tableView.estimatedRowHeight = 0;
  474. self.tableView.estimatedSectionHeaderHeight = 0;
  475. self.tableView.estimatedSectionFooterHeight = 0;
  476. //iOS15适配
  477. if (@available(iOS 15.0, *))
  478. {
  479. self.tableView.sectionHeaderTopPadding = 0;
  480. }
  481. self.tableView.contentInset = UIEdgeInsetsMake(9, 0, 150, 0);
  482. [self.tableView registerNib:[UINib nibWithNibName:@"MOGuildInputBaseCell" bundle:nil] forCellReuseIdentifier:MOGuildInputBaseCell_ID];
  483. [self.tableView registerNib:[UINib nibWithNibName:@"MOGuildImageOrTextBaseCell" bundle:nil] forCellReuseIdentifier:MOGuildImageOrTextBaseCell_ID];
  484. [self.tableView registerClass:[MOGuildImageArrCell class] forCellReuseIdentifier:MOGuildImageArrCell_ID];
  485. [self.tableView registerNib:[UINib nibWithNibName:@"MOGuildNewInputCell" bundle:nil] forCellReuseIdentifier:MOGuildNewInputCell_ID];
  486. [self.tableView registerNib:[UINib nibWithNibName:@"MOGuildPhoneNumCell" bundle:nil] forCellReuseIdentifier:MOGuildPhoneNumCell_ID];
  487. [self.tableView registerNib:[UINib nibWithNibName:@"MOGuildAppInfoCell" bundle:nil] forCellReuseIdentifier:MOGuildAppInfoCell_ID];
  488. [self.tableView registerNib:[UINib nibWithNibName:@"MOGuildRequireInfoCell" bundle:nil] forCellReuseIdentifier:MOGuildRequireInfoCell_ID];
  489. [self.tableView registerClass:[MOGuildSureCell class] forCellReuseIdentifier:MOGuildSureCell_ID];
  490. self.tableView.showsVerticalScrollIndicator = NO;
  491. MOMineItemModel *addModel = [[MOMineItemModel alloc] init];
  492. addModel.placeholderImgString = @"icon_guild_new_add";
  493. addModel.isAddBtn = YES;
  494. [self.showArr addObject:addModel];
  495. [self.tableView reloadData];
  496. [self toUpdateTheApplyBtnStatus];
  497. }
  498. - (NSMutableArray *)showArr{
  499. if(!_showArr){
  500. _showArr = [NSMutableArray array];
  501. }
  502. return _showArr;
  503. }
  504. @end