Commit 2c752735 authored by Steven杜宇's avatar Steven杜宇

// 新品

parent d0349142
......@@ -1310,6 +1310,7 @@
04DFB6F22E8BAA1C008EC0EB /* YHTagCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04DFB6F12E8BAA1C008EC0EB /* YHTagCollectionView.swift */; };
04DFB6F52E8BC896008EC0EB /* YHDynamicViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04DFB6F42E8BC896008EC0EB /* YHDynamicViewModel.swift */; };
04DFB6F72E8BC8C7008EC0EB /* YHDynamicItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04DFB6F62E8BC8C7008EC0EB /* YHDynamicItem.swift */; };
04DFB70E2E9BA461008EC0EB /* YHNewProductCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04DFB70D2E9BA461008EC0EB /* YHNewProductCell.swift */; };
04E0D3C82E866A6300F1824B /* YHCirclePhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E0D3C72E866A6300F1824B /* YHCirclePhotoCell.swift */; };
04E0D3CA2E866A9800F1824B /* YHCircleAddPhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E0D3C92E866A9800F1824B /* YHCircleAddPhotoCell.swift */; };
04E0D3CC2E877D4D00F1824B /* YHMediaUploadSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04E0D3CB2E877D4D00F1824B /* YHMediaUploadSheetView.swift */; };
......@@ -2690,6 +2691,7 @@
04DFB6F12E8BAA1C008EC0EB /* YHTagCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHTagCollectionView.swift; sourceTree = "<group>"; };
04DFB6F42E8BC896008EC0EB /* YHDynamicViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDynamicViewModel.swift; sourceTree = "<group>"; };
04DFB6F62E8BC8C7008EC0EB /* YHDynamicItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDynamicItem.swift; sourceTree = "<group>"; };
04DFB70D2E9BA461008EC0EB /* YHNewProductCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHNewProductCell.swift; sourceTree = "<group>"; };
04E0D3C72E866A6300F1824B /* YHCirclePhotoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCirclePhotoCell.swift; sourceTree = "<group>"; };
04E0D3C92E866A9800F1824B /* YHCircleAddPhotoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCircleAddPhotoCell.swift; sourceTree = "<group>"; };
04E0D3CB2E877D4D00F1824B /* YHMediaUploadSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHMediaUploadSheetView.swift; sourceTree = "<group>"; };
......@@ -3513,6 +3515,7 @@
045C0B002D12CA5E00BD2DC0 /* YHStatusAdvantageBottomView.swift */,
045C0B012D12CA5E00BD2DC0 /* YHTalentProgramEvaluationView.swift */,
04E507D52D6EE856005F758B /* YHUserLevelAlertView.swift */,
04DFB70D2E9BA461008EC0EB /* YHNewProductCell.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -7686,6 +7689,7 @@
045C0FD92D12CA5F00BD2DC0 /* YHHomeCollectionViewCell.swift in Sources */,
045C0FDA2D12CA5F00BD2DC0 /* YHBasicContentView.swift in Sources */,
045C0FDB2D12CA5F00BD2DC0 /* YHSelectViewController.swift in Sources */,
04DFB70E2E9BA461008EC0EB /* YHNewProductCell.swift in Sources */,
047A96862D1698150033BB4E /* YHGCMySchemeViewModel.swift in Sources */,
04AE20312D13B6E500891D24 /* YHGCChildBasicInfoVC.swift in Sources */,
045C0FDC2D12CA5F00BD2DC0 /* YHMyNotifySettingVC.swift in Sources */,
......
//
// YHNewProductCell.swift
// galaxy
//
// Created by Dufet on 2025/10/12.
// Copyright © 2025 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHNewProductCell: UITableViewCell {
static let cellReuseIdentifier = "YHNewProductCell"
lazy var imgView: UIImageView = {
let v = UIImageView()
v.clipsToBounds = true
return v
}()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupUI()
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
func updateModel(_ model: YHSelectGoodsModel) {
self.imgView.sd_setImage(with: URL(string: model.image), placeholderImage: UIImage(named: "global_default_image"))
}
func setupUI() {
self.selectionStyle = .none
self.contentView.addSubview(self.imgView)
self.imgView.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(160)
make.bottom.equalTo(-12)
}
}
}
......@@ -147,7 +147,9 @@ extension YHSelectViewController {
tableView.delegate = self
tableView.tableHeaderView = sectionView
tableView.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: 250))
tableView.register(cellWithClass: YHSelectLookTableViewCell.self)
tableView.register(YHSelectLookTableViewCell.self, forCellReuseIdentifier: YHSelectLookTableViewCell.cellReuseIdentifier)
tableView.register(YHNewProductCell.self, forCellReuseIdentifier: YHNewProductCell.cellReuseIdentifier)
return tableView
}()
view.addSubview(tableView)
......@@ -185,13 +187,30 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withClass: YHSelectLookTableViewCell.self)
let model = self.viewModel.goodsArray[indexPath.row]
if model.goodsCategoryType == 1 { // 新品商品
guard let cell = tableView.dequeueReusableCell(withIdentifier: YHNewProductCell.cellReuseIdentifier, for: indexPath) as? YHNewProductCell else {
return UITableViewCell()
}
cell.updateModel(model)
return cell
}
guard let cell = tableView.dequeueReusableCell(withIdentifier: YHSelectLookTableViewCell.cellReuseIdentifier, for: indexPath) as? YHSelectLookTableViewCell else {
return UITableViewCell()
}
cell.number = indexPath.row
cell.dataSource = self.viewModel.goodsArray[indexPath.row]
cell.dataSource = model
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
let model = self.viewModel.goodsArray[indexPath.row]
if model.goodsCategoryType == 1 { // 新品商品
return 160
}
if indexPath.row == 0 {
return 102
}
......@@ -221,10 +240,15 @@ extension YHSelectViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let model = self.viewModel.goodsArray[indexPath.row]
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/goods/sales-detail" + "?id=\(model.id)"
YHAnalytics.track("APP_GalaxySelectionPage_ClickProduct", properties: ["productID": model.id])
var url = ""
if model.goodsCategoryType == 1 { // 新品商品
url = YHBaseUrlManager.shared.businessH5Url() + "/yh-new-goods/detail?id=" + model.id
} else {
url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/goods/sales-detail" + "?id=\(model.id)"
YHAnalytics.track("APP_GalaxySelectionPage_ClickProduct", properties: ["productID": model.id])
}
if YHLoginManager.shared.isLogin() {
if YHLoginManager.shared.isLogin() {x
let token = YHLoginManager.shared.h5Token
let urlHasParam = String.hasQueryParameters(urlString: url)
if urlHasParam {
......@@ -264,6 +288,9 @@ extension YHSelectViewController: JXSegmentedListContainerViewListDelegate {
}
class YHSelectLookTableViewCell: UITableViewCell {
static let cellReuseIdentifier = "YHSelectLookTableViewCell"
var centerImageView: UIImageView!
var titleLabel: UILabel!
var subTitleLabel: UILabel!
......
......@@ -64,6 +64,7 @@ class YHSelectGoodsModel: SmartCodable {
var icons: [YHSelectGoodIconModel] = []
// 货币符号 HKD、CNY
var currency: String = ""
var goodsCategoryType: Int = 0 // 产品的分类类型:0 默认普通,1 新品商品
required init() {
}
......
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