Commit a641d996 authored by 刘俊宏's avatar 刘俊宏

完成修改密码接口对接并完善功能

parent bd5c0063
...@@ -242,6 +242,7 @@ ...@@ -242,6 +242,7 @@
F969BF08244EC38000C79953 /* GoodsCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F969BF06244EC38000C79953 /* GoodsCollectionViewCell.xib */; }; F969BF08244EC38000C79953 /* GoodsCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F969BF06244EC38000C79953 /* GoodsCollectionViewCell.xib */; };
F969BF1E244EE67900C79953 /* GoodsManageListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F969BF1C244EE67900C79953 /* GoodsManageListVC.swift */; }; F969BF1E244EE67900C79953 /* GoodsManageListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = F969BF1C244EE67900C79953 /* GoodsManageListVC.swift */; };
F969BF1F244EE67900C79953 /* GoodsManageListVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = F969BF1D244EE67900C79953 /* GoodsManageListVC.xib */; }; F969BF1F244EE67900C79953 /* GoodsManageListVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = F969BF1D244EE67900C79953 /* GoodsManageListVC.xib */; };
F9DDBE922457BFEC00A32CB2 /* HUDEXT.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DDBE912457BFEC00A32CB2 /* HUDEXT.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
...@@ -531,6 +532,7 @@ ...@@ -531,6 +532,7 @@
F969BF06244EC38000C79953 /* GoodsCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GoodsCollectionViewCell.xib; sourceTree = "<group>"; }; F969BF06244EC38000C79953 /* GoodsCollectionViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GoodsCollectionViewCell.xib; sourceTree = "<group>"; };
F969BF1C244EE67900C79953 /* GoodsManageListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoodsManageListVC.swift; sourceTree = "<group>"; }; F969BF1C244EE67900C79953 /* GoodsManageListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoodsManageListVC.swift; sourceTree = "<group>"; };
F969BF1D244EE67900C79953 /* GoodsManageListVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GoodsManageListVC.xib; sourceTree = "<group>"; }; F969BF1D244EE67900C79953 /* GoodsManageListVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GoodsManageListVC.xib; sourceTree = "<group>"; };
F9DDBE912457BFEC00A32CB2 /* HUDEXT.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDEXT.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -1181,6 +1183,7 @@ ...@@ -1181,6 +1183,7 @@
F933F6AE2452C68B00189561 /* PKHUD */ = { F933F6AE2452C68B00189561 /* PKHUD */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
F9DDBE912457BFEC00A32CB2 /* HUDEXT.swift */,
F933F6AF2452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift */, F933F6AF2452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift */,
F933F6B02452C68B00189561 /* PKHUDAnimation.swift */, F933F6B02452C68B00189561 /* PKHUDAnimation.swift */,
F933F6B12452C68B00189561 /* PKHUDAnimating.swift */, F933F6B12452C68B00189561 /* PKHUDAnimating.swift */,
...@@ -1768,6 +1771,7 @@ ...@@ -1768,6 +1771,7 @@
E042F734245274F200CDFA12 /* YunDanLieBiaoCell.swift in Sources */, E042F734245274F200CDFA12 /* YunDanLieBiaoCell.swift in Sources */,
E01C26B62446AF3100ADCC70 /* DemoViewController.swift in Sources */, E01C26B62446AF3100ADCC70 /* DemoViewController.swift in Sources */,
F933F6C32452C68B00189561 /* FrameView.swift in Sources */, F933F6C32452C68B00189561 /* FrameView.swift in Sources */,
F9DDBE922457BFEC00A32CB2 /* HUDEXT.swift in Sources */,
E0A7548A244A8F0F00A84B67 /* CheckWareHourseViewController.swift in Sources */, E0A7548A244A8F0F00A84B67 /* CheckWareHourseViewController.swift in Sources */,
F9023F62244999F500DD5A63 /* WarehoseMangementCell.swift in Sources */, F9023F62244999F500DD5A63 /* WarehoseMangementCell.swift in Sources */,
E0516F772448003D00E373CE /* PayViewController.swift in Sources */, E0516F772448003D00E373CE /* PayViewController.swift in Sources */,
......
//
// HUDEXT.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/4/28.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
func delay(_ delay: Double, closure:@escaping () -> Void) {
DispatchQueue.main.asyncAfter(
deadline: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: closure)
}
...@@ -10,14 +10,14 @@ import UIKit ...@@ -10,14 +10,14 @@ import UIKit
import LGButton import LGButton
class ChangePassViewController: BaseViewController { class ChangePassViewController: BaseViewController {
@IBOutlet weak var newPBtn: UIButton! @IBOutlet weak var newPBtn: UIButton!
@IBOutlet weak var oldPBtn: UIButton! @IBOutlet weak var oldPBtn: UIButton!
@IBOutlet weak var newPassTF: UITextField! @IBOutlet weak var newPassTF: UITextField!
@IBOutlet weak var oldPassTF: UITextField! @IBOutlet weak var oldPassTF: UITextField!
@IBOutlet weak var fisrtView: UIView! @IBOutlet weak var fisrtView: UIView!
@IBOutlet weak var submitBtn: LGButton! @IBOutlet weak var submitBtn: LGButton!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
navbar.title = "修改密码" navbar.title = "修改密码"
...@@ -25,7 +25,7 @@ class ChangePassViewController: BaseViewController { ...@@ -25,7 +25,7 @@ class ChangePassViewController: BaseViewController {
newPassTF.isSecureTextEntry = true newPassTF.isSecureTextEntry = true
oldPassTF.isSecureTextEntry = true oldPassTF.isSecureTextEntry = true
newPassTF.addTarget(self, action: #selector(tfChange(sender:)), for: .editingChanged) newPassTF.addTarget(self, action: #selector(tfChange(sender:)), for: .editingChanged)
oldPassTF.addTarget(self, action: #selector(tfChange(sender:)), for: .editingChanged) oldPassTF.addTarget(self, action: #selector(tfChange(sender:)), for: .editingChanged)
...@@ -37,7 +37,7 @@ class ChangePassViewController: BaseViewController { ...@@ -37,7 +37,7 @@ class ChangePassViewController: BaseViewController {
}) })
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
//MARK: -方法 //MARK: -方法
@objc func tfChange(sender:UITextField){ @objc func tfChange(sender:UITextField){
if oldPassTF.textColor == UIColor(named: "密码错误字体颜色") { if oldPassTF.textColor == UIColor(named: "密码错误字体颜色") {
oldPassTF.textColor = UIColor(named: "标题字颜色") oldPassTF.textColor = UIColor(named: "标题字颜色")
...@@ -48,19 +48,32 @@ class ChangePassViewController: BaseViewController { ...@@ -48,19 +48,32 @@ class ChangePassViewController: BaseViewController {
submitBtn.alpha = 0.45 submitBtn.alpha = 0.45
} }
} }
@IBAction func newPassAction(_ sender: UIButton) { @IBAction func newPassAction(_ sender: UIButton) {
newPBtn.isSelected = !newPBtn.isSelected newPBtn.isSelected = !newPBtn.isSelected
newPassTF.isSecureTextEntry = !newPBtn.isSelected newPassTF.isSecureTextEntry = !newPBtn.isSelected
} }
@IBAction func oldPassAction(_ sender: UIButton) { @IBAction func oldPassAction(_ sender: UIButton) {
oldPBtn.isSelected = !oldPBtn.isSelected oldPBtn.isSelected = !oldPBtn.isSelected
oldPassTF.isSecureTextEntry = !oldPBtn.isSelected oldPassTF.isSecureTextEntry = !oldPBtn.isSelected
} }
@IBAction func submitAction(_ sender: Any) { @IBAction func submitAction(_ sender: Any) {
changePwd(["user_token":UserToken as Any,"pwd":oldPassTF.text as Any,"new_pwd":newPassTF.text as Any], success: { (data) in
} HUD.flash(.labeledSubSuccess(subtitle: "修改成功"),delay: 1.5)
delay(1.5) {
HUD.flash(.label("请重新登录"), delay: 1.5)
delay(1.5){
UserDefaults.standard.removeObject(forKey: "user_token")
NotificationCenter.default.post(name: Notification.Name(rawValue: "logout"), object: nil)
}
}
}) { (error) in
}
}
} }
...@@ -96,7 +96,7 @@ class LoginViewController: BaseViewController, CodeViewDelegate,GeliAlertViewDel ...@@ -96,7 +96,7 @@ class LoginViewController: BaseViewController, CodeViewDelegate,GeliAlertViewDel
login(["user_name":phoneTF.text as Any,"pwd":passTF.text as Any], success: { (data) in login(["user_name":phoneTF.text as Any,"pwd":passTF.text as Any], success: { (data) in
let dataM = data as! LoginModel let dataM = data as! LoginModel
UserDefaults.standard.set(dataM.data?.user_token, forKey: "user_token") UserDefaults.standard.set(dataM.data?.user_token, forKey: "user_token")
UserDefaults.standard.synchronize() // UserDefaults.standard.synchronize()
self.loginBtn.isLoading = false self.loginBtn.isLoading = false
self.delegate?.successLogin() self.delegate?.successLogin()
}) { (error) in }) { (error) in
......
...@@ -50,7 +50,7 @@ class AccountViewController: BaseViewController{ ...@@ -50,7 +50,7 @@ class AccountViewController: BaseViewController{
print("退出登录") print("退出登录")
//模拟退出登录 //模拟退出登录
UserDefaults.standard.removeObject(forKey: "user_token") UserDefaults.standard.removeObject(forKey: "user_token")
UserDefaults.standard.synchronize() // UserDefaults.standard.synchronize()
NotificationCenter.default.post(name: Notification.Name(rawValue: "logout"), object: nil) NotificationCenter.default.post(name: Notification.Name(rawValue: "logout"), object: nil)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment