瀏覽代碼

朋友圈消息列表

桂欢 1 年之前
父節點
當前提交
ee9a441d34

+ 6 - 0
SLAiELTS/SLAiELTS.xcodeproj/project.pbxproj

@@ -142,6 +142,7 @@
 		3D58825E2A28397D00F1B38E /* SLCitySetVc.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D58825C2A28397D00F1B38E /* SLCitySetVc.xib */; };
 		3D58828B2A2976CD00F1B38E /* SLMsgBgSetVc.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D5882892A2976CD00F1B38E /* SLMsgBgSetVc.m */; };
 		3D58828C2A2976CD00F1B38E /* SLMsgBgSetVc.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D58828A2A2976CD00F1B38E /* SLMsgBgSetVc.xib */; };
+		3D58829F2A29C17D00F1B38E /* SLMomentsNewsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D58829E2A29C17D00F1B38E /* SLMomentsNewsModel.m */; };
 		3D5BC38B29E3E77400748197 /* SLMoentsChatView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D5BC38A29E3E77400748197 /* SLMoentsChatView.m */; };
 		3D5BC38F29E3F87100748197 /* SLFriensInfoVc.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D5BC38D29E3F87100748197 /* SLFriensInfoVc.m */; };
 		3D5BC39029E3F87100748197 /* SLFriensInfoVc.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D5BC38E29E3F87100748197 /* SLFriensInfoVc.xib */; };
@@ -526,6 +527,8 @@
 		3D5882882A2976CD00F1B38E /* SLMsgBgSetVc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLMsgBgSetVc.h; sourceTree = "<group>"; };
 		3D5882892A2976CD00F1B38E /* SLMsgBgSetVc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLMsgBgSetVc.m; sourceTree = "<group>"; };
 		3D58828A2A2976CD00F1B38E /* SLMsgBgSetVc.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SLMsgBgSetVc.xib; sourceTree = "<group>"; };
+		3D58829D2A29C17D00F1B38E /* SLMomentsNewsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLMomentsNewsModel.h; sourceTree = "<group>"; };
+		3D58829E2A29C17D00F1B38E /* SLMomentsNewsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLMomentsNewsModel.m; sourceTree = "<group>"; };
 		3D5BC38929E3E77400748197 /* SLMoentsChatView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLMoentsChatView.h; sourceTree = "<group>"; };
 		3D5BC38A29E3E77400748197 /* SLMoentsChatView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLMoentsChatView.m; sourceTree = "<group>"; };
 		3D5BC38C29E3F87100748197 /* SLFriensInfoVc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLFriensInfoVc.h; sourceTree = "<group>"; };
@@ -1594,6 +1597,8 @@
 			children = (
 				3DB97D2529D6A86D00B12754 /* SDTimeLineCellModel.h */,
 				3DB97D2629D6A86D00B12754 /* SDTimeLineCellModel.m */,
+				3D58829D2A29C17D00F1B38E /* SLMomentsNewsModel.h */,
+				3D58829E2A29C17D00F1B38E /* SLMomentsNewsModel.m */,
 			);
 			path = Model;
 			sourceTree = "<group>";
@@ -2189,6 +2194,7 @@
 				3D8EBBC72A131FA40008B0C1 /* SLHomeMsgTableViewCell.m in Sources */,
 				3D8C9F8229AC57F200678283 /* ViewController.m in Sources */,
 				3D1F17AE2A0DE55D00F030AD /* SLLocationManager.m in Sources */,
+				3D58829F2A29C17D00F1B38E /* SLMomentsNewsModel.m in Sources */,
 				3D24987429AC7909003C3AFA /* UIViewController+Extension.m in Sources */,
 				3D19CC0229E7E9340041A6B8 /* SLMomentDetailTableVc.m in Sources */,
 				3D25105B29AC9475000AE530 /* SLForgetPWViewController.m in Sources */,

+ 30 - 0
SLAiELTS/SLAiELTS/ViewControllers/Moments/Model/SLMomentsNewsModel.h

@@ -0,0 +1,30 @@
+//
+//  SLMomentsNewsModel.h
+//  SLAiELTS
+//
+//  Created by Gusont on 2023/6/2.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SLMomentsNewsModel : NSObject
+
+@property (nonatomic, copy) NSString *userName;
+ 
+@property (nonatomic, copy) NSString *userId;
+
+@property (nonatomic, copy) NSString *friendId;
+
+@property (nonatomic, copy) NSString *image;
+
+@property (nonatomic, copy) NSString *interType;
+
+@property (nonatomic, copy) NSString *commentContent;
+
+@property (nonatomic, copy) NSString *interDate;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 12 - 0
SLAiELTS/SLAiELTS/ViewControllers/Moments/Model/SLMomentsNewsModel.m

@@ -0,0 +1,12 @@
+//
+//  SLMomentsNewsModel.m
+//  SLAiELTS
+//
+//  Created by Gusont on 2023/6/2.
+//
+
+#import "SLMomentsNewsModel.h"
+
+@implementation SLMomentsNewsModel
+
+@end

+ 49 - 5
SLAiELTS/SLAiELTS/ViewControllers/Moments/MomentsVc/SLMomentsNewsVc.m

@@ -7,11 +7,15 @@
 
 #import "SLMomentsNewsVc.h"
 #import "SLMomentsNewsCell.h"
+#import "SLMomentsNewsModel.h"
+#import "SLMomentDetailTableVc.h"
+#import "SDTimeLineCellModel.h"
 
 @interface SLMomentsNewsVc ()<UITableViewDelegate, UITableViewDataSource>
 
 @property (weak, nonatomic) IBOutlet UITableView *tableView;
 
+@property (nonatomic, strong) NSMutableArray *newsModels;
 @end
 
 @implementation SLMomentsNewsVc
@@ -25,10 +29,17 @@
     } else {
         self.automaticallyAdjustsScrollViewInsets = NO;
     }
-    YMBarButtonItem *rightBarItem = [[YMBarButtonItem alloc] initWithTitle:@"清空  " target:self action:@selector(rightBarBtnClick)];
-    rightBarItem.titleInsets = UIEdgeInsetsMake(0, 0, 0, 20);
-    self.navigationBar.rightBarButtonItem = rightBarItem;
+//    YMBarButtonItem *rightBarItem = [[YMBarButtonItem alloc] initWithTitle:@"清空  " target:self action:@selector(rightBarBtnClick)];
+//    rightBarItem.titleInsets = UIEdgeInsetsMake(0, 0, 0, 20);
+//    self.navigationBar.rightBarButtonItem = rightBarItem;
     [self.tableView registerNibCellWithReuseIdentifierClass:SLMomentsNewsCell.class];
+    [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Friend/MessageItemFriend" parameter:@{} success:^(id responseObject) {
+        NSDictionary *dataArr = [responseObject objectForKey:@"data"];
+        self.newsModels = [SLMomentsNewsModel mj_objectArrayWithKeyValuesArray:dataArr];
+        [self.tableView reloadData];
+    } failure:^(SPRequestError *error) {
+
+    }];
 }
 
 - (void)rightBarBtnClick {
@@ -37,16 +48,42 @@
 
 - (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
     SLMomentsNewsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SLMomentsNewsCell"];
+    SLMomentsNewsModel *model = [self.newsModels objectAtIndex:indexPath.row];
+    [cell confignNewsCell:model];
     return cell;
 }
 
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+    SLMomentsNewsModel *model = [self.newsModels objectAtIndex:indexPath.row];
+    return [model.interType isEqualToString:@"0"] ? 108 : 120;
+}
+
 - (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    return 10;
+    return self.newsModels.count;
 }
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     [tableView deselectRowAtIndexPath:indexPath animated:YES];
-    
+    SLMomentsNewsModel *model = [self.newsModels objectAtIndex:indexPath.row];
+    [[SLHttpCenter SharedInstance] getWithUrl:@"/api/Friend/GetFriendById" parameter:@{@"friendId" : model.friendId} success:^(id responseObject) {
+        NSDictionary *dict = [responseObject objectForKey:@"data"];
+        SDTimeLineCellModel *model = [SDTimeLineCellModel mj_objectWithKeyValues:dict];
+        model.likeItemsArray = [NSMutableArray new];
+        [model.likeStr enumerateObjectsUsingBlock:^(id  _Nonnull obj1, NSUInteger idx1, BOOL * _Nonnull stop) {
+            SDTimeLineCellLikeItemModel *model1 = [[SDTimeLineCellLikeItemModel alloc] init];
+            model1.userName = obj1;
+            model1.userId = @"1111";
+            [model.likeItemsArray addObject:model1];
+        }];
+        SLMomentDetailTableVc *vc = [SLMomentsVc loadViewControllewWithNib];
+        object_setClass(vc, SLMomentDetailTableVc.class);
+        vc.isDetail = YES;
+        vc.dataArray = [NSMutableArray arrayWithObject:model];
+        [vc.tableView reloadData];
+        [self navPushViewController:vc animated:YES];
+    } failure:^(SPRequestError *error) {
+
+    }];
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
@@ -57,4 +94,11 @@
     return 0.001f;
 }
 
+- (NSMutableArray *)newsModels {
+    if (!_newsModels) {
+        _newsModels = [NSMutableArray array];
+    }
+    return _newsModels;
+}
+
 @end

+ 0 - 2
SLAiELTS/SLAiELTS/ViewControllers/Moments/MomentsVc/SLMomentsVc.m

@@ -385,10 +385,8 @@ static CGFloat textFieldH = 56;
                 }];
             }
         }];
-        
         cell.delegate = self;
     }
-    
     ////// 此步设置用于实现cell的frame缓存,可以让tableview滑动更加流畅 //////
     [cell useCellFrameCacheWithIndexPath:indexPath tableView:tableView];
     ///////////////////////////////////////////////////////////////////////

+ 3 - 1
SLAiELTS/SLAiELTS/ViewControllers/Moments/Views/MomentsNewsCell/SLMomentsNewsCell.h

@@ -6,7 +6,7 @@
 //
 
 #import <UIKit/UIKit.h>
-
+#import "SLMomentsNewsModel.h"
 NS_ASSUME_NONNULL_BEGIN
 
 @interface SLMomentsNewsCell : UITableViewCell
@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (weak, nonatomic) IBOutlet UILabel *timeLabel;
 @property (weak, nonatomic) IBOutlet UIView *likeBgView;
 
+- (void)confignNewsCell:(SLMomentsNewsModel *)model;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 18 - 0
SLAiELTS/SLAiELTS/ViewControllers/Moments/Views/MomentsNewsCell/SLMomentsNewsCell.m

@@ -20,4 +20,22 @@
     // Configure the view for the selected state
 }
 
+- (void)confignNewsCell:(SLMomentsNewsModel *)model {
+    self.nameLabel.text = model.userName;
+    if (model.image.length) {
+        NSString *momentImage = [NSString stringWithFormat:@"%@%@",[SLHttpCenter SharedInstance].serverUrl,[model.image componentsSeparatedByString:@","].firstObject];
+        [self.momentImageView sd_setImageWithURL:[NSURL URLWithString:momentImage] placeholderImage:nil];
+    }
+    self.timeLabel.text = model.interDate;
+    self.plLabel.text = model.commentContent;
+    if ([model.interType isEqualToString:@"0"]) {
+        self.likeBgView.hidden = NO;
+        self.plLabel.text = @" ";
+        self.plLabel.hidden = YES;
+    }else {
+        self.likeBgView.hidden = YES;
+        self.plLabel.hidden = NO;
+    }
+}
+
 @end

+ 12 - 19
SLAiELTS/SLAiELTS/ViewControllers/Moments/Views/MomentsNewsCell/SLMomentsNewsCell.xib

@@ -4,7 +4,6 @@
     <dependencies>
         <deployment identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
-        <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -24,7 +23,7 @@
                             <constraint firstAttribute="width" constant="48" id="W6T-xK-s4h"/>
                         </constraints>
                     </imageView>
-                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Fd0-Zh-jKa">
+                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Fd0-Zh-jKa">
                         <rect key="frame" x="325" y="15" width="80" height="80"/>
                         <constraints>
                             <constraint firstAttribute="height" constant="80" id="9fo-04-Dwb"/>
@@ -41,15 +40,18 @@
                         <nil key="highlightedColor"/>
                     </label>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GrI-Co-9ml">
-                        <rect key="frame" x="78" y="39.333333333333343" width="216" height="33.666666666666657"/>
+                        <rect key="frame" x="78" y="39.333333333333329" width="216" height="38.333333333333329"/>
+                        <constraints>
+                            <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="23" id="08N-mR-qZf"/>
+                        </constraints>
                         <string key="text">我是评论我是评论我是评论我
 qwqe</string>
-                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="16"/>
                         <nil key="textColor"/>
                         <nil key="highlightedColor"/>
                     </label>
                     <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="sLv-Vz-BQ7">
-                        <rect key="frame" x="78" y="45" width="40.666666666666657" height="18"/>
+                        <rect key="frame" x="78" y="45" width="48.666666666666657" height="18"/>
                         <subviews>
                             <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_heart_sel" translatesAutoresizingMaskIntoConstraints="NO" id="rL7-0D-Bf7">
                                 <rect key="frame" x="0.0" y="0.0" width="16.333333333333332" height="18"/>
@@ -58,16 +60,12 @@ qwqe</string>
                                 </constraints>
                             </imageView>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="点赞" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6GG-bh-1pE">
-                                <rect key="frame" x="18" y="3" width="20.666666666666671" height="12"/>
-                                <constraints>
-                                    <constraint firstAttribute="width" constant="20.670000000000002" id="3ov-vn-N6j"/>
-                                </constraints>
-                                <fontDescription key="fontDescription" type="system" pointSize="10"/>
+                                <rect key="frame" x="18" y="0.6666666666666643" width="28.666666666666671" height="17"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="14"/>
                                 <color key="textColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
                         </subviews>
-                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
                             <constraint firstAttribute="trailing" secondItem="6GG-bh-1pE" secondAttribute="trailing" constant="2" id="DMu-79-Ev4"/>
                             <constraint firstAttribute="height" constant="18" id="E2e-nb-hlZ"/>
@@ -79,19 +77,19 @@ qwqe</string>
                         </constraints>
                     </view>
                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="10分钟前" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qfD-Gl-p9a">
-                        <rect key="frame" x="78" y="81" width="42" height="12"/>
-                        <fontDescription key="fontDescription" type="system" pointSize="10"/>
+                        <rect key="frame" x="78" y="89.666666666666671" width="58" height="17"/>
+                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
                         <color key="textColor" red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <nil key="highlightedColor"/>
                     </label>
                 </subviews>
                 <constraints>
+                    <constraint firstItem="qfD-Gl-p9a" firstAttribute="top" secondItem="GrI-Co-9ml" secondAttribute="bottom" priority="500" constant="12" id="1kk-Ie-DKP"/>
                     <constraint firstItem="GrI-Co-9ml" firstAttribute="top" secondItem="C3w-tk-8Dq" secondAttribute="bottom" constant="1" id="AWG-eI-8L5"/>
                     <constraint firstAttribute="trailing" secondItem="Fd0-Zh-jKa" secondAttribute="trailing" constant="12" id="F2d-69-QbE"/>
                     <constraint firstItem="Fd0-Zh-jKa" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="HXS-Q2-WVg"/>
                     <constraint firstItem="GrI-Co-9ml" firstAttribute="leading" secondItem="C3w-tk-8Dq" secondAttribute="leading" id="LMS-xi-hCd"/>
                     <constraint firstAttribute="trailing" secondItem="GrI-Co-9ml" secondAttribute="trailing" constant="123" id="LWa-za-cnj"/>
-                    <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="qfD-Gl-p9a" secondAttribute="bottom" priority="500" constant="9" id="YLz-cG-xeU"/>
                     <constraint firstItem="C3w-tk-8Dq" firstAttribute="leading" secondItem="NbU-5i-Wt7" secondAttribute="trailing" constant="14" id="anx-uX-ERR"/>
                     <constraint firstItem="sLv-Vz-BQ7" firstAttribute="top" secondItem="C3w-tk-8Dq" secondAttribute="bottom" constant="6.6699999999999999" id="dHj-c0-Mqh"/>
                     <constraint firstItem="sLv-Vz-BQ7" firstAttribute="leading" secondItem="C3w-tk-8Dq" secondAttribute="leading" id="dTb-Ee-6vf"/>
@@ -99,8 +97,6 @@ qwqe</string>
                     <constraint firstItem="NbU-5i-Wt7" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="16" id="eXV-aD-d43"/>
                     <constraint firstItem="C3w-tk-8Dq" firstAttribute="top" secondItem="NbU-5i-Wt7" secondAttribute="top" id="p0C-gP-dIm"/>
                     <constraint firstItem="qfD-Gl-p9a" firstAttribute="leading" secondItem="C3w-tk-8Dq" secondAttribute="leading" id="pxl-GW-l4u"/>
-                    <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Fd0-Zh-jKa" secondAttribute="bottom" priority="750" constant="14" id="rJs-pi-otn"/>
-                    <constraint firstItem="qfD-Gl-p9a" firstAttribute="top" secondItem="GrI-Co-9ml" secondAttribute="bottom" constant="8" id="tbo-QW-lf6"/>
                 </constraints>
             </tableViewCellContentView>
             <connections>
@@ -117,8 +113,5 @@ qwqe</string>
     <resources>
         <image name="icon_ellipse" width="52.333332061767578" height="52.333332061767578"/>
         <image name="icon_heart_sel" width="16.333333969116211" height="16.333333969116211"/>
-        <systemColor name="systemBackgroundColor">
-            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-        </systemColor>
     </resources>
 </document>