Commit 05ba2383 by xuning

跑马灯接口、用户信息接口(包含缓存用户信息等操作)、banner接口(包分站id逻辑)

parent 2b1d4f08
...@@ -32,11 +32,21 @@ ...@@ -32,11 +32,21 @@
// 设置主窗口,并设置根控制器 // 设置主窗口,并设置根控制器
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds]; self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
XVMainJobViewController *vc = [[XVMainJobViewController alloc]init]; if ([AppConfig needLogin]) {
XVNaviViewController *navi = [[XVNaviViewController alloc]initWithRootViewController:vc]; XVLoginViewController *loginVc = [[XVLoginViewController alloc]init];
XVNaviViewController *navi = [[XVNaviViewController alloc]initWithRootViewController:loginVc];
self.window.rootViewController = navi;
}else{
XVMainJobViewController *vc = [[XVMainJobViewController alloc]init];
XVNaviViewController *navi = [[XVNaviViewController alloc]initWithRootViewController:vc];
self.window.rootViewController = navi;
}
self.window.rootViewController = navi;
self.window.backgroundColor = [UIColor whiteColor]; self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "newPage@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "newPage@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23504" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23506"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <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"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<scenes> <scenes>
...@@ -11,15 +14,32 @@ ...@@ -11,15 +14,32 @@
<objects> <objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> <viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="newPage" translatesAutoresizingMaskIntoConstraints="NO" id="GG5-rm-jEg">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="GG5-rm-jEg" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="5Zt-If-T16"/>
<constraint firstItem="GG5-rm-jEg" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="FJD-BT-8vL"/>
<constraint firstItem="GG5-rm-jEg" firstAttribute="trailing" secondItem="6Tk-OE-BBY" secondAttribute="trailing" id="Lh1-aU-tPx"/>
<constraint firstAttribute="bottom" secondItem="GG5-rm-jEg" secondAttribute="bottom" id="M2v-8x-dI0"/>
</constraints>
</view> </view>
</viewController> </viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects> </objects>
<point key="canvasLocation" x="53" y="375"/> <point key="canvasLocation" x="52.671755725190835" y="374.64788732394368"/>
</scene> </scene>
</scenes> </scenes>
<resources>
<image name="newPage" width="166.66667175292969" height="296"/>
<systemColor name="systemBackgroundColor">
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
</resources>
</document> </document>
...@@ -23,10 +23,19 @@ ...@@ -23,10 +23,19 @@
[self setNavigationBarsetBackgroundColor:[UIColor whiteColor]]; [self setNavigationBarsetBackgroundColor:[UIColor whiteColor]];
//ctrl + i 格式化
} }
- (void)back {
// 判断两种情况: push 和 present
if ((self.presentedViewController || self.presentingViewController) && self.childViewControllers.count == 1) {
[self dismissViewControllerAnimated:YES completion:nil];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}
- (void)setNavigationBarsetBackgroundColor:(UIColor *)color { - (void)setNavigationBarsetBackgroundColor:(UIColor *)color {
......
//
// XVWebViewController.h
// fastservice
//
// Created by xuning on 5/6/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "XVBaseViewController.h"
#import <WebKit/WebKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XVWebViewController : XVBaseViewController
@property (nonatomic, strong) WKWebView *wkWebView;
//设置加载进度条
@property (nonatomic,strong) UIProgressView *progressView;
@property (nonatomic, strong) NSString *titleName;
/**
加载纯外部链接网页
@param string URL地址
*/
- (void)loadWebURLSring:(NSString *)string;
@end
NS_ASSUME_NONNULL_END
//
// XVWebViewController.m
// fastservice
//
// Created by xuning on 5/6/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "XVWebViewController.h"
static void *WkwebBrowserContext = &WkwebBrowserContext;
@interface XVWebViewController ()<WKNavigationDelegate,WKUIDelegate,UINavigationControllerDelegate,UINavigationBarDelegate,WKScriptMessageHandler,UIScrollViewDelegate>
//保存的网址链接
@property (nonatomic, copy) NSString *URLString;
//保存POST请求体
@property (nonatomic, copy) NSString *postData;
@end
@implementation XVWebViewController
- (void)viewDidLoad {
[super viewDidLoad];
//添加到主控制器上
[self.view addSubview:self.wkWebView];
//添加进度条
[self.view addSubview:self.progressView];
self.navigationItem.leftBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(back) image:IMG(@"iconPark-left 1 Copy 1")];
}
- (void)back {
if ([self.wkWebView canGoBack]) {
[self.wkWebView goBack];
}else{
[self.navigationController popViewControllerAnimated:YES];
}
}
- (void)loadWebURLSring:(NSString *)string{
self.URLString = string;
//创建一个NSURLRequest 的对象
NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.URLString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
//加载网页
[self.wkWebView loadRequest:request];
}
- (void)setTitleName:(NSString *)titleName {
self.navigationItem.title = titleName;
}
#pragma mark ================ WKNavigationDelegate ================
//这个是网页加载完成,导航的变化
-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
/*
主意:这个方法是当网页的内容全部显示(网页内的所有图片必须都正常显示)的时候调用(不是出现的时候就调用),,否则不显示,或则部分显示时这个方法就不调用。
*/
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];
}
//开始加载
-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation{
//开始加载的时候,让加载进度条显示
self.progressView.hidden = NO;
}
//内容返回时调用
-(void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation{}
//服务器请求跳转的时候调用
-(void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation{}
//服务器开始请求的时候调用
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
decisionHandler(WKNavigationActionPolicyAllow);
}
// 内容加载失败时候调用
-(void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error{
}
//跳转失败的时候调用
-(void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error{}
//进度条
-(void)webViewWebContentProcessDidTerminate:(WKWebView *)webView{}
#pragma mark ================ WKUIDelegate ================
// 获取js 里面的提示
-(void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:message preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
completionHandler();
}]];
[self presentViewController:alert animated:YES completion:NULL];
}
// js 信息的交流
-(void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:message preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
completionHandler(YES);
}]];
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
completionHandler(NO);
}]];
[self presentViewController:alert animated:YES completion:NULL];
}
// 交互。可输入的文本。
-(void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString * _Nullable))completionHandler{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"textinput" message:@"JS调用输入框" preferredStyle:UIAlertControllerStyleAlert];
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.textColor = [UIColor redColor];
}];
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
completionHandler([[alert.textFields lastObject] text]);
}]];
[self presentViewController:alert animated:YES completion:NULL];
}
//KVO监听进度条
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context {
if ([keyPath isEqualToString:NSStringFromSelector(@selector(estimatedProgress))] && object == self.wkWebView) {
[self.progressView setAlpha:1.0f];
BOOL animated = self.wkWebView.estimatedProgress > self.progressView.progress;
[self.progressView setProgress:self.wkWebView.estimatedProgress animated:animated];
// Once complete, fade out UIProgressView
if(self.wkWebView.estimatedProgress >= 1.0f) {
[UIView animateWithDuration:0.5f delay:0.5f options:UIViewAnimationOptionCurveEaseOut animations:^{
[self.progressView setAlpha:0.0f];
} completion:^(BOOL finished) {
[self.progressView setProgress:0.0f animated:NO];
}];
}
}else if ([keyPath isEqualToString:@"title"]){
// self.title = self.wkWebView.title;
}
else {
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
}
}
#pragma mark ================ WKScriptMessageHandler ================
//拦截执行网页中的JS方法
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message{
//服务器固定格式写法 window.webkit.messageHandlers.名字.postMessage(内容);
//客户端写法 message.name isEqualToString:@"名字"]
// if ([message.name isEqualToString:@"getToken"]) {
//
// NSString *inputValueJs = [NSString stringWithFormat:@"requestToken('%@')",[EMUserKeychain new].token];
// [self.wkWebView evaluateJavaScript:inputValueJs completionHandler:^(id _Nullable response, NSError * _Nullable error) {
// DLog(@"%@",response);
// DLog(@"%@",error.localizedDescription);
// }];
// }
}
#pragma mark ================ 懒加载 ================
- (WKWebView *)wkWebView{
if (!_wkWebView) {
//以下代码适配大小
NSString *jScript = @"var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width,user-scalable=no,initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0,'); document.getElementsByTagName('head')[0].appendChild(meta);";
WKUserScript *wkUScript = [[WKUserScript alloc] initWithSource:jScript injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
WKUserContentController *wkUController = [[WKUserContentController alloc] init];
[wkUController addUserScript:wkUScript];
WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
wkWebConfig.userContentController = wkUController;
_wkWebView = [[WKWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-KTOP_HEIGHT) configuration:wkWebConfig];
_wkWebView.backgroundColor = DEFAULT_BACKGROUND_COLOR;
// 设置代理
_wkWebView.navigationDelegate = self;
_wkWebView.UIDelegate = self;
// _wkWebView.scrollView.bounces = NO;
_wkWebView.scrollView.delegate = self;
//kvo 添加进度监控
[_wkWebView addObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress)) options:0 context:WkwebBrowserContext];
[_wkWebView sizeToFit];
}
return _wkWebView;
}
- (UIProgressView *)progressView{
if (!_progressView) {
_progressView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
_progressView.frame = CGRectMake(0, 0, self.view.bounds.size.width, 1);
// 设置进度条的色彩
_progressView.tintColor = COLOR_THEMEGRENN;
_progressView.trackTintColor = [UIColor whiteColor];
}
return _progressView;
}
//注意,观察的移除
-(void)dealloc{
if (_wkWebView) {
[self.wkWebView setNavigationDelegate:nil];
[self.wkWebView setUIDelegate:nil];
[self.wkWebView removeObserver:self forKeyPath:NSStringFromSelector(@selector(estimatedProgress))];
}
}
@end
//
// GroupList.h
// fastservice
//
// Created by xuning on 5/8/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface GroupItem : NSObject
@property (nonatomic,copy) NSString * city;
@property (nonatomic,copy) NSString * district;
@property (nonatomic,assign) int group_id;
@property (nonatomic,assign) double lat;
@property (nonatomic,assign) double lng;
@property (nonatomic,copy) NSString * icon;
@property (nonatomic,copy) NSString * text;
@property (nonatomic,copy) NSString * fl;//首字母
@end
@interface Group : NSObject
@end
@interface GroupList : NSObject
@property (nonatomic,copy) NSString * kind;
@property (nonatomic, assign) int group_id;
@property (nonatomic, copy) NSString * msg;//提示消息
@property (nonatomic,strong) Group * data_o;
@property (nonatomic,strong) Group * data_c;
@property (nonatomic,copy) NSString * city;
@property (nonatomic,copy) NSString * district;
@end
NS_ASSUME_NONNULL_END
//
// GroupList.m
// fastservice
//
// Created by xuning on 5/8/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "GroupList.h"
@implementation GroupItem
@end
@implementation Group
@end
@implementation GroupList
@end
...@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
//自定义经纬度 //自定义经纬度
@property (nonatomic, assign) int is_custom; //经纬度是否自定义 @property (nonatomic, assign) int is_custom; //经纬度是否自定义
@property (nonatomic,copy ) NSString * user_mob;//用户登录手机号 @property (nonatomic,copy ) NSString *user_mob;//用户登录手机号
@property(nonatomic, assign) BOOL closeVoice;//关闭声音 @property(nonatomic, assign) BOOL closeVoice;//关闭声音
......
...@@ -62,12 +62,12 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -62,12 +62,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign) int group_id;//商户认证时的group_id @property (nonatomic,assign) int group_id;//商户认证时的group_id
@property (nonatomic,assign) int m_s;//商户状态,0-未审核,1-已审核 @property (nonatomic,assign) int m_s;//商户状态,0-未审核,1-已审核
@property (nonatomic,copy) NSString *cate;//商户品类 @property (nonatomic,copy) NSString *cate;//商户品类
@property (nonatomic,assign) int *mul_f;//一取多发标志位,0-未开通,1-开通 @property (nonatomic,assign) int mul_f;//一取多发标志位,0-未开通,1-开通
@end @end
@interface UserInfo : NSObject @interface UserInfo : NSObject
@property (nonatomic, strong) NSString * mobile; @property (nonatomic, strong) NSString * mobile;
@property (nonatomic, assign) int user_id; @property (nonatomic, assign) int user_id;
@property (nonatomic, strong) NSString * cookie; @property (nonatomic, strong) NSString * cookie;
@property (nonatomic,copy ) NSString *spw; @property (nonatomic,copy ) NSString *spw;
......
...@@ -17,22 +17,20 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -17,22 +17,20 @@ NS_ASSUME_NONNULL_BEGIN
static NSString * const SS_SIGN = @"/flow/v1_0/user/signup"; static NSString * const SS_SIGN = @"/flow/v1_0/user/signup";
/** /**
* 验证码
*/
static NSString * const SS_SMS_CODE12 = @"/flow/v1_2/user/smscode";
/**
* 更新上传DeviceToken * 更新上传DeviceToken
*/ */
static NSString * const SS_SMS_CODEW = @"/flow/v1_1//user/smscodew"; static NSString * const SS_SMS_CODEW = @"/flow/v1_1//user/smscodew";
/** /**
* 登陆新 * 登陆新
*/ */
static NSString * const SS_LOGINX = @"/flow/v1_1/user/login"; static NSString * const SS_LOGINX = @"/flow/v1_1/user/login";
/**
* 退出
*/
static NSString * const SS_LOGOUT = @"/flow/v1_0/user/logout";
/** /**
...@@ -90,6 +88,27 @@ static NSString * const SS_BAIDU = @"https://www.baidu.com"; ...@@ -90,6 +88,27 @@ static NSString * const SS_BAIDU = @"https://www.baidu.com";
*/ */
static NSString *const SS_ONLINE_DURATION = @"/flow/v1_0/courier/onlineDuration"; static NSString *const SS_ONLINE_DURATION = @"/flow/v1_0/courier/onlineDuration";
/**
骑士协议
*/
static NSString *const SS_SERVICE_AGREEMENT = @"/flow/view/service_agreement";
/**
隐私协议
*/
static NSString *const SS_PRIVACY_COURIER = @"/flow/view/privacy_courier";
///完成单提示滚动条
static NSString *const HOME_OVERORDER_SHOW = @"/flow/v1_1/courier/message";
/**
* 获得分站列表group_id
*/
static NSString * const SS_GET_GINFO = @"/flow/v1_1/group/getGroupInfo";
/**
* 获取banner
*/
static NSString * const SS_GET_SMENU = @"/flow/v1_0/service/getSMenu";
@interface AFNetworkingClient : AFHTTPSessionManager @interface AFNetworkingClient : AFHTTPSessionManager
+ (instancetype)sharedClient; + (instancetype)sharedClient;
......
...@@ -253,7 +253,7 @@ static NSString * sg_privateNetworkBaseUrl = nil; ...@@ -253,7 +253,7 @@ static NSString * sg_privateNetworkBaseUrl = nil;
if ([pDic[@"respcd"] isEqualToString:@"2100"] && ![AppConfig needLogin] && ![AFNetworkingClient noMessageAlert:encoded error:error]) { if ([pDic[@"respcd"] isEqualToString:@"2100"] && ![AppConfig needLogin] && ![AFNetworkingClient noMessageAlert:encoded error:error]) {
[TestClient dicMobClickStatistics:@"respcd2100" url:encoded]; [TestClient dicMobClickStatistics:@"respcd2100" url:encoded];
showAlertMessage(@"登录已经过期,请重新登录!"); showAlertMessage(@"登录已经过期,请重新登录!");
// [[GlobalNetManager sharedGlobalNetManager] logout:nil]; [[GlobalNetManager sharedGlobalNetManager] logout:nil];
} }
if (success) { if (success) {
......
...@@ -21,6 +21,10 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -21,6 +21,10 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)setEnvironmentType:(int)type; + (void)setEnvironmentType:(int)type;
+ (int)getEnvironmentType; + (int)getEnvironmentType;
+ (void)setCurrentType:(UserCurrentType)type;
+ (UserCurrentType)getCurrentType;
+ (void)clearUserInfo; + (void)clearUserInfo;
...@@ -44,6 +48,21 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -44,6 +48,21 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)saveCustomLocationCoordinateWithLongitude:(NSString *)longitude Latitude:(NSString *)latitude; + (void)saveCustomLocationCoordinateWithLongitude:(NSString *)longitude Latitude:(NSString *)latitude;
+ (void)deleteCustomLocationCoordinate; + (void)deleteCustomLocationCoordinate;
+ (void)saveLocationName:(NSString * )name;
+ (void)saveDistrictName:(NSString *)name;
+ (NSString *)getLocationName;
+ (NSString *)getDistrictName;
+ (void)saveShowLocationName:(NSString * )name;
+ (void)saveShowDistrictName:(NSString *)name;
//获取选择城市信息
+ (NSString *)getShowLocationName;
+ (NSString *)getShowDistrictName;
+ (void)saveGroupID:(int )group_id;
+ (int)getGroupID;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -32,6 +32,21 @@ DEF_SINGLETION(AppConfig); ...@@ -32,6 +32,21 @@ DEF_SINGLETION(AppConfig);
return type; return type;
} }
/// 设置用户type
+ (void)setCurrentType:(UserCurrentType)type
{
[[NSUserDefaults standardUserDefaults] setInteger:type forKey:kAppPersonalType];
[[NSUserDefaults standardUserDefaults] synchronize];
}
/// 获取用户type
+ (UserCurrentType)getCurrentType
{
UserCurrentType type = (UserCurrentType)[[NSUserDefaults standardUserDefaults] integerForKey:kAppPersonalType] ;
return type;
}
+ (void)clearUserInfo{ + (void)clearUserInfo{
[AppConfig sharedAppConfig].user = nil; [AppConfig sharedAppConfig].user = nil;
[[NSUserDefaults standardUserDefaults]removeObjectForKey:kAppUserInfo]; [[NSUserDefaults standardUserDefaults]removeObjectForKey:kAppUserInfo];
...@@ -132,4 +147,50 @@ DEF_SINGLETION(AppConfig); ...@@ -132,4 +147,50 @@ DEF_SINGLETION(AppConfig);
} }
//城市
+ (void)saveLocationName:(NSString * )name{
[[NSUserDefaults standardUserDefaults] setObject:name forKey:kAppLocationName];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+ (void)saveDistrictName:(NSString *)name{
[[NSUserDefaults standardUserDefaults] setObject:name forKey:@"districtName"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+ (NSString *)getLocationName{
return [[NSUserDefaults standardUserDefaults] objectForKey:kAppLocationName];
}
+ (NSString *)getDistrictName{
return [[NSUserDefaults standardUserDefaults] objectForKey:@"districtName"];
}
+ (void)saveShowLocationName:(NSString * )name{
[[NSUserDefaults standardUserDefaults] setObject:name forKey:@"showLocationName"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+ (void)saveShowDistrictName:(NSString *)name{
[[NSUserDefaults standardUserDefaults] setObject:name forKey:@"showDistrictName"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+ (NSString *)getShowLocationName{
return [[NSUserDefaults standardUserDefaults] objectForKey:@"showLocationName"];
}
+ (NSString *)getShowDistrictName{
return [[NSUserDefaults standardUserDefaults] objectForKey:@"showDistrictName"];
}
+ (void)saveGroupID:(int)group_id{
[[NSUserDefaults standardUserDefaults] setObject:@(group_id) forKey:@"group_id"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
+ (int)getGroupID{
return [[[NSUserDefaults standardUserDefaults] objectForKey:@"group_id"] intValue];
}
@end @end
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "GroupList.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
...@@ -15,11 +15,20 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -15,11 +15,20 @@ NS_ASSUME_NONNULL_BEGIN
AS_SINGLETION(AppTools); AS_SINGLETION(AppTools);
@property (nonatomic,strong) NSMutableDictionary *cityDic;//城市列表数据
@property (nonatomic,strong) GroupItem *item;//城市选择的item
- (int)versionToIntValue; - (int)versionToIntValue;
//json串 unicode转中文 //json串 unicode转中文
+ (NSString *)replaceUnicode:(NSString *)unicodeStr; + (NSString *)replaceUnicode:(NSString *)unicodeStr;
+ (BOOL)isValidMobeilTelWithString:(NSString *)string;
+ (NSString *)kfwUUID;
+ (void)ccodeBase64Encode:(NSMutableDictionary *)pDic;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import "AppTools.h" #import "AppTools.h"
#import "CustomMethod.h"
@interface AppTools() @interface AppTools()
@property (nonatomic,assign) int version_int; @property (nonatomic,assign) int version_int;
...@@ -42,5 +43,55 @@ DEF_SINGLETION(AppTools); ...@@ -42,5 +43,55 @@ DEF_SINGLETION(AppTools);
} }
} }
//判断电话合法性
+ (BOOL)isValidMobeilTelWithString:(NSString *)string{
BOOL isValisMobeil = NO;
//手机号码
NSArray *mobeils = [CustomMethod addPhoneNumArr:string];
if (mobeils.count > 0 && [[mobeils firstObject] length] > 0) {
isValisMobeil = YES;
}else{
//电话号码正则
NSString * PHS = @"";
if ([string hasPrefix:@"400"]) {
PHS = @"^400[0-9]{7}";
}
else if ([string hasPrefix:@"800"]) {
PHS = @"^800[0-9]{7}";
}
else{
PHS = @"^(0[0-9]{2})\\d{8}$|^(0[0-9]{3}(\\d{7,8}))$";
}
NSPredicate *regextesTel = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", PHS];
if ([regextesTel evaluateWithObject:string]) {
isValisMobeil = YES;
}else{
showAlertMessage(S(@"电话号码不合法:%@",string));
isValisMobeil = NO;
}
}
return isValisMobeil;
}
+ (NSString *)kfwUUID{
CFUUIDRef uuidObj = CFUUIDCreate(nil);
NSString *uuidStr = (__bridge_transfer NSString *)CFUUIDCreateString(nil, uuidObj);
CFRelease(uuidObj);
return uuidStr;
}
//获取验证码时 加密key
+ (void)ccodeBase64Encode:(NSMutableDictionary *)pDic {
NSString *ccode_key = @"kfw123456";
NSString *time_since = S(@"%d",(int)[[NSDate date] timeIntervalSince1970]);
NSString *ccode = S(@"%@%@",ccode_key,[time_since substringWithRange:NSMakeRange(time_since.length - 4, 4)]);
ccode = [ccode base64Encode];
[pDic setAnyObject:ccode forKey:@"ccode"];//key加时间 base 64
[pDic setAnyObject:time_since forKey:@"tcode"];
// DebugLog(@"ccode_key:%@",ccode_key);
}
@end @end
//
// GlobalNetManager.h
// fastservice
//
// Created by xuning on 5/8/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "XVBaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface GlobalNetManager : NSObject
AS_SINGLETION(GlobalNetManager);
- (void)logout:(EventHandler)logoutBlock;
- (void)logout:(EventHandler)logoutBlock:(XVBaseViewController *)bvc;
// 位置上传定时器
- (void)setTimeInterval;
- (void)stopTimeInterval;
// 在线时长上传定时器
- (void)setOnlineTimerInterval;
- (void)stopOnlineTimerInterval;
@end
NS_ASSUME_NONNULL_END
//
// GlobalNetManager.m
// fastservice
//
// Created by xuning on 5/8/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "GlobalNetManager.h"
#import "XVLoginViewController.h"
#import "XVNaviViewController.h"
@interface GlobalNetManager()
@property (nonatomic,strong) NSTimer *timer;
@property (nonatomic,assign) float timer_count;
// 骑士在线时长统计
@property (nonatomic,strong) NSTimer *onlineTimer;
@property (nonatomic,assign) float online_duration;
@property (nonatomic, strong) UserInfo *userInfo;
@end
@implementation GlobalNetManager
DEF_SINGLETION(GlobalNetManager);
- (instancetype)init{
self = [super init];
if (self) {
self.timer_count = 30000;
self.online_duration = 60000;
}
return self;
}
- (void)logout:(EventHandler)logoutBlock{
if (![AppConfig needLogin]) {
[AppConfig clearUserInfo];
[[NSNotificationCenter defaultCenter] postNotificationName:kAppUserLogout object:nil];
BlockCallWithOneArg(logoutBlock, @"logout");
[[AFNetworkingClient sharedClient]runPost:SS_LOGOUT parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
if ([MyNetWork isSuccessServerData:responseObject]) {
DebugLog(@"退出app成功");
}else{
DebugLog(@"退出app失败resperr:%@",responseObject[@"resperr"]);
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
DebugLog(@"退出app失败");
}];
// 重置登录页面
XVLoginViewController *loginVc = [[XVLoginViewController alloc]init];
XVNaviViewController *navi = [[XVNaviViewController alloc]initWithRootViewController:loginVc];
theApp().window.rootViewController = navi;
}
// if ([EMClient sharedClient].isLoggedIn) {
// [[EMClient sharedClient] logout:YES completion:^(EMError *aError) {
// if (aError) {
// DebugLog(@"环信退出失败:%@",aError.errorDescription);
// }else{
// DebugLog(@"环信退出成功:%@",aError.errorDescription);
// }
// }];
// }
}
- (void)logout:(EventHandler)logoutBlock:(XVBaseViewController *)bvc{
[self logout:logoutBlock];
}
@end
//
// MyNetWork.h
// fastservice
//
// Created by xuning on 5/6/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface MyNetWork : NSObject
//环信登录
+ (void)checkEaseInfo;
//
+ (void)easeLoginWithUsername:(NSString *)name spw:(NSString *)spw;
//用户登录后 加载用户基本信息
+ (void)loginAfterLoadUserProfile:(EventHandler )myNetBlock;
/*
* 加载单个城市信息
*/
+ (void)loadGroupInfoWithGroupId:(int)group_id myNetBlock:(EventHandler )myNetBlock;
/*
* 网络请求时 城市和区域参数 提取
*/
+ (NSMutableDictionary *)parameterShowCityAndDistrict:(NSMutableDictionary *)pDic;
#pragma mark -服务器数据是否加载成功
+ (BOOL)isSuccessServerData:(id)responseObject;
#pragma mark -检查更新
+ (void)checkUpdate;
@end
NS_ASSUME_NONNULL_END
//
// MyNetWork.m
// fastservice
//
// Created by xuning on 5/6/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "MyNetWork.h"
@implementation MyNetWork
#pragma mark - -环信登录
+ (void)checkEaseInfo{
// if (![AppConfig needLogin] && ([AppConfig getUserInfo].hide_flag != 1)) {
// if (![[EMClient sharedClient] isLoggedIn]) {
// [MyNetWork easeLoginWithUsername:S(@"%d",[AppConfig getUserInfo].user_id) spw:[AppConfig getUserInfo].spw];
// }else{
// NSString *em_name = [[EMClient sharedClient] currentUsername];
// if (StringIsNullOrEmpty(em_name)) {
// return;
// }
// BOOL isMe = [em_name isEqualToString:S(@"%d",[AppConfig getUserInfo].user_id)];
// if (!isMe) {//非一人
// [MyNetWork easeLoginWithUsername:S(@"%d",[AppConfig getUserInfo].user_id) spw:[AppConfig getUserInfo].spw];
// }
// }
// }
}
+ (void)easeLoginWithUsername:(NSString *)name spw:(NSString *)spw{
// [[EMClient sharedClient] loginWithUsername:name password:spw completion:^(NSString *aUsername, EMError *aError) {
// if (!aError) {
// //设置是否自动登录
// [[EMClient sharedClient].options setIsAutoLogin:YES];
//
// //发送自动登陆状态通知
// [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_LOGINCHANGE object:@YES];
// //保存最近一次登录用户名
// // [self saveLastLoginUsername];
// DebugLog(@"环信登录成功:%@",aError.errorDescription);
// }else{
// DebugLog(@"环信登录失败:%@",aError.errorDescription);
//
// [MBProgressHUD showMessage:S(@"%@",aError.errorDescription) toView:nil];
//
// }
// }];
}
#pragma mark - -登录后加载
+ (void)loginAfterLoadUserProfile:(EventHandler )myNetBlock{
NSMutableDictionary *pDic = [[NSMutableDictionary alloc] init];
[pDic setObject:@([AppConfig getUserInfo].user_id) forKey:@"user_id"];
[[AFNetworkingClient sharedClient] runPost:SS_GET_USERPROFILE parameters:pDic success:^(NSURLSessionDataTask *task, id responseObject) {
if ([MyNetWork isSuccessServerData:responseObject]) {
UserInfo * ui = [UserInfo mj_objectWithKeyValues:responseObject[@"data"]];
UserInfo *userInfo = [AppConfig getUserInfo];
userInfo.b = ui.b;
userInfo.c = ui.c;
userInfo.m = ui.m;
[AppConfig setUser:userInfo];
BlockCallWithOneArg(myNetBlock, userInfo);
if (userInfo.c.c_s > 0) {
[AppConfig setCurrentType:UserCurrentTypeCourier];
}else{
[AppConfig setCurrentType:UserCurrentTypeCustom];
}
[[NSNotificationCenter defaultCenter] postNotificationName:kAppLoadProfileSuccess object:nil];
}else{
BlockCallWithOneArg(myNetBlock, nil);
[MBProgressHUD showMessage:[responseObject objectForKey:@"resperr"] toView:nil];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
BlockCallWithOneArg(myNetBlock, nil);
}];
}
+ (void)loadGroupInfoWithGroupId:(int)group_id myNetBlock:(EventHandler )myNetBlock{
//
NSMutableDictionary *pDic = [NSMutableDictionary dictionary];
//所在城市
[pDic setAnyObject:[AppConfig getLocationName] forKey:@"city"];
[pDic setAnyObject:[AppConfig getDistrictName] forKey:@"district"];
[pDic setObject:@(group_id) forKey:@"group_id"];
[[AFNetworkingClient sharedClient] runPost:SS_GET_GINFO parameters:pDic success:^(NSURLSessionDataTask *task, id responseObject) {
if ([MyNetWork isSuccessServerData:responseObject]) {
NSDictionary *dic = responseObject[@"data"];
[AppTools sharedAppTools].cityDic = [[NSMutableDictionary alloc] initWithDictionary:dic];
GroupItem *groupItem = [GroupItem mj_objectWithKeyValues:dic];
[AppConfig saveGroupID:groupItem.group_id];
[AppConfig saveShowLocationName:groupItem.city];
[AppConfig saveShowDistrictName:groupItem.district];
[AppTools sharedAppTools].item = groupItem;
BlockCallWithOneArg(myNetBlock, dic);
}else{
[MBProgressHUD showMessage:[responseObject objectForKey:@"resperr"] toView:nil];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
+ (NSMutableDictionary *)parameterShowCityAndDistrict:(NSMutableDictionary *)pDic{
[pDic setAnyObject:[AppConfig getShowLocationName] forKey:@"city"];
[pDic setAnyObject:[AppConfig getShowDistrictName] forKey:@"district"];
return pDic;
}
#pragma mark -服务器数据是否加载成功
+ (BOOL)isSuccessServerData:(id)responseObject{
return StringNotNullAndEmpty([responseObject objectForKey:@"respcd"]) && [[responseObject objectForKey:@"respcd"] isEqualToString:@"0000"];
}
@end
//
// CustomMethod.h
// MessageList
//
// Created by 刘超 on 13-11-13.
// Copyright (c) 2013年 刘超. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RegexKitLite.h"
@interface CustomMethod : NSObject
+ (NSString *)escapedString:(NSString *)oldString;
+ (NSMutableArray *)addHttpArr:(NSString *)text;
+ (NSMutableArray *)addPhoneNumArr:(NSString *)text;
+ (NSMutableArray *)addEmailArr:(NSString *)text;
+ (NSString *)transformString:(NSString *)originalStr emojiDic:(NSDictionary *)_emojiDic;
@end
//
// CustomMethod.m
// MessageList
//
// Created by 刘超 on 13-11-13.
// Copyright (c) 2013年 刘超. All rights reserved.
//
#import "CustomMethod.h"
@implementation CustomMethod
+ (NSString *)escapedString:(NSString *)oldString
{
NSString *escapedString_lt = [oldString stringByReplacingOccurrencesOfString:@"<" withString:@"&lt"];
NSString *escapedString = [escapedString_lt stringByReplacingOccurrencesOfString:@">" withString:@"&gt"];
return escapedString;
}
#pragma mark - 正则匹配电话号码,网址链接,Email地址
+ (NSMutableArray *)addHttpArr:(NSString *)text{
//匹配网址链接
// NSString *regex_http = @"(https?|ftp|file)+://[^\\s]*";
NSString *regex_http =
@"((http[s]{0,1}|ftp)://[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)|(www.[a-zA-Z0-9\\.\\-]+\\.([a-zA-Z]{2,4})(:\\d+)?(/[a-zA-Z0-9\\.\\-~!@#$%^&*+?:_/=<>]*)?)";
NSArray *array_http = [text componentsMatchedByRegex:regex_http];
NSMutableArray *httpArr = [NSMutableArray arrayWithArray:array_http];
/*
NSError *error;
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:regex_http options:NSRegularExpressionCaseInsensitive error:&error];
NSArray *arrayOfAllMatches = [regex matchesInString:text options:0 range:NSMakeRange(0, [text length])];
for (NSTextCheckingResult *match in arrayOfAllMatches){
NSString* substringForMatch = [text substringWithRange:match.range];
NSLog(@"substringForMatch%@",substringForMatch);
}
*/
return httpArr;
}
+ (NSMutableArray *)addPhoneNumArr:(NSString *)text{
//匹配电话号码
NSString *regex_phonenum = @"((\\d{11})|^((\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})|(\\d{4}|\\d{3})-(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1})|(\\d{7,8})-(\\d{4}|\\d{3}|\\d{2}|\\d{1}))$)";
NSArray *array_phonenum = [text componentsMatchedByRegex:regex_phonenum];
NSMutableArray *phoneNumArr = [NSMutableArray arrayWithArray:array_phonenum];
return phoneNumArr;
}
+ (NSMutableArray *)addEmailArr:(NSString *)text{
//匹配Email地址
NSString *regex_email = @"\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*.\\w+([-.]\\w+)*";
NSArray *array_email = [text componentsMatchedByRegex:regex_email];
NSMutableArray *emailArr = [NSMutableArray arrayWithArray:array_email];
return emailArr;
}
+ (NSString *)transformString:(NSString *)originalStr emojiDic:(NSDictionary *)_emojiDic
{
//匹配表情,将表情转化为html格式
NSString *text = originalStr;
NSString *regex_emoji = @"\\[[a-zA-Z0-9\\u4e00-\\u9fa5]+\\]";
NSArray *array_emoji = [text componentsMatchedByRegex:regex_emoji];
if ([array_emoji count]) {
for (NSString *str in array_emoji) {
NSRange range = [text rangeOfString:str];
NSString *i_transCharacter = [_emojiDic objectForKey:str];
if (i_transCharacter) {
NSString *imageHtml = [NSString stringWithFormat:@"<img src='%@' width='16' height='16'>",i_transCharacter];
text = [text stringByReplacingCharactersInRange:NSMakeRange(range.location, [str length]) withString:imageHtml];
}
}
}
//返回转义后的字符串
return text;
}
@end
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,6 +6,22 @@ ...@@ -6,6 +6,22 @@
// Copyright © 2025 FastService. All rights reserved. // Copyright © 2025 FastService. All rights reserved.
// //
#define EnvironmentType0 0
#define EnvironmentType1 1
typedef enum{
UserCurrentTypeNone,
UserCurrentTypeCustom,
UserCurrentTypeCourier,
}UserCurrentType;
typedef enum {
StatusTypeWork = 2,
StatusTypeClose = 3,
} StatusType;
/** /**
* 当前用户Info * 当前用户Info
*/ */
......
...@@ -127,6 +127,15 @@ isPhoneX;\ ...@@ -127,6 +127,15 @@ isPhoneX;\
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self; #define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;
/**
申明一个 block_self 的指针,指向自身,以用于在block中使用
*/
#if __has_feature(objc_arc)
#define IMP_BLOCK_SELF(type) __weak type *block_self=self;
#else
#define IMP_BLOCK_SELF(type) __block type *block_self=self;
#endif
typedef void(^EventHandler)(id sender); typedef void(^EventHandler)(id sender);
typedef void(^EventVoidHandler)(void); typedef void(^EventVoidHandler)(void);
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#import "XVRegisterViewController.h" #import "XVRegisterViewController.h"
#import "XVPasswordViewController.h" #import "XVPasswordViewController.h"
#import "XVInputFieldView.h" #import "XVInputFieldView.h"
#import "XVNaviViewController.h"
#import "XVWebViewController.h"
#import "XVMainJobViewController.h"
@interface XVLoginViewController () @interface XVLoginViewController ()
...@@ -37,12 +40,15 @@ ...@@ -37,12 +40,15 @@
@property (nonatomic, strong) XVInputFieldView *smsCodeView; @property (nonatomic, strong) XVInputFieldView *smsCodeView;
@property (nonatomic,assign) BOOL privacy;
@end @end
@implementation XVLoginViewController @implementation XVLoginViewController
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
[self setNavigationBarsetBackgroundColor:COLOR_THEMEGRENN];
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
...@@ -148,8 +154,108 @@ ...@@ -148,8 +154,108 @@
- (void)agreeClick:(UIButton *)button { - (void)agreeClick:(UIButton *)button {
button.selected = !button.selected; button.selected = !button.selected;
self.privacy = button.selected;
}
- (void)loginButtonClick {
// 如果是账号密码登录
if (self.changeLoginButton.selected) {
}else {
// 密码登录
if (StringIsNullOrEmpty(self.phoneView.textField.text)) {
[MBProgressHUD showMessage:@"请填入手机号"];
return;
}
if (![AppTools isValidMobeilTelWithString:self.phoneView.textField.text]) {
return;
}
if (StringIsNullOrEmpty(self.passwordView.textField.text)) {
[MBProgressHUD showMessage:@"请输入密码"];
return;
}
if (!self.privacy) {
[MBProgressHUD showMessage:@"请阅读并同意快服务骑士协议及隐私协议"];
return;
}
//缓存一份
LocalCache *localCache = [AppConfig getLocalCache];
localCache.user_mob = self.phoneView.textField.text;
[AppConfig saveLocalCache:localCache];
[self.view endEditing:YES];
NSMutableDictionary * pdic = [[NSMutableDictionary alloc]init];
[pdic setAnyObject:self.phoneView.textField.text forKey:@"mobile"];
[pdic setAnyObject:self.passwordView.textField.text forKey:@"password"];
[pdic setObject:@"" forKey:@"clientid"];
[pdic setAnyObject:[AppConfig getLocationName] forKey:@"city"];
[pdic setAnyObject:[AppConfig getDistrictName] forKey:@"district"];
[pdic setAnyObject:_S(@"%f",[AppConfig getLocationCoordinate].longitude) forKey:@"user_lng"];
[pdic setAnyObject:_S(@"%f",[AppConfig getLocationCoordinate].latitude) forKey:@"user_lat"];
showIndicator(YES, @"登录中", nil);
showFullView(YES, self);
IMP_BLOCK_SELF(XVLoginViewController)
[[AFNetworkingClient sharedClient]runPost:SS_LOGINX parameters:pdic success:^(NSURLSessionDataTask *task, id responseObject) {
if ([MyNetWork isSuccessServerData:responseObject]) {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)task.response;
//一些cookie信息 -->>dictionary
NSDictionary *dictionary = [httpResponse allHeaderFields];
NSDictionary *dic = [responseObject objectForKey:@"data"];
UserInfo * userInfo = [UserInfo mj_objectWithKeyValues:dic];
//保存cookie信息
if (StringNotNullAndEmpty([dictionary objectForKey:@"Set-Cookie"])) {
userInfo.cookie = [dictionary objectForKey:@"Set-Cookie"];
}else{
[TestClient dicMobClickStatistics:@"respNoCookie"];
}
[AppConfig setUser:userInfo];
//环信登录
NSString *spw = responseObject[@"data"][@"spw"];
[MyNetWork easeLoginWithUsername:S(@"%d",userInfo.user_id) spw:spw];
// 设备别名
[[NSNotificationCenter defaultCenter] postNotificationName:kAppUserLogin object:nil];
[self loginSuccess];
showIndicator(NO, @"登录中", ^{
[MBProgressHUD showMessage:@"登录成功"];
});
}else{
showIndicator(NO, @"登录中", ^{
[MBProgressHUD showMessage:[responseObject objectForKey:@"resperr"]];
});
}
showFullView(NO, block_self);
} failure:^(NSURLSessionDataTask *task, NSError *error) {
showIndicator(NO, @"登录中", nil);
showFullView(NO, block_self);
}];
}
} }
- (void)loginSuccess {
XVMainJobViewController *vc = [[XVMainJobViewController alloc]init];
XVNaviViewController *navi = [[XVNaviViewController alloc]initWithRootViewController:vc];
theApp().window.rootViewController = navi;
}
- (UIView *)containerView { - (UIView *)containerView {
if(_containerView == nil) { if(_containerView == nil) {
_containerView = [[UIView alloc]init]; _containerView = [[UIView alloc]init];
...@@ -217,7 +323,11 @@ ...@@ -217,7 +323,11 @@
WS(weakSelf); WS(weakSelf);
[_forgetButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) { [_forgetButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) {
XVPasswordViewController *vc = [[XVPasswordViewController alloc]init]; XVPasswordViewController *vc = [[XVPasswordViewController alloc]init];
[weakSelf.navigationController pushViewController:vc animated:YES]; XVNaviViewController *navi = [[XVNaviViewController alloc]initWithRootViewController:vc];
navi.modalPresentationStyle = UIModalPresentationFullScreen;
[weakSelf presentViewController:navi animated:YES completion:nil];
}]; }];
} }
...@@ -231,7 +341,9 @@ ...@@ -231,7 +341,9 @@
[_registerButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) { [_registerButton addBlockForControlEvents:UIControlEventTouchUpInside block:^(id _Nonnull sender) {
XVRegisterViewController *registerVc = [[XVRegisterViewController alloc]init]; XVRegisterViewController *registerVc = [[XVRegisterViewController alloc]init];
[weakSelf presentViewController:registerVc animated:YES completion:nil]; XVNaviViewController *navi = [[XVNaviViewController alloc]initWithRootViewController:registerVc];
navi.modalPresentationStyle = UIModalPresentationFullScreen;
[weakSelf presentViewController:navi animated:YES completion:nil];
}]; }];
} }
return _registerButton; return _registerButton;
...@@ -240,6 +352,7 @@ ...@@ -240,6 +352,7 @@
- (UIButton *)loginButton { - (UIButton *)loginButton {
if(_loginButton == nil) { if(_loginButton == nil) {
_loginButton = [[UIButton alloc]initWithTitle:@"登录" fontSize:16 titleColor:[UIColor whiteColor] bgColor:COLOR_THEMEGRENN]; _loginButton = [[UIButton alloc]initWithTitle:@"登录" fontSize:16 titleColor:[UIColor whiteColor] bgColor:COLOR_THEMEGRENN];
[_loginButton addTarget:self action:@selector(loginButtonClick) forControlEvents:(UIControlEventTouchUpInside)];
} }
return _loginButton; return _loginButton;
} }
...@@ -273,14 +386,15 @@ ...@@ -273,14 +386,15 @@
[text appendAttributedString:str1]; [text appendAttributedString:str1];
NSMutableAttributedString *str2 = [[NSMutableAttributedString alloc] initWithString:@"《快服务服务者合作协议》"]; NSMutableAttributedString *str2 = [[NSMutableAttributedString alloc] initWithString:@"快服务骑士协议"];
str2.font = font; str2.font = font;
str2.color = BLUE_COLOR; str2.color = BLUE_COLOR;
WS(weakSelf)
YYTextHighlight *highlight = [YYTextHighlight new]; YYTextHighlight *highlight = [YYTextHighlight new];
highlight.tapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) { highlight.tapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {
[weakSelf toWebView:SS_SERVICE_AGREEMENT name:@"骑士协议"];
}; };
[str2 setTextHighlight:highlight range:str2.rangeOfAll]; [str2 setTextHighlight:highlight range:str2.rangeOfAll];
...@@ -294,14 +408,14 @@ ...@@ -294,14 +408,14 @@
[text appendAttributedString:str3]; [text appendAttributedString:str3];
NSMutableAttributedString *str4 = [[NSMutableAttributedString alloc] initWithString:@"《隐私协议》"]; NSMutableAttributedString *str4 = [[NSMutableAttributedString alloc] initWithString:@"隐私协议"];
str4.font = font; str4.font = font;
str4.color = BLUE_COLOR; str4.color = BLUE_COLOR;
YYTextHighlight *highlight1 = [YYTextHighlight new]; YYTextHighlight *highlight1 = [YYTextHighlight new];
highlight1.tapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) { highlight1.tapAction = ^(UIView *containerView, NSAttributedString *text, NSRange range, CGRect rect) {
[weakSelf toWebView:SS_PRIVACY_COURIER name:@"隐私协议"];
}; };
[str4 setTextHighlight:highlight1 range:str4.rangeOfAll]; [str4 setTextHighlight:highlight1 range:str4.rangeOfAll];
...@@ -315,4 +429,14 @@ ...@@ -315,4 +429,14 @@
return _protocolLabel; return _protocolLabel;
} }
- (void)toWebView:(NSString *)url name:(NSString *)name {
NSString * path = S(@"%@%@",[AFNetworkingClient baseURLString],url);
XVWebViewController *web = [[XVWebViewController alloc]init];
[web loadWebURLSring:path];
[self.navigationController pushViewController:web animated:YES];
}
@end @end
...@@ -13,7 +13,7 @@ typedef enum : NSUInteger { ...@@ -13,7 +13,7 @@ typedef enum : NSUInteger {
InputTypeNumber, InputTypeNumber,
InputTypeText, InputTypeText,
InputTypePassword, InputTypePassword,
InputTypeCode, InputTypePicCode,
InputTypeSmsCode, InputTypeSmsCode,
} InputType; } InputType;
...@@ -27,6 +27,11 @@ typedef enum : NSUInteger { ...@@ -27,6 +27,11 @@ typedef enum : NSUInteger {
@property (nonatomic, strong) UIButton *smsCodeButton; @property (nonatomic, strong) UIButton *smsCodeButton;
@property (nonatomic, strong) UIButton *picCodeButton;
@property (nonatomic, strong) UILabel *voiceLabel;
@property (nonatomic,copy) void(^textEditingChanged)(NSString *obj); @property (nonatomic,copy) void(^textEditingChanged)(NSString *obj);
/// 创建 /// 创建
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
@interface XVInputFieldView()<UITextFieldDelegate> @interface XVInputFieldView()<UITextFieldDelegate>
@property (nonatomic, strong) UIView *lineView; @property (nonatomic, strong) UIView *lineView;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic,assign) InputType type; @property (nonatomic,assign) InputType type;
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
- (instancetype)initWithType:(InputType)type placeholder:(NSString *)placeholder { - (instancetype)initWithType:(InputType)type placeholder:(NSString *)placeholder {
if (self = [super init]) { if (self = [super init]) {
self.type = type; self.type = type;
self.textField.placeholder = placeholder; NSAttributedString *attr = [[NSAttributedString alloc]initWithString:placeholder attributes:@{NSForegroundColorAttributeName : kHexRGB(0x737272),NSFontAttributeName:[UIFont systemFontOfSize:14]}];
self.textField.attributedPlaceholder = attr;
[self setupUI]; [self setupUI];
} }
...@@ -46,7 +48,7 @@ ...@@ -46,7 +48,7 @@
[self addSubview:self.lineView]; [self addSubview:self.lineView];
[self.lineView mas_makeConstraints:^(MASConstraintMaker *make) { [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self); make.bottom.mas_equalTo(self);
make.height.mas_equalTo(0.5); make.height.mas_equalTo(1);
make.left.mas_equalTo(self).mas_offset(0); make.left.mas_equalTo(self).mas_offset(0);
make.right.mas_equalTo(self).mas_offset(0); make.right.mas_equalTo(self).mas_offset(0);
}]; }];
...@@ -60,6 +62,13 @@ ...@@ -60,6 +62,13 @@
make.right.mas_equalTo(self).mas_offset(-7); make.right.mas_equalTo(self).mas_offset(-7);
make.centerY.mas_equalTo(self.textField); make.centerY.mas_equalTo(self.textField);
}]; }];
self.voiceLabel.hidden = NO;
[self addSubview:self.voiceLabel];
self.voiceLabel.text = @"密码长度6-20位";
[self.voiceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.textField);
make.top.mas_equalTo(self.lineView.mas_bottom).mas_offset(5);
}];
} }
if(self.type == InputTypeSmsCode) { if(self.type == InputTypeSmsCode) {
...@@ -74,6 +83,28 @@ ...@@ -74,6 +83,28 @@
}]; }];
kViewBorderRadius(self.smsCodeButton, 4, 0, [UIColor clearColor]); kViewBorderRadius(self.smsCodeButton, 4, 0, [UIColor clearColor]);
[self addSubview:self.voiceLabel];
[self.voiceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.textField);
make.top.mas_equalTo(self.lineView.mas_bottom).mas_offset(5);
}];
}
if (self.type == InputTypePicCode) {
[self addSubview:self.picCodeButton];
[self.picCodeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self).mas_offset(-7);
make.centerY.mas_equalTo(self.textField);
make.height.mas_equalTo(30);
make.width.mas_equalTo(70);
}];
} }
if(self.type == InputTypeNumber) { if(self.type == InputTypeNumber) {
...@@ -114,7 +145,7 @@ ...@@ -114,7 +145,7 @@
- (UIView *)lineView { - (UIView *)lineView {
if (_lineView == nil) { if (_lineView == nil) {
_lineView = [[UIView alloc]init]; _lineView = [[UIView alloc]init];
_lineView.backgroundColor = EF_3_COLOR; _lineView.backgroundColor = BB_3_COLOR;
} }
return _lineView; return _lineView;
} }
...@@ -138,11 +169,19 @@ ...@@ -138,11 +169,19 @@
return _smsCodeButton; return _smsCodeButton;
} }
- (UIImageView *)imageView { - (UIButton *)picCodeButton {
if (_imageView == nil) { if (_picCodeButton == nil) {
_imageView = [[UIImageView alloc]init]; _picCodeButton = [[UIButton alloc]init];
[_picCodeButton setBackgroundColor:BB_3_COLOR];
} }
return _imageView; return _picCodeButton;
} }
- (UILabel *)voiceLabel {
if (_voiceLabel == nil) {
_voiceLabel = [[UILabel alloc]initWithText:@"收不到验证码?来个语音验证码吧" textColor:F_BCBCBC_COLOR textAlignment:(NSTextAlignmentLeft) fontSize:12];
_voiceLabel.hidden = YES;
}
return _voiceLabel;
}
@end @end
...@@ -45,8 +45,24 @@ ...@@ -45,8 +45,24 @@
[super viewDidLoad]; [super viewDidLoad];
[self setupUI]; [self setupUI];
[self getMarqueeData];
}
- (void)getMarqueeData {
[[AFNetworkingClient sharedClient] runGET:HOME_OVERORDER_SHOW parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
dispatch_async(dispatch_get_main_queue(), ^{
self.marqueeView.scrollTitle = responseObject[@"data"][@"msg"];
[self.marqueeView beginScrolling];
});
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
} }
- (void)setupUI { - (void)setupUI {
...@@ -75,8 +91,10 @@ ...@@ -75,8 +91,10 @@
[self.listContainerView layoutIfNeeded]; [self.listContainerView layoutIfNeeded];
[self.view addSubview:self.sortView]; [self.view addSubview:self.sortView];
CGFloat top = KTOP_HEIGHT + 50 + 30 + 15;
CGFloat h = (SCREEN_HEIGHT - self.listContainerView.top) / 2; CGFloat h = (SCREEN_HEIGHT - top) / 2;
self.dragView = [[WMDragView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-48, h, 48, 48)]; self.dragView = [[WMDragView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-48, h, 48, 48)];
...@@ -85,7 +103,7 @@ ...@@ -85,7 +103,7 @@
[self.view addSubview:self.dragView]; [self.view addSubview:self.dragView];
self.dragView.isKeepBounds = YES; self.dragView.isKeepBounds = YES;
self.dragView.freeRect = CGRectMake(SCREEN_WIDTH/2, self.listContainerView.top, SCREEN_WIDTH/2, h-100); self.dragView.freeRect = CGRectMake(SCREEN_WIDTH/2, top, SCREEN_WIDTH/2, h-100);
self.dragView.keepDirection = WMKeepDirectionInitialize; self.dragView.keepDirection = WMKeepDirectionInitialize;
WS(weakSelf) WS(weakSelf)
...@@ -230,8 +248,8 @@ ...@@ -230,8 +248,8 @@
_marqueeView.scrollSpace = 100; _marqueeView.scrollSpace = 100;
_marqueeView.backgroundColor = kHexRGB(0xDBDBDB); _marqueeView.backgroundColor = kHexRGB(0xDBDBDB);
_marqueeView.scrollTitleColor = [UIColor whiteColor]; _marqueeView.scrollTitleColor = [UIColor whiteColor];
_marqueeView.frame = CGRectMake(10, self.barView.height + self.categoryView.height, SCREEN_WIDTH-20, 31); _marqueeView.frame = CGRectMake(10, self.barView.height + 6 + self.categoryView.height, SCREEN_WIDTH-20, 31);
kViewBorderRadius(_marqueeView, 8, 0, kHexRGB(0xDBDBDB)); kViewBorderRadius(_marqueeView, 15, 0, kHexRGB(0xDBDBDB));
} }
return _marqueeView; return _marqueeView;
} }
......
...@@ -24,3 +24,130 @@ static NSString * const kAppServerError = @"kAppServerError"; ...@@ -24,3 +24,130 @@ static NSString * const kAppServerError = @"kAppServerError";
* 服务器慢通知 * 服务器慢通知
*/ */
static NSString * const kAppServerLow = @"kAppServerLow"; static NSString * const kAppServerLow = @"kAppServerLow";
/**
* 注册
*/
static NSString * const kAppSigin = @"kAppSigin";
/**
* 用户登录通知
*/
static NSString * const kAppUserLogin = @"kAppUserLogin" ;
/**
* 用户退出通知
*/
static NSString * const kAppUserLogout = @"kAppUserLogout" ;
/**
* 骑士认证通知
*/
static NSString * const kAppCourierCer = @"kAppCourierCer" ;
/**
* 定位成功后的通知
*/
static NSString * const kAppHasLocatonInfo = @"kAppHasLocatonInfo" ;
/**
* 定位成功后的通知,导航专用
*/
static NSString * const kAppNaviLocatonInfo = @"kAppNaviLocatonInfo" ;
/**
* 个推通知
*/
static NSString * const kAppGTNotification = @"kAppGTNotification" ;
/**
* 环信通知
*/
static NSString * const kAppHXNotification = @"kAppHXNotification" ;
/**
* 本地通知
*/
static NSString * const kAppBDNotification = @"kAppBDNotification" ;
/**
* 微信授权通知
*/
static NSString * const kAppWXAUTHNotification = @"kAppWXAUTHNotification" ;
/**
* 其他途径跳转到app传来参数
*/
static NSString * const kAppTOAPPNotification = @"kAppTOAPPNotification";
/**
* 切换城市
*/
static NSString * const kAppSCWPOINotification = @"selectCityWithPoiSearch";
/**
* 抢单成功
*/
static NSString * const kAppGetOrderSuccess = @"kAppGetOrderSuccess";
/**
* 检索 appkey error
*/
static NSString * const kAppKeyErrorNotification = @"kAppKeyErrorNotification";
/**
* 更新用户基本信息
*/
static NSString * const kUpdateUserinfoNotification = @"kUpdateUserinfoNotification";
/**
* 更新用户基本信息成功
*/
static NSString * const kAppLoadProfileSuccess = @"kAppLoadProfileSuccess";
/**
* 定位服务未开启
*/
static NSString * const kAppLocationServerNoOpen = @"locationServer";
/**
* 开启语音播报
*/
static NSString * const kAppSoundOFFON = @"kAppSoundOFFON";
/**
* app测试 推送测试
*/
static NSString * const kAppPushTest = @"kAppPushTest";
/**
* 通知定时屏蔽新订单弹框
*/
static NSString * const kNewOrderNotification = @"kNewOrderNotification";
/**
* 新订单消息
*/
static NSString * const kAppNewOrderMessage = @"kAppNewOrderMessage";
static NSString * const kAppOrderListClickMessage = @"kAppOrderListClickMessage";
/**
滑动抢单
*/
static NSString * const kAppOrderSliderMessage = @"kAppOrderSliderMessage";
/**
切换抢单模式
*/
static NSString * const kAppOrderSwitchSliderMessage = @"kAppOrderSwitchSliderMessage";
/**
添加新订单
*/
static NSString * const kAppOrderAdd2ListMessage = @"kAppOrderAdd2ListMessage";
/**
取消抢单
*/
static NSString * const kAppOrderCancleMessage = @"kAppOrderCancleMessage";
...@@ -12,9 +12,11 @@ ...@@ -12,9 +12,11 @@
#import "XVVerticalButton.h" #import "XVVerticalButton.h"
#import "XVSettingViewController.h" #import "XVSettingViewController.h"
#import "XVMyViewController.h" #import "XVMyViewController.h"
#import "HomeBannerModel.h"
#import "XVWebViewController.h"
@interface XVPersonalViewController () @interface XVPersonalViewController ()<SDCycleScrollViewDelegate>
@property (nonatomic, strong) UIImageView *userImageView; @property (nonatomic, strong) UIImageView *userImageView;
...@@ -57,6 +59,10 @@ ...@@ -57,6 +59,10 @@
@property (nonatomic, strong) UIButton *serviceButton; @property (nonatomic, strong) UIButton *serviceButton;
@property (nonatomic, strong) UserInfo *userInfo;
@property (nonatomic, strong) NSArray<HomeBannerModel *>* bannerList;
@end @end
...@@ -66,6 +72,121 @@ ...@@ -66,6 +72,121 @@
[super viewDidLoad]; [super viewDidLoad];
self.w = SCREEN_WIDTH * 0.8 - 12; self.w = SCREEN_WIDTH * 0.8 - 12;
[self setupUI]; [self setupUI];
[self loadData];
[self loadMenuData];
}
- (void)loadData {
IMP_BLOCK_SELF(XVPersonalViewController);
[MyNetWork loginAfterLoadUserProfile:^(UserInfo *userInfo) {
[block_self setupViews:userInfo];
}];
}
//横幅banner
- (void)loadMenuData{
NSMutableDictionary * pDic = [NSMutableDictionary dictionary];
[pDic setObject:@([AppConfig getUserInfo].user_id) forKey: @"user_id"];
[pDic setObject:@([AppConfig getGroupID]) forKey: @"group_id"];
//参数 city 和 district
pDic = [MyNetWork parameterShowCityAndDistrict:pDic];
IMP_BLOCK_SELF(XVPersonalViewController);
NSURLSessionTask * task = [[AFNetworkingClient sharedClient] runPost:SS_GET_SMENU parameters:pDic success:^(NSURLSessionDataTask *task, id responseObject) {
if ([MyNetWork isSuccessServerData:responseObject]) {
NSArray<HomeBannerModel *>* bannerList = [HomeBannerModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"banner_data"]];
self.bannerList = bannerList;
NSMutableArray *imgGorup = [NSMutableArray arrayWithCapacity:bannerList.count];
for (HomeBannerModel *model in bannerList) {
[imgGorup addObject:model.banner_url];
}
block_self.cycleScrollView.imageURLStringsGroup = imgGorup;
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (void)setupViews:(UserInfo *)userInfo {
self.userInfo = userInfo;
if (StringIsNullOrEmpty(userInfo.headPortrait)) {
self.userImageView.image = userInfo.b.gender == 2 ? IMG(@"woman") : IMG(@"man");
}else{
self.userImageView.image = [UIImage imageNamed:userInfo.headPortrait];
}
self.nameLabel.text = userInfo.b.nickname;
NSString *phone = self.userInfo.b.mobile;
if (phone && phone.length > 7) {
phone = [phone stringByReplacingCharactersInRange:NSMakeRange(phone.length -8, 4) withString:@"****"];//防止号码有前缀所以使用倒数第8位开始替换
}
self.phoneLabel.text = phone;
// 实名认证状态
int flag = userInfo.c.c_s;
if (flag == 2 || flag == 3 || flag == 6) {
self.healthButton.selected = YES;
}else{
self.healthButton.selected = NO;
}
// 服务保障状态
self.idButton.selected = userInfo.c.g_s == 1;
//0=铁牌骑士,1=铜牌骑士,2=银牌骑士,3=金牌骑士,4=钻石骑士
switch (userInfo.c.l) {
case 0:
self.levelImageView.image = IMG(@"tiepai");
break;
case 1:
self.levelImageView.image = IMG(@"tongpai");
break;
case 2:
self.levelImageView.image = IMG(@"yinpai");
break;
case 3:
self.levelImageView.image = IMG(@"jinpai");
break;
case 4:
self.levelImageView.image = IMG(@"zuanshi");
break;
default:
self.levelImageView.image = IMG(@"zhuansong");
break;
}
}
- (void)eyeButtonClick {
self.eyeButton.selected = ! self.eyeButton.selected;
if (self.eyeButton.selected) {
self.phoneLabel.text = self.userInfo.b.mobile;
}else{
NSString *phone = self.userInfo.b.mobile;
if (phone && phone.length > 7) {
phone = [phone stringByReplacingCharactersInRange:NSMakeRange(phone.length -8, 4) withString:@"****"];//防止号码有前缀所以使用倒数第8位开始替换
}
self.phoneLabel.text = phone;
}
}
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index {
HomeBannerModel *model = self.bannerList[index];
XVWebViewController *web = [[XVWebViewController alloc]init];
[web loadWebURLSring:model.obj_url];;
web.titleName = model.title;
[self cw_pushViewController:web];
} }
- (void)setupUI { - (void)setupUI {
...@@ -81,6 +202,7 @@ ...@@ -81,6 +202,7 @@
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.userImageView.mas_right).mas_offset(13); make.left.mas_equalTo(self.userImageView.mas_right).mas_offset(13);
make.top.mas_equalTo(self.userImageView); make.top.mas_equalTo(self.userImageView);
make.width.mas_equalTo(70);
}]; }];
[self.view addSubview:self.levelImageView]; [self.view addSubview:self.levelImageView];
...@@ -246,7 +368,7 @@ ...@@ -246,7 +368,7 @@
- (UILabel *)nameLabel { - (UILabel *)nameLabel {
if(_nameLabel == nil) { if(_nameLabel == nil) {
_nameLabel = [[UILabel alloc]initWithText:@"骑士" textColor:F_101010_COLOR textAlignment:(NSTextAlignmentLeft) fontSize:26]; _nameLabel = [[UILabel alloc]initWithText:@"骑士" textColor:F_101010_COLOR textAlignment:(NSTextAlignmentLeft) fontSize:24];
} }
return _nameLabel; return _nameLabel;
} }
...@@ -261,6 +383,7 @@ ...@@ -261,6 +383,7 @@
- (UIButton *)eyeButton { - (UIButton *)eyeButton {
if (_eyeButton == nil) { if (_eyeButton == nil) {
_eyeButton = [[UIButton alloc]initWithNormalImageName:@"closeeyes" selectedImgName:@"openeyes"]; _eyeButton = [[UIButton alloc]initWithNormalImageName:@"closeeyes" selectedImgName:@"openeyes"];
[_eyeButton addTarget:self action:@selector(eyeButtonClick) forControlEvents:UIControlEventTouchUpInside];
} }
return _eyeButton; return _eyeButton;
} }
...@@ -327,6 +450,7 @@ ...@@ -327,6 +450,7 @@
- (SDCycleScrollView *)cycleScrollView { - (SDCycleScrollView *)cycleScrollView {
if (_cycleScrollView == nil) { if (_cycleScrollView == nil) {
_cycleScrollView = [[SDCycleScrollView alloc]initWithFrame:CGRectMake(6, 99+9, self.w, 74)]; _cycleScrollView = [[SDCycleScrollView alloc]initWithFrame:CGRectMake(6, 99+9, self.w, 74)];
_cycleScrollView.delegate = self;
} }
return _cycleScrollView; return _cycleScrollView;
} }
......
//
// HomeBannerModel.h
// fastservice
//
// Created by xuning on 5/8/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface HomeBannerModel : NSObject
//banner
@property (nonatomic,copy) NSString *banner_url;
@property (nonatomic,copy) NSString *obj_url;
@property (nonatomic,copy) NSString *title;
//分享
@property (nonatomic,copy) NSString *content;
@property (nonatomic,copy) NSString *img_url;
@property (nonatomic,copy) NSString *share_title;
@end
NS_ASSUME_NONNULL_END
//
// HomeBannerModel.m
// fastservice
//
// Created by xuning on 5/8/25.
// Copyright © 2025 FastService. All rights reserved.
//
#import "HomeBannerModel.h"
@implementation HomeBannerModel
@end
...@@ -12,11 +12,13 @@ ...@@ -12,11 +12,13 @@
#import <YYKit.h> #import <YYKit.h>
#import "MJExtension.h" #import "MJExtension.h"
#import "UIImageView+WebCache.h" #import <UIImageView+WebCache.h>
#import <UIButton+WebCache.h>
#import <UIScrollView+EmptyDataSet.h> #import <UIScrollView+EmptyDataSet.h>
#import <MBProgressHUD.h> #import <MBProgressHUD.h>
#import <Masonry.h> #import <Masonry.h>
#import <MJRefresh/MJRefresh.h> #import <MJRefresh/MJRefresh.h>
#import <IQKeyboardManager/IQKeyboardManager.h>
//#import "WRNavigationBar.h" //#import "WRNavigationBar.h"
#import <LEEAlert.h> #import <LEEAlert.h>
#import "UINavigationController+FDFullscreenPopGesture.h" #import "UINavigationController+FDFullscreenPopGesture.h"
...@@ -46,6 +48,9 @@ ...@@ -46,6 +48,9 @@
#import "TestClient.h" #import "TestClient.h"
#import "XVAlertTools.h" #import "XVAlertTools.h"
#import "AppTools.h" #import "AppTools.h"
#import "AFNetworkingClient.h"
#import "MyNetWork.h"
#import "GlobalNetManager.h"
#endif #endif
......
...@@ -24,6 +24,9 @@ target 'fastservice' do ...@@ -24,6 +24,9 @@ target 'fastservice' do
pod 'SDCycleScrollView' pod 'SDCycleScrollView'
pod 'MBProgressHUD' pod 'MBProgressHUD'
pod 'LEEAlert' pod 'LEEAlert'
pod 'AvoidCrash' pod 'AvoidCrash'
...@@ -39,7 +42,14 @@ target 'fastservice' do ...@@ -39,7 +42,14 @@ target 'fastservice' do
pod 'CWLateralSlide', '~> 1.6.3' pod 'CWLateralSlide', '~> 1.6.3'
pod 'HWPanModal', '~> 0.9.9' pod 'HWPanModal', '~> 0.9.9'
# pod 'FloatingPanel'
pod 'HyphenateLite'
pod "Qiniu", "~> 8.3.1"
pod 'SobotKit'
pod 'Pingpp/Wx', '2.2.34'
pod 'Pingpp/Alipay', '2.2.34'
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment