杨锴
2024-10-24 e821bea13d9f20905bba3972c4e9c4964994db5d
XQMuse/Root/Home/HomeVC.swift
@@ -9,6 +9,7 @@
import JQTools
import RxSwift
import MediaPlayer
import MJRefresh
let SetBGMSuccess_Noti = Notification.Name.init("SetBGMSuccess_Noti")
@@ -48,6 +49,10 @@
                                                AudioPlayer.getSharedInstance().playSceneAt(audioFile)
                                    }
                        }
        tableView.mj_header = MJRefreshNormalHeader(refreshingBlock: {
            self.getData()
        })
                        getData()
    }
@@ -140,6 +145,7 @@
            }
            private func getData(){
        tableView.mj_header?.endRefreshing()
                        Services.getCategoryListByType(type: 1).subscribe(onNext: { data in
                                    var items = [HomeTopMenuItem]()
@@ -183,6 +189,7 @@
                                                self.viewModel.meditationList.removeAll()
                                                self.viewModel.meditationList = m
                                                for v in self.viewModel.meditationList{
                    if v.clientMeditationCategoryVO?.categoryName.isEmpty ?? true{continue}
                                                            self.titleItems.append(TitleItem(title: v.clientMeditationCategoryVO?.categoryName ?? "", subTitle: v.clientMeditationCategoryVO?.description ?? "",hasMore:true))
                                                }
                                                self.tableView.reloadData()
@@ -191,17 +198,13 @@
            }
            @objc func searchAction(){
                        let vc = SearchVC()
        let vc = SearchVC(serchType: .muse)
                        push(vc: vc)
            }
            @objc func settingvoiceAction(){
//                        let vc = BackgroundVoiceVC()
//                        push(vc: vc)
                         let nav = LoginNav(rootViewController: LoginVC())
                        nav.modalPresentationStyle = .fullScreen
                        present(nav, animated: true)
                        let vc = BackgroundVoiceVC()
                        push(vc: vc)
            }
            @objc func jumpMoreAction(_ sender:UIButton){
@@ -235,16 +238,20 @@
            func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
                        if indexPath.section == 0{
            //每日疗愈
                                    let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_1_TCell") as! Home_Style_1_TCell
                                    cell.model = viewModel.todyModel
                                    return cell
                        }else if indexPath.section == 1{
            //私人定制
                                    let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_4_TCell") as! Home_Style_4_TCell
                                    cell.style = .style1
                                    cell.setModels(viewModel.privateTodyModels)
                                    return cell
                        }else if indexPath.section == 2{
            // 新手冥想指南
                                    let cell = tableView.dequeueReusableCell(withIdentifier: "_Home_Style_2_TCell") as! Home_Style_2_TCell
            cell.imgView.image = UIImage(named: "bg_guide_home")
                                    cell.view_shadow.isHidden = true
                                    return cell
                        }else {
@@ -326,7 +333,9 @@
extension HomeVC:UIScrollViewDelegate{
            func scrollViewDidScroll(_ scrollView: UIScrollView) {
                        let v = min(scrollView.contentOffset.y / JQ_NavBarHeight, 1)
                        navigationController?.navigationBar.standardAppearance.backgroundColor = .white.withAlphaComponent(v)
//                        let v = min(scrollView.contentOffset.y / JQ_NavBarHeight, 1)
//                        navigationController?.navigationBar.standardAppearance.backgroundColor = .white.withAlphaComponent(v)
        navigationController?.navigationBar.standardAppearance.backgroundColor = .white
        navigationController?.navigationBar.scrollEdgeAppearance?.backgroundColor = .white
            }
}