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

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

* 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS:
  工作经验相关bug修复
parents 3f24a106 5e5d8f72
......@@ -401,8 +401,8 @@ extension YHHomeViewController : UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
tableView.deselectRow(at: indexPath, animated: true)
printLog("点击了 tableView Cell \(indexPath.row)")
let vc = YHWebViewViewController()
vc.url = "https://cloudapi.qiyuesuo.cn/contract/share/3202449385770287813?openPageToken=dd333ac2-88cd-40f8-b985-dc00c7c2f90a"
let vc = YHNewWebViewController()
vc.url = "https://cloudapi.qiyuesuo.cn/contract/share/3203196638675878889?openPageToken=1c9e8a62-eeb5-4651-9a13-adf335ae3dbe"
self.navigationController?.pushViewController(vc)
// https://cloudapi.qiyuesuo.cn/contract/share/3202449385770287813?openPageToken=d004e5af-aab9-43e4-b813-c5a6a8c16497
}
......
......@@ -10,7 +10,7 @@ import UIKit
class YHCompanySelectViewController: YHBaseViewController {
public var backLocationStringController: ((String) -> Void)?
public var backLocationStringController: ((YHCompanyModelListModel) -> Void)?
var searchView: UITextField!
var sureButton: UIButton!
var tableView: UITableView!
......@@ -130,7 +130,8 @@ class YHCompanySelectViewController: YHBaseViewController {
@objc func submit() {
if let backLocationStringController = backLocationStringController {
backLocationStringController(searchView.text ?? "")
var model = YHCompanyModelListModel()
model.company_name = searchView.text
self.navigationController?.popViewController()
}
}
......@@ -182,7 +183,7 @@ extension YHCompanySelectViewController: UITableViewDelegate, UITableViewDataSou
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let text = searchDataSource?[indexPath.row].company_name ?? ""
guard let text = searchDataSource?[indexPath.row] else { return }
if let backLocationStringController = backLocationStringController {
backLocationStringController(text)
self.navigationController?.popViewController()
......
......@@ -453,6 +453,11 @@ extension YHWorkExperienceViewController: UITableViewDelegate, UITableViewDataSo
self.updateDataSource()
}
}
cell.companyBlock = {[weak self] company in
guard let self = self else { return }
self.viewModel.updateModel(company)
self.updateDataSource()
}
return cell
}
}
......
......@@ -10,7 +10,9 @@ import UIKit
class YHWorkExperienceItemView: UIView {
typealias ItemBlock = (_ model: YHWorkExperienceModel) -> ()
typealias CompanyBlock = (_ model: YHCompanyModelListModel) -> ()
var block: ItemBlock?
var companyBlock: CompanyBlock?
var titleLabel: UILabel!
var messageTextField: UITextField!
var nextStepImageView: UIImageView!
......@@ -279,7 +281,7 @@ class YHWorkExperienceItemView: UIView {
showPromptLabel.isHidden = true
}
if dataSource.id == .id10 {
if dataSource.id == .id10 || dataSource.id == .id22{
longTimeButton.isHidden = false
nextStepImageView.isHidden = true
if dataSource.message == "长期" {
......@@ -371,7 +373,7 @@ class YHWorkExperienceItemView: UIView {
case .normal:
printLog("不需要跳转")
case .address:
let addressPicker = YHAddressViewController(selectProvince: "上海市", selectCity: "" )
let addressPicker = YHAddressViewController()
addressPicker.backLocationStringController = { (address,province,city,area) in
self.dataSource?.message = address
self.dataSource?.value = [province, city, area]
......@@ -409,10 +411,10 @@ class YHWorkExperienceItemView: UIView {
case .unit:
let vc = YHCompanySelectViewController()
vc.backLocationStringController = { (country) in
self.dataSource?.message = country
self.dataSource?.message = country.company_name
self.updateAllViews()
if let block = self.block {
block(self.dataSource ?? YHWorkExperienceModel())
if let block = self.companyBlock {
block(country)
}
}
UIViewController.current?.navigationController?.pushViewController(vc)
......
......@@ -10,6 +10,8 @@ import UIKit
class YHWorkExperienceTableViewCell: UITableViewCell {
typealias WorkExperienceBlock = (_ model: YHWorkExperienceModel) -> ()
typealias CompanyBlock = (_ model: YHCompanyModelListModel) -> ()
var companyBlock: CompanyBlock?
var workExperienceBlock: WorkExperienceBlock?
var centerView: UIView!
var titleLabel: UILabel!
......@@ -138,6 +140,12 @@ class YHWorkExperienceTableViewCell: UITableViewCell {
block(model)
}
}
itemView.companyBlock = {[weak self] company in
guard let self = self else { return }
if let block = self.companyBlock {
block(company)
}
}
mainItemView.addSubview(itemView)
itemView.snp.makeConstraints { make in
make.left.equalTo(18)
......
......@@ -125,7 +125,7 @@ class YHWorkHighlightsTableViewCell: UITableViewCell {
make.left.equalTo(18)
make.right.equalTo(-18)
make.top.equalTo(111)
make.bottom.equalTo(-44)
make.bottom.equalTo(-92)
}
promptsLabel = {
......
......@@ -22,14 +22,14 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
let item1 = YHWorkExperienceModel(id: .id2, isNeed: true, title: "用人单位性质", isUserKeyBoard: false, prompts: "请输入", message: mainModel.industry, type: .nature, isShowPrompts: isShowPrompt, alertMessage:"请选择用人单位性质")
let item2 = YHWorkExperienceModel(id: .id3, isNeed: false, title: "用人单位介绍", isUserKeyBoard: true, prompts: "如方便提供,请填写", message: mainModel.company_introduce)
let item3 = YHWorkExperienceModel(id: .id4, isNeed: false, title: "用人单位官网", isUserKeyBoard: true, prompts: "如有,请输入官网链接", message: mainModel.company_website)
let item4 = YHWorkExperienceModel(id: .id5, isNeed: true, title: "出生国家/地区", isUserKeyBoard: false, prompts: "请选择", message: mainModel.location.country, type: .country, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
let item4 = YHWorkExperienceModel(id: .id5, isNeed: true, title: "工作国家/地区", isUserKeyBoard: false, prompts: "请选择", message: mainModel.location.country, type: .country, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
var string = ""
let array = mainModel.location.area
for item in array {
string = string + item
}
let item5 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "出生城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
let item55 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "出生城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.location.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入工作国家/地区")
let item5 = YHWorkExperienceModel(id: .id6, isNeed: true, title: "工作城市", isUserKeyBoard: false, prompts: "请选择", message: string, type: .address, isShowPrompts: isShowPrompt, alertMessage:"请选择工作国家/地区")
let item55 = YHWorkExperienceModel(id: .id7, isNeed: true, title: "工作城市", isUserKeyBoard: true, prompts: "请输入", message: mainModel.location.foreign, isShowPrompts: isShowPrompt, alertMessage:"请输入工作国家/地区")
let item6 = YHWorkExperienceModel(id: .id8, isNeed: true, title: "职位", isUserKeyBoard: true, prompts: "请输入", message: mainModel.position, isShowPrompts: isShowPrompt, alertMessage:"请输入职位")
let item7 = YHWorkExperienceModel(id: .id9, isNeed: true, title: "入职年月", isUserKeyBoard: false, prompts: "请选择", message: mainModel.entry_time, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择入职年月")
let item8 = YHWorkExperienceModel(id: .id10, isNeed: true, title: "离职年月", isUserKeyBoard: false, prompts: "请选择", message: mainModel.departure_time, type: .time, isShowPrompts: isShowPrompt, alertMessage:"请选择离职年月")
......@@ -114,6 +114,12 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
}
}
func updateModel(_ item: YHCompanyModelListModel) {
mainModel.company_name = item.company_name ?? ""
mainModel.company_introduce = item.company_introduce ?? ""
mainModel.company_website = item.company_link ?? ""
}
func updateWduty(_ value: String) {
mainModel.wduty = value
}
......@@ -230,7 +236,7 @@ class YHWorkExperienceViewModel: YHBaseViewModel {
"position": mainModel.position,
"professional_level": mainModel.professional_level,
"professional_other": mainModel.professional_other,
"projects": mainModel.projects,
"projects": [],
"remark": mainModel.remark,
"step": mainModel.step,
"top_manager_end_at": mainModel.top_manager_end_at,
......
......@@ -11,7 +11,7 @@ import WebKit
class YHNewWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationDelegate {
var webview = WKWebView()
var webView = WKWebView()
var progBar = UIProgressView()
var url = "https://www.baidu.com"
......@@ -21,36 +21,24 @@ class YHNewWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationDe
gk_navShadowColor = .clear
gk_navigationBar.isHidden = true
// 创建wkwebview
webview = WKWebView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height))
webview.navigationDelegate = self
webView = WKWebView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: self.view.frame.height))
webView.navigationDelegate = self
webView.uiDelegate = self
// 创建网址
let url = NSURL(string: url)
// 创建请求
let request = NSURLRequest(url: url! as URL)
// 加载请求
webview.load(request as URLRequest)
webView.load(request as URLRequest)
// 添加wkwebview
self.view.addSubview(webview)
self.view.addSubview(webView)
// // 加载网页的进度条
// progBar = UIProgressView(frame: CGRect(x: 0, y: 0, width: self.view.frame.width, height: 30))
// progBar.progress = 0.0
// progBar.tintColor = UIColor.brandMainColor
// webview.addSubview(progBar)
// // 监听网页加载的进度
// webview.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil)
}
override func viewWillDisappear(_ animated: Bool) {
// webview.removeObserver(self, forKeyPath: "estimatedProgress")
}
// MARK: - WKNavigationDelegate
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
self.navigationItem.title = webview.title
self.navigationItem.title = webView.title
}
// MARK: - WKUIDelegate
......@@ -58,7 +46,7 @@ class YHNewWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationDe
func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
// 实现非安全链接的跳转。如果目标主视图不为空,则允许导航
if !(navigationAction.targetFrame?.isMainFrame != nil) {
webview.load(navigationAction.request)
webView.load(navigationAction.request)
}
return nil
}
......@@ -72,38 +60,30 @@ class YHNewWebViewController: YHBaseViewController, WKUIDelegate, WKNavigationDe
self.present(alert, animated: true, completion: nil)
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
decisionHandler(.allow)
}
func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
print("页面开始加载")
}
func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
print("页面提交")
}
// MARK: - webview function
@objc func toBack() {
if webview.canGoBack {
webview.goBack()
if webView.canGoBack {
webView.goBack()
}
}
@objc func toForward() {
if webview.canGoForward {
webview.goForward()
}
}
// MARK: - KVO
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "estimatedProgress" {
self.progBar.alpha = 1.0
progBar.setProgress(Float(webview.estimatedProgress), animated: true)
//进度条的值最大为1.0
if(self.webview.estimatedProgress >= 1.0) {
UIView.animate(withDuration: 0.3, delay: 0.1, options: .curveEaseInOut, animations: { () -> Void in
self.progBar.alpha = 0.0
}, completion: { (finished:Bool) -> Void in
self.progBar.progress = 0
})
}
if webView.canGoForward {
webView.goForward()
}
}
override class func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
}
}
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