diff --git a/src/components/HomePage.vue b/src/components/HomePage.vue index 8f62c22..ac86948 100644 --- a/src/components/HomePage.vue +++ b/src/components/HomePage.vue @@ -80,6 +80,20 @@ const customerInfo = ref((() => { return null })()) +const secondStageInfo = ref((() => { + const stored = localStorage.getItem('second_stage_info') + if (stored && stored !== 'undefined') { + try { + return JSON.parse(stored) as CustomerInfo + } catch (error) { + console.error('解析二阶信息失败:', error) + localStorage.removeItem('second_stage_info') + return null + } + } + return null +})()) + // ------------------------------------------------------------------- // 2. JS-SDK 初始化 和 签名获取 // ------------------------------------------------------------------- @@ -301,14 +315,29 @@ const fetchAndCheckExternalContact = async () => { if (externalUserId.value) { const result = await checkFormExists(externalUserId.value) if (result.data.code && result.data.form_content && result.data.form_content.length > 0) { - const rawAnswers = result.data.form_content[0].answers as RawAnswerItem[]; - console.log('原始答案:', rawAnswers); - const mappedCustomerInfo = mapAnswersToCustomerInfo(rawAnswers); + // 一阶表单 + const rawAnswers1 = result.data.form_content[0].answers as RawAnswerItem[]; + console.log('一阶原始答案:', rawAnswers1); + const mappedCustomerInfo = mapAnswersToCustomerInfo(rawAnswers1); customerInfo.value = mappedCustomerInfo; localStorage.setItem('customer_info', JSON.stringify(mappedCustomerInfo)); + + // 二阶表单 + if (result.data.form_content.length > 1) { + const rawAnswers2 = result.data.form_content[1].answers as RawAnswerItem[]; + console.log('二阶原始答案:', rawAnswers2); + const mappedSecondStage = mapAnswersToCustomerInfo(rawAnswers2); + secondStageInfo.value = mappedSecondStage; + localStorage.setItem('second_stage_info', JSON.stringify(mappedSecondStage)); + } else { + secondStageInfo.value = null; + localStorage.removeItem('second_stage_info'); + } } else { customerInfo.value = null localStorage.removeItem('customer_info') + secondStageInfo.value = null + localStorage.removeItem('second_stage_info') } } } catch (error: any) { @@ -365,13 +394,27 @@ const handleSmartReply = () => { +
+

+ 📋 二阶评估信息 +

+
+
    +
  • + {{ index + 1 }}. {{ item.topic }} : + {{ item.answer }} +
  • +
+
+
+
- @@ -617,6 +660,30 @@ const handleSmartReply = () => { line-height: 1.4; font-size: 0.85rem; flex: 1; + /* 确保普通回答也能换行 */ + word-wrap: break-word; + overflow-wrap: break-word; +} + +/* 二阶表单垂直排列样式 */ +.qa-item-stacked { + flex-direction: column; + align-items: stretch; +} + +.qa-item-stacked .question { + white-space: normal; /* 允许换行 */ + margin-bottom: 6px; /* 题目和答案之间的间距 */ + width: 100%; + word-wrap: break-word; /* 防止长单词溢出 */ + overflow-wrap: break-word; +} + +.qa-item-stacked .answer { + width: 100%; + word-wrap: break-word; + overflow-wrap: break-word; + padding-left: 0; } /* 手机号输入界面样式 */