Commit 1ed82272 authored by Alex朱枝文's avatar Alex朱枝文

已提交问卷优化

parent 2c22a2cd
...@@ -156,7 +156,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -156,7 +156,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
// 跳转分析 // 跳转分析
} }
} else if iType == 6 { } else if iType == 6 {
// 跳转方案商品 // 跳转方案商品
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
// - 获取它对应的参数 // - 获取它对应的参数
...@@ -168,7 +168,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -168,7 +168,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
let vc = YHMakePlanViewController() let vc = YHMakePlanViewController()
UIViewController.current?.navigationController?.pushViewController(vc, animated: true) UIViewController.current?.navigationController?.pushViewController(vc, animated: true)
} }
} 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)
......
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