diff --git a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj index 12bdfbd..85966e4 100644 --- a/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj +++ b/YouerLiveVideo/YouerLiveVideo.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ 598939491ED3CFD8005DA462 /* UserEditViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 598939481ED3CFD8005DA462 /* UserEditViewController.swift */; }; 5989394B1ED3CFF4005DA462 /* AppSettingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5989394A1ED3CFF4005DA462 /* AppSettingViewController.swift */; }; 5989394D1ED4016D005DA462 /* HistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5989394C1ED4016D005DA462 /* HistoryViewController.swift */; }; + 598939501ED41C44005DA462 /* ChangePassWordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5989394F1ED41C44005DA462 /* ChangePassWordViewController.swift */; }; 598A0E531E51941300273AB8 /* libNIMSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 598A0E4D1E51941300273AB8 /* libNIMSDK.a */; }; 598A0E541E51941300273AB8 /* libaacplus.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 598A0E4F1E51941300273AB8 /* libaacplus.a */; }; 598A0E551E51941300273AB8 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 598A0E501E51941300273AB8 /* libcrypto.a */; }; @@ -244,6 +245,7 @@ 598939481ED3CFD8005DA462 /* UserEditViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserEditViewController.swift; sourceTree = ""; }; 5989394A1ED3CFF4005DA462 /* AppSettingViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppSettingViewController.swift; sourceTree = ""; }; 5989394C1ED4016D005DA462 /* HistoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryViewController.swift; sourceTree = ""; }; + 5989394F1ED41C44005DA462 /* ChangePassWordViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChangePassWordViewController.swift; sourceTree = ""; }; 598A0E121E51941300273AB8 /* NIMChatroom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NIMChatroom.h; sourceTree = ""; }; 598A0E131E51941300273AB8 /* NIMChatroomEnterRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NIMChatroomEnterRequest.h; sourceTree = ""; }; 598A0E141E51941300273AB8 /* NIMChatroomMember.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NIMChatroomMember.h; sourceTree = ""; }; @@ -680,6 +682,14 @@ path = lib/DanmakuLib; sourceTree = ""; }; + 5989394E1ED41C31005DA462 /* Setting */ = { + isa = PBXGroup; + children = ( + 5989394F1ED41C44005DA462 /* ChangePassWordViewController.swift */, + ); + path = Setting; + sourceTree = ""; + }; 598A0E0F1E51941300273AB8 /* SDK */ = { isa = PBXGroup; children = ( @@ -1184,6 +1194,7 @@ 598939481ED3CFD8005DA462 /* UserEditViewController.swift */, 5989394A1ED3CFF4005DA462 /* AppSettingViewController.swift */, 5989394C1ED4016D005DA462 /* HistoryViewController.swift */, + 5989394E1ED41C31005DA462 /* Setting */, BFBB83DA1ECC445D008B404B /* UserCenter */, ); path = User; @@ -1539,6 +1550,7 @@ BF25E0151DDAAF73003EC0C1 /* SVIndefiniteAnimatedView.m in Sources */, BFF5F4921DD5B7CA00D33B89 /* SwiftyJSON.swift in Sources */, 5989394B1ED3CFF4005DA462 /* AppSettingViewController.swift in Sources */, + 598939501ED41C44005DA462 /* ChangePassWordViewController.swift in Sources */, BF682F1E1ECE8772007632CA /* MainHomeTableViewController.swift in Sources */, BF7B75A91E305A6D0011D5C7 /* UIView+MJExtension.m in Sources */, BF25DFEE1DDAA36A003EC0C1 /* Result.swift in Sources */, diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/AppSettingViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/AppSettingViewController.swift index aa0c3ca..75c2c5a 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/AppSettingViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/AppSettingViewController.swift @@ -9,7 +9,7 @@ import UIKit class AppSettingViewController: UIViewController { - + var titleArr:[String] = ["密码修改"] override func viewDidLoad() { super.viewDidLoad() @@ -21,6 +21,16 @@ class AppSettingViewController: UIViewController { // Dispose of any resources that can be recreated. } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tabBarController?.tabBar.isHidden = true + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.tabBarController?.hidesBottomBarWhenPushed = false + } + /* // MARK: - Navigation @@ -33,3 +43,60 @@ class AppSettingViewController: UIViewController { */ } + +extension AppSettingViewController:UITableViewDelegate,UITableViewDataSource{ + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! AppSettingCell + cell.titleName.text = titleArr[indexPath.row] + return cell + } + + func numberOfSections(in tableView: UITableView) -> Int { + return titleArr.count + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return 1 + } + + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + switch indexPath.section { + case 0: + let vc = Story.instantiateViewControllerWithIdentifier("ChangePassWordViewControllerVC", storyName: "User") as! ChangePassWordViewController + vc.title = "密码修改" + self.navigationController?.pushViewController(vc, animated: true) + break + default: + break + } + } + + func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { + let view = UILabel(frame: CGRect(x:0,y:0,width:getScreenWidth(),height:1)) + view.backgroundColor = tableView.backgroundColor + return view + } + + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + let view = UILabel(frame: CGRect(x:0,y:0,width:getScreenWidth(),height:15)) + view.backgroundColor = tableView.backgroundColor + return view + + } + func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat { + return 1 + } + + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + return 15 + } +} + + + +class AppSettingCell: UITableViewCell { + + + @IBOutlet weak var titleName: UILabel! + +} diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift index 3a6d4a6..9560f40 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/HistoryViewController.swift @@ -13,18 +13,32 @@ class HistoryViewController: UIViewController { @IBOutlet weak var collectionView: UICollectionView! var datatSet:[TVStationSubject] = [] - var type:Int = 0// 资源类型 0-微课 1-资源 2-电视台 + var type:Int = 0// 资源类型 0-微课 1-资源 + var isHistory:Int = 0 override func viewDidLoad() { super.viewDidLoad() - AppDelegate.instance().httpServer.getHistroyView(parameters: ["f_ViewType":type as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in - httpJsonResule(jsonString: str, error: error, successHandler: { (json) in - for item in json.contentData()["resultData"].arrayValue{ - self.datatSet.append(TVStationSubject(json: item)) - } - self.collectionView.reloadData() - }, failHandler: { (error) in - - }) + if isHistory == 0{ + AppDelegate.instance().httpServer.getHistroyView(parameters: ["f_ViewType":type as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in + for item in json.contentData()["resultData"].arrayValue{ + self.datatSet.append(TVStationSubject(json: item)) + } + self.collectionView.reloadData() + }, failHandler: { (error) in + + }) + } + }else{ + AppDelegate.instance().httpServer.getHistroyView(parameters: ["f_ViewType":type as AnyObject,"pageIndex":1 as AnyObject]) { (str, error) in + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in + for item in json.contentData()["resultData"].arrayValue{ + self.datatSet.append(TVStationSubject(json: item)) + } + self.collectionView.reloadData() + }, failHandler: { (error) in + + }) + } } // Do any additional setup after loading the view. } diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift new file mode 100644 index 0000000..e0c4b96 --- /dev/null +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift @@ -0,0 +1,84 @@ +// +// ChangePassWordViewController.swift +// YouerLiveVideo +// +// Created by 左丞 on 2017/5/23. +// Copyright © 2017年 左丞. All rights reserved. +// + +import UIKit + +class ChangePassWordViewController: UIViewController { + + @IBOutlet weak var scrollView: UIScrollView! + @IBOutlet weak var scrollViewHeight: NSLayoutConstraint! + + @IBOutlet weak var passwordTextFiled: UITextField! + @IBOutlet weak var agrenPasswordTextFiled: UITextField! + @IBOutlet weak var userCodeTextFiled: UITextField! + + + var scrollViewH:CGFloat! + + @IBAction func editKeyboard(_ sender: Any) { + self.view.endEditing(true) + } + + override func viewDidLoad() { + super.viewDidLoad() + scrollViewH = scrollViewHeight.constant + NotificationCenter.default.addObserver(self, selector: #selector(ChangePassWordViewController.keyboardWIllChange), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) + + // Do any additional setup after loading the view. + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + @IBAction func agrenChangePasswordBtnClick(_ sender: UIButton) { + + } + + @IBAction func sendUserCodeBtnClick(_ sender: UIButton) { + + } + + // MARK: - 输入密码点击return回收键盘 + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + textField.resignFirstResponder() + return true + } + // MARK: - 键盘监听 + func keyboardWIllChange(noti: NSNotification){ + let userInfo:NSDictionary=noti.userInfo! as NSDictionary + let endFrame=(userInfo[UIKeyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue + if endFrame?.origin.y==getScreenHeight() { + scrollViewHeight.constant=scrollViewH + }else{ + if ((endFrame?.origin.y)!-64) < scrollViewH { + scrollViewHeight.constant=((endFrame?.origin.y)!-64) + }else{ + scrollViewHeight.constant=scrollViewH + } + } + } + // MARK: - 销毁通知 + deinit { + NotificationCenter.default.removeObserver(self) + } + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destinationViewController. + // Pass the selected object to the new view controller. + } + */ + +} + + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard index 868eb27..0052222 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard @@ -167,12 +167,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift index fea4af7..e79d406 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserEditViewController.swift @@ -19,7 +19,6 @@ class UserEditViewController: UIViewController ,UIImagePickerControllerDelegate, override func viewDidLoad() { super.viewDidLoad() setContentArr() - // Do any additional setup after loading the view. } @@ -32,6 +31,18 @@ class UserEditViewController: UIViewController ,UIImagePickerControllerDelegate, } contentArr = [user.name(),user.userid,ident,user.schoolName()] } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tabBarController?.tabBar.isHidden = true + } + + override func viewWillDisappear(_ animated: Bool) { + super.viewWillDisappear(animated) + self.tabBarController?.hidesBottomBarWhenPushed = false + } + + override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift index 5063eb2..394e751 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift @@ -14,8 +14,11 @@ class UserViewController: UIViewController { @IBOutlet weak var historyList: UITableView! @IBOutlet weak var userName: UILabel! @IBOutlet weak var userPhoto: UIImageView! - var historyType:[String] = ["微课","校园资源库","校园电视台"] + var historyType:[String] = ["资源历史","微课历史"] + var myResourceType:[String] = ["我的资源","我的微课"] + var sectionList:[String] = ["历史记录","我的"] var isCloseHistoryList:Bool = false + var isCloseMyResource:Bool = false override func viewDidLoad() { super.viewDidLoad() self.configTheme() @@ -38,22 +41,30 @@ class UserViewController: UIViewController { } @IBAction func userEditClcik(_ sender: Any) { - print("编译个人资料") let vc = Story.instantiateViewControllerWithIdentifier("UserEditViewControllerVC", storyName: "User") as! UserEditViewController self.navigationController?.pushViewController(vc, animated: true) } func editBtnClick(){ - print("编译设置") let vc = Story.instantiateViewControllerWithIdentifier("AppSettingViewControllerVC", storyName: "User") as! AppSettingViewController + vc.title = "设置" self.navigationController?.pushViewController(vc, animated: true) } func headerTap(tap:UITapGestureRecognizer){ - isCloseHistoryList = !isCloseHistoryList + if tap.view?.tag == 200{ + isCloseHistoryList = !isCloseHistoryList + }else{ + isCloseMyResource = !isCloseMyResource + } historyList.reloadData() } + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.tabBarController?.tabBar.isHidden = false + } + /* // MARK: - Navigation @@ -72,6 +83,7 @@ extension UserViewController:UITableViewDelegate,UITableViewDataSource{ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let vc = Story.instantiateViewControllerWithIdentifier("HistoryViewControllerVC", storyName: "User") as! HistoryViewController vc.type = indexPath.row + vc.isHistory = indexPath.section vc.title = historyType[indexPath.row] self.navigationController?.pushViewController(vc, animated: true) } @@ -83,21 +95,30 @@ extension UserViewController:UITableViewDelegate,UITableViewDataSource{ } func numberOfSections(in tableView: UITableView) -> Int { - return 1 + return sectionList.count } func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - if isCloseHistoryList { + if section == 0{ + if isCloseHistoryList{ + return 0 + } + return historyType.count + }else if section == 1{ + if isCloseMyResource{ + return 0 + } + return myResourceType.count + }else{ return 0 } - return historyType.count } func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let headerView = UIView(frame: CGRect(x: 0, y: 0, width: getScreenWidth(), height: 44)) headerView.backgroundColor = UIColor.white let label = UILabel(frame: CGRect(x: 8, y: headerView.frame.height/2-10, width: 100, height: 21)) - label.text = "历史记录" + label.text = sectionList[section] label.sizeToFit() headerView.addSubview(label) @@ -106,7 +127,10 @@ extension UserViewController:UITableViewDelegate,UITableViewDataSource{ image.image = #imageLiteral(resourceName: "arrow") image.isUserInteractionEnabled = true var angle:Double = 0 - if !isCloseHistoryList{ + if !isCloseHistoryList && section == 0{ + angle = M_PI_2 + } + if !isCloseMyResource && section == 1{ angle = M_PI_2 } image.transform = CGAffineTransform(rotationAngle: CGFloat(angle)) @@ -115,7 +139,7 @@ extension UserViewController:UITableViewDelegate,UITableViewDataSource{ let line = UILabel(frame: CGRect(x: 0, y: headerView.frame.height-1, width: getScreenWidth(), height: 1)) line.backgroundColor = historyList.backgroundColor headerView.addSubview(line) - + headerView.tag = 200+section headerView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(UserViewController.headerTap(tap:)))) return headerView } @@ -128,8 +152,6 @@ extension UserViewController:UITableViewDelegate,UITableViewDataSource{ return 1 } - - } class UserCenterHistoryCell:UITableViewCell{ -- libgit2 0.21.0