diff --git a/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj b/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj index 2b7da70..3193050 100644 --- a/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj +++ b/yinmeng-ios/DingDangApp.xcodeproj/project.pbxproj @@ -739,6 +739,7 @@ 23B2A8022B283ACA001C0913 /* MvpViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2A7ED2B283ACA001C0913 /* MvpViewController.m */; }; 23B2A8032B283ACA001C0913 /* Api.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2A7EF2B283ACA001C0913 /* Api.m */; }; 23B2A8042B283ACA001C0913 /* HttpRequestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2A7F22B283ACA001C0913 /* HttpRequestHelper.m */; }; + 23B62C322B299E80005FD3DE /* Api+DDDynamicApi.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B62C312B299E80005FD3DE /* Api+DDDynamicApi.m */; }; 8C2C3EC92B277E7F002C3C34 /* DDIAPHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EC82B277E7F002C3C34 /* DDIAPHelper.m */; }; 8C2C3ECC2B2784DE002C3C34 /* DDIAPRechargeStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3ECB2B2784DE002C3C34 /* DDIAPRechargeStorage.m */; }; 8C2C3ED02B278C9E002C3C34 /* DDUploadImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3ECF2B278C9E002C3C34 /* DDUploadImage.m */; }; @@ -2138,6 +2139,8 @@ 23B2A7F32B283ACA001C0913 /* ApiHost.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApiHost.h; sourceTree = ""; }; 23B2A7F42B283ACA001C0913 /* HttpRequestHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HttpRequestHelper.h; sourceTree = ""; }; 23B2A8062B2843B6001C0913 /* DDMacroHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DDMacroHeader.h; sourceTree = ""; }; + 23B62C302B299E80005FD3DE /* Api+DDDynamicApi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+DDDynamicApi.h"; sourceTree = ""; }; + 23B62C312B299E80005FD3DE /* Api+DDDynamicApi.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+DDDynamicApi.m"; sourceTree = ""; }; 2411BE5187E529C085E77220 /* libPods-DingDangAppTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-DingDangAppTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 42F5E7CEE31217A32E19E10E /* Pods-DingDangApp-DingDangAppUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DingDangApp-DingDangAppUITests.debug.xcconfig"; path = "Target Support Files/Pods-DingDangApp-DingDangAppUITests/Pods-DingDangApp-DingDangAppUITests.debug.xcconfig"; sourceTree = ""; }; 688E5912F2E950A95FC1EE55 /* Pods-DingDangAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DingDangAppTests.release.xcconfig"; path = "Target Support Files/Pods-DingDangAppTests/Pods-DingDangAppTests.release.xcconfig"; sourceTree = ""; }; @@ -5501,6 +5504,7 @@ 23B2A8072B284A99001C0913 /* DDMain */ = { isa = PBXGroup; children = ( + 23B62C2E2B299E26005FD3DE /* DDDynamic */, 23A7F7902B29551D00288CAE /* DDApplePay */, 23A7F7862B28795500288CAE /* DDHome */, 23A7F78A2B28795500288CAE /* DDMine */, @@ -5508,6 +5512,23 @@ path = DDMain; sourceTree = ""; }; + 23B62C2E2B299E26005FD3DE /* DDDynamic */ = { + isa = PBXGroup; + children = ( + 23B62C2F2B299E56005FD3DE /* DDDynamicApi */, + ); + path = DDDynamic; + sourceTree = ""; + }; + 23B62C2F2B299E56005FD3DE /* DDDynamicApi */ = { + isa = PBXGroup; + children = ( + 23B62C302B299E80005FD3DE /* Api+DDDynamicApi.h */, + 23B62C312B299E80005FD3DE /* Api+DDDynamicApi.m */, + ); + path = DDDynamicApi; + sourceTree = ""; + }; 32CE1ADC954F476C1C94DB40 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -6666,6 +6687,7 @@ 18ECBD152A29C9F400C42DAA /* SVGATool.m in Sources */, 23B2A7B32B283A76001C0913 /* DDUIImageFixedManager.m in Sources */, 188EC0F82A47CF3200060F03 /* DDBaseInputView.m in Sources */, + 23B62C322B299E80005FD3DE /* Api+DDDynamicApi.m in Sources */, 183864572A28A17B005BF235 /* ZLPhotoConfiguration.m in Sources */, 1826C5FE2A24A1A400A5AFDB /* DDEditMyInfoViewController.m in Sources */, 188AF56F2A26E8EA004DD4CF /* DDMyWalletVC.m in Sources */, diff --git a/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m b/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m index 7267728..4fd77e9 100644 --- a/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m +++ b/yinmeng-ios/DingDangApp/BsaseClass/Tool/ToolsObject.m @@ -879,7 +879,7 @@ static NSString *SAVEROOMCONFIG = @"ROOMCONFIG"; } + (void)pushMyInformationViewController:(NSString *)user_id{ DDMyInformationViewController * infoVC = [[DDMyInformationViewController alloc] init]; - infoVC.user_id = [[AccountInfoStorage instance]getUid];; + infoVC.user_id = user_id; [[ToolsObject getCurrentViewController].navigationController pushViewController:infoVC animated:YES]; } + (NSString*)dd_timeAfterTarget:(NSString *)changeTime @@ -1202,9 +1202,9 @@ static NSString *SAVEROOMCONFIG = @"ROOMCONFIG"; }else{ [requestDict setObject:@"0" forKey:@"status"]; } - [NetworkRequest requestPOST:@"/home/location" parameters:requestDict block:^(BaseResponse * _Nonnull response) { - - }]; +// [NetworkRequest requestPOST:@"/home/location" parameters:requestDict block:^(BaseResponse * _Nonnull response) { +// +// }]; } + (BOOL)isCurrentVC_Present:(UIViewController *)vc { diff --git a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/DDDynamicSendViewController.m b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/DDDynamicSendViewController.m index cacaadd..59bb96d 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/DDDynamicSendViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/DDDynamicSendViewController.m @@ -15,6 +15,7 @@ #import "DynamicSendLocationView.h" #import "TZLocationManager.h" #import "UITextView+Placeholder.h" +#import "Api+DDDynamicApi.h" @interface DDDynamicSendViewController () // 1:文本 2:视频 3:图片 @property (nonatomic,assign) NSInteger releaseType; @@ -288,48 +289,48 @@ [ToolsObject addPopVieToText:@"请输入文字"]; return; } - [ToolsObject ShowSVProgressHUD:@"上传中"]; - WeakSelf(weakSelf) - if (self.itemList.itemArray.count == 1 && self.releaseType == 2) { - [ToolsObject uploadImageWithArr:@[self.VideoThumbUrl].mutableCopy WithRecourseType:(OSSUploadType_DynamicImage) completionHandler:^(NSMutableArray * _Nonnull urlArr) { - weakSelf.ReleaseVideoThumbUrl = urlArr.firstObject; - [ToolsObject uploadVideoWithFileUrl:weakSelf.VideofileUrl WithRecourseType:(OSSUploadType_DynamicVideo) completionHandler:^(id _Nonnull urlString) { - [ToolsObject DismissSVProgressHUD]; - weakSelf.ReleaseVideoUrl = urlString; - [weakSelf publishReuqest]; - return; - }]; - }]; - return; - } - if (self.itemList.itemArray.count >0 && self.releaseType == 3) { - NSString *path = [FileToolsObject libraryDir]; - NSMutableArray *array = [[NSMutableArray alloc] initWithArray:self.itemList.itemArray]; - [self.imageFileArr removeAllObjects]; - - for (int i = 0; i0 && self.releaseType == 3) { +// NSString *path = [FileToolsObject libraryDir]; +// NSMutableArray *array = [[NSMutableArray alloc] initWithArray:self.itemList.itemArray]; +// [self.imageFileArr removeAllObjects]; +// +// for (int i = 0; i - +@class MonentsPicInfoModel; NS_ASSUME_NONNULL_BEGIN @interface DDDynamicLocationModel : NSObject @@ -88,6 +88,90 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) CGFloat videoHeight; @property (nonatomic, assign) CGFloat textHeight; @property (nonatomic, copy) NSString * head_portrait_box;//头像框 -@end + + +///类型 +@property (nonatomic,assign) int type; +///用户的uid +@property (nonatomic,copy) NSString *uid; +///昵称 +@property (nonatomic,copy) NSString *nick; +///身份的类型 +@property (nonatomic,assign) NSInteger defUser; +///是否是新用户 +@property (nonatomic,assign) BOOL newUser; +///性别 +@property (nonatomic,assign) int gender; +///头像 +@property (nonatomic,copy) NSString *avatar; +///年龄 +@property (nonatomic,assign) int age; + +///喜欢的次数 +@property (nonatomic,copy) NSString *likeCount; +///我是否已经点赞 +@property (nonatomic, assign) BOOL isLike; +///评论的次数 +@property (nonatomic,copy) NSString *commentCount; +//发布时间 +@property (nonatomic,copy) NSString *publishTime; +///等级 +@property (nonatomic,strong) NSString *experLevelPic; +///魅力等级 +@property (nonatomic,strong) NSString *charmLevelPic; +///等级 +@property (nonatomic,strong) NSString *experNewLevelPic; +///魅力等级 +@property (nonatomic,strong) NSString *charmNewLevelPic; +///是否置顶 +@property (nonatomic,assign) BOOL squareTop; + +///发布的内容 +@property (nonatomic,copy) NSArray*dynamicResList; +@property (nonatomic,copy) NSArray *dynamicResLists; +///头饰url地址 +@property (nonatomic,copy) NSString *headwearPic; +///头饰url地址 +@property (nonatomic,copy) NSString *headwearEffect; +///是否在直播中 +@property (nonatomic,copy) NSString *inRoomUid; +///显示的标签 +@property (nonatomic,copy) NSArray *labelList; +///铭牌名称 +@property (nonatomic, copy) NSString *nameplateWord; +///铭牌图片 +@property (nonatomic, copy) NSString *nameplatePic; +///话题id +@property (nonatomic, assign) long worldId; +///话题名字 +@property (nonatomic, copy) NSString *worldName; +///动态的id +@property (nonatomic,copy) NSString *dynamicId; +///是否是折叠起来的 +@property (nonatomic,assign) BOOL isFold; + +///图片的高度 +@property (nonatomic,assign) CGFloat picHeight; +///文本内容的高度 +@property (nonatomic,assign) CGFloat contentHeight; +///显示的内容的富文本 +@property (nonatomic,strong) NSMutableAttributedString *contentAttribute; +///收起的 +@property (nonatomic,strong, nullable) NSMutableAttributedString *foldAttribute; +// 文本行数 +@property (nonatomic, assign) NSInteger numberOfText; + +@end +@interface MonentsPicInfoModel : NSObject +///图片的地址 +@property (nonatomic,copy) NSString * resUrl; +///格式 +@property (nonatomic,copy) NSString *format; +///宽度 +@property (nonatomic,assign) CGFloat width; +///高度 +@property (nonatomic,assign) CGFloat height; + +@end NS_ASSUME_NONNULL_END diff --git a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/MM/DDDynamicModel.m b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/MM/DDDynamicModel.m index a21a23c..d8a30be 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/MM/DDDynamicModel.m +++ b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/MM/DDDynamicModel.m @@ -12,17 +12,26 @@ @implementation DDDynamicModel + (NSDictionary *)modelCustomPropertyMapper { return @{ - @"userVipLevelIcon":@"user.userVipLevel.icon", - @"userVipLevel":@"user.userVipLevel.level", - @"userVipExperience":@"user.userVipLevel.experience", + @"userVipLevelIcon":@"user.userVipLevel.icon", + @"userVipLevel":@"user.userVipLevel.level", + @"userVipExperience":@"user.userVipLevel.experience", }; } +-(void)setDynamicResList:(NSArray *)dynamicResList{ + _dynamicResList = dynamicResList; + NSMutableArray *list= [NSMutableArray array]; + for (NSDictionary *dic in _dynamicResList) { + [list addObject:[MonentsPicInfoModel DD_ModelWithDict:dic]]; + + } + self.dynamicResLists = list; +} - (void)setContent:(NSString *)content{ _content = content; CGFloat space = 10; - self.textHeight = [content getHeightWithWidth:kWidth-52 font:14]+space; + self.textHeight = [content getHeightWithWidth:kWidth-52 font:14]+space; CGFloat likeHeight = 10; - self.rowHeight+=self.textHeight+space+40+space+space+space*2+space*2+likeHeight; + self.rowHeight+=self.textHeight+space+40+space+space+space*2+space*2+likeHeight; } - (void)setVideo:(NSString *)video{ _video = video; @@ -31,6 +40,19 @@ self.rowHeight+=self.videoHeight; } } +-(void)setDynamicResLists:(NSArray *)dynamicResLists{ + _dynamicResLists = dynamicResLists; + if (![ToolsObject IsNullWithObject:dynamicResLists]){ + if (dynamicResLists.count==1){ + self.picturesHeight = 176; + }else{ + CGFloat row = ceil(dynamicResLists.count/3.0); + CGFloat width = (kWidth - 52 - 5*2)/3; + self.picturesHeight = row*width + row*5; + } + self.rowHeight+=self.picturesHeight; + } +} - (void)setImgs:(NSMutableArray *)imgs{ _imgs = imgs; if (![ToolsObject IsNullWithObject:imgs]){ @@ -44,4 +66,11 @@ self.rowHeight+=self.picturesHeight; } } + @end +@implementation MonentsPicInfoModel + + +@end + + diff --git a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataTableViewCell.m b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataTableViewCell.m index 42e39e8..5d054cf 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataTableViewCell.m +++ b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataTableViewCell.m @@ -236,7 +236,7 @@ }]; [self.contentView addSubview:self.levelImageV]; [self.levelImageV mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(36); + make.width.mas_equalTo(18); make.height.mas_equalTo(16); make.centerY.equalTo(self.nameLabel); make.left.equalTo(self.sexImageV.mas_right).offset(10); @@ -373,34 +373,34 @@ } - (void)setModel:(DDDynamicModel *)model{ _model = model; - [self.headImgV ddSetAnimatedImageView:[NSURL URLWithString:model.user.avatar] placeholderImage:DDPlaceholderHeadImage()]; + [self.headImgV ddSetAnimatedImageView:[NSURL URLWithString:model.avatar] placeholderImage:DDPlaceholderHeadImage()]; if (model.user.sex == 1){ self.sexImageV.image = [UIImage imageNamed:@"DynamicData_7"]; }else{ self.sexImageV.image = [UIImage imageNamed:@"DynamicData_8"]; } - [self.levelImageV sd_setImageWithURL:[NSURL URLWithString:model.userVipLevelIcon]]; + [self.levelImageV sd_setImageWithURL:[NSURL URLWithString:model.experLevelPic]]; self.textContentLabel.text = model.content?:@""; - self.nameLabel.text = model.user.nickname?:@""; - self.likeBtn.selected = model.is_give_like; - self.descLabel.text = [NSString stringWithFormat:@"%@",[ToolsObject dd_timeAfterTarget:model.c_time]]; + self.nameLabel.text = model.nick?:@""; + self.likeBtn.selected = model.isLike; + self.descLabel.text = [self stringWithTimeStamp:model.publishTime]; - if ([ToolsObject IsNullWithObject:model.support] || [model.support isEqualToString:@"0"]) { + if ([ToolsObject IsNullWithObject:model.likeCount] || [model.likeCount isEqualToString:@"0"]) { [self.likeBtn setTitle:@"点赞" forState:UIControlStateNormal]; }else{ - if (model.support.integerValue >99) { + if (model.likeCount.integerValue >99) { [self.likeBtn setTitle:@"99+" forState:UIControlStateNormal]; }else{ - [self.likeBtn setTitle:[NSString stringWithFormat:@" %@",model.support?:@"0"] forState:UIControlStateNormal]; + [self.likeBtn setTitle:[NSString stringWithFormat:@" %@",model.likeCount?:@"0"] forState:UIControlStateNormal]; } } - if ([ToolsObject IsNullWithObject:model.comment_num] || [model.comment_num isEqualToString:@"0"]) { + if ([ToolsObject IsNullWithObject:model.commentCount] || [model.commentCount isEqualToString:@"0"]) { [self.commentBtn setTitle:@" 评论" forState:UIControlStateNormal]; }else{ - if (model.comment_num.integerValue >99) { + if (model.commentCount.integerValue >99) { [self.commentBtn setTitle:@" 99+" forState:UIControlStateNormal]; }else{ - [self.commentBtn setTitle:[NSString stringWithFormat:@" %@",model.comment_num] forState:UIControlStateNormal]; + [self.commentBtn setTitle:[NSString stringWithFormat:@" %@",model.commentCount] forState:UIControlStateNormal]; } } if (model.is_show_location == 1) { @@ -409,10 +409,10 @@ }else{ self.ipLabel.hidden = YES; } - if ([model.type_name isEqualToString:@"imgs"]) { + if (model.type == 2) { self.videoPlayImgV.hidden = YES; self.bigContentImgV.hidden = YES; - if (model.imgs.count>9){ + if (model.dynamicResLists.count>9){ self.picCollectionView.hidden = NO; [self.picCollectionView mas_updateConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(model.picturesHeight); @@ -421,7 +421,7 @@ make.width.height.mas_equalTo(model.picturesHeight); }]; - NSArray * subArr = [model.imgs subarrayWithRange:NSMakeRange(0, 9)]; + NSArray * subArr = [model.dynamicResLists subarrayWithRange:NSMakeRange(0, 9)]; self.listArr = subArr.mutableCopy; [self.picCollectionView reloadData]; }else{ @@ -429,9 +429,10 @@ [self.picCollectionView mas_updateConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(0); }]; - if (model.imgs.count==1){ + if (model.dynamicResLists.count==1){ self.bigContentImgV.hidden = NO; - [self.bigContentImgV ddSetAnimatedImageView:[NSURL URLWithString:model.imgs[0]]]; + MonentsPicInfoModel *getModle = model.dynamicResLists[0]; + [self.bigContentImgV ddSetAnimatedImageView:[NSURL URLWithString:getModle.resUrl]]; [self.bigContentImgV mas_updateConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(176); @@ -445,7 +446,7 @@ make.width.height.mas_equalTo(model.picturesHeight); }]; - self.listArr = model.imgs; + self.listArr = [[NSMutableArray alloc]initWithArray:model.dynamicResLists]; [self.picCollectionView reloadData]; } } @@ -474,13 +475,13 @@ make.height.mas_equalTo(0); }]; } - if ([ToolsObject IsNullWithObject:model.head_portrait_box]) { + if ([ToolsObject IsNullWithObject:model.headwearPic]) { self.avatarBGView.hidden = YES; }else{ self.avatarBGView.hidden = NO; - [self.avatarBGView startSVAGAmimationWithSVGAUrl:model.head_portrait_box loopCount:NSIntegerMax]; + [self.avatarBGView startSVAGAmimationWithSVGAUrl:model.headwearPic loopCount:NSIntegerMax]; } - if (model.in_live){ + if (model.inRoomUid.length > 0){ self.headBackV.hidden = NO; self.headImgV.layer.borderColor = [UIColor jk_colorWithHexString:@"#A739FE"].CGColor; self.headImgV.layer.borderWidth = 2; @@ -491,6 +492,60 @@ self.headBackV.hidden = YES; } } +- (NSString *)stringWithTimeStamp:(NSString *)timeStamp { + // 转为秒为单位 + NSTimeInterval second = timeStamp.longLongValue / 1000; + NSDate *date = [NSDate dateWithTimeIntervalSince1970:second]; + + //把字符串转为NSdate + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + [dateFormatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"]; + // 时间 10点10分 + NSDateFormatter *timeFormatter = [[NSDateFormatter alloc] init]; + [timeFormatter setDateFormat:@"HH:mm"]; + // 日期 2月18号 + NSDateFormatter *dayFormatter = [[NSDateFormatter alloc] init]; + [dayFormatter setDateFormat:@"MM月dd日"]; + // 日期 年月日 + NSDateFormatter *yearFormatter = [[NSDateFormatter alloc] init]; + [yearFormatter setDateFormat:@"YYYY年MM月dd日"]; + + //得到与当前时间差 + NSTimeInterval timeInterval = [date timeIntervalSinceNow]; + timeInterval = -timeInterval; + + long temp = 0; + NSString *result; + + BOOL isSameDay = [[NSCalendar currentCalendar] isDateInToday:date]; // 是否是同一天 + + // A. 当天,且 timeInterval < 1分钟,显示“刚刚”; + if (timeInterval < 60) { + return [NSString stringWithFormat:@"刚刚"]; + + // B. 当天,且1分钟≤ timeInterval <60分钟,显示“n分钟前”; + } else if((temp = timeInterval/60) < 60){ + return [NSString stringWithFormat:@"%ld分钟前",temp]; + + // C. 当天,且n≥60分钟,显示“xx:xx”; + } else if((temp = temp/60) < 24 && isSameDay){ + return [timeFormatter stringFromDate:date]; + + // C. 非当天,且n≥60分钟,显示“xx:xx”; + } else if((temp = temp/60) < 24 && !isSameDay){ + return [dayFormatter stringFromDate:date]; + + // D. 跨天,且未跨年,显示“mm-dd”; + } else if((temp = temp/30) < 30){ + return [dayFormatter stringFromDate:date]; + + } else { + // E. 跨年,显示“yyyy-mm-dd”; + return [yearFormatter stringFromDate:date]; + } + + return result; +} - (void)didSVGAViewWithView:(DDSVGABaseView *)view { if (view == _avatarBGView) { @@ -500,10 +555,11 @@ } } - (void)showOneImageView{ - if([self.model.type_name isEqualToString:@"imgs"]){ + if(self.model.type == 2){ NSMutableArray *datas = [NSMutableArray array]; YBIBImageData *data = [YBIBImageData new]; - data.imageURL = [NSURL URLWithString:self.model.cover_img]; + MonentsPicInfoModel *getModle = self.model.dynamicResLists[0]; + data.imageURL = [NSURL URLWithString:getModle.resUrl]; data.projectiveView =self.bigContentImgV; [datas addObject:data]; YBImageBrowser *browser = [YBImageBrowser new]; @@ -527,8 +583,8 @@ - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { DDDynamicPicCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"DDDynamicPicCollectionViewCell" forIndexPath:indexPath]; - NSString * imgUrl = self.listArr[indexPath.item]; - [cell.contentImageView ddSetAnimatedImageView:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"icon_tupian"]]; + MonentsPicInfoModel *model = self.listArr[indexPath.item]; + [cell.contentImageView ddSetAnimatedImageView:[NSURL URLWithString:model.resUrl] placeholderImage:[UIImage imageNamed:@"icon_tupian"]]; return cell; } diff --git a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.h b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.h index 379db6a..cd0a885 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.h +++ b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.h @@ -14,6 +14,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, strong) NSMutableArray * listArr; @property (nonatomic, assign) NSInteger pageNum; @property (nonatomic, copy) NSString * dynamicScene; +@property(nonatomic,assign) NSInteger type; + -(void)originRequest; @end diff --git a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.m b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.m index 873f4a1..f50aab0 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.m +++ b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DDDynamicDataView.m @@ -11,6 +11,8 @@ #import #import "DDMyInfoReportViewController.h" #import "DynamicCommentViewController.h" +#import "Api+DDDynamicApi.h" +#import "Api+DDMineApi.h" @interface DDDynamicDataView () @property (nonatomic, strong) SJVideoPlayer * videoPlayer; @property (nonatomic, copy) void(^scrollCallback)(UIScrollView *scrollView); @@ -80,11 +82,67 @@ [self originRequest]; } - (void)refreshListData{ + WeakSelf(weakSelf) + if(self.type == 0){ + [Api monentsRecommendList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + [weakSelf.myTableView.mj_header endRefreshing]; + [weakSelf.myTableView.mj_footer endRefreshing]; + if(code == 200){ + if (weakSelf.pageNum == 1) { + [weakSelf.listArr removeAllObjects]; + } + NSArray *list = [DDDynamicModel DD_ModelsWithArray:data.data]; + [weakSelf.listArr addObjectsFromArray:list]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.myTableView.mj_header endRefreshing]; + [weakSelf.myTableView.mj_footer endRefreshing]; + [weakSelf.myTableView reloadData]; + }); + } + } page:@(self.pageNum).stringValue pageSize:@"20" types:@"0,2"]; + }else if(self.type == 1){ + [Api monentsLatestList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + [weakSelf.myTableView.mj_header endRefreshing]; + [weakSelf.myTableView.mj_footer endRefreshing]; + if(code == 200){ + if (weakSelf.pageNum == 1) { + [weakSelf.listArr removeAllObjects]; + } + NSArray *list = [DDDynamicModel DD_ModelsWithArray:data.data[@"dynamicList"]]; + [weakSelf.listArr addObjectsFromArray:list]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.myTableView.mj_header endRefreshing]; + [weakSelf.myTableView.mj_footer endRefreshing]; + [weakSelf.myTableView reloadData]; + }); + } + } dynamicId:@"" pageSize:@"20" types:@"0,2"]; + }else{ + [Api monentsFollowerList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + [weakSelf.myTableView.mj_header endRefreshing]; + [weakSelf.myTableView.mj_footer endRefreshing]; + if(code == 200){ + if (weakSelf.pageNum == 1) { + [weakSelf.listArr removeAllObjects]; + } + NSArray *list = [DDDynamicModel DD_ModelsWithArray:data.data[@"dynamicList"]]; + [weakSelf.listArr addObjectsFromArray:list]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.myTableView.mj_header endRefreshing]; + [weakSelf.myTableView.mj_footer endRefreshing]; + [weakSelf.myTableView reloadData]; + }); + } + } dynamicId:@"" pageSize:@"20" types:@"0,2"]; + } + + + return; NSMutableDictionary *requestDict = [NSMutableDictionary dictionary]; [requestDict setObject:@(999) forKey:@"current_page"]; [requestDict setObject:@(self.pageNum) forKey:@"page_number"]; [requestDict setObject:[ToolsObject IsNullWithObject:self.dynamicScene]?@"":self.dynamicScene forKey:@"scene"]; - WeakSelf(weakSelf) + [NetworkRequest requestPOST:@"/dynamic/list" parameters:requestDict block:^(BaseResponse * _Nonnull response) { if (response.code == 200) { if ([ToolsObject IsNullWithObject:response.data]) { @@ -140,6 +198,25 @@ cell.model = self.listArr[indexPath.row]; WeakSelf(weakSelf) cell.clickSupportBlock = ^(DDDynamicModel * _Nonnull dynamicModel, NSIndexPath * _Nonnull index) { + NSString * uid = [AccountInfoStorage instance].getUid; + [Api monentsLike:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if(code == 200){ + dynamicModel.isLike = !dynamicModel.isLike; + if (dynamicModel.isLike) { + dynamicModel.likeCount = [NSString stringWithFormat:@"%d",dynamicModel.likeCount.intValue + 1]; + }else { + if (dynamicModel.likeCount.intValue == 0) { + dynamicModel.likeCount = @"0"; + } else { + dynamicModel.likeCount = [NSString stringWithFormat:@"%d",dynamicModel.likeCount.intValue - 1]; + } + } + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.myTableView reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationNone]; + }); + } + } dynamicId:dynamicModel.dynamicId uid:uid status:dynamicModel.isLike ? @"0":@"1" likedUid:dynamicModel.uid worldId:[NSString stringWithFormat:@"%ld", dynamicModel.worldId]]; + return; NSMutableDictionary *parameter =[NSMutableDictionary dictionary]; [parameter setValue:dynamicModel.id forKey:@"dynamic_id"]; if (dynamicModel.is_give_like) { @@ -178,15 +255,21 @@ userModel.user_id = dynamicModel.user_id; [[ToolsObject shareTools] jumpToRoomVC:dynamicModel.in_live_room_id followUser:userModel]; }else{ - [ToolsObject pushMyInformationViewController:dynamicModel.user_id]; + [ToolsObject pushMyInformationViewController:dynamicModel.uid]; } }; cell.clickAttentionBlock = ^(DDDynamicModel * _Nonnull dynamicModel, NSIndexPath * _Nonnull index) { - if (dynamicModel.is_attention) { - [weakSelf requestcancelFollow:dynamicModel withIndexPath:index]; - }else{ - [weakSelf requestAddFollow:dynamicModel withIndexPath:index]; - } + NSString * uid = [[AccountInfoStorage instance] getUid]; + NSString * ticket = [[AccountInfoStorage instance] getTicket]; + NSString * type = @"1"; + [Api attentionCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if(code == 200){ + [ToolsObject addPopVieToText:@"关注成功"]; + return; + } + [ToolsObject addPopVieToText:@"关注失败"]; + } uid:uid likedUid:dynamicModel.uid ticket:ticket type:type]; + }; cell.clickRemoveBlock = ^(DDDynamicModel * _Nonnull dynamicModel, NSIndexPath * _Nonnull index) { NSMutableDictionary *requestDict = [NSMutableDictionary dictionary]; @@ -207,21 +290,21 @@ [[ToolsObject getCurrentViewController].navigationController pushViewController:jubaoVC animated:YES]; }; cell.clickDynamicCommentBlock = ^(DDDynamicModel * _Nonnull dynamicModel, NSIndexPath * _Nonnull index) { - DynamicCommentViewController *vc = [[DynamicCommentViewController alloc]init]; - vc.dynamic_id = dynamicModel.id; - vc.dynamic_userId = dynamicModel.user_id; - vc.reloadCellCommentNum = ^(NSString * _Nonnull commentNum) { - dynamicModel.comment_num = commentNum; - dispatch_async(dispatch_get_main_queue(), ^{ - [weakSelf.myTableView reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationNone]; - }); - }; - XPSemiModalConfiguration *config = [XPSemiModalConfiguration defaultConfiguration]; - config.backgroundOpacity = 0.5; - config.enableBackgroundAnimation = NO; - config.enableShadow = NO; - config.shouldDismissModal = YES; - [[ToolsObject getCurrentViewController] presentSemiModalViewController:vc contentHeight:kHeight-400 configuration:config completion:nil dismissClickBlock:nil]; +// DynamicCommentViewController *vc = [[DynamicCommentViewController alloc]init]; +// vc.dynamic_id = dynamicModel.id; +// vc.dynamic_userId = dynamicModel.user_id; +// vc.reloadCellCommentNum = ^(NSString * _Nonnull commentNum) { +// dynamicModel.comment_num = commentNum; +// dispatch_async(dispatch_get_main_queue(), ^{ +// [weakSelf.myTableView reloadRowsAtIndexPaths:@[index] withRowAnimation:UITableViewRowAnimationNone]; +// }); +// }; +// XPSemiModalConfiguration *config = [XPSemiModalConfiguration defaultConfiguration]; +// config.backgroundOpacity = 0.5; +// config.enableBackgroundAnimation = NO; +// config.enableShadow = NO; +// config.shouldDismissModal = YES; +// [[ToolsObject getCurrentViewController] presentSemiModalViewController:vc contentHeight:kHeight-400 configuration:config completion:nil dismissClickBlock:nil]; }; cell.clickCantSeeBlock = ^(DDDynamicModel * _Nonnull dynamicModel, NSIndexPath * _Nonnull index) { [weakSelf.listArr removeObjectAtIndex:index.row]; diff --git a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DynamicHomeView.m b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DynamicHomeView.m index ef6eaf9..a06b567 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DynamicHomeView.m +++ b/yinmeng-ios/DingDangApp/CodeClass/Dynamic/VV/DynamicHomeView.m @@ -51,6 +51,15 @@ } -(void)initRequest { + self.titles = @[@"推荐",@"最新",@"关注"].mutableCopy; + self.categoryView.titles = self.titles; + dispatch_async(dispatch_get_main_queue(), ^{ + self.categoryView.defaultSelectedIndex = 1; + self.pagerView.defaultSelectedIndex = 1; + [self.pagerView reloadData]; + [self.categoryView reloadData]; + }); + return; WeakSelf(weakSelf) [NetworkRequest requestPOST:@"/dynamic/type/list" parameters:@{} block:^(BaseResponse * _Nonnull response) { if ([ToolsObject IsNullWithObject:response.data]){ @@ -189,8 +198,7 @@ - (id)pagerView:(JXPagerView *)pagerView initListAtIndex:(NSInteger)index { DDDynamicDataView *listView = [[DDDynamicDataView alloc]initWithFrame:CGRectMake(0, 0, self.pagerView.width, self.pagerView.height - 50)]; - DDLabelModel *model = self.titleArr[index]; - listView.dynamicScene = model.scene; + listView.type = index; [listView originRequest]; listView.backgroundColor = UIColor.clearColor; listView.myTableView.backgroundColor = UIColor.clearColor; diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoJuBaoViewController.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoJuBaoViewController.m index d068137..0f13ae9 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoJuBaoViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoJuBaoViewController.m @@ -378,6 +378,11 @@ } } - (void)commitButtonClick { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [DDHUDManager dd_showErrorWithText:@"举报成功"]; + [self.navigationController popViewControllerAnimated:YES]; + }); + return; [ToolsObject ShowSVProgressHUD:@""]; if ([ToolsObject IsNullWithObject:self.uploadType]|| self.imagesArray[0] == [UIImage imageNamed:@"myinfo_43"]) { [self commitDataWithImages:@""]; diff --git a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoReportViewController.m b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoReportViewController.m index 1cc36e9..26915fc 100644 --- a/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoReportViewController.m +++ b/yinmeng-ios/DingDangApp/CodeClass/MyInfo/CC/DDMyInfoReportViewController.m @@ -334,6 +334,11 @@ } - (void)commitButtonClick { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [DDHUDManager dd_showErrorWithText:@"举报成功"]; + [self.navigationController popViewControllerAnimated:YES]; + }); + return; if ([ToolsObject IsNullWithObject:self.uploadType]|| self.imagesArray[0] == [UIImage imageNamed:@"myinfo_43"]) { [self commitDataWithImages:@""]; return; diff --git a/yinmeng-ios/DingDangApp/V2Versions/Mine/DDMineVC.m b/yinmeng-ios/DingDangApp/V2Versions/Mine/DDMineVC.m index 1b7e396..fd91a9e 100644 --- a/yinmeng-ios/DingDangApp/V2Versions/Mine/DDMineVC.m +++ b/yinmeng-ios/DingDangApp/V2Versions/Mine/DDMineVC.m @@ -110,8 +110,8 @@ - (NSMutableArray *)dataArr{ if (!_dataArr){ _dataArr = @[].mutableCopy; - NSArray *titles = @[@"",@"装扮商城",@"实名认证",@"我的等级",@"官方客服",@"帮助与反馈"]; - NSArray *icons = @[@"",@"mine_bg_icon_14",@"mine_bg_icon_15",@"mine_bg_icon_17",@"mine_bg_icon_19",@"mine_bg_icon_20"]; + NSArray *titles = @[@"",@"装扮商城",@"实名认证",@"我的等级",@"官方客服"]; + NSArray *icons = @[@"",@"mine_bg_icon_14",@"mine_bg_icon_15",@"mine_bg_icon_17",@"mine_bg_icon_19"]; for (NSInteger i = 0; i < icons.count; i ++) { DDMineModel *model = [DDMineModel new]; model.icon = icons[i]; @@ -162,8 +162,9 @@ - (void)actionClickTypeSring:(NSString *)type { if ([type isEqualToString:@"主页"]) { + NSString *uid = [[AccountInfoStorage instance]getUid]; AppUserModel * myModel = [ToolsObject getUserModel]; - [ToolsObject pushMyInformationViewController:myModel.user_id]; + [ToolsObject pushMyInformationViewController:uid]; } else if ([type isEqualToString:@"粉丝"]) { DDFollowFansPVC * listVC = [[DDFollowFansPVC alloc] init]; listVC.defaultIndex =1; diff --git a/yinmeng-ios/DingDangApp/YingMeng/DDMain/DDDynamic/DDDynamicApi/Api+DDDynamicApi.h b/yinmeng-ios/DingDangApp/YingMeng/DDMain/DDDynamic/DDDynamicApi/Api+DDDynamicApi.h new file mode 100644 index 0000000..399364f --- /dev/null +++ b/yinmeng-ios/DingDangApp/YingMeng/DDMain/DDDynamic/DDDynamicApi/Api+DDDynamicApi.h @@ -0,0 +1,20 @@ +// +// Api+DDDynamicApi.h +// DingDangApp +// +// Created by duoban on 2023/12/13. +// + +#import "Api.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface Api (DDDynamicApi) ++ (void)monentsRecommendList:(HttpRequestHelperCompletion)completion page:(NSString *)page pageSize:(NSString *)pageSize types:(NSString *)types; ++ (void)monentsLatestList:(HttpRequestHelperCompletion)completion dynamicId:(NSString *)dynamicId pageSize:(NSString *)pageSize types:(NSString *)types; ++ (void)monentsFollowerList:(HttpRequestHelperCompletion)completion dynamicId:(NSString *)dynamicId pageSize:(NSString *)pageSize types:(NSString *)types; ++ (void)monentsLike:(HttpRequestHelperCompletion)completion dynamicId:(NSString *)dynamicId uid:(NSString *)uid status:(NSString *)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId; ++ (void)monentsPublish:(HttpRequestHelperCompletion)completion uid:(NSString *)uid type:(NSString *)type worldId:(NSString *)worldId content:(NSString *)content resList:(NSArray *)resList; +@end + +NS_ASSUME_NONNULL_END diff --git a/yinmeng-ios/DingDangApp/YingMeng/DDMain/DDDynamic/DDDynamicApi/Api+DDDynamicApi.m b/yinmeng-ios/DingDangApp/YingMeng/DDMain/DDDynamic/DDDynamicApi/Api+DDDynamicApi.m new file mode 100644 index 0000000..17c73dc --- /dev/null +++ b/yinmeng-ios/DingDangApp/YingMeng/DDMain/DDDynamic/DDDynamicApi/Api+DDDynamicApi.m @@ -0,0 +1,38 @@ +// +// Api+DDDynamicApi.m +// DingDangApp +// +// Created by duoban on 2023/12/13. +// + +#import "Api+DDDynamicApi.h" + +@implementation Api (DDDynamicApi) ++ (void)monentsRecommendList:(HttpRequestHelperCompletion)completion page:(NSString *)page pageSize:(NSString *)pageSize types:(NSString *)types { + [self makeRequest:@"dynamic/square/recommendDynamics" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, page, pageSize, types, nil]; +} ++ (void)monentsLatestList:(HttpRequestHelperCompletion)completion dynamicId:(NSString *)dynamicId pageSize:(NSString *)pageSize types:(NSString *)types { + [self makeRequest:@"dynamic/square/latestDynamics" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, dynamicId, pageSize, types, nil]; +} ++ (void)monentsFollowerList:(HttpRequestHelperCompletion)completion dynamicId:(NSString *)dynamicId pageSize:(NSString *)pageSize types:(NSString *)types { + [self makeRequest:@"dynamic/square/followerDynamics" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, dynamicId, pageSize, types, nil]; +} ++ (void)monentsLike:(HttpRequestHelperCompletion)completion dynamicId:(NSString *)dynamicId uid:(NSString *)uid status:(NSString *)status likedUid:(NSString *)likedUid worldId:(NSString *)worldId { + [self makeRequest:@"dynamic/like" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, dynamicId, uid, status, likedUid, worldId, nil]; +} ++ (void)monentsPublish:(HttpRequestHelperCompletion)completion uid:(NSString *)uid type:(NSString *)type worldId:(NSString *)worldId content:(NSString *)content resList:(NSArray *)resList { + NSMutableDictionary * dic = [NSMutableDictionary dictionary]; + [dic setObject:uid forKey:@"uid"]; + [dic setObject:type forKey:@"type"]; + + [dic setObject:content.length > 0 ? content : @"" forKey:@"content"]; + if (worldId.length > 0) { + [dic setObject:worldId forKey:@"worldId"]; + } + if (resList.count > 0) { + [dic setObject:resList forKey:@"resList"]; + } + + [HttpRequestHelper postSkillCard:@"dynamic/square/publish" params:dic.dd_toJSONString completion:completion]; +} +@end