Browse Source

用户信息设置地区

桂欢 1 year ago
parent
commit
2ceb252bb1

+ 1 - 1
SLAiELTS/Podfile.lock

@@ -89,6 +89,6 @@ SPEC CHECKSUMS:
   WZLBadge: 9ec779dcfd94c825518b395e8315fccaabff1bfa
   ZLPhotoBrowser: 3748fdbeb2b28961c2495d15131dbf413082e1b9
 
-PODFILE CHECKSUM: 52a7e45e38eab21d8d7d274eac5270bff0fd7d41
+PODFILE CHECKSUM: 610d8231fc55f6eb9d057b10d72a1fcfdc30efb8
 
 COCOAPODS: 1.12.0

+ 1 - 1
SLAiELTS/Pods/Manifest.lock

@@ -89,6 +89,6 @@ SPEC CHECKSUMS:
   WZLBadge: 9ec779dcfd94c825518b395e8315fccaabff1bfa
   ZLPhotoBrowser: 3748fdbeb2b28961c2495d15131dbf413082e1b9
 
-PODFILE CHECKSUM: 52a7e45e38eab21d8d7d274eac5270bff0fd7d41
+PODFILE CHECKSUM: 610d8231fc55f6eb9d057b10d72a1fcfdc30efb8
 
 COCOAPODS: 1.12.0

File diff suppressed because it is too large
+ 612 - 578
SLAiELTS/Pods/Pods.xcodeproj/project.pbxproj


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

@@ -138,6 +138,8 @@
 		3D3BC35A2A27283600AEEE8E /* SLSexSetVc.m in Sources */ = {isa = PBXBuildFile; fileRef = 3D3BC3582A27283600AEEE8E /* SLSexSetVc.m */; };
 		3D3BC35B2A27283600AEEE8E /* SLSexSetVc.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3D3BC3592A27283600AEEE8E /* SLSexSetVc.xib */; };
 		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 */; };
 		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 */; };
@@ -516,6 +518,9 @@
 		3D3BC3582A27283600AEEE8E /* SLSexSetVc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SLSexSetVc.m; sourceTree = "<group>"; };
 		3D3BC3592A27283600AEEE8E /* SLSexSetVc.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SLSexSetVc.xib; sourceTree = "<group>"; };
 		3D3BC35C2A273E7400AEEE8E /* icon_yb_bg_01.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = icon_yb_bg_01.jpg; path = "../../../../../../../Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/1fdfdbd8c9b5653cd014c44cc8275865/Message/MessageTemp/a99af68e196bdd426af09785d58507f6/Image/icon_yb_bg_01.jpg"; sourceTree = "<group>"; };
+		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>"; };
 		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>"; };
@@ -1870,6 +1875,9 @@
 				3D3BC3572A27283600AEEE8E /* SLSexSetVc.h */,
 				3D3BC3582A27283600AEEE8E /* SLSexSetVc.m */,
 				3D3BC3592A27283600AEEE8E /* SLSexSetVc.xib */,
+				3D58825A2A28397D00F1B38E /* SLCitySetVc.h */,
+				3D58825B2A28397D00F1B38E /* SLCitySetVc.m */,
+				3D58825C2A28397D00F1B38E /* SLCitySetVc.xib */,
 			);
 			path = VCs;
 			sourceTree = "<group>";
@@ -1977,6 +1985,7 @@
 				3D1B9D0D29C2A1360008D01A /* SLPlaceholderCell.xib in Resources */,
 				3D1B9CF929C071AD0008D01A /* SLFeedbackVc.xib in Resources */,
 				3D6EE45929F25AB400B02EBB /* SLRecomFriendsCell.xib in Resources */,
+				3D58825E2A28397D00F1B38E /* SLCitySetVc.xib in Resources */,
 				3D3BC1C22A2587E900AEEE8E /* SLNewMsgBgView.xib in Resources */,
 				3DF3DAB329B9B86200CAD3AB /* SLUserCenterViewController.xib in Resources */,
 				3DB97D6C29D6ABC100B12754 /* sdRefeshView_arrow@2x.png in Resources */,
@@ -2161,6 +2170,7 @@
 				3DB97D5B29D6AB2300B12754 /* SDWaitingView.m in Sources */,
 				3DE9967929E915BF00C50A83 /* SLMomentsVc.m in Sources */,
 				3DA2C73929CAA9C30087CDB4 /* AccessToken.m in Sources */,
+				3D58825D2A28397D00F1B38E /* SLCitySetVc.m in Sources */,
 				3DB97D4529D6A86E00B12754 /* SDWeiXinPhotoContainerView.m in Sources */,
 				3D2DC3F429B1E6320041A729 /* SLMikeInputView.m in Sources */,
 				3D2DC3BF29B0709F0041A729 /* NLSRingBuffer.mm in Sources */,
@@ -2469,6 +2479,49 @@
 					"$(PROJECT_DIR)/SLAiELTS/Vendor/modeling/Libraries",
 				);
 				MARKETING_VERSION = 1.0.0;
+				OTHER_LDFLAGS = (
+					"$(inherited)",
+					"-framework",
+					"\"AFNetworking\"",
+					"-framework",
+					"\"BRPickerView\"",
+					"-framework",
+					"\"CoreGraphics\"",
+					"-framework",
+					"\"Foundation\"",
+					"-framework",
+					"\"IQKeyboardManager\"",
+					"-framework",
+					"\"ImageIO\"",
+					"-framework",
+					"\"JXCategoryView\"",
+					"-framework",
+					"\"MBProgressHUD\"",
+					"-framework",
+					"\"MJExtension\"",
+					"-framework",
+					"\"MJRefresh\"",
+					"-framework",
+					"\"Masonry\"",
+					"-framework",
+					"\"PGDatePicker\"",
+					"-framework",
+					"\"PGPickerView\"",
+					"-framework",
+					"\"Photos\"",
+					"-framework",
+					"\"PhotosUI\"",
+					"-framework",
+					"\"QuartzCore\"",
+					"-framework",
+					"\"SDWebImage\"",
+					"-framework",
+					"\"UIKit\"",
+					"-framework",
+					"\"WZLBadge\"",
+					"-framework",
+					"\"ZLPhotoBrowser\"",
+				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.AI.SLAiELTS;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -2514,6 +2567,49 @@
 					"$(PROJECT_DIR)/SLAiELTS/Vendor/modeling/Libraries",
 				);
 				MARKETING_VERSION = 1.0.0;
+				OTHER_LDFLAGS = (
+					"$(inherited)",
+					"-framework",
+					"\"AFNetworking\"",
+					"-framework",
+					"\"BRPickerView\"",
+					"-framework",
+					"\"CoreGraphics\"",
+					"-framework",
+					"\"Foundation\"",
+					"-framework",
+					"\"IQKeyboardManager\"",
+					"-framework",
+					"\"ImageIO\"",
+					"-framework",
+					"\"JXCategoryView\"",
+					"-framework",
+					"\"MBProgressHUD\"",
+					"-framework",
+					"\"MJExtension\"",
+					"-framework",
+					"\"MJRefresh\"",
+					"-framework",
+					"\"Masonry\"",
+					"-framework",
+					"\"PGDatePicker\"",
+					"-framework",
+					"\"PGPickerView\"",
+					"-framework",
+					"\"Photos\"",
+					"-framework",
+					"\"PhotosUI\"",
+					"-framework",
+					"\"QuartzCore\"",
+					"-framework",
+					"\"SDWebImage\"",
+					"-framework",
+					"\"UIKit\"",
+					"-framework",
+					"\"WZLBadge\"",
+					"-framework",
+					"\"ZLPhotoBrowser\"",
+				);
 				PRODUCT_BUNDLE_IDENTIFIER = com.AI.SLAiELTS;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";

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

@@ -32,6 +32,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 @property (nonatomic, copy) NSString *sex;
 
+
+@property (nonatomic, copy) NSString *province;
+
 @property (nonatomic, copy) NSString *city;
 
 @property (nonatomic, copy) NSString *interests;

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

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

+ 114 - 0
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLCitySetVc.m

@@ -0,0 +1,114 @@
+//
+//  SLCitySetVc.m
+//  SLAiELTS
+//
+//  Created by Gusont on 2023/6/1.
+//
+
+#import "SLCitySetVc.h"
+#import <BRPickerView.h>
+#import "SLBaseCellView.h"
+#import "SLLocationManager.h"
+
+@interface SLCitySetVc ()
+
+@end
+
+@implementation SLCitySetVc
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view from its nib.
+    self.title = @"设置性别";
+    [self confignSexSetView];
+}
+
+- (void)confignSexSetView {
+    NSArray *arr = @[[SLPageModelDetail initWithTitle:@"定位到的位置" bgImage:@""],
+      [SLPageModelDetail initWithTitle:@"选择地区" bgImage:@""],];
+    [arr enumerateObjectsUsingBlock:^(SLPageModelDetail * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
+        SLBaseCellView *baseCell = [[SLBaseCellView alloc] initWithFrame:CGRectZero];
+        baseCell.titleLabel.text = obj.title;
+        baseCell.subTitleLabel.text = @"";
+        [baseCell updateConstraintsWith:SLBaseCellView1];
+        baseCell.tag = 8888 + idx;
+        WS(weakSelf);
+        __block SLBaseCellView *blockBaseCell = baseCell;
+        [baseCell addTapWithBlock:^{
+            blockBaseCell.contentView.backgroundColor = SLColSel;
+            [UIView animateWithDuration:0.5 animations:^{
+                blockBaseCell.contentView.backgroundColor = [UIColor whiteColor];
+            }];
+            switch (idx) {
+                case 0:
+                {
+                    [[SLLocationManager shareInstance] getLocationComplete:^(CLLocation * _Nullable currentLocation) {
+                        if (currentLocation) {
+                            SLLoginInfo *newLoginModel = [SLGlobalInfo SharedInstance].loginInfo;
+                            newLoginModel.user.province = [SLLocationManager shareInstance].province;
+                            newLoginModel.user.city = [SLLocationManager shareInstance].city;
+                            [SLGlobalInfo SharedInstance].loginInfo = newLoginModel;
+                            SLBaseCellView *baseCell = [weakSelf.view viewWithTag:8888];
+                            baseCell.subTitleLabel.text = [NSString stringWithFormat:@"%@%@",[SLLocationManager shareInstance].province,[SLLocationManager shareInstance].city];
+                            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                                [weakSelf.navigationController popViewControllerAnimated:YES];
+                            });
+                        }else {
+                            [ZFToast ShowWithMessage:@"定位失败,请检查权限设置"];
+                        }
+                    }];
+                }
+                    break;
+                case 1:
+                {
+                    [weakSelf addressPickerViewShow];
+                }
+                    break;
+                default:
+                    break;
+            }
+
+        }];
+        baseCell.backgroundColor = [UIColor whiteColor];
+        [self.view addSubview:baseCell];
+        CGFloat top = 56 * idx * KScaleW + kNavBarHeight + 10;
+        [baseCell mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.left.right.equalTo(self.view);
+            make.height.mas_equalTo(56 * KScaleW);
+            make.top.equalTo(self.view).offset(top);
+        }];
+        
+    }];
+}
+
+
+- (void)addressPickerViewShow {
+    /// 地址选择器
+    BRAddressPickerView *addressPickerView = [[BRAddressPickerView alloc]init];
+    addressPickerView.pickerMode = BRAddressPickerModeCity;
+    addressPickerView.title = @"请选择地区";
+    //addressPickerView.selectValues = @[@"浙江省", @"杭州市", @"西湖区"];
+//    addressPickerView.selectIndexs = @[@10, @0, @4];
+//    addressPickerView.isAutoSelect = YES;
+    WS(weakSelf);
+    addressPickerView.resultBlock = ^(BRProvinceModel *province, BRCityModel *city, BRAreaModel *area) {
+        [[SLHttpCenter SharedInstance] postWithUrl:@"/api/User/SetUserAddress" parameter:@{@"province" : province.name, @"city" : city.name ?: @""} success:^(id responseObject) {
+            SLLoginInfo *newLoginModel = [SLGlobalInfo SharedInstance].loginInfo;
+            newLoginModel.user.province = province.name;
+            newLoginModel.user.city = city.name;
+            [SLGlobalInfo SharedInstance].loginInfo = newLoginModel;
+            SLBaseCellView *baseCell = [weakSelf.view viewWithTag:8888 + 1];
+            baseCell.titleLabel.text = @"已选地区";
+            baseCell.subTitleLabel.text = [NSString stringWithFormat:@"%@%@",province.name,city.name];
+            [ZFToast ShowWithMessage:@"保存成功"];
+            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
+                [weakSelf.navigationController popViewControllerAnimated:YES];
+            });
+        } failure:^(SPRequestError *error) {
+            
+        }];
+    };
+    [addressPickerView show];
+}
+
+@end

+ 31 - 0
SLAiELTS/SLAiELTS/ViewControllers/MyVC/VCs/SLCitySetVc.xib

@@ -0,0 +1,31 @@
+<?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="SLCitySetVc">
+            <connections>
+                <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"/>
+            <viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
+            <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+            <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>

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

@@ -10,6 +10,7 @@
 #import "SLModifyNicknameVc.h"
 #import "SLChangeMobileVc.h"
 #import "SLImagePickerAndUpload.h"
+#import "SLCitySetVc.h"
 
 @interface SLUserCenterViewController ()<UITableViewDelegate, UITableViewDataSource>
 
@@ -71,6 +72,10 @@
         SLChangeMobileVc *vc = [SLChangeMobileVc loadViewControllewWithNib];
         [self navPushViewController:vc animated:YES];
     }
+    if ([detail.title isEqualToString:@"地区"]) {
+        SLCitySetVc *vc = [SLCitySetVc loadViewControllewWithNib];
+        [self navPushViewController:vc animated:YES];
+    }
     if ([detail.title isEqualToString:@"退出登录"]) {
         [SLCustomizeAlert showAletrWithTitle:@"退出确认" message:@"是否确认退出登录?" sureBtnTitle:@"确定" cancelBtnTitle:@"取消" sureBtnAction:^{
             [[SLGlobalInfo SharedInstance] userLogout];
@@ -127,7 +132,7 @@
           [SLPageModelDetail initWithTitle:@"手机号" subTitle:user.phone],
           [SLPageModelDetail initWithTitle:@"DLid" subTitle:user.dlId canEdit:YES],
           [SLPageModelDetail initWithTitle:@"性别" subTitle:user.sex canEdit:YES],
-          [SLPageModelDetail initWithTitle:@"地区" subTitle:user.city],
+          [SLPageModelDetail initWithTitle:@"地区" subTitle:[NSString stringWithFormat:@"%@%@",user.province,user.city]],
           [SLPageModelDetail initWithTitle:@"星座" subTitle:@"" canEdit:YES],],
           @[[SLPageModelDetail initWithTitle:@"用户服务协议" subTitle:@"" bgImage:@""],
             [SLPageModelDetail initWithTitle:@"免责声明" subTitle:@"" bgImage:@""]],

+ 5 - 1
SLAiELTS/SLAiELTS/ViewControllers/MyVC/Views/SLBaseCellView.m

@@ -42,7 +42,7 @@
     }];
     [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
         make.centerY.equalTo(self.contentView);
-        make.right.equalTo(self.rightImageViw.mas_left).offset(-12);
+        make.right.equalTo(self.rightImageViw.mas_left).offset(-6);
     }];
     [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.equalTo(self.leftImageView);
@@ -65,6 +65,10 @@
                 make.left.equalTo(self.contentView).offset(12);
                 make.centerY.equalTo(self.contentView);
             }];
+            [self.subTitleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
+                make.centerY.equalTo(self.contentView);
+                make.right.equalTo(self.rightImageViw.mas_left).offset(-6);
+            }];
             [self.lineView mas_remakeConstraints:^(MASConstraintMaker *make) {
                 make.left.equalTo(self.titleLabel);
                 make.right.equalTo(self.contentView);

Some files were not shown because too many files changed in this diff