Răsfoiți Sursa

通用设置部分

桂欢 1 an în urmă
părinte
comite
b1a1e16a38

+ 0 - 4
SLAiELTS/SLAiELTS/AppMarcos/YMConstMacro.h

@@ -6,7 +6,6 @@
 
 #define YMPath_DOCUMENT     [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
 
-
 #define  kWindow \
 ({\
     UIWindow* window = nil;\
@@ -91,9 +90,6 @@
 ///
 #define StrongWeakSelf   typeof(wkSelf) __strong stSelf=wkSelf;
 
-#define YMPath_DOCUMENT     [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
-
-
 #define SLBgColor      SLColor(@"#F2F3F7")
 
 #define SLBlackColor      SLColor(@"#273F66")

+ 6 - 2
SLAiELTS/SLAiELTS/ViewControllers/MessageVC/Views/SLMikeInputView.xib

@@ -40,7 +40,7 @@
                     <rect key="frame" x="165" y="627.66666666666663" width="60.333333333333343" height="60.333333333333371"/>
                 </imageView>
                 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="icon_yb_bg_01.jpg" translatesAutoresizingMaskIntoConstraints="NO" id="igR-nc-VIH">
-                    <rect key="frame" x="0.0" y="220.33333333333334" width="390" height="383.33333333333326"/>
+                    <rect key="frame" x="78" y="297" width="234" height="230"/>
                     <constraints>
                         <constraint firstAttribute="width" secondItem="igR-nc-VIH" secondAttribute="height" multiplier="175:172" id="cau-gb-70Y"/>
                     </constraints>
@@ -51,7 +51,11 @@
                 <constraint firstAttribute="trailing" secondItem="76w-rg-8wP" secondAttribute="trailing" id="7J6-R3-8hR"/>
                 <constraint firstItem="dkF-D7-cqe" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="9w2-p4-wvp"/>
                 <constraint firstItem="OVz-mu-onH" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="IQ4-8I-Kur"/>
-                <constraint firstItem="igR-nc-VIH" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" id="NIy-Mi-C0Y"/>
+                <constraint firstItem="igR-nc-VIH" firstAttribute="width" secondItem="iN0-l3-epB" secondAttribute="width" multiplier="0.6" id="NIy-Mi-C0Y">
+                    <userDefinedRuntimeAttributes>
+                        <userDefinedRuntimeAttribute type="boolean" keyPath="adapterScreen" value="YES"/>
+                    </userDefinedRuntimeAttributes>
+                </constraint>
                 <constraint firstAttribute="bottom" secondItem="76w-rg-8wP" secondAttribute="bottom" id="NiK-bs-NnZ"/>
                 <constraint firstItem="dkF-D7-cqe" firstAttribute="top" secondItem="OVz-mu-onH" secondAttribute="bottom" constant="20" id="aww-J7-pkg"/>
                 <constraint firstItem="76w-rg-8wP" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="cyf-Ug-7Gb"/>

+ 2 - 0
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLUserCenterViewController.h

@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface SLUserCenterViewController : SLBaseViewController
 
+@property (nonatomic, assign) BOOL isSetting;
+
 @end
 
 NS_ASSUME_NONNULL_END

+ 29 - 4
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLUserCenterViewController.m

@@ -26,7 +26,7 @@
 - (void)viewDidLoad {
     [super viewDidLoad];
     // Do any additional setup after loading the view from its nib.
-    self.title = @"个人中心";
+    self.title = self.isSetting ? @"通用设置" : @"个人中心";
     if (@available(iOS 11.0, *)) {
         self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
     } else {
@@ -99,14 +99,33 @@
         vc.title = detail.title;
         [self navPushViewController:vc animated:YES];
     }
+    if ([detail.title isEqualToString:@"清空聊天记录"]) {
+        [SLCustomizeAlert showAletrWithTitle:@"温馨提示" message:@"是否清空聊天记录?" sureBtnTitle:@"确定" cancelBtnTitle:@"取消" sureBtnAction:^{
+            NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
+            NSDictionary *dic = [userDefaults dictionaryRepresentation];
+            for (id  key in dic) {
+                if ([key isKindOfClass:NSString.class] && [key containsString:[NSString stringWithFormat:@"%@--to--",[SLGlobalInfo SharedInstance].loginInfo.user.userId]]) {
+                    [userDefaults removeObjectForKey:key];
+                }
+            }
+            [userDefaults synchronize];
+            //语音文件
+            NSString *voicePath = [YMPath_DOCUMENT stringByAppendingFormat:@"/%@", @"voices"];
+            [[NSFileManager defaultManager] removeItemAtPath:voicePath error:nil];
+            [ZFToast ShowWithMessage:@"清空成功"];
+        } cancelBtnAction:^{
+            
+        }];
+    }
     
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (indexPath.section == 0 && indexPath.row == 0) {
-        return 68.f;
+    SLPageModelDetail *detail = [[self.dataModels objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
+    if ([detail.title isEqualToString:@"头像"]) {
+        return 68.0f;
     }
-    return 50.f;
+    return 50.0f;
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
@@ -137,6 +156,12 @@
           @[[SLPageModelDetail initWithTitle:@"用户服务协议" subTitle:@"" bgImage:@""],
             [SLPageModelDetail initWithTitle:@"免责声明" subTitle:@"" bgImage:@""]],
           @[[SLPageModelDetail initWithTitle:@"退出登录" subTitle:@"" bgImage:@""],]];
+        if (self.isSetting) {
+            arr = @[
+                  @[[SLPageModelDetail initWithTitle:@"语言设置" subTitle:@"" bgImage:@""],
+                    [SLPageModelDetail initWithTitle:@"聊天背景" subTitle:@"" bgImage:@""]],
+                  @[[SLPageModelDetail initWithTitle:@"清空聊天记录" subTitle:@"" bgImage:@""],]];
+        }
         _dataModels = [NSMutableArray arrayWithArray:arr];
     }
     return _dataModels;

+ 1 - 0
SLAiELTS/SLAiELTS/ViewControllers/MyVC/Views/Cells/SLMyListCollectionViewCell.m

@@ -54,6 +54,7 @@
                 case 2:
                 {
                     SLUserCenterViewController *vc = [SLUserCenterViewController loadViewControllewWithNib];
+                    vc.isSetting = YES;
                     [self.viewController navPushViewController:vc animated:YES];
                 }
                     break;