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

已提交问卷优化

parent 2c22a2cd
......@@ -156,7 +156,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
// 跳转分析
}
} else if iType == 6 {
} else if iType == 6 {
// 跳转方案商品
DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) {
// - 获取它对应的参数
......@@ -168,7 +168,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
let vc = YHMakePlanViewController()
UIViewController.current?.navigationController?.pushViewController(vc, animated: true)
}
} else {
} else {
printLog("未处理的类型 \(iType)")
}
}
......
......@@ -254,6 +254,7 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
if let first = questions.first, surveyContainerModel.defaultAnswers.contains(where: { answer in
answer.questionKey == first.businessKey
}) {
/*
for answer in surveyContainerModel.defaultAnswers {
if let question = questions.first(where: { item in
item.businessKey == answer.questionKey
......@@ -268,6 +269,26 @@ class YHCustomerInformationQuestionnaireVC: YHBaseViewController {
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) {
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