Commit 9709ff9d authored by pete谢兆麟's avatar pete谢兆麟

案例分享逻辑修改

parent 4d0cad51
......@@ -229,11 +229,6 @@ extension YHServiceCenterViewController {
}
@objc func pushOrderView() {
// let vc = YHResignGuidelinesExampleViewController()
// self.navigationController?.pushViewController(vc)
// return
var flag = true
if self.state == 1 || self.state == 3 {
......
......@@ -94,7 +94,6 @@ extension YHResignGuidelinesExampleShareViewController {
centerImageView = {
let view = UIImageView()
view.image = UIImage(named: centerImageName)
return view
}()
view.addSubview(centerImageView)
......@@ -126,6 +125,7 @@ extension YHResignGuidelinesExampleShareViewController {
make.center.equalToSuperview()
make.width.height.equalTo(21)
}
centerImageView.kf.setImage(with: URL(string: centerImageName))
let qrString = url
if let qrCode = qrString.generateQRCode() {
// 可以将qrCode设置为UIImageView的image属性来显示二维码
......
......@@ -7,6 +7,7 @@
//
import UIKit
import Kingfisher
enum YHResignGuidelinesExampleType: Int {
case house
......@@ -23,6 +24,9 @@ class YHResignGuidelinesExampleViewController: YHBaseViewController {
var type: YHResignGuidelinesExampleType = .house
// var viewModel = YHResignCertificateListViewModel()
var viewModel = YHResignGuidelinesViewModel()
var height: CGFloat = 0
var id = 3473
override func viewDidLoad() {
super.viewDidLoad()
gk_navTitle = "银河续签案例分享"
......@@ -37,21 +41,21 @@ class YHResignGuidelinesExampleViewController: YHBaseViewController {
}
func getData() {
if type == .house {
imageName = "resign_guidelines_example_house"
} else if type == .work {
imageName = "resign_guidelines_example_work"
} else if type == .taxation {
imageName = "resign_guidelines_example_taxation"
} else {
imageName = "resign_guidelines_example_nowork"
}
viewModel.getResignDetail(Id: 3473) {[weak self] success, error in
// if type == .house {
// imageName = "resign_guidelines_example_house"
// } else if type == .work {
// imageName = "resign_guidelines_example_work"
// } else if type == .taxation {
// imageName = "resign_guidelines_example_taxation"
// } else {
// imageName = "resign_guidelines_example_nowork"
// }
viewModel.getResignDetail(Id: id) {[weak self] success, error in
guard let self = self else { return }
self.imageName = self.viewModel.mainModel.content_url
self.getImageSizeFromURL(urlString: self.imageName)
}
tableView.reloadData()
}
func setView() {
......@@ -104,21 +108,41 @@ class YHResignGuidelinesExampleViewController: YHBaseViewController {
}
@objc func nextStep() {
var imageName = ""
if type == .house {
imageName = "resign_guidelines_example_house_share"
} else if type == .work {
imageName = "resign_guidelines_example_work_share"
} else if type == .taxation {
imageName = "resign_guidelines_example_taxation_share"
} else {
imageName = "resign_guidelines_example_nowork_share"
}
// var imageName = ""
// if type == .house {
// imageName = "resign_guidelines_example_house_share"
// } else if type == .work {
// imageName = "resign_guidelines_example_work_share"
// } else if type == .taxation {
// imageName = "resign_guidelines_example_taxation_share"
// } else {
// imageName = "resign_guidelines_example_nowork_share"
// }
let vc = YHResignGuidelinesExampleShareViewController()
vc.centerImageName = imageName
vc.centerImageName = self.viewModel.mainModel.share_url
vc.url = "https://baidu.com"
self.navigationController?.pushViewController(vc)
}
func getImageSizeFromURL(urlString: String) {
let imageURL = URL(string: urlString)!
// 使用Kingfisher的ImageDownloader下载图片数据
ImageDownloader.default.downloadImage(with: imageURL, options: [], progressBlock: nil) { (result) in
switch result {
case .success(let response):
// 使用UIImage初始化图片数据
let image = response.image
let size = image.size
let scale = size.width > 0 ? Double(size.height / size.width) : 0.0
// 获取图片的宽度和高度
self.height = KScreenWidth * scale
self.tableView.reloadData()
case .failure(let error):
print(error)
}
}
}
}
extension YHResignGuidelinesExampleViewController: UITableViewDelegate, UITableViewDataSource {
......@@ -133,15 +157,17 @@ extension YHResignGuidelinesExampleViewController: UITableViewDelegate, UITableV
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if type == .house {
return 986.fix
} else if type == .work {
return 925.fix
} else if type == .taxation {
return 946.fix
} else {
return 1069.fix
}
// if type == .house {
// return 986.fix
// } else if type == .work {
// return 925.fix
// } else if type == .taxation {
// return 946.fix
// } else {
// return 1069.fix
// }
return height
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......@@ -154,7 +180,7 @@ class YHResignGuidelinesExampleTableViewCell: UITableViewCell {
var bgImageView: UIImageView!
var imageName: String? {
didSet {
bgImageView.image = UIImage(named: imageName ?? "")
bgImageView.kf.setImage(with: URL(string: imageName))
}
}
override func awakeFromNib() {
......
......@@ -21,6 +21,8 @@ class YHResignGuidelinesModel: SmartCodable {
var is_finished_transcode: Int = 0
var img_url_compress: String = ""
var clue_classify_img_url: String = ""
var share_url: String = ""
var content_url: String = ""
required init() {
}
......
......@@ -18,10 +18,11 @@ class YHResignGuidelinesViewModel: YHBaseViewModel {
//1. json字符串 转 对象
guard self != nil else { return }
if json.code == 200 {
guard let dic = json.data?.peel as? [String : Any], let data = dic["data"] as? [String: Any], let result = YHResignGuidelinesModel.deserialize(from: data) else {
guard let dic = json.data?.peel as? [String : Any], let result = YHResignGuidelinesModel.deserialize(from: dic) else {
callBackBlock(false,nil)
return
}
self?.mainModel = result
callBackBlock(true, nil)
} else {
......
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