diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift index 2c20f70..2ebd3d5 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift @@ -22,6 +22,7 @@ class ChangePassWordViewController: UIViewController { @IBOutlet weak var agrenPasswordTextFiled: UITextField! @IBOutlet weak var userCodeTextFiled: UITextField! + @IBOutlet var cancleItem: UIBarButtonItem! var scrollViewH:CGFloat = 200 var user = AppDelegate.instance().accountManager @@ -29,13 +30,20 @@ class ChangePassWordViewController: UIViewController { self.view.endEditing(true) } + @IBAction func cancleAction(_ sender: UIBarButtonItem) { + self.dismiss(animated: true, completion: nil) + } override func viewDidLoad() { super.viewDidLoad() if user.isOnline() { + self.navigationItem.rightBarButtonItem=nil phonrView.isHidden=true phoneViewHeight.constant=0 scrollViewH=150 }else{ + self.configTheme() + self.title="忘记密码" + self.navigationItem.rightBarButtonItem=cancleItem phonrView.isHidden=false phoneViewHeight.constant=50 scrollViewH=200 @@ -71,23 +79,24 @@ class ChangePassWordViewController: UIViewController { if user.isOnline() { phone=user.phone() }else{ - phone=passwordTextFiled.text! + phone=userPhoneTextFiled.text! } SVProgressHUD.show(withStatus: "修改密码...") SVProgressHUD.setDefaultMaskType(.black) - let parameters:Dictionary<String,AnyObject>=["f_Account":user.account() as AnyObject, - "f_Mobile":phone as AnyObject, - "f_UserPassword":passwordTextFiled.text! as AnyObject, - "f_VerCode":userCodeTextFiled.text! as AnyObject] + let parameters:Dictionary<String,AnyObject>=["mobile":phone as AnyObject, + "password":passwordTextFiled.text!.md5() as AnyObject, + "vercode":userCodeTextFiled.text! as AnyObject] AppDelegate.instance().httpServer.getUpdatePassword(parameters: parameters) { (str, error) in SVProgressHUD.dismiss() if error==nil { if JSON.fromString(jsonString: str)!["status"].intValue == 1{ httpJsonResule(jsonString: str, error: error, successHandler: { (json) in if !self.user.isOnline() { - NotificationCenter.default.post(name: NSNotification.Name(rawValue: "refreshLoginUser"), object: self.passwordTextFiled.text!) + NotificationCenter.default.post(name: NSNotification.Name(rawValue: "refreshLoginUser"), object: phone) + self.dismiss(animated: true, completion: nil) + }else{ + self.navigationController!.popViewController(animated: true) } - self.navigationController!.popViewController(animated: true) AppDelegate.instance().window?.makeToast("修改成功") }, failHandler: { (error) in self.view.makeToast("修改失败") diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard index 9daa306..21c40ab 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard @@ -260,10 +260,10 @@ </objects> <point key="canvasLocation" x="1509.5999999999999" y="-131.78410794602701"/> </scene> - <!--Change Pass Word View Controller--> + <!--忘记密码--> <scene sceneID="opx-Sc-v2W"> <objects> - <viewController storyboardIdentifier="ChangePassWordViewControllerVC" id="HIn-e8-Pzh" customClass="ChangePassWordViewController" customModule="YouerLiveVideo" customModuleProvider="target" sceneMemberID="viewController"> + <viewController storyboardIdentifier="ChangePassWordViewControllerVC" automaticallyAdjustsScrollViewInsets="NO" id="HIn-e8-Pzh" customClass="ChangePassWordViewController" customModule="YouerLiveVideo" customModuleProvider="target" sceneMemberID="viewController"> <layoutGuides> <viewControllerLayoutGuide type="top" id="fMj-B9-eEF"/> <viewControllerLayoutGuide type="bottom" id="Gxk-Dg-G3D"/> @@ -281,8 +281,8 @@ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="PPf-BI-ZxE"> <rect key="frame" x="0.0" y="100" width="375" height="50"/> <subviews> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请重复您输入的新密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Qzh-5W-Fdl"> - <rect key="frame" x="20" y="16.5" width="335" height="17"/> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请重复您输入的新密码" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="Qzh-5W-Fdl"> + <rect key="frame" x="20" y="15.5" width="335" height="19"/> <nil key="textColor"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits"/> @@ -315,8 +315,8 @@ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="YjI-UW-Ova"> <rect key="frame" x="0.0" y="150" width="375" height="50"/> <subviews> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入您收到的验证码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="dtg-hq-Nhp"> - <rect key="frame" x="20" y="17" width="147" height="17"/> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入您收到的验证码" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="dtg-hq-Nhp"> + <rect key="frame" x="20" y="16" width="246" height="19"/> <nil key="textColor"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits" keyboardType="numberPad"/> @@ -340,6 +340,12 @@ <state key="normal" title=" 获取验证码 "> <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> </state> + <userDefinedRuntimeAttributes> + <userDefinedRuntimeAttribute type="boolean" keyPath="layer.masksToBounds" value="YES"/> + <userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius"> + <integer key="value" value="5"/> + </userDefinedRuntimeAttribute> + </userDefinedRuntimeAttributes> <connections> <action selector="sendUserCodeBtnClick:" destination="HIn-e8-Pzh" eventType="touchUpInside" id="Hmd-rM-a0h"/> </connections> @@ -361,8 +367,8 @@ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DSL-73-rUm"> <rect key="frame" x="0.0" y="50" width="375" height="50"/> <subviews> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入新密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="KOX-8X-bEC"> - <rect key="frame" x="20" y="17" width="335" height="17"/> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入新密码" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="KOX-8X-bEC"> + <rect key="frame" x="20" y="16" width="335" height="19"/> <nil key="textColor"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits"/> @@ -395,8 +401,8 @@ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="b6X-Hs-kwP"> <rect key="frame" x="0.0" y="0.0" width="375" height="50"/> <subviews> - <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入新密码" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="bQy-pc-aag"> - <rect key="frame" x="20" y="17" width="335" height="17"/> + <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入手机号" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="bQy-pc-aag"> + <rect key="frame" x="20" y="16" width="335" height="19"/> <nil key="textColor"/> <fontDescription key="fontDescription" type="system" pointSize="14"/> <textInputTraits key="textInputTraits"/> @@ -513,8 +519,16 @@ <action selector="editKeyboard:" destination="HIn-e8-Pzh" eventType="touchUpInside" id="Gqe-4a-Nym"/> </connections> </view> + <navigationItem key="navigationItem" title="忘记密码" id="kn3-BP-XrH"> + <barButtonItem key="rightBarButtonItem" title="取消" id="Qjp-nS-fi2"> + <connections> + <action selector="cancleAction:" destination="HIn-e8-Pzh" id="TkS-G8-Iyw"/> + </connections> + </barButtonItem> + </navigationItem> <connections> <outlet property="agrenPasswordTextFiled" destination="Qzh-5W-Fdl" id="NIs-ap-xHZ"/> + <outlet property="cancleItem" destination="Qjp-nS-fi2" id="gIx-W1-0Kq"/> <outlet property="contentSizeHeight" destination="lat-Tj-mho" id="3Ro-l4-uWu"/> <outlet property="passwordTextFiled" destination="KOX-8X-bEC" id="Rd7-u2-mLM"/> <outlet property="phoneViewHeight" destination="xsq-cP-2jd" id="yza-R9-2EJ"/> @@ -527,7 +541,7 @@ </viewController> <placeholder placeholderIdentifier="IBFirstResponder" id="kXj-Be-3l7" userLabel="First Responder" sceneMemberID="firstResponder"/> </objects> - <point key="canvasLocation" x="776.79999999999995" y="550.97451274362822"/> + <point key="canvasLocation" x="1716" y="550.97451274362822"/> </scene> <!--History View Controller--> <scene sceneID="U2w-Je-5CE"> @@ -619,5 +633,23 @@ </objects> <point key="canvasLocation" x="2237.5999999999999" y="-131.78410794602701"/> </scene> + <!--Navigation Controller--> + <scene sceneID="i2G-X9-4tF"> + <objects> + <navigationController storyboardIdentifier="ForgetPasswordNVC" automaticallyAdjustsScrollViewInsets="NO" id="Bvh-GB-Vld" sceneMemberID="viewController"> + <toolbarItems/> + <navigationBar key="navigationBar" contentMode="scaleToFill" id="Xw0-eG-MuP"> + <rect key="frame" x="0.0" y="0.0" width="375" height="44"/> + <autoresizingMask key="autoresizingMask"/> + </navigationBar> + <nil name="viewControllers"/> + <connections> + <segue destination="HIn-e8-Pzh" kind="relationship" relationship="rootViewController" id="4I7-9a-ckQ"/> + </connections> + </navigationController> + <placeholder placeholderIdentifier="IBFirstResponder" id="iPu-LA-mtp" userLabel="First Responder" sceneMemberID="firstResponder"/> + </objects> + <point key="canvasLocation" x="776.79999999999995" y="550.97451274362822"/> + </scene> </scenes> </document> diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard index 86e2b6b..483c534 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/Login.storyboard @@ -78,7 +78,7 @@ </imageView> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入账号" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="IzH-dB-I9H"> <rect key="frame" x="36" y="18.5" width="339" height="19"/> - <fontDescription key="fontDescription" type="system" pointSize="13"/> + <fontDescription key="fontDescription" type="system" pointSize="15"/> <textInputTraits key="textInputTraits" keyboardType="numberPad"/> <connections> <outlet property="delegate" destination="fvc-9c-Gca" id="l7n-F4-FsF"/> @@ -120,7 +120,7 @@ </imageView> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入密码" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="nVn-EA-yWM"> <rect key="frame" x="36" y="18.5" width="339" height="19"/> - <fontDescription key="fontDescription" type="system" pointSize="13"/> + <fontDescription key="fontDescription" type="system" pointSize="15"/> <textInputTraits key="textInputTraits" secureTextEntry="YES"/> <connections> <outlet property="delegate" destination="fvc-9c-Gca" id="tMS-9N-o09"/> @@ -175,7 +175,7 @@ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pzO-1N-Vrz"> <rect key="frame" x="16" y="182" width="343" height="30"/> <subviews> - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="设置密码或找回密码" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v6n-Br-sBy"> + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="忘记密码或找回密码" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v6n-Br-sBy"> <rect key="frame" x="0.0" y="0.0" width="119.5" height="30"/> <fontDescription key="fontDescription" type="system" pointSize="13"/> <nil key="highlightedColor"/> @@ -185,29 +185,51 @@ <fontDescription key="fontDescription" type="system" pointSize="13"/> <nil key="highlightedColor"/> </label> - <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ps0-yz-uMV"> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="T7C-vv-Dor"> <rect key="frame" x="0.0" y="0.0" width="343" height="30"/> - <fontDescription key="fontDescription" type="system" pointSize="13"/> - <state key="normal"> - <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> - </state> - <connections> - <action selector="registerBtnClickAction:" destination="fvc-9c-Gca" eventType="touchUpInside" id="joQ-gk-ZzE"/> - </connections> - </button> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ps0-yz-uMV"> + <rect key="frame" x="171.5" y="0.0" width="171.5" height="30"/> + <fontDescription key="fontDescription" type="system" pointSize="13"/> + <state key="normal"> + <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> + </state> + <connections> + <action selector="registerBtnClickAction:" destination="fvc-9c-Gca" eventType="touchUpInside" id="joQ-gk-ZzE"/> + </connections> + </button> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xaX-gZ-zWh"> + <rect key="frame" x="0.0" y="0.0" width="171.5" height="30"/> + <connections> + <action selector="returnPassword:" destination="fvc-9c-Gca" eventType="touchUpInside" id="WCg-Bw-Rh0"/> + </connections> + </button> + </subviews> + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> + <constraints> + <constraint firstAttribute="bottom" secondItem="xaX-gZ-zWh" secondAttribute="bottom" id="6fF-FD-MJB"/> + <constraint firstItem="ps0-yz-uMV" firstAttribute="leading" secondItem="xaX-gZ-zWh" secondAttribute="trailing" id="Dys-kN-Wuj"/> + <constraint firstAttribute="bottom" secondItem="ps0-yz-uMV" secondAttribute="bottom" id="ONw-ic-gJh"/> + <constraint firstItem="xaX-gZ-zWh" firstAttribute="leading" secondItem="T7C-vv-Dor" secondAttribute="leading" id="SgW-zP-wM4"/> + <constraint firstItem="ps0-yz-uMV" firstAttribute="top" secondItem="T7C-vv-Dor" secondAttribute="top" id="YrN-s2-zsD"/> + <constraint firstItem="xaX-gZ-zWh" firstAttribute="top" secondItem="T7C-vv-Dor" secondAttribute="top" id="bZG-zy-wj2"/> + <constraint firstAttribute="trailing" secondItem="ps0-yz-uMV" secondAttribute="trailing" id="mbh-g5-oXR"/> + <constraint firstItem="ps0-yz-uMV" firstAttribute="width" secondItem="T7C-vv-Dor" secondAttribute="width" multiplier="1:2" id="qcM-tG-rkH"/> + </constraints> + </view> </subviews> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <constraints> - <constraint firstItem="ps0-yz-uMV" firstAttribute="top" secondItem="pzO-1N-Vrz" secondAttribute="top" id="7G1-mO-jQj"/> <constraint firstAttribute="trailing" secondItem="7fx-1i-VwW" secondAttribute="trailing" id="8ot-xx-BFo"/> <constraint firstAttribute="bottom" secondItem="7fx-1i-VwW" secondAttribute="bottom" id="Byb-9b-kOd"/> + <constraint firstAttribute="trailing" secondItem="T7C-vv-Dor" secondAttribute="trailing" id="KF5-RM-Ush"/> + <constraint firstItem="T7C-vv-Dor" firstAttribute="leading" secondItem="pzO-1N-Vrz" secondAttribute="leading" id="Owr-Ww-G6p"/> <constraint firstAttribute="height" constant="30" id="TT4-WL-hYa"/> <constraint firstItem="7fx-1i-VwW" firstAttribute="top" secondItem="pzO-1N-Vrz" secondAttribute="top" id="VzP-hc-s7a"/> - <constraint firstAttribute="bottom" secondItem="ps0-yz-uMV" secondAttribute="bottom" id="d8H-p3-iy8"/> - <constraint firstAttribute="trailing" secondItem="ps0-yz-uMV" secondAttribute="trailing" id="eo1-LL-5jy"/> + <constraint firstAttribute="bottom" secondItem="T7C-vv-Dor" secondAttribute="bottom" id="dPD-d5-Eqe"/> <constraint firstAttribute="bottom" secondItem="v6n-Br-sBy" secondAttribute="bottom" id="gbJ-jU-WFB"/> + <constraint firstItem="T7C-vv-Dor" firstAttribute="top" secondItem="pzO-1N-Vrz" secondAttribute="top" id="hCd-Ju-trB"/> <constraint firstItem="v6n-Br-sBy" firstAttribute="top" secondItem="pzO-1N-Vrz" secondAttribute="top" id="hj5-hs-ep4"/> - <constraint firstItem="ps0-yz-uMV" firstAttribute="leading" secondItem="pzO-1N-Vrz" secondAttribute="leading" id="uJt-wq-oTh"/> <constraint firstItem="v6n-Br-sBy" firstAttribute="leading" secondItem="pzO-1N-Vrz" secondAttribute="leading" id="xdM-JA-UcQ"/> </constraints> </view> diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/LoginViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/LoginViewController.swift index 78bdb63..ce1205d 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/LoginViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserCenter/LoginViewController.swift @@ -129,6 +129,10 @@ class LoginViewController: UIViewController,UITextFieldDelegate { let vc = UIStoryboard(name: "Login", bundle: nil).instantiateViewController(withIdentifier: "RegisterViewControllerNV") self.present(vc, animated: true, completion: nil) } + @IBAction func returnPassword(_ sender: UIButton) { + let vc = Story.instantiateViewControllerWithIdentifier("ForgetPasswordNVC", storyName: "User") + self.present(vc!, animated: true, completion: nil) + } //键盘监听 func keyboardWIllChange(noti: NSNotification){ let userInfo:NSDictionary=noti.userInfo! as NSDictionary -- libgit2 0.21.0