diff --git a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj index 7b02ced..1d11c15 100644 --- a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj +++ b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj @@ -130,6 +130,7 @@ BF25E0171DDAAF73003EC0C1 /* SVProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = BF25E0101DDAAF73003EC0C1 /* SVProgressHUD.bundle */; }; BF25E0181DDAAF73003EC0C1 /* SVProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = BF25E0121DDAAF73003EC0C1 /* SVProgressHUD.m */; }; BF25E0191DDAAF73003EC0C1 /* SVRadialGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = BF25E0141DDAAF73003EC0C1 /* SVRadialGradientLayer.m */; }; + BF29F9081ED6ACC2004667AF /* NewLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF29F9071ED6ACC2004667AF /* NewLoginViewController.swift */; }; BF3E4A771E2F30B700D90659 /* 观看人数.png in Resources */ = {isa = PBXBuildFile; fileRef = BF3E4A721E2F30B700D90659 /* 观看人数.png */; }; BF3E4A781E2F30B700D90659 /* 礼物数量.png in Resources */ = {isa = PBXBuildFile; fileRef = BF3E4A731E2F30B700D90659 /* 礼物数量.png */; }; BF3E4A791E2F30B700D90659 /* 上传封面.png in Resources */ = {isa = PBXBuildFile; fileRef = BF3E4A741E2F30B700D90659 /* 上传封面.png */; }; @@ -463,6 +464,7 @@ BF25E0121DDAAF73003EC0C1 /* SVProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVProgressHUD.m; sourceTree = ""; }; BF25E0131DDAAF73003EC0C1 /* SVRadialGradientLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVRadialGradientLayer.h; sourceTree = ""; }; BF25E0141DDAAF73003EC0C1 /* SVRadialGradientLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVRadialGradientLayer.m; sourceTree = ""; }; + BF29F9071ED6ACC2004667AF /* NewLoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewLoginViewController.swift; sourceTree = ""; }; BF3E4A721E2F30B700D90659 /* 观看人数.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "观看人数.png"; sourceTree = ""; }; BF3E4A731E2F30B700D90659 /* 礼物数量.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "礼物数量.png"; sourceTree = ""; }; BF3E4A741E2F30B700D90659 /* 上传封面.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "上传封面.png"; sourceTree = ""; }; @@ -1234,6 +1236,7 @@ children = ( BFBB83DD1ECC445D008B404B /* LoginViewController.swift */, BFBB83E01ECC445D008B404B /* RegisterViewController.swift */, + BF29F9071ED6ACC2004667AF /* NewLoginViewController.swift */, BFBB83E11ECC445D008B404B /* Login.storyboard */, ); path = UserCenter; @@ -1557,6 +1560,7 @@ BF7B759C1E305A6D0011D5C7 /* MJRefreshAutoNormalFooter.m in Sources */, 5904FC4F1ECA8B8C00E631FF /* SearchTVStationListViewController.swift in Sources */, BFC076781E3445F3008BAC79 /* DownLoad.swift in Sources */, + BF29F9081ED6ACC2004667AF /* NewLoginViewController.swift in Sources */, 59AE3DFF1ECFDAFD003E2C62 /* TVStationChannelViewController.swift in Sources */, BF25DFE71DDAA36A003EC0C1 /* MultipartFormData.swift in Sources */, 5989394D1ED4016D005DA462 /* HistoryViewController.swift in Sources */, diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/Contents.json b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_account.imageset/3.png b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_account.imageset/3.png new file mode 100644 index 0000000..6f6c4eb Binary files /dev/null and b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_account.imageset/3.png differ diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_account.imageset/Contents.json b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_account.imageset/Contents.json new file mode 100644 index 0000000..41771cf --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_account.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "3.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_password.imageset/2.png b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_password.imageset/2.png new file mode 100644 index 0000000..9a8805b Binary files /dev/null and b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_password.imageset/2.png differ diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_password.imageset/Contents.json b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_password.imageset/Contents.json new file mode 100644 index 0000000..b17e27b --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/z_NewIcon/User/login_password.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "2.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/YouerLiveVideo/YouerLiveVideo/Base.lproj/Main.storyboard b/YouerLiveVideo/YouerLiveVideo/Base.lproj/Main.storyboard index e505bcc..c900993 100644 --- a/YouerLiveVideo/YouerLiveVideo/Base.lproj/Main.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - - + + @@ -81,7 +81,7 @@ - + @@ -423,7 +423,7 @@ - + @@ -569,7 +569,7 @@ - + @@ -736,7 +736,7 @@ - + @@ -799,24 +799,6 @@ - - - - - - - - - - - - - - - - - - @@ -1489,7 +1471,7 @@ - + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/LeadViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/LeadViewController.swift index d5eb77b..589b7ef 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/LeadViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/LeadViewController.swift @@ -13,11 +13,12 @@ class LeadViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() LeadViewController.instance=self - if AppDelegate.instance().accountManager.isOnline() { - showMain() - }else{ - showLogin() - } + showMain() +// if AppDelegate.instance().accountManager.isOnline() { +// showMain() +// }else{ +// showLogin() +// } } func showMain() { removeAll() @@ -26,7 +27,7 @@ class LeadViewController: UIViewController { } func showLogin() { removeAll() - let vc=Story.instantiateViewControllerWithIdentifier("LoginViewControllerVC", storyName: "Login") as! LoginViewController + let vc=Story.instantiateViewControllerWithIdentifier("NewLoginViewControllerVC", storyName: "Login") as! NewLoginViewController displayContentController(content: vc) } override func didReceiveMemoryWarning() { diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/Resource/FilterListViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/Resource/FilterListViewController.swift index aeae9b5..75f3a40 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/Resource/FilterListViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/Resource/FilterListViewController.swift @@ -49,6 +49,8 @@ class FilterListViewController: UIViewController,UITableViewDelegate,UITableView for item in JSON.fromString(jsonString: str)!["data"].arrayValue { self.dataSet.append(filterListModel(j: item)) } + self.currentItem=filterListModel(array: self.dataSet) + self.tableView.reloadData() }, failHandler: { (error) in self.view.makeToast("获取知识点目录失败:\(error.localizedDescription)") }) @@ -67,6 +69,8 @@ class FilterListViewController: UIViewController,UITableViewDelegate,UITableView for item in JSON.fromString(jsonString: str)!["data"].arrayValue { self.dataSet.append(filterListModel(j: item)) } + self.currentItem=filterListModel(array: self.dataSet) + self.tableView.reloadData() }, failHandler: { (error) in self.view.makeToast("获取考点目录失败:\(error.localizedDescription)") }) diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift index 2ebd3d5..f44df31 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift @@ -36,6 +36,7 @@ class ChangePassWordViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() if user.isOnline() { + self.title="密码修改" self.navigationItem.rightBarButtonItem=nil phonrView.isHidden=true phoneViewHeight.constant=0 diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard index 483c534..4956e0a 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard @@ -69,16 +69,19 @@ - - + + - - + + - - + + + + + @@ -91,7 +94,7 @@ - + @@ -111,16 +114,19 @@ - - + + - - + + - - + + + + + @@ -129,7 +135,7 @@ - + @@ -175,8 +181,8 @@ - - + - + @@ -585,12 +591,12 @@ - + - + @@ -673,7 +679,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/NewLoginViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/NewLoginViewController.swift new file mode 100644 index 0000000..938f54d --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/NewLoginViewController.swift @@ -0,0 +1,139 @@ +// +// NewLoginViewController.swift +// youer +// +// Created by sinceredeveloper on 15/11/9. +// Copyright (c) 2015年 kagami. All rights reserved. +// + +import UIKit + +class NewLoginViewController: UIViewController,UITextFieldDelegate { + @IBOutlet weak var viewContent: UIView! + @IBOutlet weak var constraintContentOffset: NSLayoutConstraint! + @IBOutlet weak var fieldAccount: UITextField! + @IBOutlet weak var fieldPassword: UITextField! + @IBOutlet weak var buttonLogin: UIButton! + override func viewDidLoad() { + super.viewDidLoad() + constraintContentOffset.constant=20 + view.backgroundColor=UIColorFromRGB(0xf7f7f7) + Theme.configButton(buttonLogin) + let lastAccount=Setting.getString("lastAccountNumber") + fieldAccount.text=lastAccount + } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + NotificationCenter.default.addObserver(self, selector: #selector(NewLoginViewController.keyboardWillShow), name: NSNotification.Name.UIKeyboardWillShow, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(NewLoginViewController.keyboardWillHide), name: NSNotification.Name.UIKeyboardWillHide, object: nil) + fieldAccount.tintColor=Theme.topBarColor() + fieldPassword.tintColor=Theme.topBarColor() + } + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + NotificationCenter.default.removeObserver(self) + } + + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + @IBAction func onLoginClicked(sender: AnyObject) { + self.view.endEditing(true) + let account=fieldAccount.text + let pw=fieldPassword.text + + if (account?.characters.count)!<1 || pw!.characters.count<1 { + self.view.makeToast("账号或密码不能为空") + return + } + login(phone: account!, pw:pw!) + } + + func login(phone:String, pw:String){ + if phone.isMobilePhoneNumber() { + SVProgressHUD.show(withStatus: "登录...") + SVProgressHUD.setDefaultMaskType(.black) + let parameters:Dictionary=["grant_type":"password" as AnyObject,"username":phone as AnyObject,"password":pw as AnyObject] + AppDelegate.instance().httpServer.login(parameters: parameters) { (str, error) in + let json=JSON.fromString(jsonString: str) + if let ret=json{ + let er=ret["error"].string + if let errorStr=er{ + SVProgressHUD.dismiss() + let Strings=errorStr.components(separatedBy:":") + if Strings.count >= 2 { + switch Strings[1] { + //用户关联多个身份,请使用学事号登录:100 + case "101"://用户认证身份不存在:101 + AppDelegate.instance().window?.makeToast("用户认证身份不存在,请进行账号激活。") + break + //用户帐号或密码错误:102 + case "103":// 用户不存在:103 + AppDelegate.instance().window?.makeToast("该号码不存在,请联系客服400-826-2468") + break + default: + AppDelegate.instance().window?.makeToast("\(errorStr)") + break + } + }else{ + AppDelegate.instance().window?.makeToast("\(errorStr)") + } + }else if ret["access_token"].stringValue != ""{ + AppDelegate.instance().accountManager.setTokenInfo(tokenInfo: ret) + AppDelegate.instance().accountManager.saveToken(tokenInfo: ret) + AppDelegate.instance().accountManager.refreshUserInfo(completionHandler: { (finish) in + if finish{ + // self.loadUserInfo() + SVProgressHUD.dismiss() + self.back() + }else{ + AppDelegate.instance().window?.makeToast("身份获取失败") + SVProgressHUD.dismiss() + } + }) + }else{ + SVProgressHUD.dismiss() + AppDelegate.instance().window?.makeToast("登录失败,请稍后重试") + } + }else{ + SVProgressHUD.dismiss() + AppDelegate.instance().window?.makeToast("登录失败") + } + } + }else{ + self.view.makeToast("请输入正确手机号") + } + } + func back(){ + self.navigationController!.popViewController(animated: true) + } + + + @IBAction func activatiAction(sender: UIButton) { + let vc = Story.instantiateViewControllerWithIdentifier("ChangePassWordViewControllerVC", storyName: "User") as! ChangePassWordViewController + self.navigationController?.pushViewController(vc, animated: true) + } + @IBAction func returnAction(sender: UIButton) { + let vc = UIStoryboard(name: "Login", bundle: nil).instantiateViewController(withIdentifier: "RegisterViewControllerVC") as! RegisterViewController + self.navigationController!.pushViewController(vc, animated: true) + } + + func keyboardWillShow(){ + constraintContentOffset.constant=144 + UIView.animate(withDuration: 2, animations: { () -> Void in + self.viewContent.layoutIfNeeded() + }) + + } + func keyboardWillHide(){ + constraintContentOffset.constant=20 + UIView.animate(withDuration: 2, animations: { () -> Void in + self.viewContent.layoutIfNeeded() + }) + } +} + + + diff --git a/YouerLiveVideo/YouerLiveVideo/util/utiles.swift b/YouerLiveVideo/YouerLiveVideo/util/utiles.swift index 939dffe..8f881a7 100644 --- a/YouerLiveVideo/YouerLiveVideo/util/utiles.swift +++ b/YouerLiveVideo/YouerLiveVideo/util/utiles.swift @@ -146,7 +146,7 @@ extension UIViewController{ self.navigationController?.navigationBar.barTintColor=Theme.topBarColor() self.navigationController?.navigationBar.tintColor=UIColor.white self.navigationController?.navigationBar.isTranslucent=false - self.navigationController?.navigationBar.titleTextAttributes = {[NSForegroundColorAttributeName: UIColor.white]}()//Theme.topBarColor()]}() + self.navigationController?.navigationBar.titleTextAttributes = {[NSForegroundColorAttributeName: UIColor.white,NSBackgroundColorAttributeName: Theme.topBarColor()]}()//Theme.topBarColor()]}() } ///套上UINavigationController func wrapWithNavigationController()->UINavigationController{ -- libgit2 0.21.0