Commit 6d88c5699f8411a7ddbd8a25231e5a38c31ea3e7

Authored by “张旭”
1 parent 1af7f5eb

下滑页大图点击 , 大图详情页变形问题 , 删除WebViewJavascriptBridge 的UIWebview

... ... @@ -67,11 +67,28 @@ target 'metaCode' do
67 67 # pod 'QMUIKit'
68 68 pod 'YYWebImage', :git => 'https://gitee.com/mirrors/YYWebImage.git'
69 69  
  70 + pod 'WebViewJavascriptBridge'
  71 +
70 72 #依赖三方私有库,如果里面有.a的时候加上这个
71 73 pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
72 74 end
73 75  
  76 + #依赖三方私有库,如果里面有.a的时候加上这个
  77 + pre_install do |installer| Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
  78 + ############################################ #删除WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件
74 79  
  80 + dir_web = File.join(installer.sandbox.pod_dir('WebViewJavascriptBridge'), 'WebViewJavascriptBridge')
  81 + Dir.foreach(dir_web) {|x|
  82 + real_path = File.join(dir_web, x)
  83 + if (!File.directory?(real_path) && File.exists?(real_path))
  84 + if(x == 'WebViewJavascriptBridge.h' || x == 'WebViewJavascriptBridge.m')
  85 + File.delete(real_path)
  86 + end
  87 + end
  88 + }
  89 + #删除WebViewJavascriptBridge中的WebViewJavascriptBridge.h和WebViewJavascriptBridge.m文件
  90 + #################################################
  91 + end
75 92  
76 93  
77 94  
... ...
metaCode/Classes/Main/HomePage/Controller/AuthMainController/CNMetaCodeHomePageController.swift
... ... @@ -56,6 +56,9 @@ enum VNumPage {
56 56  
57 57 class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDelegate, NewPagedFlowViewDataSource, CNCustomIndexViewDelegate,UIGestureRecognizerDelegate,WKNavigationDelegate{
58 58  
  59 + //获取身份信息接口总次数,为0时刷新左右轮播
  60 + var reloadNum:Int = 0
  61 + var reloadShopNum:Int = 1
59 62  
60 63 ///NewPagedFlowView 开始滑动时的偏移量
61 64 private var beginOffset = 0.0
... ... @@ -396,9 +399,6 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
396 399 bannerView?.idModel = identityModel
397 400 if (identityModel.auth == true){
398 401 bannerView?.baseScrollView.isScrollEnabled = true
399   - if identityModel.id == 9{
400   - self.getApplyShopInfo()
401   - }
402 402 }else{
403 403 //未认证
404 404 if (identityModel.downType == 3 || identityModel.downType == 4 || identityModel.upType == 3 || identityModel.upType == 4)
... ... @@ -409,7 +409,8 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
409 409 }
410 410  
411 411 //未认证&要显示的是电商
412   - if identityModel.id == 9{
  412 + if identityModel.id == 9 && reloadShopNum == 1{
  413 + reloadShopNum = reloadShopNum - 1
413 414 self.getApplyShopInfo()
414 415 }
415 416 }
... ... @@ -626,7 +627,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
626 627 {
627 628 // showLoading(message: "")
628 629 CNLiveMineViewModel.requestAuthStandList(page: 1)
629   - { result, respStatue in
  630 + { [self] result, respStatue in
630 631  
631 632 hiddenLoading()
632 633 if respStatue == .success{
... ... @@ -636,10 +637,9 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
636 637  
637 638 self.dataArray = NSMutableArray.init()
638 639 self.dataArray.addObjects(from: listArray as! [Any])
639   - self.addPageView()
640   -
641   - self.backgroupView.updateData(idArray: listArray as! Array<StandListModel>)
642 640  
  641 + //全部已认证
  642 + var isAllAuthed = true
643 643 //请求身份详情,判断是企业认证还是个人认证
644 644 listArray.forEach { standListModel in
645 645 let listModel = standListModel as! StandListModel
... ... @@ -648,9 +648,16 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
648 648 listModel.isPersonOrEnterprise = 3
649 649 }else{
650 650 //未认证
  651 + isAllAuthed = false
651 652 self.getStandInfo(identityId: "\(listModel.id)")
  653 + reloadNum = reloadNum + 1
652 654 }
653 655 }
  656 + if isAllAuthed{
  657 + self.addPageView()
  658 +
  659 + self.backgroupView.updateData(idArray: listArray as! Array<StandListModel>)
  660 + }
654 661  
655 662 }else{
656 663 self.NetApiStatus = .apiError
... ... @@ -667,7 +674,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
667 674  
668 675 // MARK: - 获取身份信息是个人认证还是企业认证,机构认证
669 676 func getStandInfo(identityId:String){
670   - CNLiveMineViewModel.requestsStandInfo(identityId: identityId, type: .effect, authType: .person) { result, respStatue in
  677 + CNLiveMineViewModel.requestsStandInfo(identityId: identityId, type: .effect, authType: .person) { [self] result, respStatue in
671 678 hiddenLoading()
672 679 if respStatue == .success{
673 680 let standInfoBaseModel = result as! MineStandInfoBaseModel
... ... @@ -675,104 +682,59 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
675 682 let listModel = standListModel as! StandListModel
676 683 if listModel.id == standInfoBaseModel.identityId{
677 684 listModel.standInfoBaseModel = standInfoBaseModel
678   - }
679   - }
680   -
681   - if standInfoBaseModel.authInfos.count > 0{
682   - //个人认证有值
683   - if standInfoBaseModel.enterpriseAuthInfos.count > 0{
684   - //个人有值,企业认证有值
685   - if standInfoBaseModel.agencyAuthInfos.count > 0{
686   - //个人有值,企业有值,机构认证有值
687   - self.dataArray.forEach { standListModel in
688   - let listModel = standListModel as! StandListModel
689   - if listModel.id == standInfoBaseModel.identityId{
690   - //目标model,企业+个人+机构
  685 + if standInfoBaseModel.authInfos.count > 0{
  686 + //个人认证有值
  687 + if standInfoBaseModel.enterpriseAuthInfos.count > 0{
  688 + //个人有值,企业认证有值
  689 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  690 + //个人有值,企业有值,机构认证有值
691 691 listModel.isPersonOrEnterprise = 4
692   - }
693   - }
694   -
695   - }else{
696   - //个人有值,企业有值,机构认证没值
697   - self.dataArray.forEach { standListModel in
698   - let listModel = standListModel as! StandListModel
699   - if listModel.id == standInfoBaseModel.identityId{
700   - //目标model,企业+个人
  692 + }else{
  693 + //个人有值,企业有值,机构认证没值
701 694 listModel.isPersonOrEnterprise = 0
702 695 }
703   - }
704   - }
705   -
706   - }else{
707   - //个人有值,企业认证没值
708   - if standInfoBaseModel.agencyAuthInfos.count > 0{
709   - //个人有值,企业没值,机构有值
710   - self.dataArray.forEach { standListModel in
711   - let listModel = standListModel as! StandListModel
712   - if listModel.id == standInfoBaseModel.identityId{
713   - //目标model
  696 +
  697 + }else{
  698 + //个人有值,企业认证没值
  699 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  700 + //个人有值,企业没值,机构有值
714 701 listModel.isPersonOrEnterprise = 0
715   - }
716   - }
717   - }else{
718   - //个人有值,企业没值,机构没值
719   - self.dataArray.forEach { standListModel in
720   - let listModel = standListModel as! StandListModel
721   - if listModel.id == standInfoBaseModel.identityId{
722   - //目标model ,个人
  702 + }else{
  703 + //个人有值,企业没值,机构没值
723 704 listModel.isPersonOrEnterprise = 1
724 705 }
725 706 }
726   - }
727   - }
728   -
729   - }else if standInfoBaseModel.enterpriseAuthInfos.count > 0{
730   - //企业认证有值,个人没值
731   - if standInfoBaseModel.agencyAuthInfos.count > 0{
732   - ///企业有值,个人没值,机构有值
733   - self.dataArray.forEach { standListModel in
734   - let listModel = standListModel as! StandListModel
735   - if listModel.id == standInfoBaseModel.identityId{
736   - //目标model
  707 +
  708 + }else if standInfoBaseModel.enterpriseAuthInfos.count > 0{
  709 + //企业认证有值,个人没值
  710 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  711 + ///企业有值,个人没值,机构有值
737 712 listModel.isPersonOrEnterprise = 0
738   - }
739   - }
740   - }else{
741   - ///企业有值,个人没值,机构没值
742   - self.dataArray.forEach { standListModel in
743   - let listModel = standListModel as! StandListModel
744   - if listModel.id == standInfoBaseModel.identityId{
745   - //目标model ,企业
  713 + }else{
  714 + ///企业有值,个人没值,机构没值
746 715 listModel.isPersonOrEnterprise = 2
747 716 }
748   - }
749   - }
750   -
751   -
752   - }else{
753   - //企业个人都没值
754   - if standInfoBaseModel.agencyAuthInfos.count > 0{
755   - //企业没值,个人没值,机构有值
756   - self.dataArray.forEach { standListModel in
757   - let listModel = standListModel as! StandListModel
758   - if listModel.id == standInfoBaseModel.identityId{
759   - //目标model 机构
  717 +
  718 +
  719 + }else{
  720 + //企业个人都没值
  721 + if standInfoBaseModel.agencyAuthInfos.count > 0{
  722 + //企业没值,个人没值,机构有值
760 723 listModel.isPersonOrEnterprise = 5
761   - }
762   - }
763   - }else{
764   - //企业没值,个人没值,机构没值
765   - self.dataArray.forEach { standListModel in
766   - let listModel = standListModel as! StandListModel
767   - if listModel.id == standInfoBaseModel.identityId{
768   - //目标model ,已认证/无企业和个人
  724 + }else{
  725 + //企业没值,个人没值,机构没值
769 726 listModel.isPersonOrEnterprise = 3
770 727 }
771 728 }
772 729 }
773   -
774 730 }
775   - self.pageFlowView.reloadData()
  731 + //已请求全部身份详情,开始刷新
  732 + reloadNum = reloadNum - 1
  733 + if reloadNum == 0{
  734 + self.addPageView()
  735 + let arr = Array(self.dataArray)
  736 + self.backgroupView.updateData(idArray: arr as! Array<StandListModel>)
  737 + }
776 738 }else{
777 739 //网络请求失败
778 740 }
... ... @@ -789,8 +751,10 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
789 751 for (index, item) in self!.dataArray.enumerated() {
790 752 let model = item as! StandListModel
791 753 model.shopInfoModel = shopModel
792   - let bannerView = self?.pageFlowView.cells[index] as? CNCustomIndexView
793   - bannerView?.idModel = model
  754 + if model.id == 9{
  755 + let bannerView = self?.pageFlowView.cells[index] as? CNCustomIndexView
  756 + bannerView?.idModel = model
  757 + }
794 758 }
795 759 }
796 760 }
... ...
metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideDetailViewController.swift
... ... @@ -269,7 +269,7 @@ class CNUpSlideDetailViewController: CNLiveBaseViewController,UITableViewDataSou
269 269 return 75
270 270 }else if self.slideModel?.type == SlideModelTypeOneCourse75{
271 271 //大图课程
272   - return KSreenWidth
  272 + return KSreenWidth*(KSreenWidth/DownSlideSingleCourseW)
273 273 }
274 274 }
275 275 }else{
... ...
metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideViewController.swift
... ... @@ -131,7 +131,6 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa
131 131 guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveDownSlideSingleCourseCellIdentifier) as? CNDownSlideSingleCourseCell
132 132 else {
133 133 let cell = CNDownSlideSingleCourseCell()
134   - cell.slideModel = slideModel
135 134 return cell
136 135 }
137 136 cell.slideModel = slideModel
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNDownSlideView.swift
... ... @@ -149,14 +149,14 @@ class CNDownSlideView:UIView{
149 149 override init(frame: CGRect) {
150 150 super.init(frame: frame)
151 151  
152   -// let tap = UITapGestureRecognizer.init(target: self, action: #selector(slideViewTap))
153   -// tap.cancelsTouchesInView = false
154   -// self.addGestureRecognizer(tap)
  152 + let tap = UITapGestureRecognizer.init(target: self, action: #selector(slideViewTap))
  153 + tap.cancelsTouchesInView = false
  154 + self.addGestureRecognizer(tap)
155 155 self.initUI()
156 156 }
157   -// @objc func slideViewTap() {
158   -// print("slideViewTap")
159   -// }
  157 + @objc func slideViewTap() {
  158 + print("slideViewTap")
  159 + }
160 160 required init?(coder: NSCoder) {
161 161 fatalError("init(coder:) has not been implemented")
162 162 }
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNHomePageBackgroupView.swift
... ... @@ -77,9 +77,9 @@ class CNHomePageBackgroupView: UIView{
77 77 ///当前在屏幕显示的view
78 78 var currentApearView: CNHomePageBackgroupSubView?
79 79 ///数据源
80   - lazy var dataArray:Array<CNHomePageBackgroupSubView> = {
81   - let dataArray = Array<CNHomePageBackgroupSubView>()
82   - return dataArray
  80 + lazy var groupSubViewDataArray:Array<CNHomePageBackgroupSubView> = {
  81 + let groupSubViewDataArray = Array<CNHomePageBackgroupSubView>()
  82 + return groupSubViewDataArray
83 83 }()
84 84  
85 85 // MARK: - 初始化
... ... @@ -103,7 +103,7 @@ class CNHomePageBackgroupView: UIView{
103 103 let obj:UIView = array[i]
104 104 obj.removeFromSuperview()
105 105 }
106   - self.dataArray = Array<CNHomePageBackgroupSubView>()
  106 + self.groupSubViewDataArray = Array<CNHomePageBackgroupSubView>()
107 107  
108 108 for i in (0..<idArray.count){
109 109  
... ... @@ -117,11 +117,11 @@ class CNHomePageBackgroupView: UIView{
117 117 subView.imageView.kf.setImage(with: URL(string: idModel.backgroundImg),placeholder: UIImage(named: "homePage_backgroup_blue"))
118 118  
119 119 //更新双向链表
120   - let lastSubView: CNHomePageBackgroupSubView? = self.dataArray.last
  120 + let lastSubView: CNHomePageBackgroupSubView? = self.groupSubViewDataArray.last
121 121 lastSubView?.nextSubView = subView
122 122 subView.preSubView = lastSubView
123 123  
124   - self.dataArray.append(subView)
  124 + self.groupSubViewDataArray.append(subView)
125 125  
126 126 if i==0 {
127 127 self.currentApearView = subView
... ... @@ -130,7 +130,7 @@ class CNHomePageBackgroupView: UIView{
130 130 }
131 131  
132 132 //倒序添加子view
133   - for i in self.dataArray.enumerated().reversed() {
  133 + for i in self.groupSubViewDataArray.enumerated().reversed() {
134 134  
135 135 let subview: CNHomePageBackgroupSubView = i.element
136 136 self.addSubview(subview)
... ... @@ -148,14 +148,14 @@ class CNHomePageBackgroupView: UIView{
148 148 if(currentApearViewIndex == 0){
149 149 return nil
150 150 }
151   - return dataArray[currentApearViewIndex - 1]
  151 + return groupSubViewDataArray[currentApearViewIndex - 1]
152 152 }
153 153 ///获取当前视图右边的子视图
154 154 func getRightView()->CNHomePageBackgroupSubView?{
155   - if(currentApearViewIndex >= self.dataArray.count - 1){
  155 + if(currentApearViewIndex >= self.groupSubViewDataArray.count - 1){
156 156 return nil
157 157 }
158   - return dataArray[currentApearViewIndex + 1]
  158 + return groupSubViewDataArray[currentApearViewIndex + 1]
159 159 }
160 160  
161 161 /// 替换当前显示的子view
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNMainView.swift
... ... @@ -22,8 +22,8 @@ class CNFrontMainView : UIView{
22 22 override init(frame: CGRect) {
23 23 super.init(frame: frame)
24 24 self.initUI()
25   -// let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction))
26   -// self.addGestureRecognizer(tap)
  25 + let tap:UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapAction))
  26 + self.addGestureRecognizer(tap)
27 27 }
28 28  
29 29 required init?(coder: NSCoder) {
... ... @@ -519,18 +519,18 @@ class CNFrontMainView : UIView{
519 519  
520 520 if (payLayer != nil){
521 521 //已添加layer
522   - }else{
523   - //未添加layer
524   - let gradient = CAGradientLayer()
525   - gradient.frame = self.bounds
526   - gradient.colors = [HexColor(startHex)!.cgColor, HexColor(endHex)!.cgColor]
527   - gradient.locations = [0, 1]
528   - gradient.startPoint = CGPoint(x: 0, y: 0.43)
529   - gradient.endPoint = CGPoint(x: 0.43, y: 0.43)
530   - gradient.name = unStandBtnBgViewLayer
531   - self.unStandBtnBgView.layer.insertSublayer(gradient, at: 0)
532   - self.unStandBtnBgView.backgroundColor = .clear
  522 + payLayer?.removeFromSuperlayer()
533 523 }
  524 + //添加新layer
  525 + let gradient = CAGradientLayer()
  526 + gradient.frame = self.bounds
  527 + gradient.colors = [HexColor(startHex)!.cgColor, HexColor(endHex)!.cgColor]
  528 + gradient.locations = [0, 1]
  529 + gradient.startPoint = CGPoint(x: 0, y: 0.43)
  530 + gradient.endPoint = CGPoint(x: 0.43, y: 0.43)
  531 + gradient.name = unStandBtnBgViewLayer
  532 + self.unStandBtnBgView.layer.insertSublayer(gradient, at: 0)
  533 + self.unStandBtnBgView.backgroundColor = .clear
534 534 }
535 535 func subLayer(name:String,viewLayer:CALayer) -> CALayer?{
536 536 if let subLayer = viewLayer.sublayers?.first(where: { $0.name == name }) {
... ... @@ -556,7 +556,8 @@ class CNFrontMainView : UIView{
556 556  
557 557 // MARK: -按钮点击事件
558 558 @objc func tapAction(){
559   - tapTransformAciton!()
  559 + //翻转到反面
  560 +// tapTransformAciton!()
560 561 }
561 562  
562 563 @objc func addStandBtnAction() {
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/UpSlide/CNUpSlideView.swift
... ... @@ -46,6 +46,9 @@ class CNUpSlideView:UIView{
46 46 }
47 47 set{
48 48 _downPath = newValue!
  49 + self.subviews.forEach { view in
  50 + view.removeFromSuperview()
  51 + }
49 52 if(type == UpDownTypeH5){
50 53 self.addSubview(self.webView)
51 54 if (_downPath != ""){
... ...
metaCode/Classes/Main/HomePages/View/HomepageDetail/CNLiveAlbumImageCell.swift
... ... @@ -11,7 +11,9 @@ class CNLiveAlbumImageCell:UITableViewCell{
11 11  
12 12 //MARK: - 懒加载
13 13 lazy var iconImgView :UIImageView = {
14   - let iconImgView = UIImageView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: KSreenWidth))
  14 + let iconImgView = UIImageView(frame: CGRect(x: (KSreenWidth - KSreenWidth*(KSreenWidth/DownSlideSingleCourseW))/2, y: 0, width: KSreenWidth*(KSreenWidth/DownSlideSingleCourseW), height: KSreenWidth*(KSreenWidth/DownSlideSingleCourseW)))
  15 + iconImgView.contentMode = .scaleAspectFill
  16 + iconImgView.clipsToBounds = true
15 17 return iconImgView
16 18 }()
17 19  
... ... @@ -28,6 +30,7 @@ class CNLiveAlbumImageCell:UITableViewCell{
28 30 private func setupUI() {
29 31 contentView.backgroundColor = HexColor(kCNDownSlideBackgroundColorHex)
30 32 self.contentView.addSubview(self.iconImgView)
  33 +
31 34 }
32 35  
33 36  
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
... ... @@ -284,7 +284,7 @@ class CNLiveMineViewModel: NSObject {
284 284 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
285 285 CNLiveNetworking.setAllowRequestDefaultArgument(true)
286 286 CNLiveNetworking.setupShowDataResult(false)
287   - CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .cacheNetwork) { task, result, error in
  287 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseMCUrl+"/identityApi/allList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
288 288 hiddenLoading()
289 289 if (error == nil) {
290 290 let resp = result as! NSDictionary
... ...