Commit fc3de8cb authored by pete谢兆麟's avatar pete谢兆麟

首页直播优化需求开发

parent baab3eee
......@@ -31,6 +31,7 @@
0411CF122D1C065300644D35 /* YHGCSignatureAddViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0411CF112D1C065300644D35 /* YHGCSignatureAddViewModel.swift */; };
0411CF142D1C0B0700644D35 /* YHGCSignatureAddModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0411CF132D1C0B0700644D35 /* YHGCSignatureAddModel.swift */; };
0411CF162D1C0D0C00644D35 /* YHGCSignatureAddTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0411CF152D1C0D0C00644D35 /* YHGCSignatureAddTableViewCell.swift */; };
0411CF182D1D502D00644D35 /* YHlifeCollectionReusableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0411CF172D1D502D00644D35 /* YHlifeCollectionReusableView.swift */; };
04307B662D1942F500ED8E8D /* YHDynamicSheetPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04307B652D1942F500ED8E8D /* YHDynamicSheetPickerView.swift */; };
04307B682D19911800ED8E8D /* YHIncomeInfoEditCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04307B672D19911800ED8E8D /* YHIncomeInfoEditCell.swift */; };
04307B6A2D1A4C6500ED8E8D /* YHIncomeInfoSelectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04307B692D1A4C6500ED8E8D /* YHIncomeInfoSelectCell.swift */; };
......@@ -1232,6 +1233,7 @@
0411CF112D1C065300644D35 /* YHGCSignatureAddViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCSignatureAddViewModel.swift; sourceTree = "<group>"; };
0411CF132D1C0B0700644D35 /* YHGCSignatureAddModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCSignatureAddModel.swift; sourceTree = "<group>"; };
0411CF152D1C0D0C00644D35 /* YHGCSignatureAddTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHGCSignatureAddTableViewCell.swift; sourceTree = "<group>"; };
0411CF172D1D502D00644D35 /* YHlifeCollectionReusableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHlifeCollectionReusableView.swift; sourceTree = "<group>"; };
04307B652D1942F500ED8E8D /* YHDynamicSheetPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDynamicSheetPickerView.swift; sourceTree = "<group>"; };
04307B672D19911800ED8E8D /* YHIncomeInfoEditCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeInfoEditCell.swift; sourceTree = "<group>"; };
04307B692D1A4C6500ED8E8D /* YHIncomeInfoSelectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIncomeInfoSelectCell.swift; sourceTree = "<group>"; };
......@@ -3041,6 +3043,7 @@
045C0ACB2D12CA5E00BD2DC0 /* YHLifeHeadView.swift */,
045C0ACC2D12CA5E00BD2DC0 /* YHLifeItemTableViewCell.swift */,
045C0ACD2D12CA5E00BD2DC0 /* YHLifeSectionView.swift */,
0411CF172D1D502D00644D35 /* YHlifeCollectionReusableView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -7135,6 +7138,7 @@
045C111D2D12CA5F00BD2DC0 /* YHResignInfoValidTimeItemView.swift in Sources */,
045C111E2D12CA5F00BD2DC0 /* YHPreviewAcademicAndProfessionalQualificationViewController.swift in Sources */,
045C111F2D12CA5F00BD2DC0 /* YHWorkExperienceTableViewCell.swift in Sources */,
0411CF182D1D502D00644D35 /* YHlifeCollectionReusableView.swift in Sources */,
045C11202D12CA5F00BD2DC0 /* UITextField+Extension.swift in Sources */,
045C11212D12CA5F00BD2DC0 /* YHPlayer.swift in Sources */,
045C11222D12CA5F00BD2DC0 /* YHAddAdoptersViewController.swift in Sources */,
......
......@@ -32,6 +32,7 @@ class YHLifeViewController: YHBaseViewController {
collectinoView.backgroundColor = .white
// collectinoView.contentInset = UIEdgeInsets(top: 16, left: 20, bottom: 0, right: 20)
collectinoView.register(YHLookCollectionViewCell.self, forCellWithReuseIdentifier:YHLookCollectionViewCell.cellReuseIdentifier)
collectinoView.register(YHlifeCollectionReusableView.self, forSupplementaryViewOfKind: UICollectionView.elementKindSectionFooter, withReuseIdentifier: YHlifeCollectionReusableView.reuseIdentifier)
collectinoView.delegate = self
collectinoView.dataSource = self
collectinoView.translatesAutoresizingMaskIntoConstraints = false
......@@ -97,6 +98,10 @@ extension YHLifeViewController {
}
}
self.viewModel.getSchedulLiveList {[weak self] success, error in
guard let self = self else { return }
self.myCollectView.reloadData()
}
}
func getDetailImages() {
......@@ -272,7 +277,7 @@ extension YHLifeViewController: JXSegmentedListContainerViewListDelegate {
}
}
extension YHLifeViewController: UICollectionViewDelegate, UICollectionViewDataSource {
extension YHLifeViewController: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.viewModel.liveArr.count
......@@ -298,6 +303,24 @@ extension YHLifeViewController: UICollectionViewDelegate, UICollectionViewDataSo
let playbackInfo = YHPlayerManager.PlaybackInfo(id: item.id, url: nil, title: item.live_title, roomId: item.room_id.count > 0 ? item.room_id : nil, uid: nil, isLive: true, scene: .fullscreen)
YHPlayerManager.shared.enterLive(from: nil, playbackInfo: playbackInfo)
}
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
if kind == UICollectionView.elementKindSectionFooter {
let footerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: YHlifeCollectionReusableView.reuseIdentifier, for: indexPath) as! YHlifeCollectionReusableView
// 配置 footerView
footerView.dataSource = self.viewModel.schedulLiveArr
return footerView
}
return UICollectionReusableView()
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForFooterInSection section: Int) -> CGSize {
if self.viewModel.schedulLiveArr.count != 0 {
let height = 50.0 + 104.0 * Double(self.viewModel.schedulLiveArr.count)
return CGSize(width: KScreenWidth, height: height) // 根据需要设置高度
}
return CGSize(width: KScreenWidth, height: 0) // 根据需要设置高度
}
}
class YHLookCollectionViewCell: UICollectionViewCell {
......
......@@ -22,3 +22,22 @@ class YHLiveModel: SmartCodable {
}
}
class YHLiveListModel: SmartCodable {
var live_id: Int = 0
var title: String = ""
var avatarurl: String = ""
var status: Int = 0
var start_time: String = ""
var account: String = ""
var image: String = ""
var is_schedule_live: Bool = false
required init() {
}
}
class YHLiveListDataModel: SmartCodable {
var live_list: [YHLiveListModel] = []
required init() {
}
}
......@@ -20,6 +20,7 @@ class YHHomePageViewModel : YHBaseViewModel {
var categoryArr:[YHHomeLifeCategoryModel?] = []
var detailModel: YHHomeLifeCategoryDetailModel = YHHomeLifeCategoryDetailModel()
var liveArr: [YHLiveModel] = []
var schedulLiveArr: [YHLiveListModel] = []
var liveInfo: YHHomeLiveInfoModel?
//首页相关参数
private var curPageIndex : Int = 1
......@@ -576,6 +577,30 @@ extension YHHomePageViewModel {
}
}
func getSchedulLiveList(callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.LiveSales.schedulLiveList
let _ = YHNetRequest.getRequest(url: strUrl) { [weak self] json, code in
guard let self = self else { return }
//1. json字符串 转 对象
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let resultModel = YHLiveListDataModel.deserialize(from: dic) else {
self.schedulLiveArr = []
callBackBlock(false,nil)
return
}
self.schedulLiveArr = resultModel.live_list
callBackBlock(true, nil)
} else {
self.schedulLiveArr = []
let error : YHErrorModel = YHErrorModel(errorCode:Int32(json.code), errorMsg: json.msg)
callBackBlock(false, error)
}
} failBlock: { err in
self.schedulLiveArr = []
callBackBlock(false, err)
}
}
//获取首页浮动小窗
func getHomeFloatingLive(callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Home.homeFloatingLive
......
......@@ -16,6 +16,8 @@ class YHSelectViewController: YHBaseViewController {
var headView: YHSelectLookHeadView!
var viewModel: YHSelectViewModel = YHSelectViewModel()
var selectItem: Int = 0
var buttonItem: Int = 0
var selectMenuView: YHSelectMenuView!
var canShowMenu: Bool = true
var hideFlag: Bool = false
......@@ -52,8 +54,13 @@ extension YHSelectViewController {
func loadData() {
self.viewModel.getCategoryList {[weak self] success, error in
guard let self = self else { return }
var dataSource: [String] = []
for item in self.viewModel.categoryArray {
dataSource.append(item.name)
}
self.headView.items = dataSource
}
self.viewModel.getGoodsList(categoryID: "0") {[weak self] success, error in
self.viewModel.getGoodsList(categoryID: "0", sortType: 0) {[weak self] success, error in
guard let self = self else { return }
self.tableView.reloadData()
if self.viewModel.goodsArray.count == 0 {
......@@ -76,7 +83,7 @@ extension YHSelectViewController {
func updataData() {
if selectItem < self.viewModel.categoryArray.count {
let model = self.viewModel.categoryArray[selectItem]
self.viewModel.getGoodsList(categoryID: model.id) {[weak self] success, error in
self.viewModel.getGoodsList(categoryID: model.id, sortType: buttonItem) {[weak self] success, error in
guard let self = self else { return }
self.tableView.reloadData()
if self.viewModel.goodsArray.count == 0 {
......@@ -112,27 +119,14 @@ extension YHSelectViewController {
sectionView.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 92)
headView = {
let head = YHSelectLookHeadView()
head.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 46)
head.block = {
self.tableView.setContentOffset(CGPoint(x: 0, y: 92), animated: true)
var dataSource: [String] = []
for item in self.viewModel.categoryArray {
dataSource.append(item.name)
}
if self.canShowMenu {
self.canShowMenu = false
self.selectMenuView = YHSelectMenuView()
var top: CGFloat = k_Height_NavigationtBarAndStatuBar + 46
if self.hideFlag {
top = k_Height_safeAreaInsetsTop() + 6 + 36 + 46 + 46
}
self.selectMenuView.show(top: top, selectItem: self.selectItem, dataSource: dataSource) { item in
self.selectItem = item
self.updataData()
self.canShowMenu = true
self.headView.itemButton.isSelected = false
}
}
head.frame = CGRect(x: 0, y: 0, width: KScreenWidth, height: 66)
head.block = { index in
self.selectItem = index
self.updataData()
}
head.buttonBlock = { index in
self.buttonItem = index
self.updataData()
}
return head
}()
......@@ -192,15 +186,15 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 46
return 66
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if selectItem < self.viewModel.categoryArray.count {
let model = self.viewModel.categoryArray[selectItem]
headView.itemButton.setTitle(model.name, for: .normal)
headView.itemButton.iconInRight(with: 0.5)
}
// if selectItem < self.viewModel.categoryArray.count {
// let model = self.viewModel.categoryArray[selectItem]
// headView.itemButton.setTitle(model.name, for: .normal)
// headView.itemButton.iconInRight(with: 0.5)
// }
return headView
}
......@@ -249,10 +243,10 @@ extension YHSelectViewController: JXSegmentedListContainerViewListDelegate {
}
func listWillDisappear() {
self.headView.itemButton.isSelected = false
if (self.selectMenuView != nil) {
self.selectMenuView.removeFromSuperview()
}
// self.headView.itemButton.isSelected = false
// if (self.selectMenuView != nil) {
// self.selectMenuView.removeFromSuperview()
// }
}
}
......
......@@ -41,8 +41,8 @@ extension YHSelectViewModel {
}
}
func getGoodsList(categoryID: String, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let params:[String : Any] = ["goods_category_id": categoryID, "page":1, "page_size": 100]
func getGoodsList(categoryID: String, sortType: Int,callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let params:[String : Any] = ["goods_category_id": categoryID, "page":1, "page_size": 100, "sort_type": sortType]
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.LiveSales.goodsList
let _ = YHNetRequest.getRequest(url: strUrl, params: params) { [weak self] json, code in
guard let self = self else { return }
......
......@@ -721,6 +721,7 @@ class YHAllApiName {
static let createOrder = "super-app/presale/app/order/create"
// APP直播间人数
static let livePeople = "super-app/live/live-people"
static let schedulLiveList = "super-app/live/schedule-live-list"
}
struct AIChat {
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "home_select_icon@2x.png",
"filename" : "20pt@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_select_icon@3x.png",
"filename" : "20pt@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
......@@ -5,12 +5,12 @@
"scale" : "1x"
},
{
"filename" : "home_select_icon_select@2x.png",
"filename" : "20pt@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_select_icon_select@3x.png",
"filename" : "20pt@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "home_select_icon_select_two@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "home_select_icon_select_two@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment