Commit 13173d1c30b1c0fa8089bd3b29a06e07a70e2025
1 parent
afce1034
上下滑支持接口h5 , 点击添加身份 , tabbar默认首页
Showing
7 changed files
with
61 additions
and
17 deletions
metaCode/Classes/Common/Base/CNLiveBaseTabBarViewController.swift
metaCode/Classes/Main/HomePage/Controller/CNMetaCodeHomePageController.swift
| ... | ... | @@ -208,6 +208,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 208 | 208 | self.view.backgroundColor = KVCBackgroupColor |
| 209 | 209 | self.view.addSubview(self.backgroupView) |
| 210 | 210 | self.view.addSubview(self.notNetworkView) |
| 211 | + notNetworkView.isHidden = true | |
| 211 | 212 | self.notNetworkView.addSubview(self.errorImgView) |
| 212 | 213 | self.notNetworkView.addSubview(self.errorLabel) |
| 213 | 214 | self.notNetworkView.addSubview(self.errorFreshButton) |
| ... | ... | @@ -224,13 +225,13 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 224 | 225 | |
| 225 | 226 | } |
| 226 | 227 | |
| 227 | - // MARK: - <##>按钮点击事件 | |
| 228 | + // MARK: -按钮点击事件 | |
| 228 | 229 | //无网时刷新 |
| 229 | 230 | @objc func errorFreshButtonAction(){ |
| 230 | 231 | self.getUserIdentityApi() |
| 231 | 232 | } |
| 232 | 233 | |
| 233 | - // MARK: - <##>添加约束 | |
| 234 | + // MARK: -添加约束 | |
| 234 | 235 | func makeConstraints(){ |
| 235 | 236 | self.errorImgView.snp.makeConstraints { make in |
| 236 | 237 | make.centerX.equalToSuperview() |
| ... | ... | @@ -461,16 +462,19 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel |
| 461 | 462 | self.pageFlowView.scrollView.isUserInteractionEnabled = true |
| 462 | 463 | self.pageFlowView.isHidden = false |
| 463 | 464 | self.notNetworkView.isHidden = true |
| 465 | + notNetworkView.isHidden = true | |
| 464 | 466 | case .apiError://显示错误页面,隐藏UI |
| 465 | 467 | self.pageFlowView.scrollView.isUserInteractionEnabled = false |
| 466 | 468 | self.pageFlowView.isHidden = true |
| 467 | 469 | self.notNetworkView.isHidden = false |
| 470 | + notNetworkView.isHidden = false | |
| 468 | 471 | errorImgView.image = UIImage(named: "mine_list_source_unusual_failed") |
| 469 | 472 | errorLabel.text = "接口请求错误,刷新试试~" |
| 470 | 473 | case .notNetwork://显示无网页面,隐藏UI |
| 471 | 474 | self.pageFlowView.scrollView.isUserInteractionEnabled = false |
| 472 | 475 | self.pageFlowView.isHidden = true |
| 473 | 476 | self.notNetworkView.isHidden = false |
| 477 | + notNetworkView.isHidden = false | |
| 474 | 478 | errorImgView.image = UIImage(named: "mine_list_source_unusual_noNet") |
| 475 | 479 | errorLabel.text = "网络开小差了,刷新试试~" |
| 476 | 480 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNCustomIndexView.swift
| ... | ... | @@ -106,6 +106,8 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 106 | 106 | set{ |
| 107 | 107 | self.mainView.idModel = newValue! |
| 108 | 108 | _idModel = newValue |
| 109 | + self.upSlideView.url = _idModel?.upPath | |
| 110 | + self.downSlideView.url = _idModel?.downPath | |
| 109 | 111 | } |
| 110 | 112 | |
| 111 | 113 | } |
| ... | ... | @@ -249,7 +251,7 @@ class CNCustomIndexView:PGIndexBannerSubiew, UIScrollViewDelegate, WJColorChange |
| 249 | 251 | // self.addGestureRecognizer(singleTap) |
| 250 | 252 | // } |
| 251 | 253 | |
| 252 | - // MARK: - <##>设置前置视图容器 | |
| 254 | + // MARK: - 设置前置视图容器 | |
| 253 | 255 | func isHiddenMainFrontContentView(isHidden:Bool){ |
| 254 | 256 | self.mainView.isHiddenMainFrontContentView(isHidden: isHidden) |
| 255 | 257 | } | ... | ... |
metaCode/Classes/Main/HomePage/View/CNDownSlideView.swift
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | 9 | import UIKit |
| 10 | +import WebKit | |
| 10 | 11 | |
| 11 | 12 | typealias backBlock = ()->Void; |
| 12 | 13 | |
| ... | ... | @@ -35,6 +36,29 @@ class CNDownSlideView:UIView{ |
| 35 | 36 | return contentView |
| 36 | 37 | }() |
| 37 | 38 | |
| 39 | + //h5网页 | |
| 40 | + lazy var webView: WKWebView = { | |
| 41 | + let webView = WKWebView.init(frame: CGRectMake(0, 0, self.width, self.height-KTabBarHeight)) | |
| 42 | + webView.scrollView.showsVerticalScrollIndicator = false | |
| 43 | + webView.scrollView.showsHorizontalScrollIndicator = false | |
| 44 | + return webView | |
| 45 | + }() | |
| 46 | + | |
| 47 | + var _url:String? | |
| 48 | + var url:String? { | |
| 49 | + get{ | |
| 50 | + return _url | |
| 51 | + } | |
| 52 | + set{ | |
| 53 | + _url = newValue! | |
| 54 | +// _url = "https://www.baidu.com" | |
| 55 | + if (_url != ""){ | |
| 56 | + let webUrl: URL! = URL.init(string: _url!) | |
| 57 | + webView.load(URLRequest.init(url:webUrl)) | |
| 58 | + } | |
| 59 | + } | |
| 60 | + } | |
| 61 | + | |
| 38 | 62 | lazy var topView:UIView = { |
| 39 | 63 | |
| 40 | 64 | let tempTopView = UIView(frame: CGRect(x:0, y:20, width: self.width - 50, height: 70)) |
| ... | ... | @@ -85,6 +109,7 @@ class CNDownSlideView:UIView{ |
| 85 | 109 | self.addSubview(self.contentView) |
| 86 | 110 | self.addSubview(self.topView) |
| 87 | 111 | self.addSubview(self.bottomView) |
| 112 | + self.contentView.addSubview(self.webView) | |
| 88 | 113 | } |
| 89 | 114 | |
| 90 | 115 | @objc func backBtnAction(){ | ... | ... |
metaCode/Classes/Main/HomePage/View/CNMainView.swift
| ... | ... | @@ -158,8 +158,8 @@ class CNFrontMainView : UIView{ |
| 158 | 158 | tapTransformAciton!() |
| 159 | 159 | } |
| 160 | 160 | @objc func addStandBtnAction() { |
| 161 | - //跳转到添加身份页面 | |
| 162 | - | |
| 161 | + //跳转到添加身份页面 | |
| 162 | + currentViewController()?.navigationController?.pushViewController(CNLiveMineInputViewController.init(listModel: _idModel!), animated: true) | |
| 163 | 163 | } |
| 164 | 164 | } |
| 165 | 165 | ... | ... |
metaCode/Classes/Main/HomePage/View/CNUpSlideView.swift
| ... | ... | @@ -10,6 +10,28 @@ import WebKit |
| 10 | 10 | |
| 11 | 11 | ///上滑显示的VIew |
| 12 | 12 | class CNUpSlideView:UIView{ |
| 13 | + | |
| 14 | + lazy var webView: WKWebView = { | |
| 15 | + let webView = WKWebView.init(frame: CGRectMake(10, 20, self.width - 20, self.height - 20)) | |
| 16 | + webView.scrollView.showsVerticalScrollIndicator = false | |
| 17 | + webView.scrollView.showsHorizontalScrollIndicator = false | |
| 18 | + return webView | |
| 19 | + }() | |
| 20 | + | |
| 21 | + var _url:String? | |
| 22 | + var url:String? { | |
| 23 | + get{ | |
| 24 | + return _url | |
| 25 | + } | |
| 26 | + set{ | |
| 27 | + _url = newValue! | |
| 28 | + if (_url != ""){ | |
| 29 | + let webUrl: URL! = URL.init(string: _url!) | |
| 30 | + webView.load(URLRequest.init(url:webUrl)) | |
| 31 | + } | |
| 32 | + } | |
| 33 | + } | |
| 34 | + | |
| 13 | 35 | override init(frame: CGRect) { |
| 14 | 36 | super.init(frame: frame) |
| 15 | 37 | self.initUI() |
| ... | ... | @@ -25,14 +47,7 @@ class CNUpSlideView:UIView{ |
| 25 | 47 | self.backgroundColor = UIColor.white; |
| 26 | 48 | self.clipsToBounds = true; |
| 27 | 49 | self.layer.cornerRadius = 20; |
| 28 | - | |
| 29 | - let webView:WKWebView = WKWebView.init(frame: CGRectMake(10, 20, self.width - 20, self.height - 20)) | |
| 30 | - let url: URL! = URL.init(string: "https://www.baidu.com") | |
| 31 | - webView.load(URLRequest.init(url:url)) | |
| 32 | - webView.scrollView.showsVerticalScrollIndicator = false | |
| 33 | - webView.scrollView.showsHorizontalScrollIndicator = false | |
| 34 | - | |
| 35 | - self.addSubview(webView) | |
| 50 | + self.addSubview(self.webView) | |
| 36 | 51 | |
| 37 | 52 | |
| 38 | 53 | // let imageview : UIImageView = UIImageView.init(frame: CGRect(x: 20, y: 10, width: self.width - 40, height: self.height - 20)) | ... | ... |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
| ... | ... | @@ -148,7 +148,8 @@ class StandListModel: BaseModel { |
| 148 | 148 | var backgroundColour: String = "" |
| 149 | 149 | var description: String = ""//首页身份说明描述 |
| 150 | 150 | var cardImg: String = ""//卡片背景图 |
| 151 | - var downPath: String = "" | |
| 151 | + var downPath: String = ""//下滑h5 | |
| 152 | + var upPath: String = ""//上滑h5 | |
| 152 | 153 | |
| 153 | 154 | override func mapping(mapper: HelpingMapper) { |
| 154 | 155 | mapper <<< | ... | ... |