Commit 3348440c40dfe5504c45f88aec576fedd6ba42a5
Exists in
newLive
Merge branch 'newLive' of http://git.shunzhi.net/iosgroup/newlive into newLive
# Conflicts: # YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard # YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/NewLoginViewController.swift
Showing
10 changed files
with
54 additions
and
61 deletions
Show diff stats
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/HomePage.storyboard
... | ... | @@ -48,10 +48,7 @@ |
48 | 48 | </constraints> |
49 | 49 | </imageView> |
50 | 50 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ss9-IN-p7o"> |
51 | - <rect key="frame" x="331" y="0.0" width="44" height="44"/> | |
52 | - <constraints> | |
53 | - <constraint firstAttribute="width" constant="44" id="i7f-rP-uMp"/> | |
54 | - </constraints> | |
51 | + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> | |
55 | 52 | <connections> |
56 | 53 | <action selector="openOrCloseAction:" destination="cns-vb-pIQ" eventType="touchUpInside" id="pnJ-fx-YyR"/> |
57 | 54 | </connections> |
... | ... | @@ -66,6 +63,7 @@ |
66 | 63 | <constraint firstAttribute="trailing" secondItem="ss9-IN-p7o" secondAttribute="trailing" id="aAO-V3-sgD"/> |
67 | 64 | <constraint firstItem="ss9-IN-p7o" firstAttribute="top" secondItem="ckB-W3-VJE" secondAttribute="top" id="bxF-ra-1Fc"/> |
68 | 65 | <constraint firstItem="SaW-7O-OkT" firstAttribute="centerY" secondItem="ckB-W3-VJE" secondAttribute="centerY" id="ne0-jg-T5L"/> |
66 | + <constraint firstItem="ss9-IN-p7o" firstAttribute="leading" secondItem="ckB-W3-VJE" secondAttribute="leading" id="paD-hI-EiW"/> | |
69 | 67 | <constraint firstItem="SaW-7O-OkT" firstAttribute="leading" secondItem="ckB-W3-VJE" secondAttribute="leading" constant="18" id="wS7-H2-6Hb"/> |
70 | 68 | </constraints> |
71 | 69 | </view> | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/HomePage/MainHomeTableViewController.swift
... | ... | @@ -108,6 +108,7 @@ class MainHomeTableViewController: UITableViewController { |
108 | 108 | } |
109 | 109 | */ |
110 | 110 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
111 | + let user=AppDelegate.instance().accountManager | |
111 | 112 | if indexPath.row==0{ |
112 | 113 | //排行 |
113 | 114 | let vc = UIStoryboard(name: "HomePage", bundle: nil).instantiateViewController(withIdentifier: "RankingTableViewController") as! RankingTableViewController |
... | ... | @@ -118,7 +119,11 @@ class MainHomeTableViewController: UITableViewController { |
118 | 119 | self.tabBarController?.selectedIndex=2 |
119 | 120 | }else if indexPath.row==2{ |
120 | 121 | //资源 |
121 | - self.tabBarController?.selectedIndex=1 | |
122 | + if user.isOnline() && (user.roletype()==1 || user.roletype()==2 || user.roletype()==6){ | |
123 | + self.tabBarController?.selectedIndex=1 | |
124 | + }else{ | |
125 | + AppDelegate.instance().window?.makeToast("无权限查看资源") | |
126 | + } | |
122 | 127 | }else{ |
123 | 128 | //校园电视台 |
124 | 129 | self.tabBarController?.selectedIndex=3 |
... | ... | @@ -345,11 +350,15 @@ class HomeThirdTableViewCell: UITableViewCell,UICollectionViewDelegate,UICollect |
345 | 350 | } |
346 | 351 | } |
347 | 352 | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
353 | + let user=AppDelegate.instance().accountManager | |
348 | 354 | //点击下载并打开资源文档 |
349 | - let download = DownLoad.share | |
350 | - download.superVC = ((appRootViewController().childViewControllers[0] as! MViewController).selectedViewController as! UINavigationController).viewControllers[0] | |
351 | - download.downLoadWithUrl(url: dataSet[indexPath.row].f_ResourceUrl) | |
352 | - | |
355 | + if user.isOnline() && (user.roletype()==1 || user.roletype()==2 || user.roletype()==6){ | |
356 | + let download = DownLoad.share | |
357 | + download.superVC = ((appRootViewController().childViewControllers[0] as! MViewController).selectedViewController as! UINavigationController).viewControllers[0] | |
358 | + download.downLoadWithUrl(url: dataSet[indexPath.row].f_ResourceUrl) | |
359 | + }else{ | |
360 | + AppDelegate.instance().window?.makeToast("无权限查看资源") | |
361 | + } | |
353 | 362 | } |
354 | 363 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { |
355 | 364 | return CGSize(width: (getScreenWidth()-40)/3, height: (getScreenWidth()-40)/3+105.5) | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/LeadViewController.swift
... | ... | @@ -8,7 +8,8 @@ |
8 | 8 | |
9 | 9 | import UIKit |
10 | 10 | |
11 | -class LeadViewController: UIViewController { | |
11 | +class LeadViewController: UIViewController,UITabBarControllerDelegate { | |
12 | + let user=AppDelegate.instance().accountManager | |
12 | 13 | static var instance:LeadViewController! |
13 | 14 | override func viewDidLoad() { |
14 | 15 | super.viewDidLoad() |
... | ... | @@ -20,9 +21,22 @@ class LeadViewController: UIViewController { |
20 | 21 | // showLogin() |
21 | 22 | // } |
22 | 23 | } |
24 | + func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { | |
25 | + if user.isOnline() && (user.roletype()==1 || user.roletype()==2 || user.roletype()==6){ | |
26 | + return true | |
27 | + }else{ | |
28 | + if viewController.title=="资源"{ | |
29 | + AppDelegate.instance().window?.makeToast("无权限查看资源") | |
30 | + return false | |
31 | + }else{ | |
32 | + return true | |
33 | + } | |
34 | + } | |
35 | + } | |
23 | 36 | func showMain() { |
24 | 37 | removeAll() |
25 | - let vc=Story.instantiateViewControllerWithIdentifier("MViewController", storyName: "Main")! | |
38 | + let vc=Story.instantiateViewControllerWithIdentifier("MViewController", storyName: "Main") as! MViewController | |
39 | + vc.delegate=self | |
26 | 40 | displayContentController(content: vc) |
27 | 41 | } |
28 | 42 | func showLogin() { | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/MViewController.swift
YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift
... | ... | @@ -22,29 +22,22 @@ class ChangePassWordViewController: UIViewController { |
22 | 22 | @IBOutlet weak var agrenPasswordTextFiled: UITextField! |
23 | 23 | @IBOutlet weak var userCodeTextFiled: UITextField! |
24 | 24 | |
25 | - @IBOutlet var cancleItem: UIBarButtonItem! | |
26 | 25 | var timer:Timer! |
27 | 26 | var scrollViewH:CGFloat = 200 |
28 | 27 | var user = AppDelegate.instance().accountManager |
29 | 28 | @IBAction func editKeyboard(_ sender: Any) { |
30 | 29 | self.view.endEditing(true) |
31 | 30 | } |
32 | - | |
33 | - @IBAction func cancleAction(_ sender: UIBarButtonItem) { | |
34 | - self.dismiss(animated: true, completion: nil) | |
35 | - } | |
36 | 31 | override func viewDidLoad() { |
37 | 32 | super.viewDidLoad() |
38 | 33 | if user.isOnline() { |
39 | 34 | self.title="密码修改" |
40 | - self.navigationItem.rightBarButtonItem=nil | |
41 | 35 | phonrView.isHidden=true |
42 | 36 | phoneViewHeight.constant=0 |
43 | 37 | scrollViewH=150 |
44 | 38 | }else{ |
45 | 39 | self.configTheme() |
46 | 40 | self.title="忘记密码" |
47 | - self.navigationItem.rightBarButtonItem=cancleItem | |
48 | 41 | phonrView.isHidden=false |
49 | 42 | phoneViewHeight.constant=50 |
50 | 43 | scrollViewH=200 |
... | ... | @@ -94,10 +87,8 @@ class ChangePassWordViewController: UIViewController { |
94 | 87 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in |
95 | 88 | if !self.user.isOnline() { |
96 | 89 | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "refreshLoginUser"), object: phone) |
97 | - self.dismiss(animated: true, completion: nil) | |
98 | - }else{ | |
99 | - self.navigationController!.popViewController(animated: true) | |
100 | 90 | } |
91 | + self.navigationController!.popViewController(animated: true) | |
101 | 92 | AppDelegate.instance().window?.makeToast("修改成功") |
102 | 93 | }, failHandler: { (error) in |
103 | 94 | self.view.makeToast("修改失败") |
... | ... | @@ -111,7 +102,6 @@ class ChangePassWordViewController: UIViewController { |
111 | 102 | |
112 | 103 | @IBAction func sendUserCodeBtnClick(_ sender: UIButton) { |
113 | 104 | self.view.endEditing(true) |
114 | - timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ChangePassWordViewController.timerFire), userInfo: sender, repeats: true) | |
115 | 105 | var phone = "" |
116 | 106 | if user.isOnline(){ |
117 | 107 | phone = user.phone() |
... | ... | @@ -130,6 +120,7 @@ class ChangePassWordViewController: UIViewController { |
130 | 120 | if JSON.fromString(jsonString: str)!["status"].intValue == 1{ |
131 | 121 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in |
132 | 122 | self.view.makeToast("验证码发送成功") |
123 | + self.timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(ChangePassWordViewController.timerFire), userInfo: sender, repeats: true) | |
133 | 124 | }, failHandler: { (error) in |
134 | 125 | self.view.makeToast("验证码发送失败:\(error.localizedDescription)") |
135 | 126 | }) | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
2 | +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="15G1217" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |
3 | 3 | <device id="retina4_7" orientation="portrait"> |
4 | 4 | <adaptation id="fullscreen"/> |
5 | 5 | </device> |
... | ... | @@ -523,16 +523,9 @@ |
523 | 523 | <action selector="editKeyboard:" destination="HIn-e8-Pzh" eventType="touchUpInside" id="Gqe-4a-Nym"/> |
524 | 524 | </connections> |
525 | 525 | </view> |
526 | - <navigationItem key="navigationItem" title="忘记密码" id="kn3-BP-XrH"> | |
527 | - <barButtonItem key="rightBarButtonItem" title="取消" id="Qjp-nS-fi2"> | |
528 | - <connections> | |
529 | - <action selector="cancleAction:" destination="HIn-e8-Pzh" id="TkS-G8-Iyw"/> | |
530 | - </connections> | |
531 | - </barButtonItem> | |
532 | - </navigationItem> | |
526 | + <navigationItem key="navigationItem" title="忘记密码" id="kn3-BP-XrH"/> | |
533 | 527 | <connections> |
534 | 528 | <outlet property="agrenPasswordTextFiled" destination="Qzh-5W-Fdl" id="NIs-ap-xHZ"/> |
535 | - <outlet property="cancleItem" destination="Qjp-nS-fi2" id="gIx-W1-0Kq"/> | |
536 | 529 | <outlet property="contentSizeHeight" destination="lat-Tj-mho" id="3Ro-l4-uWu"/> |
537 | 530 | <outlet property="passwordTextFiled" destination="KOX-8X-bEC" id="Rd7-u2-mLM"/> |
538 | 531 | <outlet property="phoneViewHeight" destination="xsq-cP-2jd" id="yza-R9-2EJ"/> | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard
... | ... | @@ -729,13 +729,7 @@ |
729 | 729 | <outletCollection property="gestureRecognizers" destination="ZEf-mm-u9e" appends="YES" id="Gmm-Kb-eQb"/> |
730 | 730 | </connections> |
731 | 731 | </view> |
732 | - <navigationItem key="navigationItem" title="注册" id="VWP-v7-Qoc"> | |
733 | - <barButtonItem key="rightBarButtonItem" title="取消" id="Okk-g0-Rwk"> | |
734 | - <connections> | |
735 | - <action selector="cancleAction:" destination="tCx-JF-YJm" id="ypG-ks-rG6"/> | |
736 | - </connections> | |
737 | - </barButtonItem> | |
738 | - </navigationItem> | |
732 | + <navigationItem key="navigationItem" title="注册" id="VWP-v7-Qoc"/> | |
739 | 733 | <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> |
740 | 734 | <size key="freeformSize" width="375" height="667"/> |
741 | 735 | <connections> |
... | ... | @@ -787,10 +781,10 @@ |
787 | 781 | </objects> |
788 | 782 | <point key="canvasLocation" x="-2162.4000000000001" y="1533.2833583208396"/> |
789 | 783 | </scene> |
790 | - <!--New Login View Controller--> | |
784 | + <!--登录--> | |
791 | 785 | <scene sceneID="j0h-zV-7K8"> |
792 | 786 | <objects> |
793 | - <viewController storyboardIdentifier="NewLoginViewControllerVC" id="7YD-gA-dLJ" customClass="NewLoginViewController" customModule="YouerLiveVideo" customModuleProvider="target" sceneMemberID="viewController"> | |
787 | + <viewController storyboardIdentifier="NewLoginViewControllerVC" hidesBottomBarWhenPushed="YES" id="7YD-gA-dLJ" customClass="NewLoginViewController" customModule="YouerLiveVideo" customModuleProvider="target" sceneMemberID="viewController"> | |
794 | 788 | <layoutGuides> |
795 | 789 | <viewControllerLayoutGuide type="top" id="Hx8-x7-gQe"/> |
796 | 790 | <viewControllerLayoutGuide type="bottom" id="eS2-l5-mzB"/> |
... | ... | @@ -956,7 +950,7 @@ |
956 | 950 | <color key="titleColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
957 | 951 | </state> |
958 | 952 | <connections> |
959 | - <action selector="activatiAction:" destination="7YD-gA-dLJ" eventType="touchUpInside" id="U3q-J4-Ag3"/> | |
953 | + <action selector="forgetPassword:" destination="7YD-gA-dLJ" eventType="touchUpInside" id="y4v-x3-3Yo"/> | |
960 | 954 | </connections> |
961 | 955 | </button> |
962 | 956 | <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="right" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="vmw-Ug-eCf"> |
... | ... | @@ -970,7 +964,7 @@ |
970 | 964 | <color key="titleColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> |
971 | 965 | </state> |
972 | 966 | <connections> |
973 | - <action selector="returnAction:" destination="7YD-gA-dLJ" eventType="touchUpInside" id="OEZ-Z3-zKh"/> | |
967 | + <action selector="registerAccount:" destination="7YD-gA-dLJ" eventType="touchUpInside" id="1N1-9k-yxY"/> | |
974 | 968 | </connections> |
975 | 969 | </button> |
976 | 970 | </subviews> |
... | ... | @@ -1014,6 +1008,8 @@ |
1014 | 1008 | <constraint firstItem="eS2-l5-mzB" firstAttribute="top" secondItem="zyE-vu-SeI" secondAttribute="bottom" id="Uh1-h1-vQ4"/> |
1015 | 1009 | </constraints> |
1016 | 1010 | </view> |
1011 | + <navigationItem key="navigationItem" title="登录" id="xGB-lk-WD2"/> | |
1012 | + <simulatedNavigationBarMetrics key="simulatedTopBarMetrics" prompted="NO"/> | |
1017 | 1013 | <connections> |
1018 | 1014 | <outlet property="buttonLogin" destination="d0Y-Gl-m8Z" id="QDU-R3-RGe"/> |
1019 | 1015 | <outlet property="constraintContentOffset" destination="MqN-UP-SP0" id="dpa-vk-fx3"/> | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/NewLoginViewController.swift
... | ... | @@ -19,8 +19,6 @@ class NewLoginViewController: UIViewController,UITextFieldDelegate { |
19 | 19 | constraintContentOffset.constant=20 |
20 | 20 | view.backgroundColor=UIColorFromRGB(0xf7f7f7) |
21 | 21 | Theme.configButton(buttonLogin) |
22 | - let lastAccount=Setting.getString("lastAccountNumber") | |
23 | - fieldAccount.text=lastAccount | |
24 | 22 | } |
25 | 23 | override func viewWillAppear(_ animated: Bool) { |
26 | 24 | super.viewWillAppear(animated) |
... | ... | @@ -116,15 +114,13 @@ class NewLoginViewController: UIViewController,UITextFieldDelegate { |
116 | 114 | return true |
117 | 115 | } |
118 | 116 | |
119 | - @IBAction func activatiAction(_ sender: UIButton) { | |
120 | - let vc = Story.instantiateViewControllerWithIdentifier("ChangePassWordViewControllerVC", storyName: "User") as! ChangePassWordViewController | |
121 | - self.present(vc.wrapWithNavigationController(), animated: true, completion: nil) | |
117 | + @IBAction func forgetPassword(_ sender: UIButton) { | |
118 | + let vc = Story.instantiateViewControllerWithIdentifier("ChangePassWordViewControllerVC", storyName: "User") as! ChangePassWordViewController | |
119 | + self.navigationController?.pushViewController(vc, animated: true) | |
122 | 120 | } |
123 | - | |
124 | - @IBAction func returnAction(_ sender: UIButton) { | |
121 | + @IBAction func registerAccount(_ sender: UIButton) { | |
125 | 122 | let vc = UIStoryboard(name: "Login", bundle: nil).instantiateViewController(withIdentifier: "RegisterViewControllerVC") as! RegisterViewController |
126 | - self.present(vc.wrapWithNavigationController(), animated: true, completion: nil) | |
127 | - | |
123 | + self.navigationController!.pushViewController(vc, animated: true) | |
128 | 124 | } |
129 | 125 | |
130 | 126 | func keyboardWillShow(){ | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/RegisterViewController.swift
... | ... | @@ -56,7 +56,6 @@ class RegisterViewController: UIViewController,UIAlertViewDelegate,UIImagePicker |
56 | 56 | if (phoneNumber.text?.isMobilePhoneNumber())! { |
57 | 57 | SVProgressHUD.show(withStatus: "获取验证码...") |
58 | 58 | SVProgressHUD.setDefaultMaskType(.black) |
59 | - timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(RegisterViewController.timerFire), userInfo: sender, repeats: true) | |
60 | 59 | |
61 | 60 | AppDelegate.instance().httpServer.getChangePhoneCaptcha(mobile: phoneNumber.text!, completionHandler: { (str, error) in |
62 | 61 | SVProgressHUD.dismiss() |
... | ... | @@ -64,6 +63,8 @@ class RegisterViewController: UIViewController,UIAlertViewDelegate,UIImagePicker |
64 | 63 | if JSON.fromString(jsonString: str)!["status"].intValue == 1{ |
65 | 64 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in |
66 | 65 | self.view.makeToast("验证码发送成功") |
66 | + self.timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(RegisterViewController.timerFire), userInfo: sender, repeats: true) | |
67 | + | |
67 | 68 | self.nikeNameTextFiled.isUserInteractionEnabled=false |
68 | 69 | self.phoneNumber.isUserInteractionEnabled=false |
69 | 70 | self.passwordTextField.isUserInteractionEnabled=false |
... | ... | @@ -106,7 +107,7 @@ class RegisterViewController: UIViewController,UIAlertViewDelegate,UIImagePicker |
106 | 107 | if error==nil { |
107 | 108 | if JSON.fromString(jsonString: str)!["status"].intValue == 1{ |
108 | 109 | httpJsonResule(jsonString: str, error: error, successHandler: { (json) in |
109 | - self.navigationController!.dismiss(animated: true, completion: nil) | |
110 | + self.navigationController!.popViewController(animated: true) | |
110 | 111 | AppDelegate.instance().window?.makeToast("注册成功") |
111 | 112 | NotificationCenter.default.post(name: NSNotification.Name(rawValue: "refreshLoginUser"), object: self.phoneNumber.text!) |
112 | 113 | //是否登录 |
... | ... | @@ -143,10 +144,7 @@ class RegisterViewController: UIViewController,UIAlertViewDelegate,UIImagePicker |
143 | 144 | } |
144 | 145 | |
145 | 146 | @IBAction func loginBtnClickAction(_ sender: AnyObject) { |
146 | - self.navigationController!.dismiss(animated: true, completion: nil) | |
147 | - } | |
148 | - @IBAction func cancleAction(_ sender: UIBarButtonItem) { | |
149 | - self.navigationController!.dismiss(animated: true, completion: nil) | |
147 | + self.navigationController!.popViewController(animated: true) | |
150 | 148 | } |
151 | 149 | |
152 | 150 | @IBAction func nickNameSetTapAction(_ sender: AnyObject) { | ... | ... |
YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift
... | ... | @@ -49,9 +49,8 @@ class UserViewController: UIViewController { |
49 | 49 | self.navigationController?.pushViewController(vc, animated: true) |
50 | 50 | }else{ |
51 | 51 | let vc=Story.instantiateViewControllerWithIdentifier("NewLoginViewControllerVC", storyName: "Login") as! NewLoginViewController |
52 | - self.present(vc, animated: true, completion: nil) | |
52 | + self.navigationController?.pushViewController(vc, animated: true) | |
53 | 53 | } |
54 | - | |
55 | 54 | } |
56 | 55 | |
57 | 56 | func editBtnClick(){ | ... | ... |