|
@@ -8,14 +8,16 @@
|
|
|
v-if="visible"
|
|
|
>
|
|
|
<ul>
|
|
|
- <li @click="toEdit">
|
|
|
- <i class="el-icon-edit-outline"></i>
|
|
|
- {{ IS_CONTAINER_ELEMENT ? "编辑元素" : "编辑大题" }}
|
|
|
- </li>
|
|
|
- <li class="li-danger" @click="toDelete">
|
|
|
- <i class="el-icon-delete"></i>
|
|
|
- {{ IS_CONTAINER_ELEMENT ? "删除元素" : "删除大题" }}
|
|
|
- </li>
|
|
|
+ <template v-if="!IS_NOT_TOPIC">
|
|
|
+ <li @click="toEdit">
|
|
|
+ <i class="el-icon-edit-outline"></i>
|
|
|
+ {{ IS_CONTAINER_ELEMENT ? "编辑元素" : "编辑大题" }}
|
|
|
+ </li>
|
|
|
+ <li class="li-danger" @click="toDelete">
|
|
|
+ <i class="el-icon-delete"></i>
|
|
|
+ {{ IS_CONTAINER_ELEMENT ? "删除元素" : "删除大题" }}
|
|
|
+ </li>
|
|
|
+ </template>
|
|
|
<li
|
|
|
v-if="IS_CONTAINER_ELEMENT && (IS_EXPLAIN || IS_COMPOSITION)"
|
|
|
@click="toCopyExplainElement"
|
|
@@ -46,9 +48,15 @@
|
|
|
<li v-if="CAN_MOVE_DOWN" @click="toMoveDownTopic">
|
|
|
<i class="el-icon-download"></i> 下移大题
|
|
|
</li>
|
|
|
- <li v-if="!IS_CONTAINER_ELEMENT" @click="toInsetTopic">
|
|
|
+ <li v-if="!IS_CONTAINER_ELEMENT && !IS_NOT_TOPIC" @click="toInsetTopic">
|
|
|
<i class="el-icon-add-location"></i> 插入大题
|
|
|
</li>
|
|
|
+ <li @click="toInsertForbidAnswer">
|
|
|
+ <i class="el-icon-crop"></i> 插入禁答区
|
|
|
+ </li>
|
|
|
+ <li v-if="IS_NOT_TOPIC" class="li-danger" @click="toDelete">
|
|
|
+ <i class="el-icon-delete"></i> 删除禁答区
|
|
|
+ </li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -59,6 +67,7 @@ import { mapState, mapMutations, mapActions } from "vuex";
|
|
|
import { deepCopy } from "../plugins/utils";
|
|
|
import { fetchSameSerialNumberChildrenPositionInfo } from "../store/card";
|
|
|
import Clickoutside from "element-ui/src/utils/clickoutside";
|
|
|
+import { getElementModel, EDITABLE_NOT_TOPIC } from "../elementModel";
|
|
|
|
|
|
export default {
|
|
|
name: "right-click-menu",
|
|
@@ -94,7 +103,7 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
CAN_MOVE_UP() {
|
|
|
- if (this.IS_CONTAINER_ELEMENT) return false;
|
|
|
+ if (this.IS_CONTAINER_ELEMENT || this.IS_NOT_TOPIC) return false;
|
|
|
|
|
|
const curTopicPos = this.topicSeries.findIndex(
|
|
|
(item) => item.id === this.curElement.parent.id
|
|
@@ -107,7 +116,7 @@ export default {
|
|
|
);
|
|
|
},
|
|
|
CAN_MOVE_DOWN() {
|
|
|
- if (this.IS_CONTAINER_ELEMENT) return false;
|
|
|
+ if (this.IS_CONTAINER_ELEMENT || this.IS_NOT_TOPIC) return false;
|
|
|
|
|
|
const curTopicPos = this.topicSeries.findIndex(
|
|
|
(item) => item.id === this.curElement.parent.id
|
|
@@ -119,6 +128,9 @@ export default {
|
|
|
this.topicSeries[curTopicPos].sign
|
|
|
);
|
|
|
},
|
|
|
+ IS_NOT_TOPIC() {
|
|
|
+ return EDITABLE_NOT_TOPIC.includes(this.curElement.type);
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {
|
|
|
this.init();
|
|
@@ -134,6 +146,8 @@ export default {
|
|
|
"copyExplainChildren",
|
|
|
"deleteExplainChildren",
|
|
|
"topicMoveUp",
|
|
|
+ "addForbidArea",
|
|
|
+ "scrollToElementPage",
|
|
|
]),
|
|
|
init() {
|
|
|
// 注册自定义右键事件菜单
|
|
@@ -226,7 +240,14 @@ export default {
|
|
|
},
|
|
|
toDelete() {
|
|
|
this.close();
|
|
|
- this.$confirm("确定要删除当前元素吗?", "提示", {
|
|
|
+
|
|
|
+ if (this.IS_NOT_TOPIC) {
|
|
|
+ this.removeSelectElement();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const name = this.IS_CONTAINER_ELEMENT ? "元素" : "大题";
|
|
|
+ this.$confirm(`确定要删除当前${name}吗?`, "提示", {
|
|
|
type: "warning",
|
|
|
})
|
|
|
.then(() => {
|
|
@@ -295,6 +316,20 @@ export default {
|
|
|
type: this.curElement.type,
|
|
|
});
|
|
|
},
|
|
|
+ toInsertForbidAnswer() {
|
|
|
+ this.close();
|
|
|
+ let element = getElementModel("FORBID_AREA");
|
|
|
+ element.w = document.getElementById("topic-column").offsetWidth;
|
|
|
+ element.sign = this.curElement.sign;
|
|
|
+ this.addForbidArea({ element, beforeElementId: this.curElement.id });
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.rebuildPages();
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.scrollToElementPage(element);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
toRebuildPages() {
|
|
|
this.$nextTick(() => {
|
|
|
this.rebuildPages();
|