Commit 136a1a74 authored by Steven杜宇's avatar Steven杜宇
parents 799d155a c26756ba
...@@ -153,8 +153,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -153,8 +153,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
printLog("需要登录") printLog("需要登录")
return return
} }
let surveyViewModel = YHSurveyViewModel()
// 跳转分析 // 跳转分析
surveyViewModel.getRenewalPlanGenerated { state, error in
guard let state = state else {
if let msg = error?.errorMsg, !msg.isEmpty {
YHHUD.flash(message: msg)
}
return
}
if state.isGeneratePlan == true {
let vc = YHPlanViewController()
UIViewController.current?.navigationController?.pushViewController(vc)
} else {
let vc = YHCustomerInformationQuestionnaireVC()
UIViewController.current?.navigationController?.pushViewController(vc)
}
}
} }
} else if iType == 6 { } else if iType == 6 {
// 跳转方案商品 // 跳转方案商品
...@@ -164,9 +179,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -164,9 +179,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
printLog("需要登录") printLog("需要登录")
return return
} }
let surveyViewModel = YHSurveyViewModel()
let vc = YHMakePlanViewController() surveyViewModel.getRenewalPlanGenerated { state, error in
UIViewController.current?.navigationController?.pushViewController(vc, animated: true) guard let state = state else {
if let msg = error?.errorMsg, !msg.isEmpty {
YHHUD.flash(message: msg)
}
return
}
if state.isGeneratePlan == true {
let vc = YHMakePlanViewController()
UIViewController.current?.navigationController?.pushViewController(vc, animated: true)
} else {
let vc = YHCustomerInformationQuestionnaireVC()
UIViewController.current?.navigationController?.pushViewController(vc)
}
}
} }
} else { } else {
printLog("未处理的类型 \(iType)") printLog("未处理的类型 \(iType)")
......
...@@ -254,6 +254,7 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController { ...@@ -254,6 +254,7 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
if let first = questions.first, surveyContainerModel.defaultAnswers.contains(where: { answer in if let first = questions.first, surveyContainerModel.defaultAnswers.contains(where: { answer in
answer.questionKey == first.businessKey answer.questionKey == first.businessKey
}) { }) {
/*
for answer in surveyContainerModel.defaultAnswers { for answer in surveyContainerModel.defaultAnswers {
if let question = questions.first(where: { item in if let question = questions.first(where: { item in
item.businessKey == answer.questionKey item.businessKey == answer.questionKey
...@@ -268,6 +269,26 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController { ...@@ -268,6 +269,26 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
self.answerDic[question.id] = options self.answerDic[question.id] = options
} }
} }
*/
for (index, answer) in surveyContainerModel.defaultAnswers.enumerated() {
if let question = questions.first(where: { item in
item.businessKey == answer.questionKey
}) {
displayedQuestions.append(question)
let options = answer.optionKey.compactMap { optionKey in
let option = question.options.first { optionItem in
optionItem.businessKey == optionKey
}
return YHSurveyConditionOptionExtra(extra: "", optionId: option?.id ?? "", title: option?.title ?? "", optionKey: answer.questionKey)
}
self.answerDic[question.id] = options
}
if surveyContainerModel.defaultAnswers.count > index + 1, let lastModel = displayedQuestions.last, let nextQuestion = self.findNextQuestion(allQuestions: self.allQuestions, displayedQuestions: self.displayedQuestions, answerDic: self.answerDic, currentIndex: displayedQuestions.count - 1, currentOptionId: lastModel.id), nextQuestion.businessKey != surveyContainerModel.defaultAnswers[index + 1].questionKey {
self.displayedQuestions.append(nextQuestion)
break
}
}
if let lastModel = displayedQuestions.last, let nextQuestion = self.findNextQuestion(allQuestions: self.allQuestions, displayedQuestions: self.displayedQuestions, answerDic: self.answerDic, currentIndex: displayedQuestions.count - 1, currentOptionId: lastModel.id) { if let lastModel = displayedQuestions.last, let nextQuestion = self.findNextQuestion(allQuestions: self.allQuestions, displayedQuestions: self.displayedQuestions, answerDic: self.answerDic, currentIndex: displayedQuestions.count - 1, currentOptionId: lastModel.id) {
self.displayedQuestions.append(nextQuestion) self.displayedQuestions.append(nextQuestion)
......
...@@ -15,9 +15,10 @@ class YHMakePlanCardView: UIView { ...@@ -15,9 +15,10 @@ class YHMakePlanCardView: UIView {
// MARK: - UI Elements // MARK: - UI Elements
var data: YHMakePlanMainModel? var data: YHMakePlanMainModel?
private lazy var containerView: UIView = { private lazy var containerView: UIButton = {
let view = UIView() let view = UIButton()
view.backgroundColor = .white view.backgroundColor = .white
view.addTarget(self, action: #selector(gotoDetail), for: .touchUpInside)
return view return view
}() }()
...@@ -136,6 +137,33 @@ class YHMakePlanCardView: UIView { ...@@ -136,6 +137,33 @@ class YHMakePlanCardView: UIView {
} }
@objc func gotoDetail() {
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/goods/sales-detail" + "?id=\(self.data?.product_id ?? 0)" + "&source=renewal_customize"
if YHLoginManager.shared.isLogin() {
let token = YHLoginManager.shared.h5Token
let urlHasParam = String.hasQueryParameters(urlString: url)
if urlHasParam {
url = url + "&param=" + token
} else {
url = url + "?param=" + token
}
}
// 2.增加导航栏高度 https://test-hklife.galaxy-immi.com/superAppBridge.html#/goods/sales-detail?id=
var tUrl = url
if !url.contains("navigationH=") {
tUrl = url + "?navigationH=\(k_Height_NavigationtBarAndStatuBar)"
if url.contains("?") {
tUrl = url + "&navigationH=\(k_Height_NavigationtBarAndStatuBar)"
}
}
let vc = YHH5WebViewVC()
vc.url = tUrl
vc.isHideNavigationBar = false
UIViewController.current?.navigationController?.pushViewController(vc)
}
@objc func selectAction() { @objc func selectAction() {
YHMakePlanSelectAlertView.show(dataSource: data ?? YHMakePlanMainModel()) { tag in YHMakePlanSelectAlertView.show(dataSource: data ?? YHMakePlanMainModel()) { tag in
self.actionHandler?(tag) self.actionHandler?(tag)
......
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