fix: 修复预览跳题异常
- 更新分页 pages 异常, - 更新 code 异常
This commit is contained in:
@@ -2,8 +2,10 @@ import getlogicStatus from './logical';
|
||||
|
||||
// 更新code
|
||||
function updateCode(action, logic, pages, page) {
|
||||
const { skip_question_index: skipQuestionIndex } = logic;
|
||||
const startIndex = pages.findIndex((page) => page.findIndex(() => true) !== -1);
|
||||
const { skip_question_index: skipQuestionIndex, question_index: questionIndex } = logic;
|
||||
const startIndex = pages.findIndex(
|
||||
(page) => page.findIndex((index) => index === questionIndex) !== -1
|
||||
);
|
||||
if (startIndex < page) {
|
||||
if (skipQuestionIndex === -1) {
|
||||
action.code = 20011;
|
||||
@@ -20,7 +22,9 @@ function updateCode(action, logic, pages, page) {
|
||||
// 更新分页pages(题后跳转逻辑)
|
||||
function updatePagesAfter(pages, logic, jumpTo, page) {
|
||||
const { question_index: questionIndex, skip_question_index: skipQuestionIndex } = logic;
|
||||
const startIndex = pages.findIndex((page) => page.findIndex(() => true) !== -1);
|
||||
const startIndex = pages.findIndex(
|
||||
(page) => page.findIndex((index) => index === questionIndex) !== -1
|
||||
);
|
||||
const endIndex = pages.findIndex(
|
||||
(page) => page.findIndex((questionIndex) => questionIndex === skipQuestionIndex) !== -1
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user