Commit ea1c2109f57d28715bbc8f863105aa5aceec804c
1 parent
021651bf
提交修改
Showing
5 changed files
with
506 additions
and
21 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -55,6 +55,7 @@ |
| 55 | 55 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; |
| 56 | 56 | 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */; }; |
| 57 | 57 | 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */; }; |
| 58 | + 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */; }; | |
| 58 | 59 | 79EABB892AB4497700F3A4E2 /* CNLiveSaveStandDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */; }; |
| 59 | 60 | 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */; }; |
| 60 | 61 | 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */; }; |
| ... | ... | @@ -162,6 +163,7 @@ |
| 162 | 163 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; |
| 163 | 164 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; |
| 164 | 165 | 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+CNLiveExtension.swift"; sourceTree = "<group>"; }; |
| 166 | + 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | |
| 165 | 167 | 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveStandDB.swift; sourceTree = "<group>"; }; |
| 166 | 168 | 79F4B1152A32B96B00993C03 /* CNLiveMineInfoViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInfoViewController.swift; sourceTree = "<group>"; }; |
| 167 | 169 | 79F4B1192A32F21400993C03 /* CNLiveMineNickViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineNickViewController.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -263,6 +265,7 @@ |
| 263 | 265 | 790B1FB52A41938F0074CF00 /* UIImage+CNLiveExtensions.swift */, |
| 264 | 266 | 7C83B4432A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift */, |
| 265 | 267 | 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */, |
| 268 | + 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */, | |
| 266 | 269 | ); |
| 267 | 270 | path = Extensions; |
| 268 | 271 | sourceTree = "<group>"; |
| ... | ... | @@ -892,6 +895,7 @@ |
| 892 | 895 | 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */, |
| 893 | 896 | 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, |
| 894 | 897 | 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */, |
| 898 | + 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */, | |
| 895 | 899 | 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */, |
| 896 | 900 | 7C83B4422A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift in Sources */, |
| 897 | 901 | 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */, | ... | ... |
metaCode/Classes/Extensions/NSMutableAttributedString+CNLiveExtensions.swift
0 → 100644
| 1 | +// | |
| 2 | +// NSMutableAttributedString+CNLiveExtensions.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by open on 2023/9/19. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +extension NSMutableAttributedString { | |
| 11 | + // =========================字体的设置=========================// | |
| 12 | + /// 设置字体大小 | |
| 13 | + public func addFont(_ font: UIFont, on range: NSRange) { | |
| 14 | + | |
| 15 | + if self.length < range.location + range.length { return } | |
| 16 | + | |
| 17 | + let attrs = [NSAttributedString.Key.font: font] | |
| 18 | + self.addAttributes(attrs, range: range) | |
| 19 | + } | |
| 20 | + | |
| 21 | + /// 设置字体颜色 | |
| 22 | + public func addForegroundColor(_ color: UIColor, range: NSRange) { | |
| 23 | + | |
| 24 | + if self.length < range.location + range.length { | |
| 25 | + return | |
| 26 | + } | |
| 27 | + | |
| 28 | + let attrs = [NSAttributedString.Key.foregroundColor: color] | |
| 29 | + self.addAttributes(attrs, range: range) | |
| 30 | + } | |
| 31 | + | |
| 32 | + /// 设置字体的背景颜色 | |
| 33 | + public func addBackgroundColor(_ color: UIColor, range: NSRange) { | |
| 34 | + | |
| 35 | + if self.length < range.location + range.length { | |
| 36 | + return | |
| 37 | + } | |
| 38 | + | |
| 39 | + let attrs = [NSAttributedString.Key.backgroundColor: color] | |
| 40 | + self.addAttributes(attrs, range: range) | |
| 41 | + } | |
| 42 | +} | |
| 43 | + | |
| 44 | +extension NSMutableAttributedString { | |
| 45 | + | |
| 46 | + //=========================文本的处理==========================// | |
| 47 | + /// 字符间距的设置 字符间距 正值间距加宽,负值间距变窄 | |
| 48 | + public func addKern(_ kern: Int, range: NSRange) { | |
| 49 | + | |
| 50 | + if self.length < range.location + range.length { return } | |
| 51 | + | |
| 52 | + let attrs = [NSAttributedString.Key.kern: kern] | |
| 53 | + self.addAttributes(attrs, range: range) | |
| 54 | + } | |
| 55 | + | |
| 56 | + | |
| 57 | + /// 设置字体倾斜度,正值右倾,负值左倾 | |
| 58 | + public func addObliqueness(_ obliqueness: CGFloat, range: NSRange) { | |
| 59 | + | |
| 60 | + if self.length < range.location + range.length { return } | |
| 61 | + | |
| 62 | + let attrs = [NSAttributedString.Key.obliqueness: obliqueness] | |
| 63 | + self.addAttributes(attrs, range: range) | |
| 64 | + } | |
| 65 | + | |
| 66 | + /// 设置字体的横向拉伸,正值拉伸 ,负值压缩 | |
| 67 | + public func addExpansion(_ expansion: CGFloat, range: NSRange) { | |
| 68 | + | |
| 69 | + if self.length < range.location + range.length { return } | |
| 70 | + | |
| 71 | + let attrs = [NSAttributedString.Key.expansion: expansion] | |
| 72 | + self.addAttributes(attrs, range: range) | |
| 73 | + } | |
| 74 | + /// 文字书写方向 | |
| 75 | + public func addWritingDirection(_ direction: NSWritingDirection, range: NSRange) { | |
| 76 | + | |
| 77 | + if self.length < range.location + range.length { return } | |
| 78 | + | |
| 79 | + | |
| 80 | + var value: (Int) = (0) | |
| 81 | + | |
| 82 | + | |
| 83 | + if direction == .leftToRight { | |
| 84 | + if #available(iOS 9.0, *) { | |
| 85 | + value = (NSWritingDirectionFormatType.override.rawValue | NSWritingDirection.leftToRight.rawValue) | |
| 86 | + } else { | |
| 87 | + // Fallback on earlier versions | |
| 88 | + } | |
| 89 | + } else { | |
| 90 | + if #available(iOS 9.0, *) { | |
| 91 | + value = (NSWritingDirectionFormatType.override.rawValue | NSWritingDirection.rightToLeft.rawValue) | |
| 92 | + } else { | |
| 93 | + // Fallback on earlier versions | |
| 94 | + } | |
| 95 | + } | |
| 96 | + | |
| 97 | + /** | |
| 98 | + NSAttributedString.Key.writingDirection接收的是一个数组 | |
| 99 | + */ | |
| 100 | + | |
| 101 | + /** | |
| 102 | + //@[@(NSWritingDirectionLeftToRight | NSWritingDirectionEmbedding)] | |
| 103 | + //@[@(NSWritingDirectionLeftToRight | NSWritingDirectionOverride)] | |
| 104 | + //@[@(NSWritingDirectionRightToLeft | NSWritingDirectionEmbedding)] | |
| 105 | + //@[@(NSWritingDirectionRightToLeft | NSWritingDirectionOverride)] | |
| 106 | + // NSWritingDirectionOverride 和 NSWritingDirectionEmbedding 是指定Unicode双向定义的格式控制算法(具体的没太搞清楚) | |
| 107 | + */ | |
| 108 | + | |
| 109 | + let attrs = [NSAttributedString.Key.writingDirection: [value]] | |
| 110 | + self.addAttributes(attrs, range: range) | |
| 111 | + } | |
| 112 | +} | |
| 113 | + | |
| 114 | +extension NSMutableAttributedString { | |
| 115 | + | |
| 116 | + //=========================删除线==========================// | |
| 117 | + /// 设置删除线 NSUnderlineStyle: none不设置,single单细线删除,thick粗单线, Double双细线 | |
| 118 | + public func addStrikethrough(style: NSUnderlineStyle = .single, color: UIColor? = nil, range: NSRange) { | |
| 119 | + | |
| 120 | + if self.length < range.location + range.length { | |
| 121 | + return | |
| 122 | + } | |
| 123 | + | |
| 124 | + let attr1 = [NSAttributedString.Key.strikethroughStyle: style.rawValue] | |
| 125 | + self.addAttributes(attr1, range: range) | |
| 126 | + | |
| 127 | + if let tempColor = color { | |
| 128 | + let attr2 = [NSAttributedString.Key.strikethroughColor: tempColor] | |
| 129 | + self.addAttributes(attr2, range: range) | |
| 130 | + } | |
| 131 | + } | |
| 132 | + | |
| 133 | + | |
| 134 | + //=========================下划线==========================// | |
| 135 | + /// 设置下划线 NSUnderlineStyle: none不设置,single单细线删除,thick粗单线, Double双细线 | |
| 136 | + public func addUnderLine(style: NSUnderlineStyle = .single, color: UIColor? = nil, range: NSRange) { | |
| 137 | + | |
| 138 | + if self.length < range.location + range.length { | |
| 139 | + return | |
| 140 | + } | |
| 141 | + | |
| 142 | + let attrs = [NSAttributedString.Key.underlineStyle: NSUnderlineStyle.single.rawValue] | |
| 143 | + self.addAttributes(attrs, range: range) | |
| 144 | + | |
| 145 | + if let tempColor = color { | |
| 146 | + let attr2 = [NSAttributedString.Key.underlineColor: tempColor] | |
| 147 | + self.addAttributes(attr2, range: range) | |
| 148 | + } | |
| 149 | + } | |
| 150 | +} | |
| 151 | + | |
| 152 | +extension NSMutableAttributedString { | |
| 153 | + //=========================文字的效果==========================// | |
| 154 | + /// 设置文字的描边 | |
| 155 | + public func addStroke(color: UIColor, width: CGFloat, range: NSRange) { | |
| 156 | + | |
| 157 | + /** | |
| 158 | + 设置文字描边颜色,需要NSStrokeWidthAttributeName设置描边宽度,这样就能使文字空心. | |
| 159 | + | |
| 160 | + NSStrokeWidthAttributeName,该值改变笔画宽度(相对于字体 size 的百分比),负值填充效果,正值中空效果,默认为 0,即不改变。正数只改变描边宽度。负数同时改变文字的描边和填充宽度。例如,对于常见的空心字,这个值通常为 3.0。 | |
| 161 | + 同时设置了空心描边和文字前景两个属性,并且NSStrokeWidthAttributeName 属性设置为整数,文字前景色就无效果了 | |
| 162 | + */ | |
| 163 | + | |
| 164 | + if self.length < range.location + range.length { return } | |
| 165 | + | |
| 166 | + let attrs = [ | |
| 167 | + NSAttributedString.Key.strokeWidth: width, | |
| 168 | + NSAttributedString.Key.strokeColor: color | |
| 169 | + ] as [NSAttributedString.Key : Any] | |
| 170 | + self.addAttributes(attrs, range: range) | |
| 171 | + } | |
| 172 | + | |
| 173 | + /// 阴影 | |
| 174 | + public func addShadow(_ shadow: NSShadow, range: NSRange) { | |
| 175 | + if self.length < range.location + range.length { return } | |
| 176 | + let attrs = [NSAttributedString.Key.shadow: shadow] | |
| 177 | + self.addAttributes(attrs, range: range) | |
| 178 | + } | |
| 179 | + | |
| 180 | + /// 设置文字的特殊NSAttributedString.Key这一个凸版印刷效果) | |
| 181 | + public func addTextEffect(effect: NSAttributedString.TextEffectStyle = .letterpressStyle, range: NSRange) { | |
| 182 | + if self.length < range.location + range.length { return } | |
| 183 | + let attrs = [NSAttributedString.Key.textEffect: effect] | |
| 184 | + self.addAttributes(attrs, range: range) | |
| 185 | + } | |
| 186 | +} | |
| 187 | + | |
| 188 | +extension NSMutableAttributedString { | |
| 189 | + | |
| 190 | + //=========================偏移量==========================// | |
| 191 | + /// 设置上下偏移量 正数上移,负数下移 | |
| 192 | + public func addBaselineOffset(_ offset: CGFloat, range: NSRange) { | |
| 193 | + if self.length < range.location + range.length { return } | |
| 194 | + let attrs = [NSAttributedString.Key.baselineOffset: offset] | |
| 195 | + self.addAttributes(attrs, range: range) | |
| 196 | + } | |
| 197 | + | |
| 198 | + /// 设置行间距 | |
| 199 | + public func addLineSpacing(_ style: NSMutableParagraphStyle, range: NSRange) { | |
| 200 | + | |
| 201 | + | |
| 202 | + /** | |
| 203 | + 具体请看: https://www.jianshu.com/p/b0afc45bb642 | |
| 204 | + | |
| 205 | + NSAttributedString.Key.paragraphStyle 设置文本段落排版,为NSParagraphStyle对象 | |
| 206 | + | |
| 207 | + paragraphStyle.lineSpacing = 0.0; //增加行高 | |
| 208 | + paragraphStyle.headIndent = 0; //头部缩进,相当于左padding | |
| 209 | + paragraphStyle.tailIndent = 0; //相当于右padding | |
| 210 | + paragraphStyle.lineHeightMultiple = 0; //行间距是多少倍 | |
| 211 | + paragraphStyle.alignment = NSTextAlignmentLeft;//对齐方式 | |
| 212 | + paragraphStyle.firstLineHeadIndent = 0; //首行头缩进 | |
| 213 | + paragraphStyle.paragraphSpacing = 0; //段落后面的间距 | |
| 214 | + paragraphStyle.paragraphSpacingBefore = 0; //段落之前的间距 | |
| 215 | + */ | |
| 216 | + | |
| 217 | + if self.length < range.location + range.length { return } | |
| 218 | + | |
| 219 | + let attrs = [NSAttributedString.Key.paragraphStyle: style] | |
| 220 | + self.addAttributes(attrs, range: range) | |
| 221 | + } | |
| 222 | +} | |
| 223 | + | |
| 224 | +extension NSMutableAttributedString { | |
| 225 | + | |
| 226 | + /// 插入图片 | |
| 227 | + public func addTextAttachment(image: UIImage?, imageFrame: CGRect, atIndex index: Int) { | |
| 228 | + | |
| 229 | + let attachment = NSTextAttachment.init() | |
| 230 | + attachment.image = image | |
| 231 | + attachment.bounds = imageFrame | |
| 232 | + let att = NSAttributedString(attachment: attachment) | |
| 233 | + self.insert(att, at: index) | |
| 234 | + } | |
| 235 | +} | |
| 236 | + | |
| 237 | + | ... | ... |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineExchangeViewController.swift
| ... | ... | @@ -11,16 +11,120 @@ class CNLiveMineExchangeViewController : CNLiveBaseViewController { |
| 11 | 11 | |
| 12 | 12 | lazy var backView : UIImageView = { |
| 13 | 13 | let backView = UIImageView.init() |
| 14 | - | |
| 14 | + backView.image = UIImage(named: "mine_header_icon_back") | |
| 15 | + backView.contentMode = .scaleToFill | |
| 16 | + backView.backgroundColor = HexColor("#F7F8FA") | |
| 17 | + backView.clipsToBounds = true | |
| 15 | 18 | return backView |
| 16 | 19 | }() |
| 17 | 20 | |
| 21 | + lazy var topView: UIView = { | |
| 22 | + let topView = UIView.init() | |
| 23 | + topView.backgroundColor = .white | |
| 24 | + topView.layer.cornerRadius = 8 | |
| 25 | + topView.layer.masksToBounds = true | |
| 26 | + return topView | |
| 27 | + }() | |
| 28 | + | |
| 29 | + lazy var tipLabel: UILabel = { | |
| 30 | + let tipLabel = UILabel.init() | |
| 31 | + tipLabel.text = "输入积分数" | |
| 32 | + tipLabel.textColor = .black | |
| 33 | + tipLabel.font = BoldFont_15_Fit | |
| 34 | + return tipLabel | |
| 35 | + }() | |
| 36 | + | |
| 37 | + lazy var descL: UILabel = { | |
| 38 | + let descL = UILabel.init() | |
| 39 | + descL.text = "可兑积分:10.28w" | |
| 40 | + descL.textColor = HexColor("#999999") | |
| 41 | + descL.backgroundColor = .white | |
| 42 | + descL.font = Font_14_Fit | |
| 43 | + return descL | |
| 44 | + }() | |
| 45 | + | |
| 46 | + lazy var numberField: UITextField = { | |
| 47 | + let numberField = UITextField.init() | |
| 48 | + numberField.placeholder = "最低兑换100积分" | |
| 49 | + numberField.font = Font_16_Fit | |
| 50 | + numberField.keyboardType = .numberPad | |
| 51 | + numberField.clearButtonMode = .whileEditing | |
| 52 | + numberField.backgroundColor = .white | |
| 53 | + return numberField | |
| 54 | + }() | |
| 55 | + | |
| 56 | + lazy var lineLabel: UILabel = { | |
| 57 | + let lineLabel = UILabel.init() | |
| 58 | + lineLabel.backgroundColor = HexColor("#D9DBE4") | |
| 59 | + return lineLabel | |
| 60 | + }() | |
| 61 | + | |
| 62 | +// lazy var views: NSArray = { | |
| 63 | +// let views = NSMutableArray.init() | |
| 64 | +// | |
| 65 | +// return views | |
| 66 | +// }() | |
| 67 | + | |
| 18 | 68 | override func viewDidLoad() { |
| 19 | 69 | super.viewDidLoad() |
| 20 | 70 | navigationBarHidden = false |
| 21 | 71 | titleName = "积分兑换" |
| 72 | + titleLabel.textColor = .white | |
| 73 | + leftBtnWhite = true | |
| 22 | 74 | topNavView.backgroundColor = .clear |
| 75 | + setNeedsStatusBarAppearanceUpdate() | |
| 76 | + | |
| 77 | + view.insertSubview(backView, belowSubview: topNavView) | |
| 78 | + view.addSubview(topView) | |
| 79 | + topView.addSubview(tipLabel) | |
| 80 | + topView.addSubview(descL) | |
| 81 | + topView.addSubview(numberField) | |
| 82 | + topView.addSubview(lineLabel) | |
| 83 | + | |
| 84 | + setupConstraints() | |
| 23 | 85 | } |
| 24 | 86 | |
| 87 | + func setupConstraints() { | |
| 88 | + backView.snp.makeConstraints { make in | |
| 89 | + make.left.right.top.equalToSuperview() | |
| 90 | + make.height.equalTo(300) | |
| 91 | + } | |
| 92 | + topView.snp.makeConstraints { make in | |
| 93 | + make.centerX.equalToSuperview() | |
| 94 | + make.top.equalTo(get_system_nav_height()+30) | |
| 95 | + make.left.equalToSuperview().offset(20) | |
| 96 | + make.right.equalToSuperview().offset(-20) | |
| 97 | + make.height.equalTo(200) | |
| 98 | + } | |
| 99 | + tipLabel.snp.makeConstraints { make in | |
| 100 | + make.top.equalToSuperview().offset(20) | |
| 101 | + make.left.equalToSuperview().offset(10) | |
| 102 | + } | |
| 103 | + descL.snp.makeConstraints { make in | |
| 104 | + make.top.equalToSuperview().offset(20) | |
| 105 | + make.right.equalToSuperview().offset(-10) | |
| 106 | + } | |
| 107 | + numberField.snp.makeConstraints { make in | |
| 108 | + make.centerX.equalToSuperview() | |
| 109 | + make.top.equalTo(tipLabel.snp.bottom).offset(20) | |
| 110 | + make.left.equalToSuperview().offset(10) | |
| 111 | + make.right.equalToSuperview().offset(-10) | |
| 112 | + make.height.equalTo(40) | |
| 113 | + } | |
| 114 | + lineLabel.snp.makeConstraints { make in | |
| 115 | + make.centerX.equalToSuperview() | |
| 116 | + make.left.equalToSuperview().offset(10) | |
| 117 | + make.right.equalToSuperview().offset(-10) | |
| 118 | + make.height.equalTo(0.5) | |
| 119 | + make.top.equalTo(numberField.snp.bottom) | |
| 120 | + } | |
| 121 | + } | |
| 25 | 122 | |
| 123 | + func setupWithContent() { | |
| 124 | + | |
| 125 | + } | |
| 126 | + | |
| 127 | + override var preferredStatusBarStyle: UIStatusBarStyle { | |
| 128 | + return .lightContent | |
| 129 | + } | |
| 26 | 130 | } | ... | ... |
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
| ... | ... | @@ -428,20 +428,112 @@ class MineEarnHeaderView: UIView { |
| 428 | 428 | return mainView |
| 429 | 429 | }() |
| 430 | 430 | |
| 431 | + lazy var exlChangeView: UIImageView = { | |
| 432 | + let exlChangeView = UIImageView.init() | |
| 433 | + exlChangeView.backgroundColor = .white | |
| 434 | + exlChangeView.layer.cornerRadius = 5 | |
| 435 | + exlChangeView.layer.masksToBounds = true | |
| 436 | + exlChangeView.isUserInteractionEnabled = true | |
| 437 | + exlChangeView.image = UIImage(named: "mine_header_earn_point_left") | |
| 438 | + return exlChangeView | |
| 439 | + }() | |
| 440 | + | |
| 441 | + lazy var exrChangeView: UIImageView = { | |
| 442 | + let exrChangeView = UIImageView.init() | |
| 443 | + exrChangeView.backgroundColor = .white | |
| 444 | + exrChangeView.layer.cornerRadius = 5 | |
| 445 | + exrChangeView.layer.masksToBounds = true | |
| 446 | + exrChangeView.image = UIImage(named: "mine_header_earn_point_right") | |
| 447 | + return exrChangeView | |
| 448 | + }() | |
| 449 | + | |
| 450 | + lazy var left_tipLabel: UILabel = { | |
| 451 | + let left_tipLabel = UILabel.init() | |
| 452 | + left_tipLabel.backgroundColor = .clear | |
| 453 | + left_tipLabel.text = "积分兑换" | |
| 454 | + left_tipLabel.textColor = .white | |
| 455 | + left_tipLabel.textAlignment = .left | |
| 456 | + left_tipLabel.font = BoldFont_14_Fit | |
| 457 | + return left_tipLabel | |
| 458 | + }() | |
| 459 | + | |
| 460 | + lazy var right_tipLabel: UILabel = { | |
| 461 | + let right_tipLabel = UILabel.init() | |
| 462 | + right_tipLabel.backgroundColor = .clear | |
| 463 | + right_tipLabel.text = "元码余额收益(元)" | |
| 464 | + right_tipLabel.textColor = .white | |
| 465 | + right_tipLabel.textAlignment = .left | |
| 466 | + right_tipLabel.font = BoldFont_14_Fit | |
| 467 | + return right_tipLabel | |
| 468 | + }() | |
| 469 | + | |
| 470 | + lazy var left_Label: UILabel = { | |
| 471 | + let left_Label = UILabel.init() | |
| 472 | + left_Label.backgroundColor = .clear | |
| 473 | + left_Label.text = "1024.28W" | |
| 474 | + left_Label.textColor = .white | |
| 475 | + left_Label.textAlignment = .left | |
| 476 | + left_Label.font = BoldFont_18_Fit | |
| 477 | + return left_Label | |
| 478 | + }() | |
| 479 | + | |
| 480 | + lazy var right_Label: UILabel = { | |
| 481 | + let right_Label = UILabel.init() | |
| 482 | + right_Label.backgroundColor = .clear | |
| 483 | + right_Label.text = "10.28" | |
| 484 | + right_Label.textColor = .white | |
| 485 | + right_Label.textAlignment = .left | |
| 486 | + right_Label.font = BoldFont_18_Fit | |
| 487 | + return right_Label | |
| 488 | + }() | |
| 489 | + | |
| 431 | 490 | lazy var exChangeBtn : UIButton = { |
| 432 | 491 | let exChangeBtn = UIButton.init(type: .custom) |
| 433 | - exChangeBtn.backgroundColor = .blue | |
| 492 | + exChangeBtn.size = CGSize(width: 50, height: 20) | |
| 493 | + exChangeBtn.backgroundColor = .clear | |
| 494 | + exChangeBtn.titleLabel?.font = Font_12 | |
| 495 | + exChangeBtn.setTitleColor(.white, for: .normal) | |
| 434 | 496 | exChangeBtn.setTitle("去兑换", for: .normal) |
| 497 | + exChangeBtn.setImage(UIImage(named: "mine_list_icon_right_white_more"), for: .normal) | |
| 498 | + exChangeBtn.setupButtonImageAndTitlePossitionWith(padding: 0, style: .right) | |
| 435 | 499 | exChangeBtn.addTarget(self, action: #selector(pushExChangeMethod), for: .touchUpInside) |
| 436 | 500 | return exChangeBtn |
| 437 | 501 | }() |
| 438 | 502 | |
| 503 | + lazy var tipView: UIView = { | |
| 504 | + let tipView = UIView.init() | |
| 505 | + tipView.backgroundColor = HexColor("#F7F8FA") | |
| 506 | + tipView.layer.cornerRadius = 5 | |
| 507 | + tipView.layer.masksToBounds = true | |
| 508 | + return tipView | |
| 509 | + }() | |
| 510 | + | |
| 511 | + lazy var tipLabel: UILabel = { | |
| 512 | + let tipLabel = UILabel.init() | |
| 513 | + tipLabel.text = "兑换比例:10000积分=1元码余额 \n 积分到账可能会有延迟" | |
| 514 | + tipLabel.textColor = HexColor("#999999") | |
| 515 | + tipLabel.font = Font_13_Fit | |
| 516 | + tipLabel.numberOfLines = 2 | |
| 517 | + tipLabel.lineBreakMode = .byCharWrapping | |
| 518 | + return tipLabel | |
| 519 | + }() | |
| 520 | + | |
| 439 | 521 | |
| 440 | 522 | override init(frame: CGRect) { |
| 441 | 523 | super.init(frame: frame) |
| 442 | 524 | |
| 443 | 525 | addSubview(mainView) |
| 444 | - mainView.addSubview(exChangeBtn) | |
| 526 | + mainView.addSubview(exlChangeView) | |
| 527 | + mainView.addSubview(exrChangeView) | |
| 528 | + exlChangeView.addSubview(left_Label) | |
| 529 | + exlChangeView.addSubview(left_tipLabel) | |
| 530 | + exlChangeView.addSubview(exChangeBtn) | |
| 531 | + | |
| 532 | + exrChangeView.addSubview(right_Label) | |
| 533 | + exrChangeView.addSubview(right_tipLabel) | |
| 534 | + | |
| 535 | + mainView.addSubview(tipView) | |
| 536 | + tipView.addSubview(tipLabel) | |
| 445 | 537 | |
| 446 | 538 | setupConstraints() |
| 447 | 539 | } |
| ... | ... | @@ -453,10 +545,57 @@ class MineEarnHeaderView: UIView { |
| 453 | 545 | make.left.equalToSuperview().offset(20) |
| 454 | 546 | make.right.equalToSuperview().offset(-20) |
| 455 | 547 | } |
| 456 | - exChangeBtn.snp.makeConstraints { make in | |
| 457 | - make.center.equalToSuperview() | |
| 548 | + | |
| 549 | + tipView.snp.makeConstraints { make in | |
| 550 | + make.centerX.equalToSuperview() | |
| 551 | + make.left.equalToSuperview().offset(10) | |
| 552 | + make.right.bottom.equalToSuperview().offset(-10) | |
| 458 | 553 | make.height.equalTo(50) |
| 459 | - make.width.equalTo(100) | |
| 554 | + } | |
| 555 | + | |
| 556 | + tipLabel.snp.makeConstraints { make in | |
| 557 | + make.top.equalToSuperview().offset(2.5) | |
| 558 | + make.left.equalToSuperview().offset(10) | |
| 559 | + make.right.equalToSuperview().offset(-10) | |
| 560 | + make.bottom.equalToSuperview().offset(-2.5) | |
| 561 | + } | |
| 562 | + | |
| 563 | + exlChangeView.snp.makeConstraints { make in | |
| 564 | + make.left.top.equalToSuperview().offset(10) | |
| 565 | + make.width.equalTo((KSreenWidth - 70)*0.56) | |
| 566 | + make.bottom.equalTo(tipView.snp.top).offset(-10) | |
| 567 | + } | |
| 568 | + | |
| 569 | + exrChangeView.snp.makeConstraints { make in | |
| 570 | + make.top.equalToSuperview().offset(10) | |
| 571 | + make.right.equalToSuperview().offset(-10) | |
| 572 | + make.width.equalTo((KSreenWidth - 70)*0.44) | |
| 573 | + make.bottom.equalTo(tipView.snp.top).offset(-10) | |
| 574 | + } | |
| 575 | + | |
| 576 | + left_tipLabel.snp.makeConstraints { make in | |
| 577 | + make.left.top.equalToSuperview().offset(10) | |
| 578 | + } | |
| 579 | + | |
| 580 | + left_Label.snp.makeConstraints { make in | |
| 581 | + make.left.equalToSuperview().offset(10) | |
| 582 | + make.bottom.equalToSuperview().offset(-20) | |
| 583 | + } | |
| 584 | + | |
| 585 | + exChangeBtn.snp.makeConstraints { make in | |
| 586 | + make.centerY.equalTo(left_tipLabel) | |
| 587 | + make.right.equalToSuperview().offset(-10) | |
| 588 | + make.left.equalTo(left_tipLabel.snp.right).offset(5) | |
| 589 | + make.width.equalTo(50) | |
| 590 | + } | |
| 591 | + | |
| 592 | + right_tipLabel.snp.makeConstraints { make in | |
| 593 | + make.left.top.equalToSuperview().offset(10) | |
| 594 | + } | |
| 595 | + | |
| 596 | + right_Label.snp.makeConstraints { make in | |
| 597 | + make.left.equalToSuperview().offset(10) | |
| 598 | + make.bottom.equalToSuperview().offset(-20) | |
| 460 | 599 | } |
| 461 | 600 | } |
| 462 | 601 | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| ... | ... | @@ -558,22 +558,23 @@ class CNLiveMineViewModel: NSObject { |
| 558 | 558 | timeCount = timeCount - 1 |
| 559 | 559 | // 时间到了取消时间源 |
| 560 | 560 | if timeCount <= 0 { |
| 561 | + | |
| 561 | 562 | codeTimer.cancel() |
| 562 | - } | |
| 563 | - // 返回主线程处理一些事件,更新UI等等 | |
| 564 | - DispatchQueue.main.async { | |
| 565 | - showLoading(message: "") | |
| 566 | - CNLiveMineViewModel.requestsStandInfo(identityId: id, type: .effect) { result, respStatue in | |
| 567 | - if respStatue == .success { | |
| 568 | - let listBaseModel = result as! MineStandInfoBaseModel | |
| 569 | - if listBaseModel.authTime > 0 { | |
| 570 | - showMessage(message: listBaseModel.name!.count > 0 ? "恭喜您通过认证,您已是\(listBaseModel.name ?? "")" : "恭喜您通过认证") | |
| 571 | - resultBlock(listBaseModel, .success) | |
| 572 | - NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil) | |
| 573 | - } else { | |
| 574 | - showMessage(message: "审核失败,请您修改后重新提交") | |
| 575 | - resultBlock(listBaseModel, .failed) | |
| 576 | - NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationUnSuccess, object: nil) | |
| 563 | + // 返回主线程处理一些事件,更新UI等等 | |
| 564 | + DispatchQueue.main.async { | |
| 565 | + showLoading(message: "") | |
| 566 | + CNLiveMineViewModel.requestsStandInfo(identityId: id, type: .effect) { result, respStatue in | |
| 567 | + if respStatue == .success { | |
| 568 | + let listBaseModel = result as! MineStandInfoBaseModel | |
| 569 | + if listBaseModel.authTime > 0 { | |
| 570 | + showMessage(message: listBaseModel.name!.count > 0 ? "恭喜您通过认证,您已是\(listBaseModel.name ?? "")" : "恭喜您通过认证") | |
| 571 | + resultBlock(listBaseModel, .success) | |
| 572 | + NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil) | |
| 573 | + } else { | |
| 574 | + showMessage(message: "审核失败,请您修改后重新提交") | |
| 575 | + resultBlock(listBaseModel, .failed) | |
| 576 | + NotificationCenter.default.post(name: Notification.Name.StandAuth.StandAuthNotificationUnSuccess, object: nil) | |
| 577 | + } | |
| 577 | 578 | } |
| 578 | 579 | } |
| 579 | 580 | } | ... | ... |