|
@@ -17,7 +17,8 @@ const state = {
|
|
|
curPageNo: 0,
|
|
|
pages: [],
|
|
|
topics: [],
|
|
|
- topicSeries: [], // 大题顺序号
|
|
|
+ topicSeries: [], // 大题顺序号,不排重
|
|
|
+ topicNoSeries: [], // 大题顺序号,按顺序排重
|
|
|
insetTarget: {}, // 需要在其后面插入大题的大题
|
|
|
openElementEditDialog: false
|
|
|
};
|
|
@@ -52,6 +53,9 @@ const mutations = {
|
|
|
setTopicSeries(state, topicSeries) {
|
|
|
state.topicSeries = topicSeries;
|
|
|
},
|
|
|
+ setTopicNoSeries(state, topicNoSeries) {
|
|
|
+ state.topicNoSeries = topicNoSeries;
|
|
|
+ },
|
|
|
setInsetTarget(state, insetTarget) {
|
|
|
state.insetTarget = insetTarget;
|
|
|
},
|
|
@@ -238,22 +242,28 @@ const actions = {
|
|
|
resetTopicSeries({ state, commit }) {
|
|
|
let curTopicId = "",
|
|
|
curTopicNo = 0,
|
|
|
- topicSeries = [];
|
|
|
+ topicSeries = [],
|
|
|
+ topicNoSeries = [];
|
|
|
state.topics.forEach(topic => {
|
|
|
if (!topic.parent) return;
|
|
|
+
|
|
|
+ let data = {
|
|
|
+ id: topic.parent.id,
|
|
|
+ topicNo: topic.parent.topicNo,
|
|
|
+ type: topic.type,
|
|
|
+ sign: topic.sign
|
|
|
+ };
|
|
|
if (curTopicId !== topic.parent.id) {
|
|
|
curTopicId = topic.parent.id;
|
|
|
- curTopicNo++;
|
|
|
- topicSeries.push({
|
|
|
- id: curTopicId,
|
|
|
- topicNo: curTopicNo,
|
|
|
- type: topic.type,
|
|
|
- sign: topic.sign
|
|
|
- });
|
|
|
+ topicSeries.push(data);
|
|
|
+ }
|
|
|
+ if (curTopicNo !== topic.parent.topicNo) {
|
|
|
+ curTopicNo = topic.parent.topicNo;
|
|
|
+ topicNoSeries.push(data);
|
|
|
}
|
|
|
- topic.topicNo = curTopicNo;
|
|
|
});
|
|
|
commit("setTopicSeries", topicSeries);
|
|
|
+ commit("setTopicNoSeries", topicNoSeries);
|
|
|
},
|
|
|
// 新增试题 --------------->
|
|
|
addElement({ state, commit, dispatch }, element) {
|