|
@@ -18,7 +18,6 @@ const state = {
|
|
|
topics: [],
|
|
|
topicSeries: [], // 大题顺序号,不排重
|
|
|
topicNoSeries: [], // 大题顺序号,按顺序排重
|
|
|
- insetTarget: {}, // 需要在其后面插入大题的大题
|
|
|
openElementEditDialog: false,
|
|
|
};
|
|
|
|
|
@@ -52,9 +51,6 @@ const mutations = {
|
|
|
setTopicNoSeries(state, topicNoSeries) {
|
|
|
state.topicNoSeries = topicNoSeries;
|
|
|
},
|
|
|
- setInsetTarget(state, insetTarget) {
|
|
|
- state.insetTarget = insetTarget;
|
|
|
- },
|
|
|
addPage(state, page) {
|
|
|
state.pages.push(page);
|
|
|
},
|
|
@@ -292,21 +288,22 @@ const actions = {
|
|
|
addElement({ state, commit, dispatch }, element) {
|
|
|
let pos = null;
|
|
|
// 客观题和主观题分别对待
|
|
|
- if (state.insetTarget.id) {
|
|
|
+ if (element.insertTopic && element.insertTopic.id) {
|
|
|
// 存在插入目标元素
|
|
|
if (
|
|
|
- state.insetTarget.type === "FILL_QUESTION" &&
|
|
|
+ element.insertTopic.type === "FILL_QUESTION" &&
|
|
|
element.type !== "FILL_QUESTION"
|
|
|
) {
|
|
|
pos = fetchFirstSubjectiveTopicPositionInfo(state.topics);
|
|
|
} else {
|
|
|
let relateTopicPos = [];
|
|
|
state.topics.forEach((item, index) => {
|
|
|
- if (item.parent && item.parent.id === state.insetTarget.id)
|
|
|
+ if (item.parent && item.parent.id === element.insertTopic.id)
|
|
|
relateTopicPos.push(index);
|
|
|
});
|
|
|
pos = relateTopicPos.slice(-1)[0] + 1;
|
|
|
}
|
|
|
+ delete element.insertTopic;
|
|
|
} else {
|
|
|
// 不存在插入目标元素
|
|
|
if (element.sign === "objective") {
|
|
@@ -323,8 +320,6 @@ const actions = {
|
|
|
}
|
|
|
});
|
|
|
dispatch("resetTopicSeries");
|
|
|
- commit("setInsetTarget", {});
|
|
|
-
|
|
|
commit("setCurElement", element);
|
|
|
},
|
|
|
addForbidArea({ state, commit }, { element, beforeElementId }) {
|