Commit 2d5b9849 authored by David黄金龙's avatar David黄金龙

Merge branch 'youhua-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into youhua-dev

* 'youhua-dev' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  //  验证码UI更新
  批量上传漏洞
parents 394c9674 18081560
...@@ -10,16 +10,16 @@ import UIKit ...@@ -10,16 +10,16 @@ import UIKit
// 输入框UI显示配置 // 输入框UI显示配置
struct YHSmsCodeViewConfig { struct YHSmsCodeViewConfig {
var textColor : UIColor? = UIColor(hex: 0x000000) var textColor : UIColor? = UIColor(hex: 0xFFFFFF)
var bgColor : UIColor? = UIColor(hex: 0xebeef4) var bgColor : UIColor? = UIColor.clear
var cursorColor : UIColor? = UIColor.brandMainColor var cursorColor : UIColor? = UIColor.white
var font: UIFont? = .systemFont(ofSize: 20) var font: UIFont? = UIFont(name: "DINAlternate-Bold", size: 18)
// 展示输入框个数 // 展示输入框个数
var count : Int = 6 var count : Int = 6
var width : Double = 45.0 var width : Double = 46.0
var height : Double = 50.0 var height : Double = 46.0
// 输入框之间间距 // 输入框之间间距
var gap:Double = 10 var gap:Double = 12
} }
let codeViewBaseTag = 9527 let codeViewBaseTag = 9527
......
...@@ -15,12 +15,12 @@ class YHSmsCodeView: UIView { ...@@ -15,12 +15,12 @@ class YHSmsCodeView: UIView {
if showCursor { if showCursor {
self.cursor.layer .removeAllAnimations() self.cursor.layer .removeAllAnimations()
self.animaitonShow(true) self.animaitonShow(true)
self.layer.borderWidth = 1 self.bottomLine.backgroundColor = .white
self.layer.borderColor = UIColor.brandMainColor.cgColor
} else { } else {
self.cursor.layer .removeAllAnimations() self.cursor.layer .removeAllAnimations()
self.cursor.isHidden = true self.cursor.isHidden = true
self.layer.borderWidth = 0 self.bottomLine.backgroundColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
} }
} }
} }
...@@ -33,16 +33,22 @@ class YHSmsCodeView: UIView { ...@@ -33,16 +33,22 @@ class YHSmsCodeView: UIView {
let label = UILabel() let label = UILabel()
label.textColor = .white label.textColor = .white
label.textAlignment = .center label.textAlignment = .center
label.font = UIFont.systemFont(ofSize: 20) label.font = UIFont(name: "DINAlternate-Bold", size: 18)
return label return label
}() }()
var cursor : UIView = { lazy var cursor : UIView = {
let cursor = UIView() let cursor = UIView()
cursor.backgroundColor = UIColor.brandMainColor cursor.backgroundColor = UIColor.white
cursor.isHidden = true cursor.isHidden = true
return cursor return cursor
}() }()
lazy var bottomLine: UIView = {
let view = UIView()
view.backgroundColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
return view
}()
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
super.init(coder: coder) super.init(coder: coder)
...@@ -57,10 +63,11 @@ class YHSmsCodeView: UIView { ...@@ -57,10 +63,11 @@ class YHSmsCodeView: UIView {
self.isUserInteractionEnabled = false self.isUserInteractionEnabled = false
self.layer.cornerRadius = kCornerRadius3 self.layer.cornerRadius = kCornerRadius3
self.clipsToBounds = true self.clipsToBounds = true
self.backgroundColor = UIColor(white: 1, alpha: 0.3) self.backgroundColor = .clear
self.addSubview(label) self.addSubview(label)
self.addSubview(cursor) self.addSubview(cursor)
self.addSubview(bottomLine)
} }
@objc func animaitonShow(_ show: Bool) { @objc func animaitonShow(_ show: Bool) {
...@@ -81,7 +88,8 @@ class YHSmsCodeView: UIView { ...@@ -81,7 +88,8 @@ class YHSmsCodeView: UIView {
override func layoutSubviews() { override func layoutSubviews() {
self.label.frame = self.bounds self.label.frame = self.bounds
self.cursor.bounds = CGRectMake(0, 0, 1.5, self.frame.size.height - 20); self.cursor.bounds = CGRectMake(0, 0, 1, 17);
self.cursor.center = CGPoint(x:CGRectGetMidX(self.bounds) , y: CGRectGetMidY(self.bounds)) self.cursor.center = CGPoint(x:CGRectGetMidX(self.bounds) , y: CGRectGetMidY(self.bounds))
self.bottomLine.frame = CGRect(x: 0, y: self.frame.size.height-1, width: self.frame.size.width, height: 1)
} }
} }
...@@ -41,7 +41,8 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -41,7 +41,8 @@ class YHOSSManager: NSObject, URLSessionDelegate {
var model: YHOSSModel = YHOSSModel() var model: YHOSSModel = YHOSSModel()
var mProvider: OSSStsTokenCredentialProvider! var mProvider: OSSStsTokenCredentialProvider!
var mClient: OSSClient! var mClient: OSSClient!
var fileName: String = "" var fileName: [String] = []
override init() { override init() {
} }
...@@ -68,19 +69,24 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -68,19 +69,24 @@ class YHOSSManager: NSObject, URLSessionDelegate {
request.uploadingData = imageData request.uploadingData = imageData
request.bucketName = self.model.bucket request.bucketName = self.model.bucket
let timestamp = Date().timeIntervalSince1970 let timestamp = Date().timeIntervalSince1970
self.fileName = "\(UInt64(timestamp))" + ".jpg" let randomInt = Int.random(in: 1...100) // 随机生成1到10之间的整数
request.objectKey = self.model.bucketPath + "/" + "\(self.fileName)" let name = "\(UInt64(timestamp))" + "\(randomInt)" + ".jpg"
self.fileName.append(name)
request.objectKey = self.model.bucketPath + "/" + "\(name)"
request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)") printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
}; }
let task = self.mClient.putObject(request) let task = self.mClient.putObject(request)
task.continue({ (t) -> Any? in task.continue({ (t) -> Any? in
let result = t let result = t
if (result.error != nil) { if (result.error != nil) {
callBackBlock(nil, YHErrorModel()) callBackBlock(nil, YHErrorModel())
} else { } else {
let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + self.model.bucketPath + "/" + self.fileName let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + self.model.bucketPath + "/" + "\(self.fileName.first ?? "")"
self.fileName.removeFirst()
print("------------\(string)")
callBackBlock(string, YHErrorModel()) callBackBlock(string, YHErrorModel())
} }
return return
...@@ -94,13 +100,15 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -94,13 +100,15 @@ class YHOSSManager: NSObject, URLSessionDelegate {
request.uploadingData = fileData request.uploadingData = fileData
request.bucketName = self.model.bucket request.bucketName = self.model.bucket
let timestamp = Date().timeIntervalSince1970 let timestamp = Date().timeIntervalSince1970
self.fileName = "\(UInt64(timestamp))" + ".\(fileExtension)" let name = "\(UInt64(timestamp))" + ".\(fileExtension)"
request.objectKey = self.model.bucketPath + "/" + "\(self.fileName)" self.fileName.append(name)
request.objectKey = self.model.bucketPath + "/" + "\(name)"
request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)") printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
}; }
let task = self.mClient.putObject(request) let task = self.mClient.putObject(request)
task.continue({ (t) -> Any? in task.continue({ (t) -> Any? in
let result = t let result = t
if (result.error != nil) { if (result.error != nil) {
...@@ -108,7 +116,8 @@ class YHOSSManager: NSObject, URLSessionDelegate { ...@@ -108,7 +116,8 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let result = error.description let result = error.description
callBackBlock(nil, YHErrorModel()) callBackBlock(nil, YHErrorModel())
} else { } else {
let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + self.model.bucketPath + "/" + self.fileName let string = "https://" + self.model.bucket + "." + "oss-cn-shenzhen.aliyuncs.com/" + self.model.bucketPath + "/" + "\(self.fileName.first ?? "")"
self.fileName.removeFirst()
callBackBlock(string, YHErrorModel()) callBackBlock(string, YHErrorModel())
} }
return return
......
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