From 55ec444b274402ec146a32a88a12f404a40d8555 Mon Sep 17 00:00:00 2001 From: 葛建军 <627299690@qq.com> Date: Fri, 23 Mar 2018 13:34:11 +0800 Subject: [PATCH] 家长助手安卓和iOS端统一修改。 --- .gitignore | 7 +++++++ ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift | 6 +++--- ParentAssistant/ParentAssistant/Classes/controllers/Information/view/ChannelCollectionViewCell.xib | 10 +++++----- ParentAssistant/ParentAssistant/Classes/controllers/Information/view/ChannelSelectViewCollectionViewCell.xib | 9 ++++++--- ParentAssistant/ParentAssistant/Classes/controllers/evaluation/EvaluationViewController.swift | 6 +++--- ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/GetBackPasswordViewController.swift | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/LoginViewController.swift | 23 +++++++++++++---------- ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/My.storyboard | 41 ++++++++++++++++++----------------------- ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/MyViewController.swift | 18 ++++++++++-------- ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/RegisterViewController.swift | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- ParentAssistant/ParentAssistant/Classes/controllers/my/Model/MyViewControllerModel.swift | 3 +++ ParentAssistant/ParentAssistant/Classes/controllers/report/View/ReportHeaderView.xib | 6 +++--- ParentAssistant/ParentAssistant/Classes/util/utils.swift | 4 ++-- ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/evaluation/evaluation_icon_pushDown.imageset/Contents.json | 2 +- ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/evaluation/evaluation_icon_pushDown.imageset/down.png | Bin 0 -> 3969 bytes ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/evaluation/evaluation_icon_pushDown.imageset/下拉.png | Bin 603 -> 0 bytes ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/my/my_defphoto.imageset/Contents.json | 21 +++++++++++++++++++++ ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/my/my_defphoto.imageset/未登录.png | Bin 0 -> 4042 bytes ParentAssistant/ParentAssistant/Supporting Files/Base.lproj/Main.storyboard | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------ 19 files changed, 305 insertions(+), 105 deletions(-) create mode 100644 .gitignore create mode 100644 ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/evaluation/evaluation_icon_pushDown.imageset/down.png delete mode 100644 ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/evaluation/evaluation_icon_pushDown.imageset/下拉.png create mode 100644 ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/my/my_defphoto.imageset/Contents.json create mode 100644 ParentAssistant/ParentAssistant/Supporting Files/Assets.xcassets/my/my_defphoto.imageset/未登录.png diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d9dbea --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +*.xccheckout +*.xcuserstate +*.xcbkptlist +ParentAssistant.xcscheme +xcschememanagement.plist +*.xcuserdata +*/xcuserdatad/* \ No newline at end of file diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift index 253e80d..9e2801f 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Information/InformationViewController.swift @@ -113,7 +113,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) leftLabel.text = AccountManager.shared.address - leftLabel.textColor = UIColor.black + leftLabel.textColor = UIColor.white leftLabel.sizeToFit() let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) image.image = #imageLiteral(resourceName: "evaluation_icon_pushDown") @@ -182,7 +182,7 @@ class InformationViewController: UIViewController,UISearchBarDelegate { //点击资讯进入详情 func pushToInfoView(index:Int){ let vcs = Story.instantiateViewControllerWithIdentifier("JSViewController", storyName: "JS") as! JSViewController - vcs.webURL = "http://60.190.202.57:8101/InformationDetail.aspx?id=75&areaname=%E4%BD%99%E6%9D%AD%E5%8C%BA"//(HTTPServer.HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+AccountManager.shared.address)//.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! + vcs.webURL = (HTTPServer.HOSTWAP+"/InformationDetail.aspx?id="+"\(data.channelContent[index].id)"+"&areaname="+AccountManager.shared.address)//.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! self.navigationController?.present(vcs.wrapWithNavigationController(), animated: true, completion: nil) } @@ -349,7 +349,7 @@ extension ChannelSelectView:UICollectionViewDataSource,UICollectionViewDelegateF func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "channelcell", for: indexPath) as! ChannelSelectViewCollectionViewCell - cell.image.sd_setImage(with: URL(string: (HTTPServer.HOSTImage+SubchannelList[indexPath.row].channelImage).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!), placeholderImage: UIImage(named: "navigationBar_backgrounImage")) + cell.image.sd_setImage(with: URL(string: (HTTPServer.HOSTImage+SubchannelList[indexPath.row].channelImage).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!), placeholderImage: UIImage(named: "evaluation_icon_highSchoolEnter")) cell.channelName.text = SubchannelList[indexPath.row].channelName return cell } diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/Information/view/ChannelCollectionViewCell.xib b/ParentAssistant/ParentAssistant/Classes/controllers/Information/view/ChannelCollectionViewCell.xib index f362c5b..47a0afc 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/Information/view/ChannelCollectionViewCell.xib +++ b/ParentAssistant/ParentAssistant/Classes/controllers/Information/view/ChannelCollectionViewCell.xib @@ -41,25 +41,25 @@ - @@ -59,4 +59,7 @@ + + + diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/evaluation/EvaluationViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/evaluation/EvaluationViewController.swift index 5ab63ce..26074f3 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/evaluation/EvaluationViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/evaluation/EvaluationViewController.swift @@ -28,7 +28,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec var leftLabel:UILabel! override func viewDidLoad() { super.viewDidLoad() - self.navigationItem.title = "测评" + self.navigationItem.title = "慧测慧练" addLeftBarBtn() locationAction() addBottomBtn() @@ -120,7 +120,7 @@ class EvaluationViewController: UIViewController,CLLocationManagerDelegate,Selec let leftbtn = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 40)) leftLabel = UILabel(frame: CGRect(x: 0, y: 10, width: 60, height: 20)) leftLabel.text = AccountManager.shared.address - leftLabel.textColor = UIColor.black + leftLabel.textColor = UIColor.white leftLabel.sizeToFit() let image = UIImageView(frame: CGRect(x: leftLabel.frame.maxX+4, y: 15, width: 16, height: 9)) image.image = #imageLiteral(resourceName: "evaluation_icon_pushDown") @@ -260,7 +260,7 @@ extension EvaluationViewController:UICollectionViewDataSource,UICollectionViewDe func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "channelcell", for: indexPath) as! ChannelSelectViewCollectionViewCell - cell.image.sd_setImage(with: URL(string: (HTTPServer.HOSTImage+toolArr[indexPath.row].toolImage).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!), placeholderImage: #imageLiteral(resourceName: "defphoto")) + cell.image.sd_setImage(with: URL(string: (HTTPServer.HOSTImage+toolArr[indexPath.row].toolImage).addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!), placeholderImage: UIImage(named: "evaluation_icon_highSchoolEnter")) cell.channelName.text = toolArr[indexPath.row].toolName return cell } diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/GetBackPasswordViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/GetBackPasswordViewController.swift index 6121d66..fe6eda1 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/GetBackPasswordViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/GetBackPasswordViewController.swift @@ -33,7 +33,7 @@ class GetBackPasswordViewController: UIViewController,UITextFieldDelegate { getCodeBtn.layer.borderColor = UIColor.lightGray.cgColor topView.constant = (getScreenHeight()-325)/3 passwordHiddenBtn.setImage(UIImage(named: "my_password_look"), for: UIControlState.selected) - NotificationCenter.default.addObserver(self, selector: #selector(RegisterViewController.keyboardWIllChange(_:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(GetBackPasswordViewController.keyboardWIllChange(_:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) } // MARK: - 根据键盘调整高度 @objc func keyboardWIllChange(_ noti: Notification){ @@ -122,9 +122,63 @@ class GetBackPasswordViewController: UIViewController,UITextFieldDelegate { httpJsonResule(jsonString: str, error: error, successHandler: { (json) -> Void in let alertVC = UIAlertController(title: "提示", message: "密码修改成功", preferredStyle: UIAlertControllerStyle.alert) let showBtn = UIAlertAction(title: "确认", style: UIAlertActionStyle.default) { (action) in - self.dismiss(animated: true) { - //登录 - } + self.navigationController?.popToRootViewController(animated: true) + //登录 + SVProgressHUD.show(withStatus: "登录中...") + HTTPServer.shared.login(completionHandler: { (str, error) in + SVProgressHUD.dismiss() + let json=JSON.fromString(str) + if let ret=json{ + let er=ret["error"].string + if let errorStr=er{ + let Strings=errorStr.components(separatedBy: ":") + if Strings.count >= 2 { + switch Strings[1] { + //用户关联多个身份,请使用学事号登录:100 + case "101"://用户认证身份不存在:101 + appDelegate.window!.makeToast("用户认证身份不存在,请进行账号激活。") + break + //用户帐号或密码错误:102 + case "103":// 用户不存在:103 + appDelegate.window!.makeToast("该号码不存在,请联系客服400-826-2468") + break + default: + appDelegate.window!.makeToast(errorStr) + break + } + }else{ + appDelegate.window!.makeToast(errorStr) + } + }else if ret["access_token"].stringValue != ""{ + AccountManager.shared.setTokenInfo(tokenInfo: ret) + AccountManager.shared.saveToken(tokenInfo: ret) + AccountManager.shared.refreshUserInfo(self.phoneTextField.text!, completionHandler: { (finish) in + if finish{ + let ID=AccountManager.shared.rawUserInfo!.contentData()["userid"].stringValue + YXMessageManager.share.loginWithYX(account: ID, token: ID.md5()) { (success) in + SVProgressHUD.dismiss() + if !success { + AccountManager.shared.logOut() + appDelegate.window!.makeToast("聊天服务登录失败,请连接网络重试") + }else{ + //云信登录成功 + self.dismiss(animated: true, completion: nil) + } + } + }else{ + appDelegate.window!.makeToast("身份获取失败") + SVProgressHUD.dismiss() + } + }) + }else{ + SVProgressHUD.dismiss() + appDelegate.window!.makeToast("登录失败,请稍后重试") + } + }else{ + SVProgressHUD.dismiss() + appDelegate.window!.makeToast("登录失败") + } + }, phone: self.phoneTextField.text!, password: self.passwordTextField.text!) } alertVC.addAction(showBtn) self.present(alertVC, animated: true, completion: nil) diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/LoginViewController.swift b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/LoginViewController.swift index 3c43929..8814cab 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/LoginViewController.swift +++ b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/LoginViewController.swift @@ -14,24 +14,22 @@ class LoginViewController: UIViewController,UITextFieldDelegate { @IBOutlet var phoneTextField: UITextField!//电话号码 @IBOutlet var passwordTextField: UITextField!//密码 @IBOutlet var passwordHiddenBtn: UIButton!//查看密码按钮 - var phoneNumber:String = "" override func viewDidLoad() { super.viewDidLoad() layoutSubViews() } override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) - self.navigationController?.navigationBar.isHidden = true + self.navigationController?.navigationBar.isHidden = false } // MARK: - 设置控件属性 func layoutSubViews(){ - self.navigationController?.navigationBar.isHidden = true + self.navigationController?.navigationBar.isHidden = false + self.navigationItem.title = "登录" topView.constant = (getScreenHeight()-325)/3 passwordHiddenBtn.setImage(UIImage(named: "my_password_look"), for: UIControlState.selected) - NotificationCenter.default.addObserver(self, selector: #selector(RegisterViewController.keyboardWIllChange(_:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) - if phoneNumber != "" { - phoneTextField.text = phoneNumber - } + NotificationCenter.default.addObserver(self, selector: #selector(LoginViewController.keyboardWIllChange(_:)), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) + NotificationCenter.default.addObserver(self, selector: #selector(LoginViewController.getPhoneNumber(_:)), name: NSNotification.Name(rawValue: MyPhoneNumberNotification.getPhoneNumber), object: nil) } // MARK: - 根据键盘调整高度 @objc func keyboardWIllChange(_ noti: Notification){ @@ -40,9 +38,13 @@ class LoginViewController: UIViewController,UITextFieldDelegate { if endFrame?.origin.y == getScreenHeight() { topView.constant = (getScreenHeight()-325)/3 }else{ - topView.constant = (endFrame?.origin.y)!-325 + topView.constant = (endFrame?.origin.y)!-375 } } + @objc func getPhoneNumber(_ noti: Notification){ + let userInfo:NSDictionary=noti.userInfo! as NSDictionary + phoneTextField.text = userInfo["phoneNumber"] as? String + } // MARK: - 密码显示与否 @IBAction func passwordHiddenAction(_ sender: UIButton) { @@ -121,14 +123,15 @@ class LoginViewController: UIViewController,UITextFieldDelegate { appDelegate.window!.makeToast("聊天服务登录失败,请连接网络重试") }else{ //云信登录成功 - self.dismiss(animated: true, completion: nil) + self.navigationController?.popToRootViewController(animated: true) } } } // MARK: - 注册页面跳转 @IBAction func registerAction(_ sender: UIButton) { - self.navigationController?.popViewController(animated: true) + let vc = Story.instantiateViewControllerWithIdentifier("RegisterViewController", storyName: "My") as! RegisterViewController + self.navigationController?.pushViewController(vc, animated: true) } // MARK: - 找回密码 @IBAction func getPasswordAction(_ sender: UIButton) { diff --git a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/My.storyboard b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/My.storyboard index a49ca3a..2bcad60 100644 --- a/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/My.storyboard +++ b/ParentAssistant/ParentAssistant/Classes/controllers/my/Controller/My.storyboard @@ -23,7 +23,7 @@ - + @@ -32,7 +32,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -196,14 +196,14 @@ - - - + + + + + - + @@ -121,21 +131,31 @@ - + + + - - + + + + - + + @@ -245,9 +265,6 @@ - - - + + + + + @@ -290,9 +317,6 @@ - - - + + + + + @@ -334,9 +368,6 @@ - - - + @@ -353,7 +390,11 @@ + + + + @@ -414,23 +455,33 @@ - + + + + + + + + - - - - - - + + + + + + + + + @@ -1629,7 +1680,7 @@ - + @@ -2050,7 +2101,7 @@ @@ -2087,15 +2138,18 @@ - + - + + + + @@ -2153,6 +2207,10 @@ + + + + @@ -2174,6 +2232,7 @@ + -- libgit2 0.21.0