Commit d10ae240e88199bf9db771609c8c3e22a0719a6a

Authored by 张旭
1 parent 9aab1a32

标题自适应字号

metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
@@ -20,13 +20,15 @@ class CNCustomIndexTopView : UIView{ @@ -20,13 +20,15 @@ class CNCustomIndexTopView : UIView{
20 let titleLabel = UILabel.init(frame: CGRectMake(10, 0, 75, 35)) 20 let titleLabel = UILabel.init(frame: CGRectMake(10, 0, 75, 35))
21 titleLabel.bottom = self.bottom - 5 21 titleLabel.bottom = self.bottom - 5
22 titleLabel.textColor = .white 22 titleLabel.textColor = .white
  23 + titleLabel.textAlignment = .left
23 titleLabel.font = UIFont.systemFont(ofSize: 24, weight: .semibold) 24 titleLabel.font = UIFont.systemFont(ofSize: 24, weight: .semibold)
  25 + titleLabel.adjustsFontSizeToFitWidth=true
24 return titleLabel 26 return titleLabel
25 }() 27 }()
26 ///关闭按钮 28 ///关闭按钮
27 lazy var closeBtn: UIButton = { 29 lazy var closeBtn: UIButton = {
28 let closeBtn = UIButton(type: .custom) 30 let closeBtn = UIButton(type: .custom)
29 - closeBtn.frame = CGRect(x: self.width - 30, y: 0, width: 30, height: 30) 31 + closeBtn.frame = CGRect(x: self.width - 50, y: 0, width: 50, height: 50)
30 closeBtn.centerY = self.titleLabel.centerY 32 closeBtn.centerY = self.titleLabel.centerY
31 closeBtn.setImage(UIImage(named: "homePage_close_icon"), for: .normal) 33 closeBtn.setImage(UIImage(named: "homePage_close_icon"), for: .normal)
32 closeBtn.addTarget(self, action: #selector(closeBtnAction), for: .touchUpInside) 34 closeBtn.addTarget(self, action: #selector(closeBtnAction), for: .touchUpInside)
@@ -45,6 +47,16 @@ class CNCustomIndexTopView : UIView{ @@ -45,6 +47,16 @@ class CNCustomIndexTopView : UIView{
45 func initUI(){ 47 func initUI(){
46 self.addSubview(self.titleLabel) 48 self.addSubview(self.titleLabel)
47 self.addSubview(self.closeBtn) 49 self.addSubview(self.closeBtn)
  50 + self.titleLabel.snp.makeConstraints { make in
  51 + make.centerY.equalToSuperview()
  52 + make.left.equalToSuperview()
  53 + make.right.equalTo(closeBtn.snp.left)
  54 + }
  55 + self.closeBtn.snp.makeConstraints { make in
  56 + make.centerY.equalToSuperview()
  57 + make.right.equalToSuperview()
  58 + make.width.equalTo(50)
  59 + }
48 } 60 }
49 61
50 //MARK: - 公开方法 62 //MARK: - 公开方法
@@ -108,6 +120,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange @@ -108,6 +120,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
108 _idModel = newValue 120 _idModel = newValue
109 self.upSlideView.url = _idModel?.upPath 121 self.upSlideView.url = _idModel?.upPath
110 self.downSlideView.url = _idModel?.downPath 122 self.downSlideView.url = _idModel?.downPath
  123 + self.topNavView.setTitleString(title:(_idModel?.name)!)
111 } 124 }
112 125
113 } 126 }
@@ -210,7 +223,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange @@ -210,7 +223,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
210 223
211 /// 顶部自定义导航 224 /// 顶部自定义导航
212 lazy var topNavView: CNCustomIndexTopView = { 225 lazy var topNavView: CNCustomIndexTopView = {
213 - let topNavView = CNCustomIndexTopView.init(frame: CGRect(x: 0, y: 0, width: self.width, height: KNavigationHeight)) 226 + let topNavView = CNCustomIndexTopView.init(frame: CGRect(x: 0, y: 30, width: self.width, height: KNavigationHeight))
214 topNavView.alpha = 0 227 topNavView.alpha = 0
215 topNavView.closeAction = { [weak self ] in 228 topNavView.closeAction = { [weak self ] in
216 self!.baseScrollView.setContentOffset(CGPoint(x: 0, y: self!.baseScrollView.height), animated: true) 229 self!.baseScrollView.setContentOffset(CGPoint(x: 0, y: self!.baseScrollView.height), animated: true)
@@ -236,7 +249,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange @@ -236,7 +249,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange
236 249
237 self.addSubview(self.baseScrollView) 250 self.addSubview(self.baseScrollView)
238 self.addSubview(self.topNavView) 251 self.addSubview(self.topNavView)
239 - self.topNavView.setTitleString(title: "志愿者") 252 +// self.topNavView.setTitleString(title: "志愿者")
240 253
241 self.baseScrollView.addSubview(self.downSlideView) 254 self.baseScrollView.addSubview(self.downSlideView)
242 self.baseScrollView.addSubview(self.mainView) 255 self.baseScrollView.addSubview(self.mainView)
metaCode/Classes/Main/HomePage/View/CNHomePageBackgroupView.swift
@@ -28,6 +28,7 @@ class CNHomePageBackgroupSubView : UIView @@ -28,6 +28,7 @@ class CNHomePageBackgroupSubView : UIView
28 let titleLabel = UILabel.init(frame: CGRectMake(25, KNavigationHeight - 20, KSreenWidth - 50, 35)) 28 let titleLabel = UILabel.init(frame: CGRectMake(25, KNavigationHeight - 20, KSreenWidth - 50, 35))
29 titleLabel.textColor = .white 29 titleLabel.textColor = .white
30 titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .semibold) 30 titleLabel.font = UIFont.systemFont(ofSize: 20, weight: .semibold)
  31 + titleLabel.adjustsFontSizeToFitWidth=true
31 return titleLabel 32 return titleLabel
32 }() 33 }()
33 34
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
@@ -136,21 +136,24 @@ class StandListBaseModel: BaseModel { @@ -136,21 +136,24 @@ class StandListBaseModel: BaseModel {
136 136
137 final class StandListModel: BaseModel, TableCodable { 137 final class StandListModel: BaseModel, TableCodable {
138 138
139 - var icon: String?//小圆图标  
140 - var name: String?//名称  
141 - var enable: Bool = false//没用  
142 var id: Int = 0//ID号 139 var id: Int = 0//ID号
  140 + var name: String?//名称
  141 + var icon: String?//小圆图标
143 var createTime: Int = 0//注册时间 142 var createTime: Int = 0//注册时间
144 - var createTimeString: String = ""  
145 - var timeString: String = ""  
146 - var auth: Bool = false//身份是否验证 143 + var enable: Bool = false//没用
147 var backgroundImg: String = ""//首页背景图 144 var backgroundImg: String = ""//首页背景图
148 var backgroundColor: String = ""//添加身份按钮背景色 145 var backgroundColor: String = ""//添加身份按钮背景色
149 var backgroundColour: String = "" 146 var backgroundColour: String = ""
150 var description: String = ""//首页身份说明描述 147 var description: String = ""//首页身份说明描述
  148 + var descBackgroundImg: String = ""//首页文字背景图
151 var cardImg: String = ""//卡片背景图 149 var cardImg: String = ""//卡片背景图
152 - var downPath: String = ""//下滑h5 150 + var cardBackgroundImg: String = ""//首页卡片背景图
153 var upPath: String = ""//上滑h5 151 var upPath: String = ""//上滑h5
  152 + var downPath: String = ""//下滑h5
  153 + var auth: Bool = false//身份是否验证
  154 +
  155 + var createTimeString: String = ""
  156 + var timeString: String = ""
154 157
155 override func mapping(mapper: HelpingMapper) { 158 override func mapping(mapper: HelpingMapper) {
156 mapper <<< 159 mapper <<<