diff --git a/src/api/studentTrainingAnswer.js b/src/api/studentTrainingAnswer.js index 4be51d4..422d013 100644 --- a/src/api/studentTrainingAnswer.js +++ b/src/api/studentTrainingAnswer.js @@ -335,3 +335,91 @@ export function checkProductDevelopmentFactorsStepFour(payload) { } return request({ url: "/api/student-training-answers/product-development-factors/step-4/validate", method: "post", data: payload, headers: { repeatSubmit: false } }); } + +export function checkConsumerBehaviorStepOne(payload) { + const hypotheses = Array.isArray(payload?.hypotheses) ? payload.hypotheses : []; + if (isStudentDemo()) { + const incomplete = hypotheses.find((item) => ["targetGroup", "keyFinding", "coreHypothesis"].some((field) => !String(item?.[field] || "").trim())); + if (!hypotheses.length || incomplete) { + return Promise.reject(new Error("请完整填写目标人群、实训8关键发现和问卷核心假设")); + } + return Promise.resolve({ code: 200, data: { valid: true, message: "校验通过" } }); + } + return request({ + url: "/api/student-training-answers/consumer-behavior/step-1/validate", + method: "post", + data: { hypotheses }, + headers: { repeatSubmit: false }, + }); +} + +export function checkConsumerBehaviorStepTwo(payload) { + const needs = Array.isArray(payload?.needs) ? payload.needs : []; + const allowedTypes = ["基本型", "期望型", "兴奋型", "无差异型", "反向型"]; + if (isStudentDemo()) { + const incomplete = needs.find((item) => !String(item?.feature || "").trim() + || !allowedTypes.includes(item?.kanoType) || !String(item?.featureDirection || "").trim()); + if (!needs.length || needs.length > 20 || incomplete) { + return Promise.reject(new Error("请完整填写功能、KANO类型和对应功能方向(最多20行)")); + } + return Promise.resolve({ code: 200, data: { valid: true, message: "校验通过" } }); + } + return request({ + url: "/api/student-training-answers/consumer-behavior/step-2/validate", + method: "post", + data: { needs }, + headers: { repeatSubmit: false }, + }); +} + +export function checkConsumerBehaviorStepThree(payload) { + if (isStudentDemo()) { + const importedDocumentUrl = String(payload?.importedDocumentUrl || "").trim(); + const questions = Array.isArray(payload?.questions) ? payload.questions : []; + const requiredSections = ["基本信息", "购买行为", "需求偏好", "开放建议"]; + const validQuestions = questions.filter((item) => String(item?.title || "").trim()); + const complete = requiredSections.every((section) => validQuestions.some((item) => item.section === section)) + && validQuestions.some((item) => item.section === "需求偏好" && item.type === "LIKERT"); + if (!importedDocumentUrl && !complete) { + return Promise.reject(new Error("请完整设计包含四个部分且含Likert五级量表的问卷,或导入Word问卷")); + } + return Promise.resolve({ code: 200, data: { valid: true, message: "校验通过" } }); + } + return request({ + url: "/api/student-training-answers/consumer-behavior/step-3/validate", + method: "post", + data: payload, + headers: { repeatSubmit: false }, + }); +} + +export function previewConsumerBehaviorQuestionnaireWord(data) { + if (isStudentDemo()) { + return Promise.reject(new Error("演示模式不支持 Word 文档预览")); + } + return request({ + url: "/api/student-training-answers/consumer-behavior/step-3/word-preview", + method: "post", + data, + headers: { + "Content-Type": "multipart/form-data", + repeatSubmit: false, + }, + }); +} + +export function checkConsumerBehaviorStepFour(payload) { + if (isStudentDemo()) { + const rows = Array.isArray(payload?.rows) ? payload.rows : []; + if (rows.length < 5 || rows.some((item) => !String(item?.title || "").trim() || !String(item?.content || "").trim())) { + return Promise.reject(new Error("请完整填写 5 个问卷调研报告模块的标题和内容")); + } + return Promise.resolve({ code: 200, data: { valid: true, message: "校验通过" } }); + } + return request({ + url: "/api/student-training-answers/consumer-behavior/step-4/validate", + method: "post", + data: payload, + headers: { repeatSubmit: false }, + }); +} diff --git a/src/views/demand/consumer-behavior.vue b/src/views/demand/consumer-behavior.vue index d406f80..98c3a99 100644 --- a/src/views/demand/consumer-behavior.vue +++ b/src/views/demand/consumer-behavior.vue @@ -49,6 +49,13 @@ :accept="uploadAccept" @change="handleFileChange" /> +
@@ -58,81 +65,170 @@
-
-

- 借助AI,生成智能产品购买决策因素调研问卷,提示词参考:设计问卷,用于分析用户购买智能产品的决策因素。问卷完成后复制到下述编辑框,并上传问卷pdf文档。 +

+

+ 基于实训 8 的用户画像结论,明确本次问卷调查的目标人群与核心假设,填写下表。

- - - 上传问卷 - -
-
- - {{ form.questionnaireFileName }} +
+ 增加一行 + 删除一行 +
+ 查看实训8
-
- 示例: -
+
+ + + + + + + + + + + +
目标人群实训8关键发现本次问卷需验证的核心假设