|
|
|
@ -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 } });
|
|
|
|
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 },
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|