diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/Contents.json b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/Contents.json index 9685119..73b19ca 100644 --- a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/Contents.json +++ b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/Contents.json @@ -6,7 +6,7 @@ }, { "idiom" : "universal", - "filename" : "开始.png", + "filename" : "bofang.png", "scale" : "2x" }, { diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/bofang.png b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/bofang.png new file mode 100644 index 0000000..633aa21 Binary files /dev/null and b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/bofang.png differ diff --git a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/开始.png b/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/开始.png deleted file mode 100644 index 309e61c..0000000 Binary files a/YouerLiveVideo/YouerLiveVideo/Assets.xcassets/starLive.imageset/开始.png and /dev/null differ diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift index ffee5a5..50053b4 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/ExcellentTVViewController.swift @@ -10,6 +10,8 @@ import UIKit import AVKit class ExcellentTVViewController: UIViewController { + @IBOutlet weak var collectionHeight: NSLayoutConstraint! + @IBOutlet weak var ContentSizeHeight: NSLayoutConstraint! @IBOutlet weak var AllTitleView: UIView! var isForbidScrollDelegate:Bool = true var startOffsetX:CGFloat = 0 @@ -22,6 +24,7 @@ class ExcellentTVViewController: UIViewController { var classSelectBtn:Int = 0 override func viewDidLoad() { super.viewDidLoad() + self.automaticallyAdjustsScrollViewInsets = false AppDelegate.instance().httpServer.getTelevisionStationCatagory(parameters: nil) { (str, error) in httpJsonResule(jsonString: str, error: error, successHandler: { (json) in for item in json.contentData().arrayValue{ @@ -211,6 +214,8 @@ extension ExcellentTVViewController:UICollectionViewDelegate,UICollectionViewDat cell.datatSet.append(TVStationSubject(json: item)) } cell.inforCollectionView.reloadData() + let height = CGFloat(ceil(CGFloat(cell.datatSet.count)/2))*cell.cellHeight + self.collectionHeight.constant = height == 0 ? cell.cellHeight : height }, failHandler: { (error) in }) @@ -228,7 +233,6 @@ extension ExcellentTVViewController:UICollectionViewDelegate,UICollectionViewDat func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { return CGSize(width: getScreenWidth(), height: collectionView.frame.size.height) - } } @@ -238,7 +242,7 @@ class ExcellentTVViewCell: UICollectionViewCell,UICollectionViewDelegate,UIColl @IBOutlet weak var inforCollectionView: UICollectionView! var datatSet:[TVStationSubject] = [] var superNacigation:UINavigationController! - + var cellHeight:CGFloat = 200 override func awakeFromNib() { super.awakeFromNib() @@ -261,7 +265,7 @@ class ExcellentTVViewCell: UICollectionViewCell,UICollectionViewDelegate,UIColl } func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - return CGSize(width: (getScreenWidth()-30)/2, height: 200) + return CGSize(width: (getScreenWidth()-30)/2, height: cellHeight) } diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard index b2bd79e..ce58602 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/TVStation/TVStation.storyboard @@ -97,171 +97,204 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + - + + + + + - + - - - - - - - - - - - - - - - - + + + + - - - - + + + + + + @@ -713,5 +746,6 @@ + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift index 66aafb7..2c20f70 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/Setting/ChangePassWordViewController.swift @@ -10,23 +10,36 @@ import UIKit class ChangePassWordViewController: UIViewController { + @IBOutlet weak var phoneViewHeight: NSLayoutConstraint! @IBOutlet weak var scrollView: UIScrollView! @IBOutlet weak var scrollViewHeight: NSLayoutConstraint! @IBOutlet weak var contentSizeHeight: NSLayoutConstraint! + + @IBOutlet weak var userPhoneTextFiled: UITextField! + @IBOutlet weak var phonrView: UIView! @IBOutlet weak var passwordTextFiled: UITextField! @IBOutlet weak var agrenPasswordTextFiled: UITextField! @IBOutlet weak var userCodeTextFiled: UITextField! - var scrollViewH:CGFloat! - + var scrollViewH:CGFloat = 200 + var user = AppDelegate.instance().accountManager @IBAction func editKeyboard(_ sender: Any) { self.view.endEditing(true) } override func viewDidLoad() { super.viewDidLoad() + if user.isOnline() { + phonrView.isHidden=true + phoneViewHeight.constant=0 + scrollViewH=150 + }else{ + phonrView.isHidden=false + phoneViewHeight.constant=50 + scrollViewH=200 + } self.automaticallyAdjustsScrollViewInsets = false NotificationCenter.default.addObserver(self, selector: #selector(ChangePassWordViewController.keyboardWIllChange), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil) @@ -34,8 +47,8 @@ class ChangePassWordViewController: UIViewController { } override func viewWillAppear(_ animated: Bool) { - scrollViewHeight.constant = getScreenHeight() - 70 - 64 - contentSizeHeight.constant = getScreenHeight() - 70 - 64 + scrollViewHeight.constant = scrollViewH + contentSizeHeight.constant = scrollViewH scrollViewH = scrollViewHeight.constant } @@ -45,11 +58,76 @@ class ChangePassWordViewController: UIViewController { } @IBAction func agrenChangePasswordBtnClick(_ sender: UIButton) { - + var phone:String="" + //确认修改 + if (agrenPasswordTextFiled.text?.characters.count)! <= 0 { + self.view.makeToast("密码不能为空") + return + } + if passwordTextFiled.text! != agrenPasswordTextFiled.text! { + self.view.makeToast("两次输入密码不一致") + return + } + if user.isOnline() { + phone=user.phone() + }else{ + phone=passwordTextFiled.text! + } + SVProgressHUD.show(withStatus: "修改密码...") + SVProgressHUD.setDefaultMaskType(.black) + let parameters:Dictionary=["f_Account":user.account() as AnyObject, + "f_Mobile":phone as AnyObject, + "f_UserPassword":passwordTextFiled.text! as AnyObject, + "f_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!) + } + self.navigationController!.popViewController(animated: true) + AppDelegate.instance().window?.makeToast("修改成功") + }, failHandler: { (error) in + self.view.makeToast("修改失败") + }) + }else{ + self.view.makeToast("修改失败") + } + } + } } @IBAction func sendUserCodeBtnClick(_ sender: UIButton) { - + self.view.endEditing(true) + var phone = "" + if user.isOnline(){ + phone = user.phone() + }else{ + phone = userPhoneTextFiled.text! + if !phone.isMobilePhoneNumber(){ + self.view.makeToast("请输入正确的手机号码") + return + } + } + SVProgressHUD.show(withStatus: "获取验证码...") + SVProgressHUD.setDefaultMaskType(.black) + AppDelegate.instance().httpServer.getChangePhoneCaptcha(mobile: phone, completionHandler: { (str, error) in + SVProgressHUD.dismiss() + if error==nil { + if JSON.fromString(jsonString: str)!["status"].intValue == 1{ + httpJsonResule(jsonString: str, error: error, successHandler: { (json) in + self.view.makeToast("验证码发送成功") + }, failHandler: { (error) in + self.view.makeToast("验证码发送失败:\(error.localizedDescription)") + }) + }else{ + self.view.makeToast("验证码发送失败") + } + } + }) + } // MARK: - 输入密码点击return回收键盘 diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard index 28cb7df..c143e1c 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/User.storyboard @@ -272,9 +272,8 @@ - + - @@ -282,10 +281,12 @@ - + + + + + + - + - @@ -309,17 +315,18 @@ - + + + + + + + + + + + @@ -463,9 +500,14 @@ + + + + + diff --git a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift index bdd30c9..97cdf2f 100644 --- a/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift +++ b/YouerLiveVideo/YouerLiveVideo/controllers/User/UserViewController.swift @@ -22,7 +22,7 @@ class UserViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() self.configTheme() - self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "radio_s"), style: .plain, target: self, action: #selector(UserViewController.editBtnClick)) + self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: #imageLiteral(resourceName: "icon_setting"), style: .plain, target: self, action: #selector(UserViewController.editBtnClick)) self.automaticallyAdjustsScrollViewInsets = false setUserInfor() // Do any additional setup after loading the view. diff --git a/YouerLiveVideo/YouerLiveVideo/util/account.swift b/YouerLiveVideo/YouerLiveVideo/util/account.swift index 79f6601..b794cbc 100644 --- a/YouerLiveVideo/YouerLiveVideo/util/account.swift +++ b/YouerLiveVideo/YouerLiveVideo/util/account.swift @@ -52,6 +52,12 @@ class AccountManager{ } return "" } + func account()->String{ + if let info=rawUserInfo{ + return info.contentData()["f_Account"].stringValue + } + return "" + } func name()->String{ if let info=rawUserInfo{ return info.contentData()["nickname"].stringValue -- libgit2 0.21.0