Commit 9589b1b9 authored by David黄金龙's avatar David黄金龙

1、日志输出

2、首页添加相应资源
parent fc65b59e
...@@ -287,9 +287,9 @@ ...@@ -287,9 +287,9 @@
A5ACE8D72B4564F7002C94D2 /* Classes */ = { A5ACE8D72B4564F7002C94D2 /* Classes */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A5ACE91B2B4564F7002C94D2 /* Modules */,
A5ACE91E2B4564F7002C94D2 /* Base */, A5ACE91E2B4564F7002C94D2 /* Base */,
A5ACE8EE2B4564F7002C94D2 /* Tools */, A5ACE8EE2B4564F7002C94D2 /* Tools */,
A5ACE91B2B4564F7002C94D2 /* Modules */,
); );
path = Classes; path = Classes;
sourceTree = "<group>"; sourceTree = "<group>";
......
...@@ -107,10 +107,6 @@ extension AppDelegate { ...@@ -107,10 +107,6 @@ extension AppDelegate {
} }
YHNetworkStatusManager.shared.listenNetWorkStatus() YHNetworkStatusManager.shared.listenNetWorkStatus()
} }
//1.设置主窗口 //1.设置主窗口
......
...@@ -37,7 +37,9 @@ class YHBaseViewController: UIViewController { ...@@ -37,7 +37,9 @@ class YHBaseViewController: UIViewController {
} }
deinit { deinit {
#if DEBUG #if DEBUG
print(#function) // print(type(of: self))
// print("执行了方法:",terminator: "\t")
printLog(#function)
#endif #endif
} }
} }
......
...@@ -17,6 +17,13 @@ class YHHomeViewController: YHBaseViewController { ...@@ -17,6 +17,13 @@ class YHHomeViewController: YHBaseViewController {
return YHHomePageViewModel() return YHHomePageViewModel()
}() }()
lazy var headBkgImagV: UIImageView = {
let imagV = UIImageView()
imagV.image = UIImage(named: "home_head_bkg")
imagV.contentMode = .scaleAspectFill
return imagV
}()
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -52,8 +59,18 @@ class YHHomeViewController: YHBaseViewController { ...@@ -52,8 +59,18 @@ class YHHomeViewController: YHBaseViewController {
} }
private func initView()->Void { private func initView()->Void {
navigationItem.title = "首页" navigationItem.title = ""
view.backgroundColor = UIColor(hex:0xE9E9E9) view.backgroundColor = UIColor(hex:0xE9E9E9)
view.addSubview(headBkgImagV)
headBkgImagV.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(307)
}
} }
} }
...@@ -30,7 +30,7 @@ extension YHHomePageViewModel { ...@@ -30,7 +30,7 @@ extension YHHomePageViewModel {
return return
} }
self.subject.onNext(YHHomeCofigMode()) self.subject.onNext(YHHomeCofigMode())
print("model 是 ==>",model) printLog("model 是 ==> \(model)")
} failBlock: { err in } failBlock: { err in
print(err) print(err)
} }
......
...@@ -18,7 +18,7 @@ extension String { ...@@ -18,7 +18,7 @@ extension String {
} }
return [String:Any]() return [String:Any]()
} }
/// JSONString转换为数组 /// JSONString转换为数组
func toArray() -> Array<Any>? { func toArray() -> Array<Any>? {
guard let jsonData:Data = data(using: .utf8) else { return nil } guard let jsonData:Data = data(using: .utf8) else { return nil }
...@@ -187,14 +187,3 @@ extension String { ...@@ -187,14 +187,3 @@ extension String {
} }
} }
/// 打印
///
/// - Parameters:
/// - message: 打印内容
/// - file: 所在文件
/// - method: 所在方法
/// - line: 所在行
public func printLog<T>(_ message: T, file: String = #file, method: String = #function, line: Int = #line) {
print("\n[文件]:\((file as NSString).lastPathComponent) [所在行]:\(line),[方法名称]:\(method),[具体信息]:\(message)")
}
...@@ -12,14 +12,20 @@ import UIKit ...@@ -12,14 +12,20 @@ import UIKit
let APP_NAME = Bundle.main.infoDictionary!["CFBundleName"] as! String let APP_NAME = Bundle.main.infoDictionary!["CFBundleName"] as! String
func YHLOG<T>(message:T,file:String = #file,funcName:String = #function,lineName:Int = #line){ /// 打印
//这个DEBUG 是一个debug时候的一个flag需要自己去xcode设置项设置。 ///
/// - Parameters:
/// - message: 打印内容
/// - file: 所在文件
/// - method: 所在方法
/// - line: 所在行
public func printLog<T>(_ message: T, file: String = #file, method: String = #function, line: Int = #line) {
#if DEBUG #if DEBUG
let flieName = (file as NSString).lastPathComponent print("\n开始一段日志输出=========>\n[文件]:\((file as NSString).lastPathComponent)\n[所在行]:\(line)\n[方法名称]:\(method)\n[打印信息]:\(message)\n结束该段日志输出<=========\n\n\n")
print("\(APP_NAME)/\(flieName)/\(funcName)/\(lineName):\(message)")
#endif #endif
} }
///屏幕宽度 ///屏幕宽度
let KScreenWidth = UIScreen.main.bounds.size.width let KScreenWidth = UIScreen.main.bounds.size.width
///屏幕高度 ///屏幕高度
...@@ -137,60 +143,60 @@ func isIphoneX() -> Bool { ...@@ -137,60 +143,60 @@ func isIphoneX() -> Bool {
class YhConstant { class YhConstant {
// MARK: - URL 相关 // MARK: - URL 相关
struct URL { struct URL {
// MARK: - 帮助与反馈 // MARK: - 帮助与反馈
static let userQAUrl = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/pages/my/index" static let userQAUrl = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/pages/my/index"
// MARK: - 优眠用户注销条款 // MARK: - 优眠用户注销条款
static let userUnregisterURL = "https://www.baidu.com" static let userUnregisterURL = "https://www.baidu.com"
// MARK: - 隐私政策 // MARK: - 隐私政策
static let privacyURL = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/subpages/personal/pages/protocol/index?classify=privacy" static let privacyURL = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/subpages/personal/pages/protocol/index?classify=privacy"
// MARK: - 用户协议 // MARK: - 用户协议
static let userProtocalURL = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/subpages/personal/pages/protocol/index?classify=agreement" static let userProtocalURL = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/subpages/personal/pages/protocol/index?classify=agreement"
// MARK: - 付费咨询服务协议 // MARK: - 付费咨询服务协议
static let payProtocalURL = "https://www.baidu.com" static let payProtocalURL = "https://www.baidu.com"
// MARK: - 官网地址 // MARK: - 官网地址
static let officialWebsite = "https://www.sumian.com" static let officialWebsite = "https://www.sumian.com"
// MARK: - 量表入口 // MARK: - 量表入口
static let liangBiaoEntryWebsite = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/pages/medicineCenter/index" static let liangBiaoEntryWebsite = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/pages/medicineCenter/index"
// MARK: - 通用链接,可以在 Safari 等 web 环境打开 APP,目前主要是提供给微信APP调用 // MARK: - 通用链接,可以在 Safari 等 web 环境打开 APP,目前主要是提供给微信APP调用
static let universal_link = "https://sdapi.sumian.com/sleepdoctor/" static let universal_link = "https://sdapi.sumian.com/sleepdoctor/"
static let wx_universal_link = universal_link + "wx-sign-in/" static let wx_universal_link = universal_link + "wx-sign-in/"
// MARK: - 医学中心 // MARK: - 医学中心
static let medical_center_url = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/pages/medicineCenter/index" static let medical_center_url = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/pages/medicineCenter/index"
// MARK: - 文章详情 // MARK: - 文章详情
static let article_detail_url = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/subpages/platform/pages/articledetail/index?immerse=1" static let article_detail_url = YHBaseUrlManager.shared.h5URL() + "landing/index.html#/subpages/platform/pages/articledetail/index?immerse=1"
} }
// MARK: - 阿里云 手机号一键登录 秘钥信息 // MARK: - 阿里云 手机号一键登录 秘钥信息
static let kAliOnePressPhoneLoginKey = "pjYDHIVE1Q4qu7QJNI8MaxfvqJQvn5j+Az8xHRlnctj+kUAGf2Hin6ONsTFu1yjCwWPvhmw5NlhFo5DuP1SabykuX1Dz/xl4aDDLQQ5oijBNqRtwmwFAHl/exvfLk6zndWdv3Hi+DUL6gRwAj2UWj1rNXAMP2YSlisC0NSrFFFpiKyHAd2dM2OpIiGh9lkGeihU5iOjv/IycVMW6l2Sx9QqcrKiAX44aPMp0/uS5+y0xYwy/CjV6bvpacHNstxtVFd2Vgi7p454=" static let kAliOnePressPhoneLoginKey = "pjYDHIVE1Q4qu7QJNI8MaxfvqJQvn5j+Az8xHRlnctj+kUAGf2Hin6ONsTFu1yjCwWPvhmw5NlhFo5DuP1SabykuX1Dz/xl4aDDLQQ5oijBNqRtwmwFAHl/exvfLk6zndWdv3Hi+DUL6gRwAj2UWj1rNXAMP2YSlisC0NSrFFFpiKyHAd2dM2OpIiGh9lkGeihU5iOjv/IycVMW6l2Sx9QqcrKiAX44aPMp0/uS5+y0xYwy/CjV6bvpacHNstxtVFd2Vgi7p454="
// MARK: - 登录信息 // MARK: - 登录信息
static let KLoginedInfoKey = "KLoginedInfoKey" static let KLoginedInfoKey = "KLoginedInfoKey"
// MARK: - 上次登录成功后的 手机号码 // MARK: - 上次登录成功后的 手机号码
static let KLastLoginedSuccessPhoneKey = "KLastLoginedSuccessPhoneKey" static let KLastLoginedSuccessPhoneKey = "KLastLoginedSuccessPhoneKey"
// MARK: - 登录用户 详情信息 // MARK: - 登录用户 详情信息
static let kDetailInfo = "kDetailInfo" static let kDetailInfo = "kDetailInfo"
} }
extension YhConstant { extension YhConstant {
...@@ -199,52 +205,52 @@ extension YhConstant { ...@@ -199,52 +205,52 @@ extension YhConstant {
static let appKey = "wx57b2a7469d15ff8f" static let appKey = "wx57b2a7469d15ff8f"
static let AppSecret = "e0a351290c66c05f85c54a31b213c1aa" static let AppSecret = "e0a351290c66c05f85c54a31b213c1aa"
} }
struct UM { struct UM {
static let appKey = "5a77b807a40fa30f0300008b" static let appKey = "5a77b807a40fa30f0300008b"
} }
// MARK: - 支付宝 // MARK: - 支付宝
struct Alipay { struct Alipay {
static let scheme = "com.usleep.health.alipay" static let scheme = "com.usleep.health.alipay"
} }
// MARK: - 通知相关 名称 // MARK: - 通知相关 名称
class BsNotification { class BsNotification {
public static let didCancelTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancelTask") public static let didCancelTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancelTask")
//用户详细信息更改成功 //用户详细信息更改成功
public static let didUpdateUserDetailInfoSuccessNotifiction = Notification.Name(rawValue: "com.usleep.health.updateUserDetailInfo.success") public static let didUpdateUserDetailInfoSuccessNotifiction = Notification.Name(rawValue: "com.usleep.health.updateUserDetailInfo.success")
//登录成功 //登录成功
public static let didLoginSuccessNotifiction = Notification.Name(rawValue: "com.usleep.health.login.success") public static let didLoginSuccessNotifiction = Notification.Name(rawValue: "com.usleep.health.login.success")
//退出成功 //退出成功
public static let didLoginoutSuccessNotifiction = Notification.Name(rawValue: "com.usleep.health.loginout.success") public static let didLoginoutSuccessNotifiction = Notification.Name(rawValue: "com.usleep.health.loginout.success")
//token 过期 //token 过期
public static let tokenInvalidateNotifiction = Notification.Name(rawValue: "com.usleep.health.token.invalidate") public static let tokenInvalidateNotifiction = Notification.Name(rawValue: "com.usleep.health.token.invalidate")
//用户注册 在完成登录、修改密码后需要 填写标签 //用户注册 在完成登录、修改密码后需要 填写标签
public static let needSelectTagsNotification = Notification.Name(rawValue: "com.usleep.health.selecte.tags") public static let needSelectTagsNotification = Notification.Name(rawValue: "com.usleep.health.selecte.tags")
//跳转安睡主页 //跳转安睡主页
public static let goAnSleepNotification = Notification.Name(rawValue: "com.usleep.health.go.An.sleep") public static let goAnSleepNotification = Notification.Name(rawValue: "com.usleep.health.go.An.sleep")
//跳转填写量表列表界面 //跳转填写量表列表界面
public static let goFillScaleNotification = Notification.Name(rawValue: "com.usleep.health.go.Fill.Scale") public static let goFillScaleNotification = Notification.Name(rawValue: "com.usleep.health.go.Fill.Scale")
//支付结果回调 //支付结果回调
public static let payResultNotification = Notification.Name(rawValue: "com.usleep.health.pay.result") public static let payResultNotification = Notification.Name(rawValue: "com.usleep.health.pay.result")
//隐藏tabBar //隐藏tabBar
public static let tabBarHideNotification = Notification.Name(rawValue: "com.usleep.health.tabBar.hide") public static let tabBarHideNotification = Notification.Name(rawValue: "com.usleep.health.tabBar.hide")
//显示tabBar //显示tabBar
public static let tabBarShowNotification = Notification.Name(rawValue: "com.usleep.health.tabBar.show") public static let tabBarShowNotification = Notification.Name(rawValue: "com.usleep.health.tabBar.show")
......
...@@ -106,7 +106,7 @@ class YHNetRequest: NSObject { ...@@ -106,7 +106,7 @@ class YHNetRequest: NSObject {
httpRequest?.responseString(completionHandler: { string in httpRequest?.responseString(completionHandler: { string in
#if DEBUG #if DEBUG
print("\n网络请求已返回 string=\(string)") printLog("\n网络请求已返回 string=\(string)")
#endif #endif
self.completeHandle(string: string) self.completeHandle(string: string)
}) })
...@@ -207,12 +207,12 @@ class YHNetRequest: NSObject { ...@@ -207,12 +207,12 @@ class YHNetRequest: NSObject {
extension YHNetRequest { extension YHNetRequest {
class func getRequest(url:String, params:[String:Any] = [:], successBlock: SuccessHandlerType!, failBlock: FailureHandlerType!) -> Request? { class func getRequest(url:String, params:[String:Any] = [:], successBlock: SuccessHandlerType!, failBlock: FailureHandlerType!) -> Request? {
YHLOG(message:"\n发起请求的URL是===> url = \(url)") printLog("\n发起请求的URL是===> url = \(url)")
return YHNetRequest().url(url).requestType(.get).success(successBlock).failed(failBlock).startRequest() return YHNetRequest().url(url).requestType(.get).success(successBlock).failed(failBlock).startRequest()
} }
class func postRequest(url:String, params:[String:Any] = [:], successBlock: SuccessHandlerType!, failBlock: FailureHandlerType!) -> Request? { class func postRequest(url:String, params:[String:Any] = [:], successBlock: SuccessHandlerType!, failBlock: FailureHandlerType!) -> Request? {
YHLOG(message:"\n发起请求的URL是===> url = \(url)") printLog("\n发起请求的URL是===> url = \(url)")
return YHNetRequest().url(url).requestType(.post).success(successBlock).failed(failBlock).startRequest() return YHNetRequest().url(url).requestType(.post).success(successBlock).failed(failBlock).startRequest()
} }
} }
......
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"filename" : "Rectangle 8235.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "Rectangle 8235@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "Rectangle 8235@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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