杨锴
2024-11-05 0fb7413df54760ac6bd15b90b738e0706de1629e
XQMuse/Root/Pavilion/VC/PavilionDetailVC.swift
@@ -21,6 +21,7 @@
            @IBOutlet weak var label_openTime: UILabel!
            @IBOutlet weak var cons_webHei: NSLayoutConstraint!
    private var barStyle:UIStatusBarStyle = .lightContent
            private var id:Int!
    private var detailModel:PavilionDetailModel?
@@ -43,6 +44,7 @@
                        title = "疗愈馆详情"
                        scrollView.contentInsetAdjustmentBehavior = .never
                        webView.scrollView.isScrollEnabled = false
        scrollView.delegate = self
                        Services.getPavlilonDetail(id: id).subscribe(onNext: {data in
                                    if let m = data.data{
@@ -56,7 +58,7 @@
                                                if bannerUrl.count > 0{
                                                            var items = [CommonBannerModel]()
                                                            for (index,v) in bannerUrl.enumerated(){
                                                                        items.append(CommonBannerModel(index: index, id: index, name: nil, resource: v, mediaType: .imageUrl))
                        items.append(CommonBannerModel(index: index, id: index, name: nil, resource: v.jq_urlEncoded(), mediaType: .imageUrl))
                                                            }
                                                            self.view_bannerBg.setItems(items: items)
                                                            self.view_bannerBg.collectionView.backgroundColor = .clear
@@ -153,8 +155,62 @@
            }
            override var preferredStatusBarStyle: UIStatusBarStyle{
                        return .lightContent
            }
    override var preferredStatusBarStyle: UIStatusBarStyle{
        return barStyle
    }
}
extension PavilionDetailVC:UIScrollViewDelegate{
    func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let v = min(scrollView.contentOffset.y / JQ_NavBarHeight, 1)
        navigationController?.navigationBar.standardAppearance.backgroundColor = .white.withAlphaComponent(v)
        if v > 0{
            (navigationItem.leftBarButtonItem?.customView as? UIButton)?.setImage(UIImage(named: "btn_back")?.withTintColor(.black.withAlphaComponent(v)), for: .normal)
            (navigationItem.rightBarButtonItem?.customView as? UIButton)?.setImage(UIImage(named: "btn_back")?.withTintColor(.black.withAlphaComponent(v)), for: .normal)
//            collect_bitem.tintColor = .black
//            share_bitem.tintColor = .black
            self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor:Def_NavFontColor.withAlphaComponent(v),.font:Def_NavFont]
            barStyle = .darkContent
        }else{
//            collect_bitem.tintColor =  self.courseDetailModel?.isCollect == .yes ? UIColor(hexString: "#fe5b60"):.white
//            share_bitem.tintColor = .white
            (navigationItem.leftBarButtonItem?.customView as? UIButton)?.setImage(UIImage(named: "btn_back")?.withTintColor(.white), for: .normal)
            self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor:UIColor.white,.font:Def_NavFont]
        }
        if v == 1{
            barStyle = .darkContent
            setNeedsStatusBarAppearanceUpdate()
        }else{
            barStyle = .lightContent
            setNeedsStatusBarAppearanceUpdate()
        }
//        if let table = scrollView as? UITableView{
//            if v > 0{
//                table.contentInset = UIEdgeInsets(top: JQ_NavBarHeight + 9, left: 0, bottom: 118, right: 0)
//            }else{
//                table.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 118, right: 0)
//            }
//        }
//        let offSetY = scrollView.contentOffset.y + CGRectGetHeight(scrollView.frame) / 2;
//        if let currentIndex = tableView?.indexPathForRow(at: CGPoint(x: 0, y: offSetY)){
//
//            if !isAnimationing{
//                if currentShowIndex != currentIndex{
//                    currentShowIndex = currentIndex
//                    pageMenu.selectedItemIndex = currentIndex.row
//                }
//            }
//        }
    }
}