Преглед изворни кода

上啦加载更多,撤销功能 cell 内容size计算完成。

openlockPPP пре 1 година
родитељ
комит
c8076b0b6b

+ 6 - 0
jiaPei.xcodeproj/project.pbxproj

@@ -98,6 +98,7 @@
 		90798B0A2A52722300E68461 /* NYComplaintListViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 90798B082A52722300E68461 /* NYComplaintListViewCell.m */; };
 		90798B0B2A52722300E68461 /* NYComplaintListViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90798B092A52722300E68461 /* NYComplaintListViewCell.xib */; };
 		90798B0F2A52AE2600E68461 /* ComplaintDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 90798B0E2A52AE2600E68461 /* ComplaintDataModel.m */; };
+		90798B122A53E87800E68461 /* NYComplaintListViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 90798B112A53E87800E68461 /* NYComplaintListViewModel.m */; };
 		90BA2E822A3177B50029A54A /* NYTheoryTimeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 90BA2E802A3177B50029A54A /* NYTheoryTimeVC.m */; };
 		90BA2E872A3177DE0029A54A /* NYGetjobTimeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 90BA2E852A3177DE0029A54A /* NYGetjobTimeVC.m */; };
 		90BA2E8B2A317BEB0029A54A /* NYBasetjTimeVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 90BA2E8A2A317BEB0029A54A /* NYBasetjTimeVC.m */; };
@@ -1816,6 +1817,8 @@
 		90798B092A52722300E68461 /* NYComplaintListViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NYComplaintListViewCell.xib; sourceTree = "<group>"; };
 		90798B0D2A52AE2600E68461 /* ComplaintDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ComplaintDataModel.h; sourceTree = "<group>"; };
 		90798B0E2A52AE2600E68461 /* ComplaintDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ComplaintDataModel.m; sourceTree = "<group>"; };
+		90798B102A53E87800E68461 /* NYComplaintListViewModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NYComplaintListViewModel.h; sourceTree = "<group>"; };
+		90798B112A53E87800E68461 /* NYComplaintListViewModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NYComplaintListViewModel.m; sourceTree = "<group>"; };
 		90BA2E7F2A3177B50029A54A /* NYTheoryTimeVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NYTheoryTimeVC.h; sourceTree = "<group>"; };
 		90BA2E802A3177B50029A54A /* NYTheoryTimeVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NYTheoryTimeVC.m; sourceTree = "<group>"; };
 		90BA2E842A3177DE0029A54A /* NYGetjobTimeVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NYGetjobTimeVC.h; sourceTree = "<group>"; };
@@ -4519,6 +4522,8 @@
 				90044C3A2A4E821E003FBBF8 /* NYFloatingSuggestViewModel.m */,
 				90044C452A4ED1CB003FBBF8 /* NYComplaintPageViewModel.h */,
 				90044C462A4ED1CB003FBBF8 /* NYComplaintPageViewModel.m */,
+				90798B102A53E87800E68461 /* NYComplaintListViewModel.h */,
+				90798B112A53E87800E68461 /* NYComplaintListViewModel.m */,
 			);
 			path = ViewModel;
 			sourceTree = "<group>";
@@ -10976,6 +10981,7 @@
 				D02010D229373AE8001B9F4D /* SLEditVideoController.m in Sources */,
 				D00A150A2754A41C00793046 /* CustomCollectionViewCell.m in Sources */,
 				D084D87F27CE033700E521F0 /* RQVipContentItemViewModel.m in Sources */,
+				90798B122A53E87800E68461 /* NYComplaintListViewModel.m in Sources */,
 				D09E5D4125E3AA260099E87C /* BDFaceSelectConfigController.m in Sources */,
 				D0481DA8289928A900F90D55 /* RQExamHistoryItemViewModel.m in Sources */,
 				D0D1F67C283F84DF0086C6AE /* RQCatalogueViewModel.m in Sources */,

BIN
jiaPei.xcworkspace/xcuserdata/mimasigeling.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
jiaPei/Modules/ComplaintModule/Controller/NYComplaintListViewController.h

@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface NYComplaintListViewController : UIViewController
 
-
+@property (weak, nonatomic) IBOutlet UITableView *tableView;
 
 @end
 

+ 45 - 72
jiaPei/Modules/ComplaintModule/Controller/NYComplaintListViewController.m

@@ -7,22 +7,14 @@
 //
 
 #import "NYComplaintListViewController.h"
-#import "NYComplaintPageViewController.h"
 #import "NYComplaintListViewCell.h"
-#import "ComplaintDataModel.h"
+#import "NYComplaintListViewModel.h"
 
 @interface NYComplaintListViewController ()<UITableViewDataSource,UITableViewDelegate>
 
-
 @property (weak, nonatomic) IBOutlet UIButton *addcomp_button;
 
-@property (weak, nonatomic) IBOutlet UITableView *tableView;
-
-@property (nonatomic,assign) int currentPage;
-
-@property (nonatomic,strong) ComplaintDataModel *complaintDataModel;
-
-@property (nonatomic,strong) NSMutableArray *complaintList;
+@property (nonatomic,strong) NYComplaintListViewModel *complaintListViewModel;
 
 @end
 
@@ -32,12 +24,13 @@
     [super viewDidLoad];
     // Do any additional setup after loading the view from its nib.
     [self setupUI];
+    [self bindViewModel];
 }
 
 - (void)viewWillAppear:(BOOL)animated
 {
     [super viewWillAppear:animated];
-    [self getComplaintList];
+    [self.complaintListViewModel getComplaintList];
 }
 
 - (void)dealloc {
@@ -46,56 +39,36 @@
 }
 
 #pragma mark - PublicMethods
-
-- (void)getComplaintList{
-    _currentPage = 1;
-    NSMutableArray *arr = [NSMutableArray array];
-    [arr addPro:@"stunum"            Value:RQ_USER_MANAGER.currentUser.outId];///学员编号
-    [arr addPro:@"currentPage"            Value:@(_currentPage)];///当前页
-    [arr addPro:@"pageSize"            Value:@10];
-    [arr addPro:@"dqbh"            Value:RQ_USER_MANAGER.currentUser.city];///地区编号
-    NSString *method = @"getComplaintList";
+//绑定vm
+- (void)bindViewModel{
     @weakify(self)
-    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
-        NSLog(@"%@",dict);
-        int code = [dict[@"code"] intValue];
-        if(code == 0 ){
-            self.complaintDataModel = [ComplaintDataModel yy_modelWithDictionary:dict[@"body"]];
-            if(self.complaintDataModel.list.count>0&&self.complaintList.count!=self.complaintDataModel.list.count){
-                [self.complaintList removeAllObjects];
-                [self.complaintList addObjectsFromArray:self.complaintDataModel.list];
-                [self.tableView reloadData];
-            }
-        }
+    // 使用 RAC 建立按钮点击事件与视图模型中的命令的绑定
+    [[self.addcomp_button rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
+        @strongify(self);
+        [self.complaintListViewModel.addCommand execute:nil];
     }];
-}
-
-//更多下一页
-- (void)getComplaintListMore {
     
-    int total = 10* (_currentPage+1);
-    if(self.complaintDataModel.total > total){
-        _currentPage +=1;
-        NSMutableArray *arr = [NSMutableArray array];
-        [arr addPro:@"stunum"            Value:RQ_USER_MANAGER.currentUser.outId];///学员编号
-        [arr addPro:@"currentPage"            Value:@(_currentPage)];///当前页
-        [arr addPro:@"pageSize"            Value:@10];
-        [arr addPro:@"dqbh"            Value:RQ_USER_MANAGER.currentUser.city];///地区编号
-        NSString *method = @"getComplaintList";
-        @weakify(self)
-        [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
-            NSLog(@"%@",dict);
-            int code = [dict[@"code"] intValue];
-            if(code == 0 ){
-                self.complaintDataModel = [ComplaintDataModel yy_modelWithDictionary:dict[@"body"]];
-                if(self.complaintDataModel.list.count>0&&self.complaintList.count!=self.complaintDataModel.list.count){
-                    [self.complaintList addObjectsFromArray:self.complaintDataModel.list];
-                    [self.tableView reloadData];
-                }
-            }
-        }];
-    }
+    /// 上拉加载
+    [self.tableView rq_addFooterRefresh:^(MJRefreshAutoNormalFooter *footer) {
+        /// 加载上拉刷新的数据
+        @strongify(self);
+        [self.complaintListViewModel getComplaintListMore];
+    }];
     
+    /// 隐藏footer or 无更多数据
+    RAC(self.tableView.mj_footer, hidden) = [[RACObserve(self.complaintListViewModel, dataSource)
+                                              deliverOnMainThread]
+                                             map:^(NSArray *dataSource) {
+                                                 @strongify(self)
+                                                 NSUInteger count = dataSource.count;
+                                                 /// 无数据,默认隐藏mj_footer
+                                                 if (count == 0) return @1;
+        
+                                                 /// 无更多数据,隐藏mj_footer
+                                                 if (count == self.complaintListViewModel.complaintDataModel.total) return @1;
+                                                 /// because of
+                                                 return (count % self.complaintListViewModel.currentPage)?@1:@0;
+                                             }];
 }
 
 #pragma mark - PrivateMethods
@@ -112,44 +85,44 @@
     
 }
 
-#pragma mark - 事件
-
-- (IBAction)pushAddCompdo:(UIButton *)sender {
-    NYComplaintPageViewController *complaintPageViewController = [[NYComplaintPageViewController alloc] init];
-    [RQControllerHelper.currentViewController.navigationController qmui_pushViewController:complaintPageViewController animated:YES completion:nil];
-}
-
-
 #pragma mark - UITableViewDataSource
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
 {
-    return  self.complaintList.count;
+    return  self.complaintListViewModel.complaintList.count;
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    return 260;
+    ComplaintInfoModel *info =self.complaintListViewModel.complaintList[indexPath.row];
+    return info.cellHeight;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
     NYComplaintListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"NYComplaintListViewCell"];
-    [cell setComplaintInfoModel:self.complaintList[indexPath.row]];
+    [cell setComplaintInfoModel:self.complaintListViewModel.complaintList[indexPath.row]];
+    cell.cancelCommand = self.complaintListViewModel.cancelCommand;
     return cell;
 }
 
 #pragma mark - UITableViewDelegate
 
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    [tableView deselectRowAtIndexPath:indexPath animated:true];
+    
+}
 
 #pragma mark - Lazy
 
-- (NSMutableArray *)complaintList
+- (NYComplaintListViewModel *)complaintListViewModel
 {
-    if(!_complaintList){
-        _complaintList = [NSMutableArray array];
+    if(!_complaintListViewModel){
+        _complaintListViewModel = [[NYComplaintListViewModel alloc] init];
+        _complaintListViewModel.vc = self;
     }
-    return _complaintList;
+    return _complaintListViewModel;
 }
 
 @end

+ 0 - 3
jiaPei/Modules/ComplaintModule/Controller/NYComplaintListViewController.xib

@@ -37,9 +37,6 @@
                     </constraints>
                     <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
                     <state key="normal" image="comp_add_button"/>
-                    <connections>
-                        <action selector="pushAddCompdo:" destination="-1" eventType="touchUpInside" id="hw4-Bl-8m9"/>
-                    </connections>
                 </button>
             </subviews>
             <viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>

+ 2 - 0
jiaPei/Modules/ComplaintModule/Controller/NYComplaintPageViewController.h

@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic ,strong) UICollectionView *collectionView;
 @property (nonatomic ,strong) NSMutableArray *photosArray;
 
+//手机号码
+@property (weak, nonatomic) IBOutlet UITextField *phone_textfield;
 //投诉
 @property (weak, nonatomic) IBOutlet UIButton *px_button;
 

+ 2 - 2
jiaPei/Modules/ComplaintModule/Controller/NYComplaintPageViewController.m

@@ -20,8 +20,7 @@
 
 //名称
 @property (weak, nonatomic) IBOutlet UILabel *objname_label;
-//手机号码
-@property (weak, nonatomic) IBOutlet UITextField *phone_textfield;
+
 
 //照片 图片 - collectionView
 @property (weak, nonatomic) IBOutlet UIView *imageArrayView;
@@ -54,6 +53,7 @@
 }
 
 - (void)configureUI {
+    self.phone_textfield.text = RQ_USER_MANAGER.currentUser.telphone;
     self.content_textview.maximumTextLength = 500;
     self.currentType_button = self.px_button;
     [self.collectionView registerClass:[CollectionViewCell class] forCellWithReuseIdentifier:@"cell"];

+ 5 - 0
jiaPei/Modules/ComplaintModule/Model/ComplaintDataModel.h

@@ -23,6 +23,11 @@ NS_ASSUME_NONNULL_BEGIN
 @property (nonatomic , copy) NSNumber              * CI_STUNUM;
 @property (nonatomic , copy) NSString              * PICURLS;
 
+
+@property (nonatomic , assign) CGFloat CONTENT_H;
+//cell 高度
+@property (nonatomic , assign) CGFloat cellHeight;
+
 @end
 
 @interface ComplaintDataModel : RQBaseModel

+ 34 - 0
jiaPei/Modules/ComplaintModule/Model/ComplaintDataModel.m

@@ -10,6 +10,40 @@
 
 @implementation ComplaintInfoModel
 
+- (CGFloat)cellHeight
+{
+    CGFloat height = 100;
+    //计算字size + imageview
+    CGFloat maxH = [self NY_sizeWithFont:[UIFont systemFontOfSize:15.f] width:260];
+    height += maxH;
+    if (self.PICURLS.length>0){
+        height += 70;
+    }
+    return height;
+}
+
+- (CGFloat)NY_sizeWithFont:(UIFont*)font width:(CGFloat)width{
+    NSString *text = self.CI_CONTENT;
+    CGFloat maxWidth = width;
+    CGFloat lineSpacing = 0; // 设置行间距
+    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
+    paragraphStyle.lineSpacing = lineSpacing;
+
+    NSDictionary *attributes = @{NSFontAttributeName: font,
+                                 NSParagraphStyleAttributeName: paragraphStyle};
+
+    CGRect boundingRect = [text boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX)
+                                             options:NSStringDrawingUsesLineFragmentOrigin
+                                          attributes:attributes
+                                             context:nil];
+
+    CGSize textSize = boundingRect.size;
+    if(textSize.height>300){ //
+        return textSize.height - 130;
+    }
+    return textSize.height;
+}
+
 @end
 
 

+ 4 - 0
jiaPei/Modules/ComplaintModule/View/NYComplaintListViewCell.h

@@ -21,9 +21,13 @@ NS_ASSUME_NONNULL_BEGIN
 @property (weak, nonatomic) IBOutlet UILabel *content_label;
 //照片
 @property (weak, nonatomic) IBOutlet UIView *imagelist_view;
+//撤销
+@property (weak, nonatomic) IBOutlet UIButton *cancel_button;
 
 @property (strong, nonatomic) ComplaintInfoModel *complaintInfoModel;
 
+@property (nonatomic, strong) RACCommand *cancelCommand;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 10 - 2
jiaPei/Modules/ComplaintModule/View/NYComplaintListViewCell.m

@@ -13,6 +13,7 @@
     
 }
 
+@property (weak, nonatomic) IBOutlet NSLayoutConstraint *content_layout_h;
 @property (nonatomic ,strong) UICollectionView *collectionView;
 @property (nonatomic ,strong) NSMutableArray *photosArray;
 
@@ -71,17 +72,20 @@
         [self.state_button setTitle:statename forState:UIControlStateNormal];
         if(complaintInfoModel.AUDIT_STATUS.intValue==2){
             self.state_button.backgroundColor = UIColorHex(0x498EF5);
+            YES;
         }else {
             self.state_button.backgroundColor = UIColorHex(0xEAEBED);
+            self.cancel_button.hidden = NO;
         }
+        self.cancel_button.hidden = complaintInfoModel.AUDIT_STATUS.intValue ==0 ? NO:YES;
+        [self.photosArray removeAllObjects];
         //图片
         if(complaintInfoModel.PICURLS.length>0){
-            [self.photosArray removeAllObjects];
             complaintInfoModel.PICURLS = [complaintInfoModel.PICURLS stringByReplacingOccurrencesOfString:@" " withString:@""];
             NSArray *list = [complaintInfoModel.PICURLS componentsSeparatedByString:@","];
             [self.photosArray addObjectsFromArray:list];
-            [self.collectionView reloadData];
         }
+        [self.collectionView reloadData];
     }
 }
 
@@ -127,5 +131,9 @@
     return _collectionView;
 }
 
+- (IBAction)cancelActiondo:(id)sender {
+    [self.cancelCommand execute:self.complaintInfoModel];
+}
+
 
 @end

+ 32 - 12
jiaPei/Modules/ComplaintModule/View/NYComplaintListViewCell.xib

@@ -22,11 +22,11 @@
                         <rect key="frame" x="15" y="15" width="290" height="245"/>
                         <subviews>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="s9n-5k-q7k">
-                                <rect key="frame" x="238" y="12" width="62" height="24"/>
+                                <rect key="frame" x="228" y="12" width="72" height="24"/>
                                 <color key="backgroundColor" red="0.28627450980392155" green="0.55686274509803924" blue="0.96078431372549022" alpha="1" colorSpace="calibratedRGB"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="24" id="Cdi-11-FeE"/>
-                                    <constraint firstAttribute="width" constant="62" id="gWY-mR-xjm"/>
+                                    <constraint firstAttribute="width" constant="72" id="gWY-mR-xjm"/>
                                 </constraints>
                                 <fontDescription key="fontDescription" type="system" pointSize="12"/>
                                 <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
@@ -58,7 +58,7 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="25Y-jw-pjb">
-                                <rect key="frame" x="85" y="12" width="145" height="20"/>
+                                <rect key="frame" x="85" y="12" width="135" height="20"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="20" id="KaO-Nv-7rh"/>
                                 </constraints>
@@ -66,27 +66,44 @@
                                 <color key="textColor" red="0.039215686274509803" green="0.10196078431372549" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
                                 <nil key="highlightedColor"/>
                             </label>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontForContentSizeCategory="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VUY-v3-HCe">
+                                <rect key="frame" x="15" y="66" width="260" height="89.666666666666686"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="30" id="1zA-jP-ok8"/>
+                                </constraints>
+                                <string key="text">LabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabel</string>
+                                <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                                <color key="textColor" red="0.039215686270000001" green="0.1019607843" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
+                                <nil key="highlightedColor"/>
+                            </label>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Wk5-2w-kwf" userLabel="View-content">
-                                <rect key="frame" x="15" y="164" width="260" height="56"/>
+                                <rect key="frame" x="15" y="165.66666666666666" width="260" height="56"/>
                                 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="56" id="kBT-TW-Svw"/>
                                 </constraints>
                             </view>
-                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" lineBreakMode="tailTruncation" numberOfLines="5" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VUY-v3-HCe">
-                                <rect key="frame" x="15" y="66" width="260" height="88"/>
+                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bii-kH-787">
+                                <rect key="frame" x="220" y="36" width="70" height="24"/>
                                 <constraints>
-                                    <constraint firstAttribute="height" constant="88" id="ZWq-p9-MIr"/>
+                                    <constraint firstAttribute="height" constant="24" id="MZh-NB-lfP"/>
+                                    <constraint firstAttribute="width" constant="70" id="dNC-mm-8ww"/>
                                 </constraints>
-                                <string key="text">LabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabelLabel</string>
-                                <fontDescription key="fontDescription" type="system" pointSize="15"/>
-                                <color key="textColor" red="0.039215686270000001" green="0.1019607843" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
-                                <nil key="highlightedColor"/>
-                            </label>
+                                <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                                <inset key="titleEdgeInsets" minX="10" minY="0.0" maxX="0.0" maxY="0.0"/>
+                                <inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
+                                <state key="normal" title="撤销">
+                                    <color key="titleColor" red="0.36078431370000003" green="0.37647058820000001" blue="0.40000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </state>
+                                <connections>
+                                    <action selector="cancelActiondo:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="iHG-SF-aK3"/>
+                                </connections>
+                            </button>
                         </subviews>
                         <color key="backgroundColor" systemColor="systemBackgroundColor"/>
                         <constraints>
                             <constraint firstItem="Wk5-2w-kwf" firstAttribute="leading" secondItem="7nK-KT-TV9" secondAttribute="leading" constant="15" id="0vH-jC-kKE"/>
+                            <constraint firstItem="bii-kH-787" firstAttribute="top" secondItem="s9n-5k-q7k" secondAttribute="bottom" id="DL0-By-maJ"/>
                             <constraint firstItem="25Y-jw-pjb" firstAttribute="top" secondItem="7nK-KT-TV9" secondAttribute="top" constant="12" id="Hk0-8a-NS3"/>
                             <constraint firstItem="sRZ-UP-G3s" firstAttribute="leading" secondItem="7nK-KT-TV9" secondAttribute="leading" constant="15" id="IXh-or-FWI"/>
                             <constraint firstItem="Qi2-TG-61Z" firstAttribute="leading" secondItem="7nK-KT-TV9" secondAttribute="leading" constant="15" id="Lu6-35-yEz"/>
@@ -98,6 +115,7 @@
                             <constraint firstItem="Qi2-TG-61Z" firstAttribute="top" secondItem="7nK-KT-TV9" secondAttribute="top" constant="12" id="cEv-JA-NIa"/>
                             <constraint firstItem="25Y-jw-pjb" firstAttribute="leading" secondItem="Qi2-TG-61Z" secondAttribute="trailing" constant="8" symbolic="YES" id="eFf-uB-Nw2"/>
                             <constraint firstItem="s9n-5k-q7k" firstAttribute="leading" secondItem="25Y-jw-pjb" secondAttribute="trailing" constant="8" symbolic="YES" id="kFt-fK-931"/>
+                            <constraint firstAttribute="trailing" secondItem="bii-kH-787" secondAttribute="trailing" id="owe-P8-aT8"/>
                             <constraint firstAttribute="trailing" secondItem="VUY-v3-HCe" secondAttribute="trailing" constant="15" id="um2-gT-pdo"/>
                             <constraint firstItem="VUY-v3-HCe" firstAttribute="top" secondItem="sRZ-UP-G3s" secondAttribute="bottom" constant="4" id="wzv-f3-Ebl"/>
                             <constraint firstItem="Wk5-2w-kwf" firstAttribute="top" secondItem="VUY-v3-HCe" secondAttribute="bottom" constant="10" id="xy8-J3-CUP"/>
@@ -119,7 +137,9 @@
             </tableViewCellContentView>
             <viewLayoutGuide key="safeArea" id="aW0-zy-SZf"/>
             <connections>
+                <outlet property="cancel_button" destination="bii-kH-787" id="QxN-1f-fRU"/>
                 <outlet property="content_label" destination="VUY-v3-HCe" id="YfR-GL-du6"/>
+                <outlet property="content_layout_h" destination="1zA-jP-ok8" id="Osi-Bm-PRb"/>
                 <outlet property="imagelist_view" destination="Wk5-2w-kwf" id="peZ-5g-7io"/>
                 <outlet property="name_label" destination="25Y-jw-pjb" id="5SD-PL-iqJ"/>
                 <outlet property="state_button" destination="s9n-5k-q7k" id="SOr-OW-RmB"/>

+ 37 - 0
jiaPei/Modules/ComplaintModule/ViewModel/NYComplaintListViewModel.h

@@ -0,0 +1,37 @@
+//
+//  NYComplaintListViewModel.h
+//  jiaPei
+//
+//  Created by Ning.ge on 2023/7/4.
+//  Copyright © 2023 JCZ. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import "NYComplaintListViewController.h"
+#import "ComplaintDataModel.h"
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NYComplaintListViewModel : NSObject
+
+@property (nonatomic,assign) int currentPage;
+
+@property (nonatomic,strong) ComplaintDataModel *complaintDataModel;
+
+@property (nonatomic,strong) NSMutableArray *complaintList;
+/// The data source of table view. 这里不能用NSMutableArray,因为NSMutableArray不支持KVO,不能被RACObserve
+@property (nonatomic, readwrite, copy) NSArray *dataSource;
+
+@property (nonatomic,weak) NYComplaintListViewController *vc;
+
+//新增投诉
+@property (nonatomic, strong) RACCommand *addCommand;
+//撤销投诉
+@property (nonatomic, strong) RACCommand *cancelCommand;
+
+- (void)getComplaintList;
+
+- (void)getComplaintListMore;
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 131 - 0
jiaPei/Modules/ComplaintModule/ViewModel/NYComplaintListViewModel.m

@@ -0,0 +1,131 @@
+//
+//  NYComplaintListViewModel.m
+//  jiaPei
+//
+//  Created by Ning.ge on 2023/7/4.
+//  Copyright © 2023 JCZ. All rights reserved.
+//
+
+#import "NYComplaintListViewModel.h"
+#import "NYComplaintPageViewController.h"
+
+
+@implementation NYComplaintListViewModel
+
+- (instancetype)init {
+    self = [super init];
+    if (self) {
+        [self setupCommands];
+    }
+    return self;
+}
+
+- (void)setupCommands {
+    @weakify(self)
+    self.addCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id  _Nullable input) {
+        @strongify(self);
+        NYComplaintPageViewController *complaintPageViewController = [[NYComplaintPageViewController alloc] init];
+        [RQControllerHelper.currentViewController.navigationController qmui_pushViewController:complaintPageViewController animated:YES completion:nil];
+        return [RACSignal empty];
+    }];
+    self.cancelCommand = [[RACCommand alloc] initWithSignalBlock:^RACSignal * _Nonnull(id  _Nullable input) {
+        @strongify(self);
+        [self cancelHandledo:input];
+        return [RACSignal empty];
+    }];
+    
+}
+
+- (void)getComplaintList{
+    _currentPage = 1;
+    NSMutableArray *arr = [NSMutableArray array];
+    [arr addPro:@"stunum"            Value:RQ_USER_MANAGER.currentUser.outId];///学员编号
+    [arr addPro:@"currentPage"            Value:@(_currentPage)];///当前页
+    [arr addPro:@"pageSize"            Value:@10];
+    [arr addPro:@"dqbh"            Value:RQ_USER_MANAGER.currentUser.city];///地区编号
+    NSString *method = @"getComplaintList";
+    @weakify(self)
+    [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
+        @strongify(self);
+        NSLog(@"%@",dict);
+        int code = [dict[@"code"] intValue];
+        if(code == 0 ){
+            self.complaintDataModel = [ComplaintDataModel yy_modelWithDictionary:dict[@"body"]];
+            if(self.complaintDataModel.list.count>0&&self.complaintList.count!=self.complaintDataModel.list.count){
+                [self.complaintList removeAllObjects];
+                [self.complaintList addObjectsFromArray:self.complaintDataModel.list];
+                self.dataSource = self.complaintList;
+                [self.vc.tableView reloadData];
+            }
+        }
+    }];
+}
+
+//更多下一页
+- (void)getComplaintListMore {
+    
+    int total = 10* _currentPage;
+    if(self.complaintDataModel.total > total){
+        _currentPage +=1;
+        NSMutableArray *arr = [NSMutableArray array];
+        [arr addPro:@"stunum"            Value:RQ_USER_MANAGER.currentUser.outId];///学员编号
+        [arr addPro:@"currentPage"            Value:@(_currentPage)];///当前页
+        [arr addPro:@"pageSize"            Value:@10];
+        [arr addPro:@"dqbh"            Value:RQ_USER_MANAGER.currentUser.city];///地区编号
+        NSString *method = @"getComplaintList";
+        @weakify(self)
+        [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
+            @strongify(self);
+            NSLog(@"%@",dict);
+            int code = [dict[@"code"] intValue];
+            if(code == 0 ){
+                self.complaintDataModel = [ComplaintDataModel yy_modelWithDictionary:dict[@"body"]];
+                if(self.complaintDataModel.list.count>0&&self.complaintList.count!=self.complaintDataModel.list.count){
+                    [self.complaintList addObjectsFromArray:self.complaintDataModel.list];
+                    self.dataSource = self.complaintList;
+                    [self.vc.tableView reloadData];
+                }
+            }
+            [self.vc.tableView.mj_footer endRefreshing];
+        }];
+    }else {
+        [self.vc.tableView.mj_footer endRefreshing];
+    }
+    
+}
+
+//撤销
+- (void)cancelHandledo:(ComplaintInfoModel*)model {
+    NSInteger compId = model.CI_ID;//减少开销
+    @weakify(self)
+    [RQ_SHARE_FUNCTION showAlertWithTitle:@"提示" message:@"是否撤销投诉!" alertControllerStyle:UIAlertControllerStyleAlert cancelButtonTitle:@"取消" otherButtonTitles:@[@"确定"] otherButtonStyles:nil showInWindow:NO completion:^(NSUInteger selectedOtherButtonIndex) {
+        if (selectedOtherButtonIndex == 0) {
+            NSMutableArray *arr = [NSMutableArray array];
+            [arr addPro:@"id"            Value:@(compId)];
+            [arr addPro:@"dqbh"            Value:RQ_USER_MANAGER.currentUser.city];///地区编号
+            NSString *method = @"delComplaint";
+            [jiaPeiManager requestAnythingWithURL:method array:arr data:nil completion:^(NSDictionary *dict) {
+                @strongify(self);
+                NSLog(@"%@",dict);
+                int code = [dict[@"code"] intValue];
+                if(code == 0 ){
+                    model.AUDIT_STATUS = @4;
+                    [self.vc.tableView reloadData];
+                }
+            }];
+        }
+    }];
+}
+
+
+#pragma mark - Lazy
+
+- (NSMutableArray *)complaintList
+{
+    if(!_complaintList){
+        _complaintList = [NSMutableArray array];
+    }
+    return _complaintList;
+}
+
+@end

+ 6 - 1
jiaPei/Modules/ComplaintModule/ViewModel/NYComplaintPageViewModel.m

@@ -8,6 +8,7 @@
 
 #import "NYComplaintPageViewModel.h"
 
+
 @implementation NYComplaintPageViewModel
 
 - (instancetype)init {
@@ -97,11 +98,15 @@
         [picids deleteCharactersInRange:range];
     }
     NSString *content = self.complaintPageViewVC.content_textview.text;
+    if(content.length==0){
+        ShowMsg(@"请输入投诉建议");
+        return;
+    }
     NSMutableArray *arr = [NSMutableArray array];
     [arr addPro:@"stunum"            Value:RQ_USER_MANAGER.currentUser.outId];///学员编号
     [arr addPro:@"type"            Value:@2];///驾校
     [arr addPro:@"content"            Value:content];///投诉内容
-    [arr addPro:@"phone"            Value:RQ_USER_MANAGER.currentUser.telphone];///学员电话
+    [arr addPro:@"phone"            Value:self.complaintPageViewVC.phone_textfield.text];///学员电话
     [arr addPro:@"picids"            Value:picids];///照片ID ,,
     [arr addPro:@"dqbh"            Value:RQ_USER_MANAGER.currentUser.city];///地区编号
     [MBProgressHUD rq_showProgressHUD:@"提交投诉..."];