diff --git a/Doctor.xcodeproj/project.pbxproj b/Doctor.xcodeproj/project.pbxproj index 70a9254..0714527 100644 --- a/Doctor.xcodeproj/project.pbxproj +++ b/Doctor.xcodeproj/project.pbxproj @@ -14,6 +14,36 @@ A9841F2C1C04357C00FB72AA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A9841F2A1C04357C00FB72AA /* Main.storyboard */; }; A9841F2E1C04357C00FB72AA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A9841F2D1C04357C00FB72AA /* Assets.xcassets */; }; A9841F311C04357C00FB72AA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A9841F2F1C04357C00FB72AA /* LaunchScreen.storyboard */; }; + A986A3531C04C4DC00B55F38 /* BaseAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A3261C04C4DC00B55F38 /* BaseAPIClient.m */; }; + A986A3541C04C4DC00B55F38 /* BaseEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A3281C04C4DC00B55F38 /* BaseEntity.m */; }; + A986A3551C04C4DC00B55F38 /* BaseModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A32A1C04C4DC00B55F38 /* BaseModel.m */; }; + A986A3561C04C4DC00B55F38 /* BaseWLService.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A32C1C04C4DC00B55F38 /* BaseWLService.m */; }; + A986A3571C04C4DC00B55F38 /* LoginModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A32E1C04C4DC00B55F38 /* LoginModel.m */; }; + A986A3581C04C4DC00B55F38 /* NSString+HXAddtions.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A3301C04C4DC00B55F38 /* NSString+HXAddtions.m */; }; + A986A3591C04C4DC00B55F38 /* about_logo@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3321C04C4DC00B55F38 /* about_logo@2x.png */; }; + A986A35A1C04C4DC00B55F38 /* brand.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3331C04C4DC00B55F38 /* brand.png */; }; + A986A35B1C04C4DC00B55F38 /* icon48.back.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3341C04C4DC00B55F38 /* icon48.back.png */; }; + A986A35C1C04C4DC00B55F38 /* icon48.scan.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3351C04C4DC00B55F38 /* icon48.scan.png */; }; + A986A35D1C04C4DC00B55F38 /* icon48.search.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3361C04C4DC00B55F38 /* icon48.search.png */; }; + A986A35E1C04C4DC00B55F38 /* icon512.wlian.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3371C04C4DC00B55F38 /* icon512.wlian.png */; }; + A986A35F1C04C4DC00B55F38 /* icon72.card.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3381C04C4DC00B55F38 /* icon72.card.png */; }; + A986A3601C04C4DC00B55F38 /* icon72.charge@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3391C04C4DC00B55F38 /* icon72.charge@2x.png */; }; + A986A3611C04C4DC00B55F38 /* icon72.done.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A33A1C04C4DC00B55F38 /* icon72.done.png */; }; + A986A3621C04C4DC00B55F38 /* icon72.home.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A33B1C04C4DC00B55F38 /* icon72.home.png */; }; + A986A3631C04C4DC00B55F38 /* icon72.logout.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A33C1C04C4DC00B55F38 /* icon72.logout.png */; }; + A986A3641C04C4DC00B55F38 /* icon72.refund.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A33D1C04C4DC00B55F38 /* icon72.refund.png */; }; + A986A3651C04C4DC00B55F38 /* icon72.search.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A33E1C04C4DC00B55F38 /* icon72.search.png */; }; + A986A3661C04C4DC00B55F38 /* icon72.update.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A33F1C04C4DC00B55F38 /* icon72.update.png */; }; + A986A3671C04C4DC00B55F38 /* icon72.valid.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3401C04C4DC00B55F38 /* icon72.valid.png */; }; + A986A3681C04C4DC00B55F38 /* icon72.wait.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3411C04C4DC00B55F38 /* icon72.wait.png */; }; + A986A3691C04C4DC00B55F38 /* icon72.write.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3421C04C4DC00B55F38 /* icon72.write.png */; }; + A986A36A1C04C4DC00B55F38 /* titlebg.png in Resources */ = {isa = PBXBuildFile; fileRef = A986A3431C04C4DC00B55F38 /* titlebg.png */; }; + A986A36B1C04C4DC00B55F38 /* AWordDefault.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A3461C04C4DC00B55F38 /* AWordDefault.m */; }; + A986A36C1C04C4DC00B55F38 /* MBProgressHUD+Util.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A3491C04C4DC00B55F38 /* MBProgressHUD+Util.m */; }; + A986A36D1C04C4DC00B55F38 /* LoginViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A34C1C04C4DC00B55F38 /* LoginViewController.m */; }; + A986A36E1C04C4DC00B55F38 /* LoginViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A986A34D1C04C4DC00B55F38 /* LoginViewController.xib */; }; + A986A36F1C04C4DC00B55F38 /* BaseViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A3501C04C4DC00B55F38 /* BaseViewModel.m */; }; + A986A3701C04C4DC00B55F38 /* LoginViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A986A3521C04C4DC00B55F38 /* LoginViewModel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -30,6 +60,49 @@ A9841F2D1C04357C00FB72AA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; A9841F301C04357C00FB72AA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; A9841F321C04357C00FB72AA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A986A3231C04C4DC00B55F38 /* Common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = ""; }; + A986A3251C04C4DC00B55F38 /* BaseAPIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseAPIClient.h; sourceTree = ""; }; + A986A3261C04C4DC00B55F38 /* BaseAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseAPIClient.m; sourceTree = ""; }; + A986A3271C04C4DC00B55F38 /* BaseEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseEntity.h; sourceTree = ""; }; + A986A3281C04C4DC00B55F38 /* BaseEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseEntity.m; sourceTree = ""; }; + A986A3291C04C4DC00B55F38 /* BaseModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseModel.h; sourceTree = ""; }; + A986A32A1C04C4DC00B55F38 /* BaseModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseModel.m; sourceTree = ""; }; + A986A32B1C04C4DC00B55F38 /* BaseWLService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseWLService.h; sourceTree = ""; }; + A986A32C1C04C4DC00B55F38 /* BaseWLService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseWLService.m; sourceTree = ""; }; + A986A32D1C04C4DC00B55F38 /* LoginModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginModel.h; sourceTree = ""; }; + A986A32E1C04C4DC00B55F38 /* LoginModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginModel.m; sourceTree = ""; }; + A986A32F1C04C4DC00B55F38 /* NSString+HXAddtions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+HXAddtions.h"; sourceTree = ""; }; + A986A3301C04C4DC00B55F38 /* NSString+HXAddtions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+HXAddtions.m"; sourceTree = ""; }; + A986A3321C04C4DC00B55F38 /* about_logo@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "about_logo@2x.png"; sourceTree = ""; }; + A986A3331C04C4DC00B55F38 /* brand.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = brand.png; sourceTree = ""; }; + A986A3341C04C4DC00B55F38 /* icon48.back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon48.back.png; sourceTree = ""; }; + A986A3351C04C4DC00B55F38 /* icon48.scan.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon48.scan.png; sourceTree = ""; }; + A986A3361C04C4DC00B55F38 /* icon48.search.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon48.search.png; sourceTree = ""; }; + A986A3371C04C4DC00B55F38 /* icon512.wlian.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon512.wlian.png; sourceTree = ""; }; + A986A3381C04C4DC00B55F38 /* icon72.card.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.card.png; sourceTree = ""; }; + A986A3391C04C4DC00B55F38 /* icon72.charge@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon72.charge@2x.png"; sourceTree = ""; }; + A986A33A1C04C4DC00B55F38 /* icon72.done.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.done.png; sourceTree = ""; }; + A986A33B1C04C4DC00B55F38 /* icon72.home.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.home.png; sourceTree = ""; }; + A986A33C1C04C4DC00B55F38 /* icon72.logout.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.logout.png; sourceTree = ""; }; + A986A33D1C04C4DC00B55F38 /* icon72.refund.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.refund.png; sourceTree = ""; }; + A986A33E1C04C4DC00B55F38 /* icon72.search.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.search.png; sourceTree = ""; }; + A986A33F1C04C4DC00B55F38 /* icon72.update.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.update.png; sourceTree = ""; }; + A986A3401C04C4DC00B55F38 /* icon72.valid.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.valid.png; sourceTree = ""; }; + A986A3411C04C4DC00B55F38 /* icon72.wait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.wait.png; sourceTree = ""; }; + A986A3421C04C4DC00B55F38 /* icon72.write.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon72.write.png; sourceTree = ""; }; + A986A3431C04C4DC00B55F38 /* titlebg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = titlebg.png; sourceTree = ""; }; + A986A3451C04C4DC00B55F38 /* AWordDefault.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AWordDefault.h; sourceTree = ""; }; + A986A3461C04C4DC00B55F38 /* AWordDefault.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AWordDefault.m; sourceTree = ""; }; + A986A3481C04C4DC00B55F38 /* MBProgressHUD+Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MBProgressHUD+Util.h"; sourceTree = ""; }; + A986A3491C04C4DC00B55F38 /* MBProgressHUD+Util.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MBProgressHUD+Util.m"; sourceTree = ""; }; + A986A34B1C04C4DC00B55F38 /* LoginViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewController.h; sourceTree = ""; }; + A986A34C1C04C4DC00B55F38 /* LoginViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewController.m; sourceTree = ""; }; + A986A34D1C04C4DC00B55F38 /* LoginViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = LoginViewController.xib; sourceTree = ""; }; + A986A34F1C04C4DC00B55F38 /* BaseViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewModel.h; sourceTree = ""; }; + A986A3501C04C4DC00B55F38 /* BaseViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewModel.m; sourceTree = ""; }; + A986A3511C04C4DC00B55F38 /* LoginViewModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginViewModel.h; sourceTree = ""; }; + A986A3521C04C4DC00B55F38 /* LoginViewModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginViewModel.m; sourceTree = ""; }; + A986A3711C04C4EE00B55F38 /* PrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -73,6 +146,12 @@ A9841F201C04357C00FB72AA /* Doctor */ = { isa = PBXGroup; children = ( + A986A3221C04C4DC00B55F38 /* Config */, + A986A3241C04C4DC00B55F38 /* Model */, + A986A3311C04C4DC00B55F38 /* Resource */, + A986A3441C04C4DC00B55F38 /* Util */, + A986A34A1C04C4DC00B55F38 /* View */, + A986A34E1C04C4DC00B55F38 /* ViewModel */, A9841F241C04357C00FB72AA /* AppDelegate.h */, A9841F251C04357C00FB72AA /* AppDelegate.m */, A9841F271C04357C00FB72AA /* ViewController.h */, @@ -89,11 +168,104 @@ A9841F211C04357C00FB72AA /* Supporting Files */ = { isa = PBXGroup; children = ( + A986A3711C04C4EE00B55F38 /* PrefixHeader.pch */, A9841F221C04357C00FB72AA /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; + A986A3221C04C4DC00B55F38 /* Config */ = { + isa = PBXGroup; + children = ( + A986A3231C04C4DC00B55F38 /* Common.h */, + ); + path = Config; + sourceTree = ""; + }; + A986A3241C04C4DC00B55F38 /* Model */ = { + isa = PBXGroup; + children = ( + A986A3251C04C4DC00B55F38 /* BaseAPIClient.h */, + A986A3261C04C4DC00B55F38 /* BaseAPIClient.m */, + A986A3271C04C4DC00B55F38 /* BaseEntity.h */, + A986A3281C04C4DC00B55F38 /* BaseEntity.m */, + A986A3291C04C4DC00B55F38 /* BaseModel.h */, + A986A32A1C04C4DC00B55F38 /* BaseModel.m */, + A986A32B1C04C4DC00B55F38 /* BaseWLService.h */, + A986A32C1C04C4DC00B55F38 /* BaseWLService.m */, + A986A32D1C04C4DC00B55F38 /* LoginModel.h */, + A986A32E1C04C4DC00B55F38 /* LoginModel.m */, + A986A32F1C04C4DC00B55F38 /* NSString+HXAddtions.h */, + A986A3301C04C4DC00B55F38 /* NSString+HXAddtions.m */, + ); + path = Model; + sourceTree = ""; + }; + A986A3311C04C4DC00B55F38 /* Resource */ = { + isa = PBXGroup; + children = ( + A986A3321C04C4DC00B55F38 /* about_logo@2x.png */, + A986A3331C04C4DC00B55F38 /* brand.png */, + A986A3341C04C4DC00B55F38 /* icon48.back.png */, + A986A3351C04C4DC00B55F38 /* icon48.scan.png */, + A986A3361C04C4DC00B55F38 /* icon48.search.png */, + A986A3371C04C4DC00B55F38 /* icon512.wlian.png */, + A986A3381C04C4DC00B55F38 /* icon72.card.png */, + A986A3391C04C4DC00B55F38 /* icon72.charge@2x.png */, + A986A33A1C04C4DC00B55F38 /* icon72.done.png */, + A986A33B1C04C4DC00B55F38 /* icon72.home.png */, + A986A33C1C04C4DC00B55F38 /* icon72.logout.png */, + A986A33D1C04C4DC00B55F38 /* icon72.refund.png */, + A986A33E1C04C4DC00B55F38 /* icon72.search.png */, + A986A33F1C04C4DC00B55F38 /* icon72.update.png */, + A986A3401C04C4DC00B55F38 /* icon72.valid.png */, + A986A3411C04C4DC00B55F38 /* icon72.wait.png */, + A986A3421C04C4DC00B55F38 /* icon72.write.png */, + A986A3431C04C4DC00B55F38 /* titlebg.png */, + ); + path = Resource; + sourceTree = ""; + }; + A986A3441C04C4DC00B55F38 /* Util */ = { + isa = PBXGroup; + children = ( + A986A3451C04C4DC00B55F38 /* AWordDefault.h */, + A986A3461C04C4DC00B55F38 /* AWordDefault.m */, + A986A3471C04C4DC00B55F38 /* MBProgressHUD */, + ); + path = Util; + sourceTree = ""; + }; + A986A3471C04C4DC00B55F38 /* MBProgressHUD */ = { + isa = PBXGroup; + children = ( + A986A3481C04C4DC00B55F38 /* MBProgressHUD+Util.h */, + A986A3491C04C4DC00B55F38 /* MBProgressHUD+Util.m */, + ); + path = MBProgressHUD; + sourceTree = ""; + }; + A986A34A1C04C4DC00B55F38 /* View */ = { + isa = PBXGroup; + children = ( + A986A34B1C04C4DC00B55F38 /* LoginViewController.h */, + A986A34C1C04C4DC00B55F38 /* LoginViewController.m */, + A986A34D1C04C4DC00B55F38 /* LoginViewController.xib */, + ); + path = View; + sourceTree = ""; + }; + A986A34E1C04C4DC00B55F38 /* ViewModel */ = { + isa = PBXGroup; + children = ( + A986A34F1C04C4DC00B55F38 /* BaseViewModel.h */, + A986A3501C04C4DC00B55F38 /* BaseViewModel.m */, + A986A3511C04C4DC00B55F38 /* LoginViewModel.h */, + A986A3521C04C4DC00B55F38 /* LoginViewModel.m */, + ); + path = ViewModel; + sourceTree = ""; + }; EE0E51118CD397393147ABC3 /* Pods */ = { isa = PBXGroup; children = ( @@ -163,9 +335,28 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + A986A35F1C04C4DC00B55F38 /* icon72.card.png in Resources */, + A986A35B1C04C4DC00B55F38 /* icon48.back.png in Resources */, + A986A36E1C04C4DC00B55F38 /* LoginViewController.xib in Resources */, + A986A3641C04C4DC00B55F38 /* icon72.refund.png in Resources */, A9841F311C04357C00FB72AA /* LaunchScreen.storyboard in Resources */, + A986A3591C04C4DC00B55F38 /* about_logo@2x.png in Resources */, + A986A36A1C04C4DC00B55F38 /* titlebg.png in Resources */, + A986A35C1C04C4DC00B55F38 /* icon48.scan.png in Resources */, + A986A3681C04C4DC00B55F38 /* icon72.wait.png in Resources */, + A986A35E1C04C4DC00B55F38 /* icon512.wlian.png in Resources */, + A986A3631C04C4DC00B55F38 /* icon72.logout.png in Resources */, + A986A3661C04C4DC00B55F38 /* icon72.update.png in Resources */, + A986A3691C04C4DC00B55F38 /* icon72.write.png in Resources */, A9841F2E1C04357C00FB72AA /* Assets.xcassets in Resources */, + A986A35D1C04C4DC00B55F38 /* icon48.search.png in Resources */, + A986A3651C04C4DC00B55F38 /* icon72.search.png in Resources */, + A986A3611C04C4DC00B55F38 /* icon72.done.png in Resources */, + A986A35A1C04C4DC00B55F38 /* brand.png in Resources */, A9841F2C1C04357C00FB72AA /* Main.storyboard in Resources */, + A986A3671C04C4DC00B55F38 /* icon72.valid.png in Resources */, + A986A3621C04C4DC00B55F38 /* icon72.home.png in Resources */, + A986A3601C04C4DC00B55F38 /* icon72.charge@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -224,9 +415,20 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + A986A3581C04C4DC00B55F38 /* NSString+HXAddtions.m in Sources */, + A986A3551C04C4DC00B55F38 /* BaseModel.m in Sources */, + A986A3571C04C4DC00B55F38 /* LoginModel.m in Sources */, A9841F291C04357C00FB72AA /* ViewController.m in Sources */, + A986A3701C04C4DC00B55F38 /* LoginViewModel.m in Sources */, + A986A36F1C04C4DC00B55F38 /* BaseViewModel.m in Sources */, + A986A3541C04C4DC00B55F38 /* BaseEntity.m in Sources */, + A986A36B1C04C4DC00B55F38 /* AWordDefault.m in Sources */, + A986A36C1C04C4DC00B55F38 /* MBProgressHUD+Util.m in Sources */, A9841F261C04357C00FB72AA /* AppDelegate.m in Sources */, + A986A36D1C04C4DC00B55F38 /* LoginViewController.m in Sources */, + A986A3531C04C4DC00B55F38 /* BaseAPIClient.m in Sources */, A9841F231C04357C00FB72AA /* main.m in Sources */, + A986A3561C04C4DC00B55F38 /* BaseWLService.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -337,6 +539,7 @@ baseConfigurationReference = 039B3B8DE609FF96BF1F8983 /* Pods.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + GCC_PREFIX_HEADER = Doctor/PrefixHeader.pch; INFOPLIST_FILE = Doctor/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = ash.Doctor; @@ -349,6 +552,7 @@ baseConfigurationReference = 1FF024B7A433F169D4A7C1DB /* Pods.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + GCC_PREFIX_HEADER = Doctor/PrefixHeader.pch; INFOPLIST_FILE = Doctor/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = ash.Doctor; diff --git a/Doctor/Config/Common.h b/Doctor/Config/Common.h new file mode 100644 index 0000000..0af7728 --- /dev/null +++ b/Doctor/Config/Common.h @@ -0,0 +1,66 @@ +// +// Common.h +// Ash_AWord +// +// Created by xmfish on 15/3/30. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#ifndef Ash_AWord_Common_h +#define Ash_AWord_Common_h + +#ifdef DEBUG +#ifndef DLog +# define DLog(fmt, ...) {NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);} +#endif +#ifndef ELog +# define ELog(err) {if(err) DLog(@"%@", err)} +#endif +#else +#ifndef DLog +# define DLog(...) +#endif +#ifndef ELog +# define ELog(err) +#endif +#endif + + + +/** + * 系统版本 + */ +#define iOSVersion ([[[UIDevice currentDevice] systemVersion] floatValue]) //系统版本 +#define iOS7AndLater ( [[[UIDevice currentDevice] systemVersion] compare:@"7.0"] != NSOrderedAscending ) + +#define isiPhone5 ([[UIScreen mainScreen] bounds].size.height == 568) +#define isiPhone4s ([[UIScreen mainScreen] bounds].size.height == 480) + +/** + * 获取当前window宽高 + */ +#define kScreenWidth ([[UIScreen mainScreen] bounds].size.width) +#define kScreenHeight ([[UIScreen mainScreen] bounds].size.height) + +#define kMainScreenFrame ([[UIScreen mainScreen] bounds]) + + + + +//文字标签 +#define kNetworkErrorTips @"网络连接失败" +#define kSSoErrorTips @"授权失败,请重新授权" +#define kLoginTips @"登录中" +#define kLoadingTips @"加载中。。。" +/** + * 接口地址 + */ + +#define WL_API_URL @"http://mapi.wlian.com/gateway/" +#define WL_DEV_API_URL @"http://api.dev.wliantx.com/gateway/" + + +#define DefaultUserIcon [UIImage imageNamed:@"defaultUserIcon"] + +#define DefaultPageSize 20 +#endif diff --git a/Doctor/Model/BaseAPIClient.h b/Doctor/Model/BaseAPIClient.h new file mode 100644 index 0000000..7ea1c6d --- /dev/null +++ b/Doctor/Model/BaseAPIClient.h @@ -0,0 +1,18 @@ +// +// BaseAPIClient.h +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import +#import "AFHTTPRequestOperationManager.h" + + +@interface BaseAPIClient : AFHTTPRequestOperationManager + ++ (instancetype)sharedClient; ++ (NSString *)getApiBaseString; + +@end diff --git a/Doctor/Model/BaseAPIClient.m b/Doctor/Model/BaseAPIClient.m new file mode 100644 index 0000000..9b12472 --- /dev/null +++ b/Doctor/Model/BaseAPIClient.m @@ -0,0 +1,34 @@ +// +// BaseAPIClient.m +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "BaseAPIClient.h" + +@implementation BaseAPIClient + + ++ (instancetype)sharedClient +{ + static BaseAPIClient *_sharedClient = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _sharedClient = [[BaseAPIClient alloc] initWithBaseURL:[NSURL URLWithString:[self getApiBaseString]]]; + _sharedClient.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + + [_sharedClient.requestSerializer setValue:@"text/html" forHTTPHeaderField:@"Content-Type"]; + _sharedClient.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; + + }); + + return _sharedClient; +} + ++ (NSString *)getApiBaseString +{ + return WL_DEV_API_URL; +} +@end diff --git a/Doctor/Model/BaseEntity.h b/Doctor/Model/BaseEntity.h new file mode 100644 index 0000000..9f95111 --- /dev/null +++ b/Doctor/Model/BaseEntity.h @@ -0,0 +1,52 @@ +// +// BaseEntity.h +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import + + +typedef NS_ENUM(NSUInteger, HTTPRequestType) { + HTTPRequestTypeWithGET = 0, + HTTPRequestTypeWithPOST, + HTTPRequestTypeWithPOSTDATA, +}; + +@class responesOBJ,DCParserConfiguration; + +@interface proFile : NSObject + +@property (nonatomic, strong) NSData *data; +@property (nonatomic, strong) NSString *name; //参数名称 +@property (nonatomic, strong) NSString *filePath; +//@"image/jpeg" +@property (nonatomic, strong) NSString *mimeType; + +@property (nonatomic, strong) NSArray *img; + +@end + +// +@interface BaseEntity : NSObject + +@property (nonatomic, assign) HTTPRequestType requireType; +@property (nonatomic, copy) NSString *reqURL; +@property (nonatomic, copy) NSString *callback; +@property (nonatomic, strong)NSString* cacheKey; +@property (nonatomic, strong) id pro; +@property (nonatomic, assign) Class responesOBJ; +@property (nonatomic, strong)DCParserConfiguration* config; + +@property (nonatomic, strong) proFile *pFile; +//@property (nonatomic, strong) NSArray *img; + +@property (nonatomic, assign) BOOL isCache; + +@property (nonatomic, copy) NSString *localJsonFileName; + +- (NSDictionary *)encodePro; + +@end diff --git a/Doctor/Model/BaseEntity.m b/Doctor/Model/BaseEntity.m new file mode 100644 index 0000000..2389355 --- /dev/null +++ b/Doctor/Model/BaseEntity.m @@ -0,0 +1,100 @@ +// +// BaseEntity.m +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "BaseEntity.h" +#import "BaseModel.h" +#import "NSString+HXAddtions.h" +#import "AWordDefault.h" +@implementation proFile + +@end +static NSString* app_key = @"123456"; +static NSString* app_key_secret = @"z*~#@kR^*N"; +@implementation BaseEntity +- (NSDictionary *)encodePro +{ + + NSMutableDictionary* dic= [NSMutableDictionary dictionary];; + + + [dic setObject:_callback forKey:@"callback"]; + if(_pro) + { + [dic setObject:_pro forKey:@"params"]; + } + [dic setObject:@"1" forKey:@"devicecode"]; + + NSString* uid = [AWordDefault getUid]; + if (uid) { + [dic setObject:uid forKey:@"uid"]; + } + [dic setObject:@"shop1" forKey:@"username"]; + NSString* token = [AWordDefault getToken]; + if (token) { + [dic setObject:token forKey:@"token"]; + } + NSString* shopid = [AWordDefault getShopId]; + if (shopid) { + [dic setObject:shopid forKey:@"shopid"]; + } + NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970]; + [dic setObject:[NSString stringWithFormat:@"%f", timeStamp] forKey:@"timestamp"]; + + [dic setObject:[self getSignWithDic:dic] forKey:@"sign"]; + + + DLog(@"参数是:%@",dic); + NSString* jsonKey = [NSString jsonStringWithDictionary:(NSDictionary*)dic]; + NSData *nsdata = [jsonKey + dataUsingEncoding:NSUTF8StringEncoding]; + NSString *baseKey = [nsdata base64EncodedStringWithOptions:0]; + NSMutableString *key = [[NSMutableString alloc]initWithString:baseKey]; + [key stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSDictionary *resultDic = @{@"key":key}; + return resultDic; +} + + +-(NSString*)getSignWithDic:(NSDictionary*)dic +{ + NSString* resultStr = [self getStrWithDic:dic]; + NSString* appkey = [NSString stringWithFormat:@"%@%@",app_key,app_key_secret]; + NSString* md5Appkey = [[appkey md5] substringWithRange:NSMakeRange(8, 18)]; + resultStr = [resultStr stringByAppendingString:md5Appkey]; + resultStr = [resultStr md5]; + return resultStr; +} + +-(NSString*)getStrWithDic:(NSDictionary*)dic +{ + NSString* resultStr = @""; + + for (NSString* key in [dic allKeys]) { + NSObject* obj = [dic objectForKey:key]; + if ([obj isKindOfClass:[NSDictionary class]]) { + obj = [self getStrWithDic:(NSDictionary*)obj]; + if ([resultStr isEqualToString:@""]) { + resultStr = obj; + + }else{ + resultStr = [NSString stringWithFormat:@"%@&%@",resultStr,obj]; + + } }else{ + if ([resultStr isEqualToString:@""]) { + resultStr = [NSString stringWithFormat:@"%@=%@",key,obj]; + + }else{ + resultStr = [NSString stringWithFormat:@"%@&%@=%@",resultStr,key,obj]; + + } + } + + } + return resultStr; +} +@end diff --git a/Doctor/Model/BaseModel.h b/Doctor/Model/BaseModel.h new file mode 100644 index 0000000..dd734e8 --- /dev/null +++ b/Doctor/Model/BaseModel.h @@ -0,0 +1,17 @@ +// +// BaseModel.h +// WlianWorld +// +// Created by xmfish on 15/11/16. +// Copyright © 2015年 ash. All rights reserved. +// + +#import + +@interface BaseModel : MTLModel + +@property (nonatomic,strong)NSString* title; +@property (nonatomic,readonly)NSString* errorCode; +@property (nonatomic,readonly)NSString* errorMessage; + +@end diff --git a/Doctor/Model/BaseModel.m b/Doctor/Model/BaseModel.m new file mode 100644 index 0000000..c2b8e90 --- /dev/null +++ b/Doctor/Model/BaseModel.m @@ -0,0 +1,47 @@ +// +// BaseModel.m +// WlianWorld +// +// Created by xmfish on 15/11/16. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "BaseModel.h" + +@implementation BaseModel ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + return @{ + // @"errCode": @"ret", + @"errorCode": @"errorCode", + @"errorMessage": @"errorMessage", + }; +} + ++ (NSValueTransformer *)errorCodeJSONTransformer { + return [MTLValueTransformer transformerUsingForwardBlock:^id(id value,BOOL *success, NSError *__autoreleasing *error) { + + NSNumber *num = value; + + NSString *tempStr = [NSString stringWithFormat:@"%@", num]; + + return tempStr; + + } reverseBlock:^id(id value,BOOL *success, NSError *__autoreleasing *error) { + + NSString *tempStr = value; + + NSNumber *tempNum = @(tempStr.integerValue); + + return tempNum; + + }]; +} +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error +{ + self = [super initWithDictionary:dictionaryValue error:error]; + if (self != nil) + { + } + return self; +} +@end diff --git a/Doctor/Model/BaseWLService.h b/Doctor/Model/BaseWLService.h new file mode 100644 index 0000000..a6ded09 --- /dev/null +++ b/Doctor/Model/BaseWLService.h @@ -0,0 +1,18 @@ +// +// BaseWLService.h +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import +#import + +@class BaseEntity; + +@interface BaseWLService : NSObject + + ++ (RACSignal *)requireWithProperty:(BaseEntity *)proper; +@end diff --git a/Doctor/Model/BaseWLService.m b/Doctor/Model/BaseWLService.m new file mode 100644 index 0000000..a2cb3c2 --- /dev/null +++ b/Doctor/Model/BaseWLService.m @@ -0,0 +1,100 @@ +// +// BaseWLService.m +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "BaseWLService.h" + +#import "BaseEntity.h" + +#import "MTLJSONAdapter.h" +#import "NSData+Godzippa.h" + +#import "EGOCache.h" +#import "BaseAPIClient.h" + +@implementation BaseWLService + ++ (void)saveCacheWithAPIKey:(NSString *)apiKey property:(BaseEntity *)proper data:(id)tweet{ + if (proper.isCache) { + SEL selector = NSSelectorFromString(@"errCode"); + IMP imp = [tweet methodForSelector:selector]; + NSString* (*func)(id, SEL) = (void *)imp; + NSString *tmpErrCode = func(tweet, selector); + DLog(@"%@", tmpErrCode); + + if (([tmpErrCode isKindOfClass:[NSString class]] && [tmpErrCode isEqualToString:@"0"] ) || ([tmpErrCode isKindOfClass:[NSNumber class]] && [tmpErrCode integerValue]==0)) { + [[EGOCache globalCache] setObject:tweet forKey:apiKey]; + + } + } +} ++ (void)responseFromCacheWithAPIKey:(NSString *)apiKey property:(BaseEntity *)proper completionBlock:(id)subscriber{ + if (proper.isCache && [[EGOCache globalCache] hasCacheForKey:apiKey]) { + [subscriber sendNext:[[EGOCache globalCache] objectForKey:apiKey]]; + [subscriber sendCompleted]; + } +} + ++(RACSignal*)requireWithProperty:(BaseEntity *)proper +{ + +// if (proper.requireType == HTTPRequestTypeWithGET) { +// return [self requireWithGetWithProperty:proper]; +// } +// return nil; + return [self requireWithGetWithProperty:proper]; +} ++(RACSignal*)requireWithGetWithProperty:(BaseEntity*)proper +{ + NSString *apiKey = proper.cacheKey; + if (proper.pro && proper.pro[@"page"]) + { + apiKey = [apiKey stringByAppendingFormat:@"%@",proper.pro[@"page"]]; + } + + + + return [[RACSignal createSignal:^RACDisposable *(id subscriber) { + [[BaseAPIClient sharedClient] GET:[proper reqURL] + parameters: [proper encodePro] + success:^(AFHTTPRequestOperation * __unused task, id json) { + DLog(@"%@", json); + + if(json) + { + NSError *error = nil; + id tweet = [MTLJSONAdapter modelOfClass:[proper.responesOBJ class] fromJSONDictionary:json error:&error]; + + + [subscriber sendNext:tweet]; + [subscriber sendCompleted]; + + [self saveCacheWithAPIKey:apiKey property:proper data:tweet]; + + } + else + { + [subscriber sendNext:nil]; + [subscriber sendCompleted]; + } + } + failure:^(AFHTTPRequestOperation *__unused task, NSError *error) { + DLog(@"%@", error.description); + + [subscriber sendError:error]; + + [self responseFromCacheWithAPIKey:apiKey property:proper completionBlock:subscriber]; + }]; + + return [RACDisposable disposableWithBlock:^{ + }]; + + }] replayLazily]; + + +} +@end diff --git a/Doctor/Model/LoginModel.h b/Doctor/Model/LoginModel.h new file mode 100644 index 0000000..92781b6 --- /dev/null +++ b/Doctor/Model/LoginModel.h @@ -0,0 +1,22 @@ +// +// LoginModel.h +// WlianWorld +// +// Created by xmfish on 15/11/16. +// Copyright © 2015年 ash. All rights reserved. +// + +#import +#import "BaseModel.h" +@interface LoginModel : BaseModel + +@property (nonatomic,readonly) NSNumber* status; +@property (nonatomic, readonly) NSString *msg; +@property (nonatomic,readonly) NSString* userid; +@property (nonatomic, readonly) NSString *username; +@property (nonatomic,readonly) NSString* shopid; +@property (nonatomic, readonly) NSString *shopname; +@property (nonatomic,readonly) NSString* token; +- (RACSignal*)loginSignalWithAccount:(NSString*)account withPassword:(NSString*)password; + +@end diff --git a/Doctor/Model/LoginModel.m b/Doctor/Model/LoginModel.m new file mode 100644 index 0000000..f97511f --- /dev/null +++ b/Doctor/Model/LoginModel.m @@ -0,0 +1,61 @@ +// +// LoginModel.m +// WlianWorld +// +// Created by xmfish on 15/11/16. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "LoginModel.h" +#import "LoginViewModel.h" +@implementation LoginModel + + ++ (NSDictionary *)JSONKeyPathsByPropertyKey { + NSMutableDictionary* dic = [NSMutableDictionary dictionaryWithDictionary:[super JSONKeyPathsByPropertyKey]]; + [dic setObject:@"info.msg" forKey:@"msg"]; + [dic setObject:@"info.status" forKey:@"status"]; + [dic setObject:@"info.userinfo.userid" forKey:@"userid"]; + [dic setObject:@"info.userinfo.username" forKey:@"username"]; + [dic setObject:@"info.userinfo.shopid" forKey:@"shopid"]; + [dic setObject:@"info.userinfo.shopname" forKey:@"shopname"]; + [dic setObject:@"info.userinfo.token" forKey:@"token"]; + return dic; +} +- (instancetype)initWithDictionary:(NSDictionary *)dictionaryValue error:(NSError **)error +{ + self = [super initWithDictionary:dictionaryValue error:error]; + if (self != nil) + { + } + return self; +} +- (instancetype)init +{ + self = [super init]; + + if (self) + { + } + + return self; +} + +-(RACSignal*)loginSignalWithAccount:(NSString *)account withPassword:(NSString *)password +{ + RACSignal* singnal = [BaseWLService requireWithProperty:[self requireWithDic:[NSDictionary dictionaryWithObjectsAndKeys:account,@"username",password,@"password", nil] ]]; + + return singnal; +} +-(BaseEntity*)requireWithDic:(NSDictionary *)dic +{ + BaseEntity *pro = [[BaseEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithPOST; + pro.responesOBJ = self.class; + pro.reqURL = @""; + pro.callback = @"user.login"; + pro.pro = dic; + return pro; +} + +@end diff --git a/Doctor/Model/NSString+HXAddtions.h b/Doctor/Model/NSString+HXAddtions.h new file mode 100644 index 0000000..8ffb083 --- /dev/null +++ b/Doctor/Model/NSString+HXAddtions.h @@ -0,0 +1,25 @@ +// +// NSString+HXAddtions.h +// HXWeb +// +// Created by hufeng on 12-2-13. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import + +@interface NSString (HXAddtions) + ++(NSString *) jsonStringWithDictionary:(NSDictionary *)dictionary; + ++(NSString *) jsonStringWithArray:(NSArray *)array; + ++(NSString *) jsonStringWithString:(NSString *) string; + ++(NSString *) jsonStringWithObject:(id) object; + ++(NSString *) jsonStringWithRTArray:(NSArray *)array; + +- (NSString *)md5; + +@end \ No newline at end of file diff --git a/Doctor/Model/NSString+HXAddtions.m b/Doctor/Model/NSString+HXAddtions.m new file mode 100644 index 0000000..7335799 --- /dev/null +++ b/Doctor/Model/NSString+HXAddtions.m @@ -0,0 +1,125 @@ +// +// NSString+HXAddtions.m +// HXWeb +// +// Created by hufeng on 12-2-13. +// Copyright (c) 2012年 __MyCompanyName__. All rights reserved. +// + +#import "NSString+HXAddtions.h" +#import +@implementation NSString (HXAddtions) + ++(NSString *) jsonStringWithString:(NSString *) string +{ + return [NSString stringWithFormat:@"\"%@\"", + [[string stringByReplacingOccurrencesOfString:@"\n" withString:@"\\n"] stringByReplacingOccurrencesOfString:@"\"" withString:@"\\\""] + ]; +} + ++(NSString *) jsonStringWithArray:(NSArray *)array +{ + NSMutableString *reString = [NSMutableString string]; + [reString appendString:@"["]; + NSMutableArray *values = [NSMutableArray array]; + for (id valueObj in array) { + NSString *value = [NSString jsonStringWithObject:valueObj]; + if (value) { + [values addObject:[NSString stringWithFormat:@"%@",value]]; + } + } + [reString appendFormat:@"%@",[values componentsJoinedByString:@","]]; + [reString appendString:@"]"]; + return reString; +} + ++(NSString *) jsonStringWithDictionary:(NSDictionary *)dictionary +{ + NSArray *keys = [dictionary allKeys]; + NSMutableString *reString = [NSMutableString string]; + [reString appendString:@"{"]; + NSMutableArray *keyValues = [NSMutableArray array]; + for (int i=0; i<[keys count]; i++) { + NSString *name = [keys objectAtIndex:i]; + id valueObj = [dictionary objectForKey:name]; + NSString *value = [NSString jsonStringWithObject:valueObj]; + if (value) + { + [keyValues addObject:[NSString stringWithFormat:@"\"%@\":%@",name,value]]; + } + } + [reString appendFormat:@"%@",[keyValues componentsJoinedByString:@","]]; + [reString appendString:@"}"]; + return reString; +} + ++(NSString *) jsonStringWithObject:(id) object +{ + NSString *value = nil; + if (!object) + { + return value; + } + + if ([object isKindOfClass:[NSString class]]) + { + value = [NSString jsonStringWithString:object]; + } + else if([object isKindOfClass:[NSDictionary class]]) + { + value = [NSString jsonStringWithDictionary:object]; + } + else if([object isKindOfClass:[NSArray class]]) + { + value = [NSString jsonStringWithArray:object]; + } + else if([object isKindOfClass:[NSNumber class]]) + { + value = [NSString jsonStringWithString:[object stringValue]]; + } + return value; +} + ++(NSString *) jsonStringWithRTArray:(NSArray *)array +{ + NSMutableString *reString = [[NSMutableString alloc] init]; + [reString appendString:@"{"]; + NSMutableArray *values = [[NSMutableArray alloc] initWithArray:array]; + for (int i=0; i<[values count]; i++) + { + NSString *tempString = [values objectAtIndex:i]; + NSString *value = [NSString jsonStringWithString:tempString]; + if (i%2 == 0) + { + [reString appendFormat:@"%@:",value]; + } + else + { + if (i == [values count]-1) + { + [reString appendFormat:@"%@",value]; + } + else + { + [reString appendFormat:@"%@,",value]; + } + } + } + [reString appendFormat:@"}"]; + return reString; +} + +- (NSString *) md5 +{ + const char *cStr = [self UTF8String]; + unsigned char result[16]; + CC_MD5( cStr, strlen(cStr), result ); // This is the md5 call + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], + result[4], result[5], result[6], result[7], + result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15] + ]; +} +@end \ No newline at end of file diff --git a/Doctor/PrefixHeader.pch b/Doctor/PrefixHeader.pch new file mode 100644 index 0000000..09e8eb7 --- /dev/null +++ b/Doctor/PrefixHeader.pch @@ -0,0 +1,22 @@ +// +// PrefixHeader.pch +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch + +// Include any system framework and library headers here that should be included in all compilation units. +// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. +#import +#import +#import +#import "Common.h" +#import "BaseEntity.h" +#import "BaseWLService.h" +#import +#import "MBProgressHUD+Util.h" +#endif /* PrefixHeader_pch */ diff --git a/Doctor/Resource/about_logo@2x.png b/Doctor/Resource/about_logo@2x.png new file mode 100644 index 0000000..ef3ccb6 Binary files /dev/null and b/Doctor/Resource/about_logo@2x.png differ diff --git a/Doctor/Resource/brand.png b/Doctor/Resource/brand.png new file mode 100644 index 0000000..7124abd Binary files /dev/null and b/Doctor/Resource/brand.png differ diff --git a/Doctor/Resource/icon48.back.png b/Doctor/Resource/icon48.back.png new file mode 100644 index 0000000..cdfd909 Binary files /dev/null and b/Doctor/Resource/icon48.back.png differ diff --git a/Doctor/Resource/icon48.scan.png b/Doctor/Resource/icon48.scan.png new file mode 100644 index 0000000..e85ef35 Binary files /dev/null and b/Doctor/Resource/icon48.scan.png differ diff --git a/Doctor/Resource/icon48.search.png b/Doctor/Resource/icon48.search.png new file mode 100644 index 0000000..ac967ba Binary files /dev/null and b/Doctor/Resource/icon48.search.png differ diff --git a/Doctor/Resource/icon512.wlian.png b/Doctor/Resource/icon512.wlian.png new file mode 100644 index 0000000..051cb21 Binary files /dev/null and b/Doctor/Resource/icon512.wlian.png differ diff --git a/Doctor/Resource/icon72.card.png b/Doctor/Resource/icon72.card.png new file mode 100644 index 0000000..dddbec9 Binary files /dev/null and b/Doctor/Resource/icon72.card.png differ diff --git a/Doctor/Resource/icon72.charge@2x.png b/Doctor/Resource/icon72.charge@2x.png new file mode 100644 index 0000000..6c095ae Binary files /dev/null and b/Doctor/Resource/icon72.charge@2x.png differ diff --git a/Doctor/Resource/icon72.done.png b/Doctor/Resource/icon72.done.png new file mode 100644 index 0000000..3f7d8cb Binary files /dev/null and b/Doctor/Resource/icon72.done.png differ diff --git a/Doctor/Resource/icon72.home.png b/Doctor/Resource/icon72.home.png new file mode 100644 index 0000000..283dc5a Binary files /dev/null and b/Doctor/Resource/icon72.home.png differ diff --git a/Doctor/Resource/icon72.logout.png b/Doctor/Resource/icon72.logout.png new file mode 100644 index 0000000..1a0d2bb Binary files /dev/null and b/Doctor/Resource/icon72.logout.png differ diff --git a/Doctor/Resource/icon72.refund.png b/Doctor/Resource/icon72.refund.png new file mode 100644 index 0000000..d5cee8c Binary files /dev/null and b/Doctor/Resource/icon72.refund.png differ diff --git a/Doctor/Resource/icon72.search.png b/Doctor/Resource/icon72.search.png new file mode 100644 index 0000000..46ff8a3 Binary files /dev/null and b/Doctor/Resource/icon72.search.png differ diff --git a/Doctor/Resource/icon72.update.png b/Doctor/Resource/icon72.update.png new file mode 100644 index 0000000..bcd420c Binary files /dev/null and b/Doctor/Resource/icon72.update.png differ diff --git a/Doctor/Resource/icon72.valid.png b/Doctor/Resource/icon72.valid.png new file mode 100644 index 0000000..fa197d9 Binary files /dev/null and b/Doctor/Resource/icon72.valid.png differ diff --git a/Doctor/Resource/icon72.wait.png b/Doctor/Resource/icon72.wait.png new file mode 100644 index 0000000..0b79441 Binary files /dev/null and b/Doctor/Resource/icon72.wait.png differ diff --git a/Doctor/Resource/icon72.write.png b/Doctor/Resource/icon72.write.png new file mode 100644 index 0000000..80b7d9d Binary files /dev/null and b/Doctor/Resource/icon72.write.png differ diff --git a/Doctor/Resource/titlebg.png b/Doctor/Resource/titlebg.png new file mode 100644 index 0000000..aae88b9 Binary files /dev/null and b/Doctor/Resource/titlebg.png differ diff --git a/Doctor/Util/AWordDefault.h b/Doctor/Util/AWordDefault.h new file mode 100644 index 0000000..72ffe0a --- /dev/null +++ b/Doctor/Util/AWordDefault.h @@ -0,0 +1,59 @@ +// +// AWordDefault.h +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import +#import "LoginModel.h" + +@interface AWordDefault : NSObject + + ++(void)setShopId:(NSString *)isShopId; ++(NSString*)getShopId; + ++(void)setToken:(NSString *)isToken; ++(NSString *)getToken; + ++(void)setUserId:(NSString *)isUserId; ++(NSString *)getUserId; + + +//获取用户是否登录 ++(void)setIsLogin:(BOOL)isLogin; ++(BOOL)getIsLogin; + +//获取用户名 ++(void)setUserName:(NSString*)userName; ++(NSString*)getUserName; + +//获取uid ++(void)setUid:(NSString*)uid; ++(NSString*)getUid; + +//获取用户头像 ++(void)setUserAvatar:(NSString*)userAvatar; ++(NSString*)getUserAvatar; + +//获取用户性别 ++(void)setUserGender:(NSString*)userGender; ++(NSString*)getUserGender; + +//获取最后更新时间 ++(void)setLastUpdateTime:(NSTimeInterval)date; ++(NSTimeInterval)getLastUpdateTime; + +//设置登录方式 ++(void)setLoginType:(NSInteger)loginType; ++(NSInteger)getLoginType; + +//设置个性签名 ++(void)setSignature:(NSString*)sinagure; ++(NSString*)getSignature; +//保存背景图片 ++(BOOL)setHeadBgImg:(UIImage *)headBgImg; ++(UIImage*)getHeadBgImg; +@end diff --git a/Doctor/Util/AWordDefault.m b/Doctor/Util/AWordDefault.m new file mode 100644 index 0000000..fdca2c9 --- /dev/null +++ b/Doctor/Util/AWordDefault.m @@ -0,0 +1,138 @@ +// +// AWordDefault.m +// Ash_AWord +// +// Created by xmfish on 15/4/1. +// Copyright (c) 2015年 ash. All rights reserved. +// + +#import "AWordDefault.h" + +@implementation AWordDefault + + ++(void)setShopId:(NSString *)isShopId +{ + [[NSUserDefaults standardUserDefaults] setObject:isShopId forKey:@"shopid"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getShopId; +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"shopid"]; +} + ++(void)setToken:(NSString *)isToken +{ + [[NSUserDefaults standardUserDefaults] setObject:isToken forKey:@"isToken"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString *)getToken +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"isToken"]; +} + ++(void)setUserId:(NSString *)isUserId +{ + [[NSUserDefaults standardUserDefaults] setObject:isUserId forKey:@"isUserId"]; + [[NSUserDefaults standardUserDefaults] synchronize]; + +} ++(NSString *)getUserId +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"isUserId"]; +} + ++(void)setIsLogin:(BOOL)isLogin +{ + [[NSUserDefaults standardUserDefaults] setBool:isLogin forKey:@"islogin"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(BOOL)getIsLogin +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:@"islogin"]; +} + ++(void)setUid:(NSString *)uid +{ + [[NSUserDefaults standardUserDefaults] setObject:uid forKey:@"uid"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUid +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"uid"]; +} + ++(void)setUserName:(NSString *)userName +{ + [[NSUserDefaults standardUserDefaults] setObject:userName forKey:@"username"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUserName +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"username"]; +} + ++(void)setUserAvatar:(NSString *)userAvatar +{ + [[NSUserDefaults standardUserDefaults] setObject:userAvatar forKey:@"useravatar"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUserAvatar +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"useravatar"]; + +} + ++(void)setUserGender:(NSString *)userGender +{ + [[NSUserDefaults standardUserDefaults] setObject:userGender forKey:@"usergender"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getUserGender +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"usergender"]; + +} ++(void)setLastUpdateTime:(NSTimeInterval)date +{ + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithDouble:date] forKey:@"updatetime"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSTimeInterval)getLastUpdateTime +{ + return [[NSUserDefaults standardUserDefaults] doubleForKey:@"updatetime"]; +} ++(void)setLoginType:(NSInteger)loginType +{ + [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:loginType] forKey:@"logintype"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSInteger)getLoginType +{ + return [[NSUserDefaults standardUserDefaults] integerForKey:@"logintype"]; +} + ++(void)setSignature:(NSString *)sinagure +{ + [[NSUserDefaults standardUserDefaults] setObject:sinagure forKey:@"sinagure"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} ++(NSString*)getSignature +{ + return [[NSUserDefaults standardUserDefaults] stringForKey:@"sinagure"]; + +} ++(BOOL)setHeadBgImg:(UIImage *)headBgImg +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); + NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"headbg.png"]]; // 保存文件的名称 + return [UIImagePNGRepresentation(headBgImg)writeToFile: filePath atomically:YES]; +} ++(UIImage*)getHeadBgImg +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); + NSString *filePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"headbg.png"]]; // 保存文件的名称 + UIImage *img = [UIImage imageWithContentsOfFile:filePath]; + return img; +} +@end diff --git a/Doctor/Util/MBProgressHUD/MBProgressHUD+Util.h b/Doctor/Util/MBProgressHUD/MBProgressHUD+Util.h new file mode 100644 index 0000000..d66c85a --- /dev/null +++ b/Doctor/Util/MBProgressHUD/MBProgressHUD+Util.h @@ -0,0 +1,24 @@ +// +// MBProgressHUD+Util.h +// ManagerDemo +// +// Created by xmfish on 14-8-12. +// Copyright (c) 2014年 ash. All rights reserved. +// + +#import "MBProgressHUD.h" + +@interface MBProgressHUD (Util) +/** + * Finds all HUD subviews and returns them. + * + * @param view The view that is going to be searched. + * @return All found HUD views (array of MBProgressHUD objects). + */ + ++ (void)hudWithView:(UIView *)view label:(NSString *)msg; + ++ (void)errorHudWithView:(UIView *)view label:(NSString *)msg hidesAfter:(NSTimeInterval)delay; + ++ (void)checkHudWithView:(UIView *)view label:(NSString *)msg hidesAfter:(NSTimeInterval)delay; +@end diff --git a/Doctor/Util/MBProgressHUD/MBProgressHUD+Util.m b/Doctor/Util/MBProgressHUD/MBProgressHUD+Util.m new file mode 100644 index 0000000..7d18173 --- /dev/null +++ b/Doctor/Util/MBProgressHUD/MBProgressHUD+Util.m @@ -0,0 +1,71 @@ + +#import "MBProgressHUD+Util.h" + +static MBProgressHUD *activityHUD = nil; +@implementation MBProgressHUD(Util) + + + + ++ (void)hudWithView:(UIView *)view label:(NSString *)msg +{ + if (view == nil) + { + view = [UIApplication sharedApplication].delegate.window; + } + + + MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:view]; + + HUD.dimBackground = NO; + HUD.animationType = MBProgressHUDAnimationFade; + [view addSubview:HUD]; + HUD.mode = MBProgressHUDModeIndeterminate; + HUD.labelText = msg; + [HUD show:YES]; + activityHUD = HUD; +} + ++ (void)errorHudWithView:(UIView *)view label:(NSString *)msg hidesAfter:(NSTimeInterval)delay +{ + if (view == nil) + { + view = [UIApplication sharedApplication].delegate.window; + } + [MBProgressHUD hideAllHUDsForView:view animated:YES]; + MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:view]; + HUD.dimBackground = NO; + HUD.animationType = MBProgressHUDAnimationFade; + [view addSubview:HUD]; + HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"errormark"]]; + HUD.mode = MBProgressHUDModeCustomView; + HUD.labelText = msg; + if (msg.length > 12) { +// HUD.labelFont = [UIFont boldSystemFontOfSize:13]; + } + + + [HUD show:YES]; + [HUD hide:YES afterDelay:delay]; +} + ++ (void)checkHudWithView:(UIView *)view label:(NSString *)msg hidesAfter:(NSTimeInterval)delay +{ + if (view == nil) + { + view = [UIApplication sharedApplication].delegate.window; + } + + [MBProgressHUD hideAllHUDsForView:view animated:YES]; + MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:view]; + + HUD.dimBackground = NO; + HUD.animationType = MBProgressHUDAnimationFade; + [view addSubview:HUD]; + HUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"checkmark"]]; + HUD.mode = MBProgressHUDModeCustomView; + HUD.labelText = msg; + [HUD show:YES]; + [HUD hide:YES afterDelay:delay]; +} +@end \ No newline at end of file diff --git a/Doctor/View/LoginViewController.h b/Doctor/View/LoginViewController.h new file mode 100644 index 0000000..3a21434 --- /dev/null +++ b/Doctor/View/LoginViewController.h @@ -0,0 +1,14 @@ +// +// LoginViewController.h +// WlianWorld +// +// Created by xmfish on 15/11/16. +// Copyright © 2015年 ash. All rights reserved. +// + +#import + +@class LoginViewModel; +@interface LoginViewController : UIViewController + +@end diff --git a/Doctor/View/LoginViewController.m b/Doctor/View/LoginViewController.m new file mode 100644 index 0000000..1d4b25b --- /dev/null +++ b/Doctor/View/LoginViewController.m @@ -0,0 +1,106 @@ +// +// LoginViewController.m +// WlianWorld +// +// Created by xmfish on 15/11/16. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "LoginViewController.h" +#import "LoginViewModel.h" +#import "AWordDefault.h" +@interface LoginViewController () + +@property (weak, nonatomic) IBOutlet UIButton *sureBtn; +@property (weak, nonatomic) IBOutlet UITextField *passwordTextField; +@property (weak, nonatomic) IBOutlet UITextField *accountTextField; +@property (nonatomic,strong)LoginViewModel* viewModel; +@end + +@implementation LoginViewController + +-(id)init +{ + self = [super init]; + + if (self) + { + _viewModel = [[LoginViewModel alloc] init]; + } + + return self; +} +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. + + [self bindViewModel]; +} + + +-(void)bindViewModel +{ + self.title = _viewModel.model.title; + RAC(self.viewModel,account) = self.accountTextField.rac_textSignal; + RAC(self.viewModel,password) = self.passwordTextField.rac_textSignal; + self.sureBtn.rac_command = self.viewModel.executeLogin; + + @weakify(self); + RAC(self.sureBtn, backgroundColor) = [self.viewModel.validLoginSignal map:^id(NSNumber* value) { + return[value boolValue] ? [UIColor redColor ]:[UIColor grayColor]; + }]; + + [self.viewModel.executeLogin.executionSignals subscribeNext:^(id result) { + @strongify(self) + [self.accountTextField resignFirstResponder]; + [self.passwordTextField resignFirstResponder]; + + }]; + [[self.sureBtn.rac_command executing] subscribeNext:^(NSNumber *executing) { + @strongify(self) + if([executing boolValue]){ + [MBProgressHUD showHUDAddedTo:self.view animated:YES].labelText = @"登陆中。。。"; + } + }]; + [self.sureBtn.rac_command.executionSignals.flatten subscribeNext:^(id x) { + @strongify(self) + if (self.viewModel.model.status.intValue == 0) { + [MBProgressHUD checkHudWithView:self.view label:self.viewModel.model.msg hidesAfter:1.0]; + //[nsde]; + }else + { + DLog(@"登陆成功,信息:%@",self.viewModel.model); + + [AWordDefault setUid:self.viewModel.model.userid]; + [AWordDefault setToken:self.viewModel.model.token]; + [AWordDefault setShopId:self.viewModel.model.shopid]; + [MBProgressHUD hideHUDForView:self.view animated:YES]; + [self dismissViewControllerAnimated:YES completion:nil]; + + + } + }]; + [self.sureBtn.rac_command.errors subscribeNext:^(id x) { + @strongify(self) + [MBProgressHUD errorHudWithView:self.view label:@"网络连接错误" hidesAfter:1.0]; + + }]; + + +} +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/Doctor/View/LoginViewController.xib b/Doctor/View/LoginViewController.xib new file mode 100644 index 0000000..1eb8032 --- /dev/null +++ b/Doctor/View/LoginViewController.xib @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Doctor/ViewModel/BaseViewModel.h b/Doctor/ViewModel/BaseViewModel.h new file mode 100644 index 0000000..962c275 --- /dev/null +++ b/Doctor/ViewModel/BaseViewModel.h @@ -0,0 +1,16 @@ +// +// BaseViewModel.h +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import + +@class BaseModel; +@interface BaseViewModel : NSObject + + + +@end diff --git a/Doctor/ViewModel/BaseViewModel.m b/Doctor/ViewModel/BaseViewModel.m new file mode 100644 index 0000000..2fc1590 --- /dev/null +++ b/Doctor/ViewModel/BaseViewModel.m @@ -0,0 +1,22 @@ +// +// BaseViewModel.m +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "BaseViewModel.h" +#import "BaseModel.h" +@implementation BaseViewModel + ++(BaseEntity*)requireWithDic:(NSDictionary *)dic withModel:(BaseModel*)model +{ + BaseEntity *pro = [[BaseEntity alloc] init]; + pro.requireType = HTTPRequestTypeWithGET; + pro.responesOBJ = model.class; + pro.reqURL = @""; + pro.pro = dic; + return pro; +} +@end diff --git a/Doctor/ViewModel/LoginViewModel.h b/Doctor/ViewModel/LoginViewModel.h new file mode 100644 index 0000000..dea7e3e --- /dev/null +++ b/Doctor/ViewModel/LoginViewModel.h @@ -0,0 +1,23 @@ +// +// LoginViewModel.h +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "BaseViewModel.h" +#import "LoginModel.h" +@interface LoginViewModel : BaseViewModel + +@property (nonatomic,strong) NSString* account; +@property (nonatomic,strong) NSString* password; + +@property (strong, nonatomic) RACCommand *executeLogin; +@property (strong, nonatomic)RACSignal* validLoginSignal; + +@property (nonatomic, strong)LoginModel* model; + + + +@end diff --git a/Doctor/ViewModel/LoginViewModel.m b/Doctor/ViewModel/LoginViewModel.m new file mode 100644 index 0000000..7454ec5 --- /dev/null +++ b/Doctor/ViewModel/LoginViewModel.m @@ -0,0 +1,55 @@ +// +// LoginViewModel.m +// WlianWorld +// +// Created by xmfish on 15/11/13. +// Copyright © 2015年 ash. All rights reserved. +// + +#import "LoginViewModel.h" + +@interface LoginViewModel() + +@end + +@implementation LoginViewModel + +-(id)init +{ + self = [super init]; + + if (self) + { + self.model = [[LoginModel alloc] init]; + [self initialize]; + } + + return self; +} + + +- (void)initialize +{ + + self.model.title = @"登陆"; + + self.validLoginSignal = [[RACSignal combineLatest:@[RACObserve(self, account),RACObserve(self, password)] reduce:^id(NSString* account,NSString* password){ + return @( (account.length>1) && (password.length>1) ); + }] distinctUntilChanged]; + + + self.executeLogin = [[RACCommand alloc] initWithEnabled:self.validLoginSignal + signalBlock:^RACSignal *(id input) { + return [self executeSearchSignal]; + }]; +} + + +- (RACSignal *)executeSearchSignal { + + return [[self.model loginSignalWithAccount:self.account withPassword:self.password] doNext:^(id result) { + self.model = result; + }]; +} + +@end