Commit 14809966 authored by David黄金龙's avatar David黄金龙

处理 几处bug

parent 083eb274
......@@ -152,8 +152,7 @@ extension YHActivityDetailViewController {
if !activityId.isEmpty {
viewModel.getActivityDetailData(activityID: activityId) { success, error in
if success {
//tableView
self.tableView.reloadData()
//bottomView
self.bottomView.dataModel = self.viewModel.activityDetailModel
......@@ -162,6 +161,9 @@ extension YHActivityDetailViewController {
YHHUD.flash(message: msg)
self.navigationController?.popViewController()
}
//tableView
self.tableView.reloadData()
}
} else {
YHHUD.flash(message: "参数错误")
......
......@@ -38,7 +38,7 @@ class YHActivityModel: YHBaseModel {
// 使用DateFormatter将Date对象转换为字符串
let dateString = dateFormatter.string(from: date)
dateFormatter.dateFormat = "mm:ss"
dateFormatter.dateFormat = "HH:mm"
let titmeString = dateFormatter.string(from: date)
// 获取Calendar的当前实例
......@@ -50,8 +50,14 @@ class YHActivityModel: YHBaseModel {
// 星期几的名称,根据weekday的值,1到7分别代表周一到周日
if weekday > 0 && weekday < 8 {
let weekdayName = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"][weekday - 1]
//3.
beginTimeForUI = dateString + " " + weekdayName + " " + titmeString
if let tttt = endTime.double() {
// 将时间戳转换为Date对象
let date2 = Date(timeIntervalSince1970: TimeInterval(tttt))
let titmeString2 = dateFormatter.string(from: date2)
beginTimeForUI = dateString + " " + weekdayName + " " + titmeString + "-" + titmeString2
}
}
}
}
......
......@@ -58,89 +58,53 @@ class YHActivityDetailCell: UITableViewCell {
}()
override func layoutSubviews() {
super.layoutSubviews()
//活动温馨提示
lazy var fakeView:UIView = {
let view = UIView()
view.backgroundColor = .clear
return view
}()
}
topImgV.snp.remakeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(KScreenWidth)
extension YHActivityDetailCell {
func updateUI() {
guard let model = dataModel else {
return
}
acitivityTitle.snp.remakeConstraints { make in
make.top.equalTo(topImgV.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
}
contentView.removeSubviews()
var lastView : UIView = acitivityTitle
contentView.addSubview(topImgV)
contentView.addSubview(acitivityTitle)
contentView.addSubview(acitivityDetail)
contentView.addSubview(acitivityTips)
contentView.addSubview(fakeView)
if acitivityDetail.isHidden {
if acitivityTips.isHidden {
acitivityTitle.snp.remakeConstraints { make in
make.top.equalTo(topImgV.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalToSuperview().offset(-42)
}
} else {
acitivityTips.snp.remakeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalToSuperview().offset(-42)
}
topImgV.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(KScreenWidth)
}
if let url = URL(string: model.cover) {
topImgV.kf.setImage(with: url, placeholder: UIImage(named: "global_default_image"))
} else {
if acitivityTips.isHidden {
acitivityDetail.snp.remakeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalToSuperview().offset(-42)
}
} else {
acitivityDetail.snp.remakeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
topImgV.image = UIImage(named: "global_default_image")
}
lastView = acitivityDetail
acitivityTips.snp.remakeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(24)
acitivityTitle.dataModel = model
acitivityTitle.snp.makeConstraints { make in
make.top.equalTo(topImgV.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
make.bottom.equalToSuperview().offset(-42)
}
}
}
}
}
extension YHActivityDetailCell {
func updateUI() {
guard let model = dataModel else {
return
}
var lastView : UIView = acitivityTitle
if let url = URL(string: model.cover) {
topImgV.kf.setImage(with: url, placeholder: UIImage(named: "global_default_image"))
} else {
topImgV.image = UIImage(named: "global_default_image")
}
acitivityTitle.dataModel = model
//acitivityDetail
if model.introduce.isEmpty && model.posters.count < 1 {
......@@ -150,6 +114,15 @@ extension YHActivityDetailCell {
//展示
acitivityDetail.isHidden = false
acitivityDetail.dataModel = model
acitivityDetail.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
}
lastView = acitivityDetail
}
//acitivityTips
......@@ -158,47 +131,27 @@ extension YHActivityDetailCell {
} else {
acitivityTips.isHidden = false
acitivityTips.dataModel = model
}
layoutIfNeeded()
}
func setupUI() {
backgroundColor = .clear
contentView.backgroundColor = .pageBkgColor
selectionStyle = .none
contentView.addSubview(topImgV)
contentView.addSubview(acitivityTitle)
contentView.addSubview(acitivityDetail)
contentView.addSubview(acitivityTips)
topImgV.snp.makeConstraints { make in
make.top.left.right.equalToSuperview()
make.height.equalTo(KScreenWidth)
}
acitivityTitle.snp.makeConstraints { make in
make.top.equalTo(topImgV.snp.bottom).offset(24)
acitivityTips.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
}
acitivityDetail.snp.makeConstraints { make in
make.top.equalTo(acitivityTitle.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
lastView = acitivityTips
}
acitivityTips.snp.makeConstraints { make in
make.top.equalTo(acitivityDetail.snp.bottom).offset(24)
fakeView.snp.makeConstraints { make in
make.top.equalTo(lastView.snp.bottom).offset(24)
make.left.equalTo(20)
make.right.equalTo(-20)
make.height.equalTo(1)
make.bottom.equalToSuperview().offset(-42)
}
}
func setupUI() {
backgroundColor = .clear
contentView.backgroundColor = .pageBkgColor
selectionStyle = .none
}
}
......@@ -55,7 +55,7 @@ class YHActivityTipsItemView: UIView {
nameLabel.textAlignment = .left
nameLabel.lineBreakMode = .byCharWrapping
nameLabel.font = UIFont.PFSC_R(ofSize:14)
nameLabel.text = "1、请大家仔细甄别活动的真实性、有效性、安全性。所有运动、户外等具有相关风险的活动请确认购买保险;\r\n2、此活动开始前24小时可以取消报名;\r\n3、若取消活动,系统将通知你活动取消。"
nameLabel.text = ""
nameLabel.numberOfLines = 0
return nameLabel
}()
......
......@@ -159,8 +159,8 @@ extension YHActivityTitleItemView {
make.bottom.equalToSuperview()
}
nameTextView.attributed.text = """
\("", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_B(ofSize:24)))\(.image(UIImage(named: "activity_vip_icon2")!,.custom(.offset(CGPoint(x: 0, y: -7)), size: .init(width: 44, height: 34))))
"""
// nameTextView.attributed.text = """
// \("", .foreground(UIColor.mainTextColor), .font(UIFont.PFSC_B(ofSize:24)))\(.image(UIImage(named: "activity_vip_icon2")!,.custom(.offset(CGPoint(x: 0, y: -7)), size: .init(width: 44, height: 34))))
// """
}
}
......@@ -120,11 +120,6 @@ extension YHOrderTipsItemView {
make.width.lessThanOrEqualTo(60)
}
// lableTime.backgroundColor = .red//for test hjl
addSubview(lableName)
lableName.snp.makeConstraints { make in
make.left.equalTo(segmentationView.snp.right).offset(8)
......
......@@ -36,9 +36,6 @@ class YHOrderTipsView: UIView {
let tap : UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(tapButton(gestureRecognizer:)))
addGestureRecognizer(tap)
// backgroundColor = .red //for test hjl
}
......
......@@ -50,8 +50,6 @@ class YHTestViewController: YHBaseViewController {
make.width.equalTo(width)
make.height.equalTo(80)
}
testView.layer.insertSublayer(gradientLayer, at: 0)
// testView.backgroundColor = .red//for test hjl
}
}
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