|
@@ -22,46 +22,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="mc_checkBox">
|
|
|
- <div v-for="(item1, index1) in this.checkJson" :key="index1" class="mc_ti_1" :draggable="isdrag == `${index1}`"
|
|
|
- :class="{ active: checkC === `x${index1}` }">
|
|
|
- <div class="title" @click.stop="checkTitle(`${index1}`)">
|
|
|
- <div class="drag" @mousedown="setDrag(`${index1}`)" @mouseup="isdrag = ''"></div>
|
|
|
- <span>{{ selectType(item1, index1) }}</span>
|
|
|
- <div class="btnBox">
|
|
|
- <div class="delete" @click.stop="deleteCheck(`${index1}`)"></div>
|
|
|
- <div class="open" v-if="item1.array && item1.array.length" :class="{ isopen: item1.isopen }"
|
|
|
- @click.stop="openPan(index1)"></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div v-if="item1.array && item1.array.length && item1.isopen" class="mc_ti_1_xia">
|
|
|
- <div v-for="(item2, index2) in item1.array" :key="`${index1}-${index2}`" class="mc_ti_2"
|
|
|
- :draggable="isdrag == `${index1}-${index2}`" :class="{ active: checkC === `x${index1}-${index2}` }">
|
|
|
- <div class="title" @click.stop="checkTitle(`${index1}-${index2}`)">
|
|
|
- <div class="drag" @mousedown="setDrag(`${index1}-${index2}`)" @mouseup="isdrag = ''"></div>
|
|
|
- <span>{{ selectType(item2, index2) }}</span>
|
|
|
- <div class="btnBox">
|
|
|
- <div class="delete" @click.stop="deleteCheck(`${index1}-${index2}`)"></div>
|
|
|
- <div class="open" v-if="item2.array && item2.array.length" :class="{ isopen: item2.isopen }"
|
|
|
- @click.stop="openPan(index1, index2)"></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div v-if="item2.array && item2.array.length && item2.isopen" class="mc_ti_2_xia">
|
|
|
- <div v-for="(item3, index3) in item2.array" :key="`${index1}-${index2}-${index3}`"
|
|
|
- class="mc_ti_3" :draggable="isdrag == `${index1}-${index2}-${index3}`"
|
|
|
- :class="{ active: checkC === `x${index1}-${index2}-${index3}` }">
|
|
|
- <div class="title" @click.stop="checkTitle(`${index1}-${index2}-${index3}`)">
|
|
|
- <div class="drag" @mousedown="setDrag(`${index1}-${index2}-${index3}`)"
|
|
|
- @mouseup="isdrag = ''"></div>
|
|
|
- <span>{{ selectType(item3, index3) }}</span>
|
|
|
- <div class="btnBox">
|
|
|
- <div class="delete" @click.stop="deleteCheck(`${index1}-${index2}-${index3}`)"></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <checkOrder :checkC.sync="checkC" :checkJson="checkJson" @changeJson="changeJson"></checkOrder>
|
|
|
<div class="e_btn">
|
|
|
<el-button type="primary" size="mini" @click="nextSteps()">下一步</el-button>
|
|
|
</div>
|
|
@@ -70,7 +31,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import checkOrder from '../components/checkOrder.vue';
|
|
|
+import minxinVue from '../minxins/minxin';
|
|
|
+
|
|
|
export default {
|
|
|
+ mixins:[minxinVue],
|
|
|
+ components: {
|
|
|
+ checkOrder,
|
|
|
+ },
|
|
|
props: {
|
|
|
manualJson: {
|
|
|
type: Array
|
|
@@ -80,34 +48,6 @@ export default {
|
|
|
return {
|
|
|
topicType: "",
|
|
|
number: "",
|
|
|
- options: [
|
|
|
- {
|
|
|
- value: 1,
|
|
|
- label: "选择题"
|
|
|
- },
|
|
|
- {
|
|
|
- value: 2,
|
|
|
- label: "问答题"
|
|
|
- },
|
|
|
- {
|
|
|
- value: 3,
|
|
|
- label: "填空题"
|
|
|
- },
|
|
|
- {
|
|
|
- value: 4,
|
|
|
- label: "添加文档"
|
|
|
- }
|
|
|
- ],
|
|
|
- options2: {
|
|
|
- 1: "选择题",
|
|
|
- 2: "问答题",
|
|
|
- 3: "填空题",
|
|
|
- 4: "添加文档"
|
|
|
- },
|
|
|
- buttonOptions: [
|
|
|
- { name: "分组", type: 1 },
|
|
|
- { name: "分页", type: 2 }
|
|
|
- ],
|
|
|
checkJson: [
|
|
|
// {
|
|
|
// ttype: 1, //题目分类 1普通题目 2分组 3分页
|
|
@@ -116,21 +56,15 @@ export default {
|
|
|
// }
|
|
|
],
|
|
|
checkC: "",
|
|
|
- isdrag: ""
|
|
|
};
|
|
|
},
|
|
|
- computed: {
|
|
|
- selectType() {
|
|
|
- return function (item, index) {
|
|
|
- if (item.ttype == 1) {
|
|
|
- return index + 1 + "、" + this.options2[item.type];
|
|
|
- } else if (item.ttype == 2) {
|
|
|
- return `第${index + 1}组 (共${item.array.length}题)`;
|
|
|
- } else if (item.ttype == 3) {
|
|
|
- return `分页${index + 1}`;
|
|
|
- }
|
|
|
- };
|
|
|
- }
|
|
|
+ watch: {
|
|
|
+ // checkJson :{
|
|
|
+ // handler: function (newVal, oldVal) {
|
|
|
+ // this.$emit("update:manualJson", newVal)
|
|
|
+ // },
|
|
|
+ // deep: true,
|
|
|
+ // }
|
|
|
},
|
|
|
methods: {
|
|
|
numberPan() {
|
|
@@ -139,6 +73,10 @@ export default {
|
|
|
this.number = "";
|
|
|
}
|
|
|
},
|
|
|
+ changeJson(json) {
|
|
|
+ this.checkJson = json;
|
|
|
+ this.$emit("update:cJson", json);
|
|
|
+ },
|
|
|
addCheck() {
|
|
|
if (!this.topicType) {
|
|
|
this.$message.error("请选择题目类型");
|
|
@@ -185,10 +123,20 @@ export default {
|
|
|
for (var i = 0; i < this.number; i++) {
|
|
|
this.checkJson[_check[0]].array.splice((_check[1]) + 1, 0, json)
|
|
|
}
|
|
|
- } else if ((type == 2 || type == 3) && _check.length == 1) {
|
|
|
+ } else if (type == 2 && _check.length == 1) {
|
|
|
for (var i = 0; i < this.number; i++) {
|
|
|
this.checkJson[_check[0]].array.push(json)
|
|
|
}
|
|
|
+ } else if (type == 3 && _check.length == 1) {
|
|
|
+ if(this.checkJson[_check[0]].array[0] && this.checkJson[_check[0]].array[0].array){
|
|
|
+ for (var i = 0; i < this.number; i++) {
|
|
|
+ this.checkJson[_check[0]].array[0].array.push(json)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ for (var i = 0; i < this.number; i++) {
|
|
|
+ this.checkJson[_check[0]].array.push(json)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
} else {
|
|
|
for (var i = 0; i < this.number; i++) {
|
|
@@ -249,9 +197,9 @@ export default {
|
|
|
if (this.checkC) {
|
|
|
let _check = this.checkC.replace('x', '').split("-")
|
|
|
|
|
|
- if (_check.length > 1 && this.checkJson[_check[0]].array) {
|
|
|
+ if (_check.length > 1 && this.checkJson[_check[0]].array[0] && this.checkJson[_check[0]].array[0].array) {
|
|
|
this.checkJson[_check[0]].array.splice(parseInt(_check[1]) + 1, 0, json);
|
|
|
- } else if (!this.checkJson[_check[0]].array[0].array) {
|
|
|
+ } else if (this.checkJson[_check[0]].array[0] && !this.checkJson[_check[0]].array[0].array) {
|
|
|
this.checkJson[_check[0]].array = [
|
|
|
{
|
|
|
ttype: 2,
|
|
@@ -307,65 +255,7 @@ export default {
|
|
|
depthCopy(s) {
|
|
|
return JSON.parse(JSON.stringify(s));
|
|
|
},
|
|
|
- setDrag(index) {
|
|
|
- console.log(index);
|
|
|
- this.isdrag = index
|
|
|
- },
|
|
|
- openPan(index1, index2) {
|
|
|
- if (index2 === 0 || index2) {
|
|
|
- this.checkJson[index1].array[index2].isopen = !this.checkJson[index1].array[index2].isopen
|
|
|
- } else {
|
|
|
- this.checkJson[index1].isopen = !this.checkJson[index1].isopen
|
|
|
- }
|
|
|
- this.$forceUpdate();
|
|
|
- this.$emit("update:manualJson", this.checkJson);
|
|
|
- },
|
|
|
- checkTitle(index) {
|
|
|
- if (this.checkC === "x" + index) {
|
|
|
- this.checkC = ""
|
|
|
- } else {
|
|
|
- this.checkC = 'x' + index
|
|
|
- }
|
|
|
- },
|
|
|
- deleteCheck(index) {
|
|
|
- let _check = index.split("-")
|
|
|
- let string = ""
|
|
|
- if (_check.length == 1) {
|
|
|
- if (this.checkJson[_check[0]].ttype == 1) {
|
|
|
- string = "确定删除该题目吗?"
|
|
|
- } else if (this.checkJson[_check[0]].ttype == 2) {
|
|
|
- string = "删除该分组将会同步删除该分组下所有内容,是否继续操作?"
|
|
|
- } else if (this.checkJson[_check[0]].ttype == 3) {
|
|
|
- string = "删除该分页将会同步删除该分页下所有内容,是否继续操作?"
|
|
|
- }
|
|
|
- } else if (_check.length == 2) {
|
|
|
- if (this.checkJson[_check[0]].array[_check[1]].ttype == 1) {
|
|
|
- string = "确定删除该题目吗?"
|
|
|
- } else if (this.checkJson[_check[0]].array[_check[1]].ttype == 2) {
|
|
|
- string = "删除该分组将会同步删除该分组下所有内容,是否继续操作?"
|
|
|
- }
|
|
|
- } else if (_check.length == 3) {
|
|
|
- string = "确定删除该题目吗?"
|
|
|
- }
|
|
|
- this.$confirm(string, "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- if (_check.length == 1) {
|
|
|
- this.checkJson.splice(_check[0], 1)
|
|
|
- } else if (_check.length == 2) {
|
|
|
- this.checkJson[_check[0]].array.splice(_check[1], 1)
|
|
|
- } else if (_check.length == 3) {
|
|
|
- this.checkJson[_check[0]].array[_check[1]].array.splice(_check[2], 1)
|
|
|
- }
|
|
|
- this.checkC = ""
|
|
|
- this.$forceUpdate()
|
|
|
- this.$emit("update:manualJson", this.checkJson);
|
|
|
- })
|
|
|
- .catch(() => { });
|
|
|
- },
|
|
|
+
|
|
|
nextSteps(){
|
|
|
this.$emit("nextSteps")
|
|
|
}
|
|
@@ -434,123 +324,6 @@ export default {
|
|
|
flex-direction: column;
|
|
|
}
|
|
|
|
|
|
-.mc_ti_1 {
|
|
|
- width: 100%;
|
|
|
- min-height: 40px;
|
|
|
- border: 1px solid #bcbcbc;
|
|
|
- padding: 10px;
|
|
|
- box-sizing: border-box;
|
|
|
- margin-bottom: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-.mc_ti_1+.mc_ti_1 {
|
|
|
- margin-top: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1>.title {
|
|
|
- font-size: 20px;
|
|
|
- cursor: pointer;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1_xia,
|
|
|
-.mc_ti_2_xia {
|
|
|
- padding: 10px;
|
|
|
- width: 100%;
|
|
|
- box-sizing: border-box;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_2 {
|
|
|
- width: 100%;
|
|
|
- box-sizing: border-box;
|
|
|
- padding: 10px;
|
|
|
- border: 1px solid #bcbcbc;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_2+.mc_ti_2 {
|
|
|
- margin-top: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_2>.title {
|
|
|
- cursor: pointer;
|
|
|
- font-size: 18px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-.mc_ti_3 {
|
|
|
- padding: 10px;
|
|
|
- width: 100%;
|
|
|
- box-sizing: border-box;
|
|
|
- border: 1px solid #bcbcbc;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_3+.mc_ti_3 {
|
|
|
- margin-top: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_3>.title {
|
|
|
- cursor: pointer;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1>.title>.drag,
|
|
|
-.mc_ti_2>.title>.drag,
|
|
|
-.mc_ti_3>.title>.drag {
|
|
|
- display: block;
|
|
|
- background-image: url('../../../../../assets/icon/new/icon_course_drag.png');
|
|
|
- background-size: 100% 100%;
|
|
|
- width: 20px;
|
|
|
- height: 20px;
|
|
|
- cursor: pointer;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1>.title>.btnBox,
|
|
|
-.mc_ti_2>.title>.btnBox,
|
|
|
-.mc_ti_3>.title>.btnBox {
|
|
|
- margin-left: auto;
|
|
|
- display: flex;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1>.title>.btnBox .open,
|
|
|
-.mc_ti_2>.title>.btnBox .open {
|
|
|
- display: block;
|
|
|
- background-image: url('../../../../../assets/icon/new/u_arrow.png');
|
|
|
- background-size: 100% 100%;
|
|
|
- width: 15px;
|
|
|
- height: 15px;
|
|
|
- cursor: pointer;
|
|
|
- transition: all .5s;
|
|
|
- transform: rotate(-90deg);
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1>.title>.btnBox .delete,
|
|
|
-.mc_ti_2>.title>.btnBox .delete,
|
|
|
-.mc_ti_3>.title>.btnBox .delete {
|
|
|
- display: block;
|
|
|
- background-image: url('../../../../../assets/icon/new/delete_u.png');
|
|
|
- background-size: 100% 100%;
|
|
|
- width: 18px;
|
|
|
- height: 18px;
|
|
|
- cursor: pointer;
|
|
|
- margin-right: 10px;
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1>.title>.btnBox .isopen,
|
|
|
-.mc_ti_2>.title>.btnBox .isopen {
|
|
|
- transform: rotate(0deg);
|
|
|
-}
|
|
|
-
|
|
|
-.mc_ti_1.active,
|
|
|
-.mc_ti_2.active,
|
|
|
-.mc_ti_3.active {
|
|
|
- border: 1px solid #0062ff;
|
|
|
-}
|
|
|
|
|
|
.e_btn{
|
|
|
width: 100%;
|