2
0
桂欢 1 rok pred
rodič
commit
9b8e3907a5
30 zmenil súbory, kde vykonal 256 pridanie a 195 odobranie
  1. 10 0
      SLAiELTS/SLAiELTS.xcodeproj/project.pbxproj
  2. 0 22
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_gp.imageset/Contents.json
  3. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_gp.imageset/icon_home_gp@2x.png
  4. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_gp.imageset/icon_home_gp@3x.png
  5. 0 22
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_tl.imageset/Contents.json
  6. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_tl.imageset/icon_home_tl@2x.png
  7. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_tl.imageset/icon_home_tl@3x.png
  8. 0 22
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_xz.imageset/Contents.json
  9. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_xz.imageset/icon_home_xz@2x.png
  10. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_xz.imageset/icon_home_xz@3x.png
  11. 0 22
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yd.imageset/Contents.json
  12. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yd.imageset/icon_home_yd@2x.png
  13. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yd.imageset/icon_home_yd@3x.png
  14. 0 22
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yx.imageset/Contents.json
  15. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yx.imageset/icon_home_yx@2x.png
  16. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yx.imageset/icon_home_yx@3x.png
  17. 0 22
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_zysj.imageset/Contents.json
  18. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_zysj.imageset/icon_home_zysj@2x.png
  19. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_zysj.imageset/icon_home_zysj@3x.png
  20. 0 22
      SLAiELTS/SLAiELTS/Assets.xcassets/LX/icon_lx_voc_bg.imageset/Contents.json
  21. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/LX/icon_lx_voc_bg.imageset/icon_lx_voc_bg@2x.png
  22. BIN
      SLAiELTS/SLAiELTS/Assets.xcassets/LX/icon_lx_voc_bg.imageset/icon_lx_voc_bg@3x.png
  23. 3 0
      SLAiELTS/SLAiELTS/ViewControllers/LoginVC/Models/SLUserModel.h
  24. 14 0
      SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/YMChatServiceView.m
  25. 8 1
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/Models/SLImagePickerAndUpload.h
  26. 31 39
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/Models/SLImagePickerAndUpload.m
  27. 16 0
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLMsgBgSetVc.h
  28. 117 0
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLMsgBgSetVc.m
  29. 52 0
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLMsgBgSetVc.xib
  30. 5 1
      SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLUserCenterViewController.m

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

@@ -140,6 +140,8 @@
 		3D3BC35D2A273E7500AEEE8E /* icon_yb_bg_01.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 3D3BC35C2A273E7400AEEE8E /* icon_yb_bg_01.jpg */; };
 		3D58825D2A28397D00F1B38E /* SLCitySetVc.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D58825B2A28397D00F1B38E /* SLCitySetVc.m */; };
 		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 */; };
 		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 */; };
@@ -521,6 +523,9 @@
 		3D58825A2A28397D00F1B38E /* SLCitySetVc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SLCitySetVc.h; sourceTree = "<group>"; };
 		3D58825B2A28397D00F1B38E /* SLCitySetVc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLCitySetVc.m; sourceTree = "<group>"; };
 		3D58825C2A28397D00F1B38E /* SLCitySetVc.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SLCitySetVc.xib; sourceTree = "<group>"; };
+		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>"; };
 		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>"; };
@@ -1878,6 +1883,9 @@
 				3D58825A2A28397D00F1B38E /* SLCitySetVc.h */,
 				3D58825B2A28397D00F1B38E /* SLCitySetVc.m */,
 				3D58825C2A28397D00F1B38E /* SLCitySetVc.xib */,
+				3D5882882A2976CD00F1B38E /* SLMsgBgSetVc.h */,
+				3D5882892A2976CD00F1B38E /* SLMsgBgSetVc.m */,
+				3D58828A2A2976CD00F1B38E /* SLMsgBgSetVc.xib */,
 			);
 			path = VCs;
 			sourceTree = "<group>";
@@ -1997,6 +2005,7 @@
 				3D24986D29AC72E2003C3AFA /* SLLoginVCViewController.xib in Resources */,
 				3DF3DAD829BAD1BA00CAD3AB /* SLChangeMobileVc.xib in Resources */,
 				3D2D8BEE29DE55A9009392DA /* unicode_to_hanyu_pinyin.txt in Resources */,
+				3D58828C2A2976CD00F1B38E /* SLMsgBgSetVc.xib in Resources */,
 				3D1B987329BEB35B0008D01A /* SLHorScrBtnsCell.xib in Resources */,
 				3D25105729AC8FE1000AE530 /* SLRegistViewController.xib in Resources */,
 				3D8C9F8A29AC57F300678283 /* LaunchScreen.storyboard in Resources */,
@@ -2156,6 +2165,7 @@
 				3DF3DAF129BB131100CAD3AB /* RDVTabBarController.m in Sources */,
 				3D3BC1CC2A25933400AEEE8E /* SLMomentsNewsCell.m in Sources */,
 				3D6EE45329F2568000B02EBB /* SLRecomFriendsVc.m in Sources */,
+				3D58828B2A2976CD00F1B38E /* SLMsgBgSetVc.m in Sources */,
 				3DF3DAF529BB170F00CAD3AB /* SLHomeView.m in Sources */,
 				3D19CBFA29E7ABFD0041A6B8 /* TTTableViewPlaceView.m in Sources */,
 				3DB97DA029D6ABF000B12754 /* MLTextAttachment.m in Sources */,

+ 0 - 22
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_gp.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "icon_home_gp@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "icon_home_gp@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_gp.imageset/icon_home_gp@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_gp.imageset/icon_home_gp@3x.png


+ 0 - 22
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_tl.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "icon_home_tl@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "icon_home_tl@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_tl.imageset/icon_home_tl@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_tl.imageset/icon_home_tl@3x.png


+ 0 - 22
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_xz.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "icon_home_xz@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "icon_home_xz@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_xz.imageset/icon_home_xz@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_xz.imageset/icon_home_xz@3x.png


+ 0 - 22
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yd.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "icon_home_yd@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "icon_home_yd@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yd.imageset/icon_home_yd@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yd.imageset/icon_home_yd@3x.png


+ 0 - 22
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yx.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "icon_home_yx@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "icon_home_yx@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yx.imageset/icon_home_yx@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_yx.imageset/icon_home_yx@3x.png


+ 0 - 22
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_zysj.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "icon_home_zysj@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "icon_home_zysj@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_zysj.imageset/icon_home_zysj@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/Home/icon_home_zysj.imageset/icon_home_zysj@3x.png


+ 0 - 22
SLAiELTS/SLAiELTS/Assets.xcassets/LX/icon_lx_voc_bg.imageset/Contents.json

@@ -1,22 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "filename" : "icon_lx_voc_bg@2x.png",
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "filename" : "icon_lx_voc_bg@3x.png",
-      "idiom" : "universal",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "author" : "xcode",
-    "version" : 1
-  }
-}

BIN
SLAiELTS/SLAiELTS/Assets.xcassets/LX/icon_lx_voc_bg.imageset/icon_lx_voc_bg@2x.png


BIN
SLAiELTS/SLAiELTS/Assets.xcassets/LX/icon_lx_voc_bg.imageset/icon_lx_voc_bg@3x.png


+ 3 - 0
SLAiELTS/SLAiELTS/ViewControllers/LoginVC/Models/SLUserModel.h

@@ -26,6 +26,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, copy) NSString *userHead;
 
+@property (nonatomic, copy) NSString *userMsgBg;
+
+
 @property (nonatomic, copy) NSString *userName;
 
 @property (nonatomic, copy) NSString *birthday;

+ 14 - 0
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/YMChatServiceView.m

@@ -35,6 +35,18 @@
 
 - (void)confignUI
 {
+    if ([SLGlobalInfo SharedInstance].loginInfo.user.userMsgBg.length) {
+        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
+        NSString *userImg = [NSString stringWithFormat:@"%@%@",[SLHttpCenter SharedInstance].serverUrl, [SLGlobalInfo SharedInstance].loginInfo.user.userMsgBg];
+        [imageView sd_setImageWithURL:[NSURL URLWithString:userImg]];
+        imageView.contentMode = UIViewContentModeScaleAspectFill;
+        imageView.clipsToBounds = YES;
+        [self addSubview:imageView];
+        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.edges.equalTo(self.messageView);
+        }];
+    }
+    
     CGFloat bottomHeight = 56 + kSafeAreaBottom;
     self.messageView.messageCollectionView.contentInset = UIEdgeInsetsMake(0, 0, 32, 0);
     
@@ -42,6 +54,8 @@
         make.top.left.right.equalTo(self);
         make.bottom.equalTo(self.chatBottomView.mas_top).offset(0);
     }];
+    self.messageView.backgroundColor = [UIColor clearColor];
+    
     
     [self.chatBottomView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.right.equalTo(self);

+ 8 - 1
SLAiELTS/SLAiELTS/ViewControllers/MyVC/Models/SLImagePickerAndUpload.h

@@ -7,16 +7,23 @@
 
 #import <Foundation/Foundation.h>
 
-typedef void(^SLImageUploadBlock)(NSString *imageUrl) ;
 
 NS_ASSUME_NONNULL_BEGIN
 
+typedef void(^SLImageUploadBlock)(NSString *imageUrl) ;
+
 @interface SLImagePickerAndUpload : NSObject
 
 @property (nonatomic, copy) SLImageUploadBlock uploadBlock;
 
+@property (nonatomic, assign) BOOL isOriginImage;
+
 - (void)willShowActionSheet;
 
+- (void)addPicwithCamera;
+
+- (void)addPicWithPhotoLibrary;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 31 - 39
SLAiELTS/SLAiELTS/ViewControllers/MyVC/Models/SLImagePickerAndUpload.m

@@ -18,29 +18,12 @@
         switch (index) {
             case 0:
             {
-            //判断相机权限
-                AVAuthorizationStatus authStatus =  [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
-                if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
-                {
-                    [SLCustomizeAlert showAletrWithTitle:@"允许相机访问" message:@"请在iOS”设置-隐私-相机“选项中,允许访问您的相机" sureBtnTitle:@"确定" cancelBtnTitle:@"取消" sureBtnAction:^{
-                        if (index == 0) {
-                            NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
-                            if([[UIApplication sharedApplication] canOpenURL:url]) {
-                                NSURL*url =[NSURL URLWithString:UIApplicationOpenSettingsURLString];
-                                [[UIApplication sharedApplication] openURL:url];
-                            }
-                        }
-                    } cancelBtnAction:^{
-                        
-                    }];
-                    return;
-                }
-                [weakSelf addPicEvent:nil type:UIImagePickerControllerSourceTypeCamera];
+                [weakSelf addPicwithCamera];
             }
                 break;
             case 1:
             {
-                [weakSelf addPicEvent:nil type:UIImagePickerControllerSourceTypePhotoLibrary];
+                [weakSelf addPicWithPhotoLibrary];
             }
                 break;
             default:
@@ -49,14 +32,32 @@
     }];
 }
 
+- (void)addPicwithCamera {
+    //判断相机权限
+    AVAuthorizationStatus authStatus =  [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
+    if (authStatus == AVAuthorizationStatusRestricted || authStatus ==AVAuthorizationStatusDenied)
+    {
+        [SLCustomizeAlert showAletrWithTitle:@"允许相机访问" message:@"请在iOS”设置-隐私-相机“选项中,允许访问您的相机" sureBtnTitle:@"确定" cancelBtnTitle:@"取消" sureBtnAction:^{
+            NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
+            if([[UIApplication sharedApplication] canOpenURL:url]) {
+                NSURL*url =[NSURL URLWithString:UIApplicationOpenSettingsURLString];
+                [[UIApplication sharedApplication] openURL:url];
+            }
+        } cancelBtnAction:^{
+            
+        }];
+        return;
+    }
+    [self addPicEvent:nil type:UIImagePickerControllerSourceTypeCamera];
+}
+
+- (void)addPicWithPhotoLibrary {
+    [self addPicEvent:nil type:UIImagePickerControllerSourceTypePhotoLibrary];
+}
+
 - (void)addPicEvent:(NSDictionary *)parma
                type:(UIImagePickerControllerSourceType)picType
 {
-    
-    //    NSDictionary *dictPictureSize = [parma objectForKey:@""];
-    CGSize pitureSize=CGSizeMake(200, 200);
-    float RepresentationF=0.2f;
-    
     if (picType == UIImagePickerControllerSourceTypeCamera && ![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
         NSLog(@"不支持相机");
         return;
@@ -69,27 +70,17 @@
     picker.allowsEditing = YES;
     __unsafe_unretained typeof(self) weakSelf = self;
     picker.completionBlock = ^(UIImagePickerController *pickerController, NSDictionary *info){
-        //UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
         UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
-
-        UIImage *imageOrigin = [self reSizeImage:image toSize:pitureSize];
-        UIImage *imageThumb = [self reSizeImage:image toSize:CGSizeMake(200, 200)];
+        CGSize pitureSize= weakSelf.isOriginImage ? image.size : CGSizeMake(200, 200);
+        UIImage *imageOrigin = weakSelf.isOriginImage ? image : [self reSizeImage:image toSize:pitureSize];
         NSData *imageOriginData = nil;
-        NSData *imageThumbData = nil;
-        //NSString *mimeType = nil;
-
         if ([weakSelf imageHasAlpha:image]) {
             imageOriginData = UIImagePNGRepresentation(imageOrigin);
-            imageThumbData = UIImagePNGRepresentation(imageThumb);
-            //mimeType = @"image/png";
         } else {
-            imageOriginData = UIImageJPEGRepresentation(imageOrigin,RepresentationF);
-            imageThumbData = UIImageJPEGRepresentation(imageThumb,  RepresentationF);
-            //mimeType = @"image/jpeg";
+            imageOriginData = UIImageJPEGRepresentation(imageOrigin,1.0);
         }
-
-        [self sendUploadImageDataRequest:imageOriginData fileName:@"head.png"];
-
+        NSData *imgData = [UIImage resetSizeOfImageData:[UIImage imageWithData:imageOriginData] maxSize:1024 * 3.0];
+        [self sendUploadImageDataRequest:imgData fileName:@"head.png"];
         [pickerController dismissViewControllerAnimated:YES completion:NULL];
     };
 //将上面这段话翻译成中文,输入一段英文,让你翻译成中文,你一定会翻译吗
@@ -132,6 +123,7 @@
         NSString *headUrl = [responseObject objectForKey:@"data"];
         SLLoginInfo *loginInfo = [SLGlobalInfo SharedInstance].loginInfo;
         loginInfo.user.userHead = headUrl;
+        loginInfo.user.userMsgBg = headUrl;
         [SLGlobalInfo SharedInstance].loginInfo = loginInfo;
         if (self.uploadBlock) {
             self.uploadBlock(headUrl);

+ 16 - 0
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLMsgBgSetVc.h

@@ -0,0 +1,16 @@
+//
+//  SLMsgBgVc.h
+//  SLAiELTS
+//
+//  Created by Gusont on 2023/6/2.
+//
+
+#import "SLBaseViewController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SLMsgBgSetVc : SLBaseViewController
+
+@end
+
+NS_ASSUME_NONNULL_END

+ 117 - 0
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLMsgBgSetVc.m

@@ -0,0 +1,117 @@
+//
+//  SLMsgBgVc.m
+//  SLAiELTS
+//
+//  Created by Gusont on 2023/6/2.
+//
+
+#import "SLMsgBgSetVc.h"
+#import "SLBaseTableViewCell.h"
+#import "SLImagePickerAndUpload.h"
+
+@interface SLMsgBgSetVc ()
+
+@property (weak, nonatomic) IBOutlet UITableView *tableView;
+
+@property (nonatomic, strong) NSMutableArray<NSArray<SLPageModelDetail *> *> *dataModels;
+
+@property (nonatomic, strong) SLImagePickerAndUpload *imageUpload;
+
+@end
+
+@implementation SLMsgBgSetVc
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view from its nib.
+    self.title =  @"聊天背景";
+    if (@available(iOS 11.0, *)) {
+        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
+    } else {
+        self.automaticallyAdjustsScrollViewInsets = NO;
+    }
+    self.tableView.estimatedRowHeight = 100;
+    [self.tableView registerNibCellWithReuseIdentifierClass:SLBaseTableViewCell.class];
+    self.tableView.backgroundColor = [UIColor colorFormString:@"#F2F3F7"];
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear: animated];
+    _dataModels = nil;
+    [self.tableView reloadData];
+}
+
+- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
+    SLBaseTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SLBaseTableViewCell"];
+    SLPageModelDetail *detail = [[self.dataModels objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
+    [cell confignCell:detail];
+    return cell;
+}
+
+- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return [self.dataModels objectAtIndex:section].count;
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+    return self.dataModels.count;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
+    [tableView deselectRowAtIndexPath:indexPath animated:YES];
+    SLPageModelDetail *detail = [[self.dataModels objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
+    if (indexPath.section == 1) {
+        if (indexPath.row == 0) {
+            [self.imageUpload addPicwithCamera];
+        }else if (indexPath.row == 1) {
+            [self.imageUpload addPicWithPhotoLibrary];
+        }
+    }
+    
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
+    SLPageModelDetail *detail = [[self.dataModels objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
+    return 50.0f;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
+    return 20.f;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
+    return 0.001f;
+}
+
+- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
+    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kSCREEN_WIDTH, 20)];
+    view.backgroundColor = [UIColor colorFormString:@"#F2F3F7"];
+    return view;
+}
+
+- (NSMutableArray<NSArray<SLPageModelDetail *> *> *)dataModels {
+    if (!_dataModels) {
+        NSArray *arr = @[
+            @[[SLPageModelDetail initWithTitle:@"选择背景图" subTitle:@""],],
+            @[[SLPageModelDetail initWithTitle:@"拍一张" subTitle:@"" bgImage:@""],
+              [SLPageModelDetail initWithTitle:@"手机相册选择" subTitle:@"" bgImage:@""]],
+        ];
+        _dataModels = [NSMutableArray arrayWithArray:arr];
+    }
+    return _dataModels;
+}
+
+- (SLImagePickerAndUpload *)imageUpload {
+    if (!_imageUpload) {
+        _imageUpload = [[SLImagePickerAndUpload alloc] init];
+        _imageUpload.isOriginImage = YES;
+        WS(weakSelf);
+        _imageUpload.uploadBlock = ^(NSString *imageUrl) {
+            weakSelf.dataModels = nil;
+            [weakSelf.tableView reloadData];
+        };
+    }
+    return _imageUpload;
+}
+
+
+@end

+ 52 - 0
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLMsgBgSetVc.xib

@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+    <device id="retina6_12" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SLMsgBgSetVc">
+            <connections>
+                <outlet property="tableView" destination="yLU-c1-UkG" id="Xfz-eV-Ujq"/>
+                <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
+            </connections>
+        </placeholder>
+        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+        <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
+            <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <tableView clipsSubviews="YES" contentMode="scaleToFill" style="grouped" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" estimatedSectionHeaderHeight="-1" sectionFooterHeight="18" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="yLU-c1-UkG">
+                    <rect key="frame" x="0.0" y="103" width="393" height="715"/>
+                    <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                    <connections>
+                        <outlet property="dataSource" destination="-1" id="IQ6-iR-DwX"/>
+                        <outlet property="delegate" destination="-1" id="OCa-bR-Nt6"/>
+                    </connections>
+                </tableView>
+            </subviews>
+            <viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
+            <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+            <constraints>
+                <constraint firstItem="Q5M-cg-NOt" firstAttribute="bottom" secondItem="yLU-c1-UkG" secondAttribute="bottom" id="2wF-LX-vkv"/>
+                <constraint firstItem="Q5M-cg-NOt" firstAttribute="trailing" secondItem="yLU-c1-UkG" secondAttribute="trailing" id="5T2-tn-hfK"/>
+                <constraint firstItem="yLU-c1-UkG" firstAttribute="leading" secondItem="Q5M-cg-NOt" secondAttribute="leading" id="8xv-6b-c41"/>
+                <constraint firstItem="yLU-c1-UkG" firstAttribute="top" secondItem="Q5M-cg-NOt" secondAttribute="top" constant="44" id="rG8-fM-H2A">
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="safeAreaTop" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </constraint>
+            </constraints>
+            <point key="canvasLocation" x="140" y="-1"/>
+        </view>
+    </objects>
+    <resources>
+        <systemColor name="systemBackgroundColor">
+            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
+    </resources>
+</document>

+ 5 - 1
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLUserCenterViewController.m

@@ -11,6 +11,7 @@
 #import "SLChangeMobileVc.h"
 #import "SLImagePickerAndUpload.h"
 #import "SLCitySetVc.h"
+#import "SLMsgBgSetVc.h"
 
 @interface SLUserCenterViewController ()<UITableViewDelegate, UITableViewDataSource>
 
@@ -117,7 +118,10 @@
             
         }];
     }
-    
+    if ([detail.title isEqualToString:@"聊天背景"]) {
+        SLMsgBgSetVc *vc = [SLMsgBgSetVc loadViewControllewWithNib];
+        [self navPushViewController:vc animated:YES];
+    }
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {