Commit aca59afa1b930f523e98bb689870ab07acf36eda

Authored by 张旭
1 parent 24983a5f

修改首页背景图

metaCode/Classes/Config/Database/CNLiveIdentityDB.swift
... ... @@ -19,7 +19,7 @@ final class CNLiveIdentityModel: BaseModel,TableCodable {
19 19 var createTime: String? = ""//注册时间
20 20 var enable: Bool?//没用
21 21 var backgroundImg:String? = ""//首页背景图
22   - var backgroundColour:String? = ""//添加身份按钮背景色
  22 + var backgroundColor:String? = ""//添加身份按钮背景色
23 23 var description:String? = ""//首页身份说明描述
24 24 var auth: Bool?//身份是否验证
25 25  
... ...
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
... ... @@ -262,7 +262,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
262 262 bannerView?.associatedVCView = self.view
263 263 bannerView?.delegate = self
264 264 let identityModel = dataArray[index] as! CNLiveIdentityModel
265   -
  265 + bannerView?.idModel = identityModel
266 266 return bannerView
267 267 }
268 268  
... ...
metaCode/Classes/Main/HomePage/View/CNCertificationView.swift
... ... @@ -24,28 +24,28 @@ class CNCertificationView : UIView{
24 24  
25 25 }()
26 26  
27   - ///添加身份认证按钮
28   - lazy var addCerBtn: UIButton = {
29   - let addCerBtn = UIButton(type: .custom)
30   - addCerBtn.frame = CGRect(x: 0, y: 0, width: 145, height: 141)
31   - addCerBtn.centerX = self.contentView.width/2
32   - addCerBtn.centerY = self.contentView.height/2
33   - addCerBtn.setImage(UIImage(named: "homePage_addCertification_icon"), for: .normal)
34   - addCerBtn.addTarget(self, action: #selector(addCerBtnAction), for: .touchUpInside)
35   - return addCerBtn
36   - }()
37   -
38   - ///添加身份按钮底部标题
39   - lazy var addCerBtnBottomTitle: UILabel = {
40   - let addCerBtnBottomTitle = UILabel(frame: CGRect(x: 0, y: self.addCerBtn.bottom - 10, width: 100, height: 22))
41   - addCerBtnBottomTitle.centerX = self.addCerBtn.centerX
42   - addCerBtnBottomTitle.textColor = UIColor("#0066FE")
43   - addCerBtnBottomTitle.textAlignment = .center
44   - addCerBtnBottomTitle.font = UIFont.systemFont(ofSize: 15, weight: .regular)
45   - addCerBtnBottomTitle.text = "身份认证"
46   - return addCerBtnBottomTitle
47   -
48   - }()
  27 +// ///添加身份认证按钮
  28 +// lazy var addCerBtn: UIButton = {
  29 +// let addCerBtn = UIButton(type: .custom)
  30 +// addCerBtn.frame = CGRect(x: 0, y: 0, width: 145, height: 141)
  31 +// addCerBtn.centerX = self.contentView.width/2
  32 +// addCerBtn.centerY = self.contentView.height/2
  33 +// addCerBtn.setImage(UIImage(named: "homePage_addCertification_icon"), for: .normal)
  34 +// addCerBtn.addTarget(self, action: #selector(addCerBtnAction), for: .touchUpInside)
  35 +// return addCerBtn
  36 +// }()
  37 +//
  38 +// ///添加身份按钮底部标题
  39 +// lazy var addCerBtnBottomTitle: UILabel = {
  40 +// let addCerBtnBottomTitle = UILabel(frame: CGRect(x: 0, y: self.addCerBtn.bottom - 10, width: 100, height: 22))
  41 +// addCerBtnBottomTitle.centerX = self.addCerBtn.centerX
  42 +// addCerBtnBottomTitle.textColor = UIColor("#0066FE")
  43 +// addCerBtnBottomTitle.textAlignment = .center
  44 +// addCerBtnBottomTitle.font = UIFont.systemFont(ofSize: 15, weight: .regular)
  45 +// addCerBtnBottomTitle.text = "身份认证"
  46 +// return addCerBtnBottomTitle
  47 +//
  48 +// }()
49 49  
50 50 override init(frame: CGRect) {
51 51 super.init(frame: frame)
... ... @@ -60,15 +60,15 @@ class CNCertificationView : UIView{
60 60 func initUI()
61 61 {
62 62 self.addSubview(self.contentView)
63   - self.contentView.addSubview(self.addCerBtn)
64   - self.contentView.addSubview(self.addCerBtnBottomTitle)
65   - }
  63 +// self.contentView.addSubview(self.addCerBtn)
  64 +// self.contentView.addSubview(self.addCerBtnBottomTitle)
  65 +// }
66 66  
67   - @objc func addCerBtnAction(){
68   -
69   - if(self.addCertificationAction != nil){
70   - self.addCertificationAction!()
71   - }
72   -
  67 +// @objc func addCerBtnAction(){
  68 +//
  69 +// if(self.addCertificationAction != nil){
  70 +// self.addCertificationAction!()
  71 +// }
  72 +//
73 73 }
74 74 }
... ...
metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
... ... @@ -97,6 +97,33 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
97 97 ///父视图ScrollView
98 98 weak var superScrollView:UIScrollView?
99 99  
  100 + //IDmodel
  101 + var _idModel : CNLiveIdentityModel?
  102 + var idModel : CNLiveIdentityModel? {
  103 + get{
  104 + _idModel
  105 + }
  106 + set{
  107 + self.mainView.idModel = newValue!
  108 + _idModel = newValue
  109 + }
  110 +
  111 + }
  112 +
  113 +// private(set) var userInfo: UserInfoModel {
  114 +//
  115 +// set {
  116 +// _userInfo = newValue
  117 +// }
  118 +//
  119 +// get {
  120 +// if _userInfo != nil && (_userInfo?.uid.count)! > 0 {
  121 +// return _userInfo!
  122 +// }
  123 +// return UserInfoManager.readUserInfo()
  124 +// }
  125 +// }
  126 +
100 127 // MARK: - 懒加载
101 128  
102 129 ///颜色数据
... ...
metaCode/Classes/Main/HomePage/View/CNHomePageBackgroupView.swift
... ... @@ -106,36 +106,7 @@ class CNHomePageBackgroupView: UIView{
106 106 let navTitle:String = idModel.name!
107 107 subView.setTitle(title: navTitle)
108 108  
109   - subView.imageView.kf.setImage(with: URL(string: idModel.backgroundImg!))
110   - //.setImageWith(URL(string: idModel.backgroundImg ?? "")!, placeholderImage: UIImage(named: "homePage_backgroup_red"))
111   -// if (i == 0) {
112   -//
113   -// subView.name = navTitle
114   -// }
115   -// else if(i == 1){
116   -// subView.setTitle(title: "退伍军人")
117   -// subView.setImage(image: UIImage(named: "homePage_backgroup_blue"))
118   -// subView.name = "退伍军人"
119   -//
120   -// }
121   -// else if(i == 2){
122   -// subView.setTitle(title: "慈善家")
123   -// subView.setImage(image: UIImage(named: "homePage_backgroup_red"))
124   -// subView.name = "慈善家"
125   -//
126   -// }
127   -// else if(i == 3){
128   -// subView.setTitle(title: "退休干部")
129   -// subView.setImage(image: UIImage(named: "homePage_backgroup_blue"))
130   -// subView.name = "退休干部"
131   -//
132   -// }
133   -// else if(i == 4){
134   -// subView.setTitle(title: "退休医生")
135   -// subView.setImage(image: UIImage(named: "homePage_backgroup_red"))
136   -// subView.name = "退伍军人"
137   -//
138   -// }
  109 + subView.imageView.kf.setImage(with: URL(string: idModel.backgroundImg!),placeholder: UIImage(named: "homePage_backgroup_red"))
139 110  
140 111 //更新双向链表
141 112 let lastSubView: CNHomePageBackgroupSubView? = self.dataArray.last
... ...
metaCode/Classes/Main/HomePage/View/CNMainView.swift
... ... @@ -6,7 +6,7 @@
6 6 //
7 7  
8 8 import Foundation
9   -
  9 +import UIKit
10 10 ///旋转动画时间
11 11 let KTransformAnimationTime:CGFloat = 0.75;
12 12  
... ... @@ -20,35 +20,51 @@ class CNFrontMainView : UIView{
20 20 override init(frame: CGRect) {
21 21 super.init(frame: frame)
22 22 self.initUI()
23   - let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction))
24   - self.addGestureRecognizer(tap)
  23 +// let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction))
  24 +// self.addGestureRecognizer(tap)
25 25 }
26 26  
27 27 required init?(coder: NSCoder) {
28 28 fatalError("init(coder:) has not been implemented")
29 29 }
30   - lazy var nameLabel: UILabel = {
31   - let nameLabel = UILabel.init()
32   - nameLabel.textColor = .white
33   - nameLabel.font = Font_16
34   - nameLabel.text = "啊啊"
35   - nameLabel.textColor = .red
36   - return nameLabel
37   - }()
38 30  
39   - lazy var imageView:UIImageView = {
40   -
41   - let tempImageView:UIImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: self.width, height: self.width * 0.7))
42   - tempImageView.image = UIImage(named: "homePage_zhongguorenming_bank")
43   -
44   - let path : UIBezierPath = UIBezierPath.init(roundedRect: tempImageView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 20, height: 20))
45   -
46   - let maskLayer = CAShapeLayer()
47   - maskLayer.frame = tempImageView.bounds
48   - maskLayer.path = path.cgPath
49   - tempImageView.layer.mask = maskLayer
  31 + lazy var textView: UITextView = {
  32 + let textView = UITextView.init()
50 33  
51   - return tempImageView
  34 + textView.textColor = HexColor("#333333")
  35 + textView.font = UIFont.init(name: "PingFangSC-Medium", size: 13)
  36 + textView.textAlignment = .left
  37 + textView.contentMode = .scaleAspectFill
  38 + textView.sizeToFit()
  39 + textView.backgroundColor = .yellow
  40 + return textView
  41 + }()
  42 +
  43 +// lazy var imageView:UIImageView = {
  44 +//
  45 +// let tempImageView:UIImageView = UIImageView(frame: CGRect(x: 0, y: 0, width: self.width, height: self.width * 0.7))
  46 +// tempImageView.image = UIImage(named: "homePage_zhongguorenming_bank")
  47 +//
  48 +// let path : UIBezierPath = UIBezierPath.init(roundedRect: tempImageView.bounds, byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 20, height: 20))
  49 +//
  50 +// let maskLayer = CAShapeLayer()
  51 +// maskLayer.frame = tempImageView.bounds
  52 +// maskLayer.path = path.cgPath
  53 +// tempImageView.layer.mask = maskLayer
  54 +//
  55 +// return tempImageView
  56 +// }()
  57 +
  58 + lazy var addStandBtn: UIButton = {
  59 + let addStandBtn = UIButton(type: .custom)
  60 + addStandBtn.clipsToBounds = true
  61 + addStandBtn.layer.cornerRadius = 19.5
  62 + addStandBtn.backgroundColor = .white
  63 + addStandBtn.setTitle("点击添加身份", for: .normal)
  64 + addStandBtn.setTitleColor(.white, for: .normal)
  65 + addStandBtn.titleLabel?.font = UIFont.init(name: "PingFangSC-Medium", size: 14)
  66 + addStandBtn.addTarget(self, action: #selector(addStandBtnAction), for: .touchUpInside)
  67 + return addStandBtn
52 68 }()
53 69  
54 70 lazy var contentView : UIView = {
... ... @@ -58,28 +74,70 @@ class CNFrontMainView : UIView{
58 74 contentView.clipsToBounds = true
59 75 contentView.layer.cornerRadius = 20
60 76  
61   - let W = contentView.width - 40
62   - let imageView = UIImageView.init(frame: CGRect(x: 20, y: 25, width: W, height: W*0.63))
63   - imageView.image = UIImage.init(named: "homePage_mainView_front");
64   - contentView.addSubview(imageView)
  77 +// let W = contentView.width - 40
  78 +// let imageView = UIImageView.init(frame: CGRect(x: 20, y: 25, width: W, height: W*0.63))
  79 +// imageView.image = UIImage.init(named: "homePage_mainView_front");
  80 +// contentView.addSubview(imageView)
65 81  
66   - nameLabel.frame = CGRect(x: 0, y: 0, width: 100, height: 30)
67   - nameLabel.text = "啊啊"
68   - contentView.addSubview(nameLabel)
  82 + contentView.addSubview(self.addStandBtn)
  83 + addStandBtn.snp.makeConstraints { make in
  84 + make.centerX.equalToSuperview()
  85 + make.bottom.equalToSuperview().offset(-30)
  86 + make.width.equalTo(150)
  87 + make.height.equalTo(39)
  88 + }
  89 +
  90 + contentView.addSubview(self.textView)
  91 + textView.snp.makeConstraints { make in
  92 + make.top.equalToSuperview().offset(40)
  93 + make.left.equalToSuperview().offset(30)
  94 + make.right.equalToSuperview().offset(-30)
  95 + make.bottom.equalTo(addStandBtn.snp.top).offset(-30)
  96 + }
69 97  
70 98 return contentView
71 99  
72 100 }()
73 101  
  102 + //IDmodel
  103 + var _idModel : CNLiveIdentityModel?
  104 + var idModel : CNLiveIdentityModel? {
  105 + get{
  106 + _idModel
  107 + }
  108 + set{
  109 + let auth = newValue!.auth
  110 + if(auth == true){
  111 + //已认证身份
  112 + //显示证件View
  113 + print("已认证身份")
  114 +// self.imageView.isHidden = false
  115 + self.textView.isHidden = true
  116 + }else
  117 + {//未认证身份
  118 +// self.imageView.isHidden = true
  119 + //显示textview 添加身份
  120 + self.textView.isHidden = false
  121 + self.textView.text = newValue!.description
  122 + addStandBtn.backgroundColor = HexColor(newValue!.backgroundColor!)
  123 + }
  124 + _idModel = newValue
  125 + }
  126 +
  127 + }
  128 +
74 129 func initUI()
75 130 {
76   -// self.addSubview(self.imageView)
77 131 self.addSubview(self.contentView)
78 132 }
79 133  
  134 + // MARK: - <##>按钮点击事件
80 135 @objc func tapAction(){
81 136 tapTransformAciton!()
82 137 }
  138 + @objc func addStandBtnAction() {
  139 +
  140 + }
83 141 }
84 142  
85 143 ///反面View
... ... @@ -122,6 +180,8 @@ class CNBackMainView : UIView{
122 180 bottomBackBtn.addTarget(self, action: #selector(tapAction), for: .touchUpInside)
123 181 return bottomBackBtn
124 182 }()
  183 +
  184 +
125 185 //MARK: - 初始化
126 186 override init(frame: CGRect) {
127 187 super.init(frame: frame)
... ... @@ -160,6 +220,19 @@ class CNMainView : UIView{
160 220 fatalError("init(coder:) has not been implemented")
161 221 }
162 222  
  223 + //IDmodel
  224 + var _idModel : CNLiveIdentityModel?
  225 + var idModel : CNLiveIdentityModel? {
  226 + get{
  227 + _idModel
  228 + }
  229 + set{
  230 + self.frontView.idModel = newValue!
  231 + _idModel = newValue
  232 + }
  233 +
  234 + }
  235 +
163 236 ///正面View
164 237 lazy var frontView:CNFrontMainView = {
165 238  
... ... @@ -180,8 +253,6 @@ class CNMainView : UIView{
180 253 }()
181 254  
182 255  
183   -
184   -
185 256 func initUI()
186 257 {
187 258 self.addSubview(self.frontView)
... ... @@ -199,6 +270,7 @@ class CNMainView : UIView{
199 270 }
200 271  
201 272 // MARK: - 事件
  273 +
202 274 ///旋转到反面
203 275 func transformToBacnkView()
204 276 {
... ... @@ -251,7 +323,7 @@ class CNMainView : UIView{
251 323 ///缩放
252 324 open func scaledView(scale:CGFloat)
253 325 {
254   - self.frontView.imageView.transform = CGAffineTransformMakeScale(scale, scale);
  326 +// self.frontView.imageView.transform = CGAffineTransformMakeScale(scale, scale);
255 327 }
256 328 }
257 329  
... ...