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
// 输入框UI显示配置
struct YHSmsCodeViewConfig {
var textColor : UIColor? = UIColor(hex: 0x000000)
var bgColor : UIColor? = UIColor(hex: 0xebeef4)
var cursorColor : UIColor? = UIColor.brandMainColor
var font: UIFont? = .systemFont(ofSize: 20)
var textColor : UIColor? = UIColor(hex: 0xFFFFFF)
var bgColor : UIColor? = UIColor.clear
var cursorColor : UIColor? = UIColor.white
var font: UIFont? = UIFont(name: "DINAlternate-Bold", size: 18)
// 展示输入框个数
var count : Int = 6
var width : Double = 45.0
var height : Double = 50.0
var width : Double = 46.0
var height : Double = 46.0
// 输入框之间间距
var gap:Double = 10
var gap:Double = 12
}
let codeViewBaseTag = 9527
......
......@@ -15,12 +15,12 @@ class YHSmsCodeView: UIView {
if showCursor {
self.cursor.layer .removeAllAnimations()
self.animaitonShow(true)
self.layer.borderWidth = 1
self.layer.borderColor = UIColor.brandMainColor.cgColor
self.bottomLine.backgroundColor = .white
} else {
self.cursor.layer .removeAllAnimations()
self.cursor.isHidden = true
self.layer.borderWidth = 0
self.bottomLine.backgroundColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
}
}
}
......@@ -33,17 +33,23 @@ class YHSmsCodeView: UIView {
let label = UILabel()
label.textColor = .white
label.textAlignment = .center
label.font = UIFont.systemFont(ofSize: 20)
label.font = UIFont(name: "DINAlternate-Bold", size: 18)
return label
}()
var cursor : UIView = {
lazy var cursor : UIView = {
let cursor = UIView()
cursor.backgroundColor = UIColor.brandMainColor
cursor.backgroundColor = UIColor.white
cursor.isHidden = true
return cursor
}()
lazy var bottomLine: UIView = {
let view = UIView()
view.backgroundColor = UIColor.init(hex: 0xFFFFFF, alpha: 0.6)
return view
}()
required init?(coder: NSCoder) {
super.init(coder: coder)
}
......@@ -57,10 +63,11 @@ class YHSmsCodeView: UIView {
self.isUserInteractionEnabled = false
self.layer.cornerRadius = kCornerRadius3
self.clipsToBounds = true
self.backgroundColor = UIColor(white: 1, alpha: 0.3)
self.backgroundColor = .clear
self.addSubview(label)
self.addSubview(cursor)
self.addSubview(bottomLine)
}
@objc func animaitonShow(_ show: Bool) {
......@@ -81,7 +88,8 @@ class YHSmsCodeView: UIView {
override func layoutSubviews() {
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.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 {
var model: YHOSSModel = YHOSSModel()
var mProvider: OSSStsTokenCredentialProvider!
var mClient: OSSClient!
var fileName: String = ""
var fileName: [String] = []
override init() {
}
......@@ -68,19 +69,24 @@ class YHOSSManager: NSObject, URLSessionDelegate {
request.uploadingData = imageData
request.bucketName = self.model.bucket
let timestamp = Date().timeIntervalSince1970
self.fileName = "\(UInt64(timestamp))" + ".jpg"
request.objectKey = self.model.bucketPath + "/" + "\(self.fileName)"
let randomInt = Int.random(in: 1...100) // 随机生成1到10之间的整数
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
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
};
}
let task = self.mClient.putObject(request)
task.continue({ (t) -> Any? in
let result = t
if (result.error != nil) {
callBackBlock(nil, YHErrorModel())
} 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())
}
return
......@@ -94,13 +100,15 @@ class YHOSSManager: NSObject, URLSessionDelegate {
request.uploadingData = fileData
request.bucketName = self.model.bucket
let timestamp = Date().timeIntervalSince1970
self.fileName = "\(UInt64(timestamp))" + ".\(fileExtension)"
request.objectKey = self.model.bucketPath + "/" + "\(self.fileName)"
let name = "\(UInt64(timestamp))" + ".\(fileExtension)"
self.fileName.append(name)
request.objectKey = self.model.bucketPath + "/" + "\(name)"
request.uploadProgress = { (bytesSent: Int64, totalBytesSent: Int64, totalBytesExpectedToSend: Int64) -> Void in
printLog("bytesSent:\(bytesSent),totalBytesSent:\(totalBytesSent),totalBytesExpectedToSend:\(totalBytesExpectedToSend)")
};
}
let task = self.mClient.putObject(request)
task.continue({ (t) -> Any? in
let result = t
if (result.error != nil) {
......@@ -108,7 +116,8 @@ class YHOSSManager: NSObject, URLSessionDelegate {
let result = error.description
callBackBlock(nil, YHErrorModel())
} 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())
}
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