zengyicheng 1 년 전
부모
커밋
d76d96f1f9
2개의 변경된 파일776개의 추가작업 그리고 609개의 파일을 삭제
  1. 395 309
      src/components/pages/test/add/edit/edit/index.vue
  2. 381 300
      src/components/pages/test/add/setInfo/manualCreated.vue

+ 395 - 309
src/components/pages/test/add/edit/edit/index.vue

@@ -1,365 +1,451 @@
 <template>
-    <div class="edit_box">
-        <div class="e_add">
-            <div class="title" style="margin-bottom: 20px;">题目添加</div>
-            <div class="e_add_box">
-                <div class="title">基础题型</div>
-                <div class="e_add_ci">
-                    <!-- <div class="title">基础题型</div> -->
-                    <div class="box">
-                        <div class="btn" v-for="item in options" :key="item.label" @click="addCheck(item.value)">
-                            <!-- <el-button type="primary"
+  <div class="edit_box">
+    <div class="e_add">
+      <div class="title" style="margin-bottom: 20px">题目添加</div>
+      <div class="e_add_box">
+        <div class="title">基础题型</div>
+        <div class="e_add_ci">
+          <!-- <div class="title">基础题型</div> -->
+          <div class="box">
+            <div
+              class="btn"
+              v-for="item in options"
+              :key="item.label"
+              @click="addCheck(item.value)"
+            >
+              <!-- <el-button type="primary"
                                 size="mini">{{ item.label }}</el-button> -->
-                            <button class="pub_test_btn"
-                                :class="{ pub_test_btn_text: item.value == 3, pub_test_btn_choose: item.value == 1, pub_test_btn_file: item.value == 5 }">{{
-                                    item.label }}</button>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="e_add_box">
-                <div class="title">添加组件</div>
-                <div class="e_add_ci">
-                    <div class="box">
-                        <div class="btn" v-for="item in buttonOptions" :key="item.name" @click="addQtype(item.type)">
-                            <!-- <el-button type="primary"
-                                size="mini">{{ item.name }}</el-button> -->
-                            <button class="pub_test_btn"
-                                :class="{ pub_test_btn_group: item.type == 1, pub_test_btn_page: item.type == 2 }">{{ item.name
-                                }}</button>
-                        </div>
-                    </div>
-                </div>
-            </div>
-        </div>
-        <div class="e_content">
-            <div class="title">{{ title }}</div>
-            <div class="e_order_box">
-                <checkOrder :checkC.sync="checkC" :checkJson="manualJson" @changeJson="changeJson" etype="edit" :cJson.sync="cJson">
-                </checkOrder>
+              <button
+                class="pub_test_btn"
+                :class="{
+                  pub_test_btn_text: item.value == 3,
+                  pub_test_btn_choose: item.value == 1,
+                  pub_test_btn_file: item.value == 5,
+                }"
+              >
+                {{ item.label }}
+              </button>
             </div>
+          </div>
         </div>
-        <div class="e_order">
-            <div class="title">题目排序 <span style="font-size: 14px;color: #373737;">总分:{{ score }}分</span></div>
-            <div class="e_order_box" style="margin-top: 20px;">
-                <checkOrder :checkC.sync="checkC" :checkJson="manualJson" @changeJson="changeJson" etype="order" :cJson.sync="cJson">
-                </checkOrder>
+      </div>
+      <div class="e_add_box">
+        <div class="title">添加组件</div>
+        <div class="e_add_ci">
+          <div class="box">
+            <div
+              class="btn"
+              v-for="item in buttonOptions"
+              :key="item.name"
+              @click="addQtype(item.type)"
+            >
+              <!-- <el-button type="primary"
+                                size="mini">{{ item.name }}</el-button> -->
+              <button
+                class="pub_test_btn"
+                :class="{
+                  pub_test_btn_group: item.type == 1,
+                  pub_test_btn_page: item.type == 2,
+                }"
+              >
+                {{ item.name }}
+              </button>
             </div>
+          </div>
         </div>
+      </div>
+    </div>
+    <div class="e_content">
+      <div class="title">{{ title }}</div>
+      <div class="e_order_box">
+        <checkOrder
+          :checkC.sync="checkC"
+          :checkJson="manualJson"
+          @changeJson="changeJson"
+          etype="edit"
+          :cJson.sync="cJson"
+        >
+        </checkOrder>
+      </div>
     </div>
+    <div class="e_order">
+      <div class="title">
+        题目排序
+        <span style="font-size: 14px; color: #373737">总分:{{ score }}分</span>
+      </div>
+      <div class="e_order_box" style="margin-top: 20px">
+        <checkOrder
+          :checkC.sync="checkC"
+          :checkJson="manualJson"
+          @changeJson="changeJson"
+          etype="order"
+          :cJson.sync="cJson"
+        >
+        </checkOrder>
+      </div>
+    </div>
+  </div>
 </template>
 
 <script>
-import checkOrder from '../../components/checkOrder.vue';
-import minxinVue from '../../minxins/minxin';
+import checkOrder from "../../components/checkOrder.vue";
+import minxinVue from "../../minxins/minxin";
 export default {
-    components: {
-        checkOrder,
+  components: {
+    checkOrder,
+  },
+  mixins: [minxinVue],
+  props: {
+    checkJson: {
+      type: Array,
     },
-    mixins: [minxinVue],
-    props: {
-        checkJson: {
-            type: Array,
-        },
-        title: {
-            type: String
-        }
+    title: {
+      type: String,
     },
-    data() {
-        return {
-            manualJson: [],
-            checkC: "",
-            cJson:{}
-        }
+  },
+  data() {
+    return {
+      manualJson: [],
+      checkC: "",
+      cJson: {},
+    };
+  },
+  watch: {
+    checkJson: {
+      handler(newVal) {
+        this.manualJson = this.depthCopy(newVal);
+      },
+      deep: true,
     },
-    watch: {
-        checkJson: {
-            handler(newVal) {
-                this.manualJson = this.depthCopy(newVal);
-            },
-            deep: true
+  },
+  computed: {
+    score() {
+      let score = 0;
+      this.manualJson.forEach((el) => {
+        if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
+          el.array.forEach((item) => {
+            if (item.ttype == 2 && item.array.length > 0) {
+              item.array.forEach((item2) => {
+                if (item2.ttype == 1 && item2.json) {
+                  score += item2.json.score ? parseFloat(item2.json.score) : 0;
+                }
+              });
+            } else if (item.ttype == 1 && item.json) {
+              score += item.json.score ? parseFloat(item.json.score) : 0;
+            }
+          });
+        } else if (el.ttype == 1 && el.json) {
+          score += el.json.score ? parseFloat(el.json.score) : 0;
         }
+      });
+      return score > 0 ? score : "未设置分数";
     },
-    computed: {
-        score() {
-            let score = 0
-            this.manualJson.forEach(el => {
-                if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
-                    el.array.forEach(item => {
-                        if (item.ttype == 2 && item.array.length > 0) {
-                            item.array.forEach(item2 => {
-                                if (item2.ttype == 1 && item2.json) {
-                                    score += item2.json.score ? parseFloat(item2.json.score) : 0
-                                }
-                            })
-                        } else if (item.ttype == 1 && item.json) {
-                            score += item.json.score ? parseFloat(item.json.score) : 0
-                        }
-                    })
-                } else if (el.ttype == 1 && el.json) {
-                    score += el.json.score ? parseFloat(el.json.score) : 0
-                }
-            })
-            return score > 0 ? score : '未设置分数'
+  },
+  methods: {
+    changeJson(json) {
+      this.manualJson = json;
+      this.$emit("changeJson", json);
+    },
+    addCheck(topicType) {
+      let type = 1;
+      if (this.manualJson.length > 0) {
+        for (var i = 0; i < this.manualJson.length; i++) {
+          if (this.manualJson[i].ttype == 2) {
+            type = 2;
+          } else if (this.manualJson[i].ttype == 3) {
+            type = 3;
+          }
+        }
+      }
+      if (this.checkC) {
+        let _check = this.checkC.replace("x", "").split("-");
+        let _json = this.manualJson[_check[0]];
+        let json = {
+          ttype: 1,
+          type: topicType,
+        };
+        if (this.topicType == 1) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            array: [
+              { option: "选项1", img: "" },
+              { option: "选项2", img: "" },
+            ],
+            answer: "",
+          };
+        } else if (this.topicType == 3) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            answer: "",
+          };
+        } else if (this.topicType == 5) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            detail: "",
+          };
         }
+        if (_json.array) {
+          if (type == 3 && _check.length == 2) {
+            if (this.manualJson[_check[0]].array[_check[1]].array) {
+              this.manualJson[_check[0]].array[_check[1]].array.push(json);
+            } else {
+              this.manualJson[_check[0]].array.splice(
+                parseInt(_check[1]) + 1,
+                0,
+                json
+              );
+            }
+          } else if (type == 3 && _check.length == 3) {
+            this.manualJson[_check[0]].array[_check[1]].array.splice(
+              parseInt(_check[2]) + 1,
+              0,
+              json
+            );
+          } else if (type == 2 && _check.length == 2) {
+            this.manualJson[_check[0]].array.splice(
+              parseInt(_check[1]) + 1,
+              0,
+              json
+            );
+          } else if (type == 2 && _check.length == 1) {
+            this.manualJson[_check[0]].array.push(json);
+          } else if (type == 3 && _check.length == 1) {
+            if (
+              this.manualJson[_check[0]].array[0] &&
+              this.manualJson[_check[0]].array[0].array
+            ) {
+              this.manualJson[_check[0]].array[0].array.push(json);
+            } else {
+              this.manualJson[_check[0]].array.push(json);
+            }
+          }
+        } else {
+          this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
+        }
+      } else {
+        if (type == 1) {
+          this.manualJson.push({
+            ttype: 1,
+            type: topicType,
+          });
+        } else if (type == 3 || type == 2) {
+          this.$message.error("请选中分页或者分组添加题目");
+          return;
+        }
+      }
+      topicType = "";
+      this.$emit("changeJson", this.manualJson);
     },
-    methods: {
-        changeJson(json) {
-            this.manualJson = json;
-            this.$emit("changeJson", json);
-        },
-        addCheck(topicType) {
-            let type = 1;
-            if (this.manualJson.length > 0) {
-                for (var i = 0; i < this.manualJson.length; i++) {
-                    if (this.manualJson[i].ttype == 2) {
-                        type = 2;
-                    } else if (this.manualJson[i].ttype == 3) {
-                        type = 3;
-                    }
-                }
+    addQtype(type) {
+      if (type == 1) {
+        let type = 1;
+        if (this.manualJson.length > 0) {
+          for (var i = 0; i < this.manualJson.length; i++) {
+            if (this.manualJson[i].ttype == 1) {
+              type = 2;
+            } else if (this.manualJson[i].ttype == 3) {
+              type = 3;
             }
-            if (this.checkC) {
-                let _check = this.checkC.replace('x', '').split("-")
-                let _json = this.manualJson[_check[0]]
-                let json = {
-                    ttype: 1,
-                    type: topicType
-                }
-                if (_json.array) {
-                    if (type == 3 && _check.length == 2) {
-                        if (this.manualJson[_check[0]].array[_check[1]].array) {
-                            this.manualJson[_check[0]].array[_check[1]].array.push(json)
-                        } else {
-                            this.manualJson[_check[0]].array.splice(parseInt(_check[1]) + 1, 0, json)
-                        }
+          }
+        }
+        let json = {
+          ttype: 2,
+          array: [],
+          isopen: true,
+        };
+        if (type == 1) {
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
+            this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
+          } else {
+            this.manualJson.push(json);
+          }
+        } else if (type == 2) {
+          this.manualJson = [
+            {
+              ttype: 2,
+              array: this.depthCopy(this.manualJson),
+              isopen: true,
+            },
+          ];
+        } else if (type == 3) {
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
 
-                    } else if (type == 3 && _check.length == 3) {
-                        this.manualJson[_check[0]].array[_check[1]].array.splice(parseInt(_check[2]) + 1, 0, json)
-                    } else if (type == 2 && _check.length == 2) {
-                        this.manualJson[_check[0]].array.splice(parseInt(_check[1]) + 1, 0, json)
-                    } else if (type == 2 && _check.length == 1) {
-                        this.manualJson[_check[0]].array.push(json)
-                    } else if (type == 3 && _check.length == 1) {
-                        if (this.manualJson[_check[0]].array[0] && this.manualJson[_check[0]].array[0].array) {
-                            this.manualJson[_check[0]].array[0].array.push(json)
-                        } else {
-                            this.manualJson[_check[0]].array.push(json)
-                        }
-                    }
-                } else {
-                    this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
-                }
+            if (
+              _check.length > 1 &&
+              this.manualJson[_check[0]].array[0] &&
+              this.manualJson[_check[0]].array[0].array
+            ) {
+              this.manualJson[_check[0]].array.splice(
+                parseInt(_check[1]) + 1,
+                0,
+                json
+              );
+            } else if (
+              this.manualJson[_check[0]].array[0] &&
+              !this.manualJson[_check[0]].array[0].array
+            ) {
+              this.manualJson[_check[0]].array = [
+                {
+                  ttype: 2,
+                  array: this.depthCopy(this.manualJson[_check[0]].array),
+                  isopen: true,
+                },
+              ];
             } else {
-                if (type == 1) {
-                    this.manualJson.push({
-                        ttype: 1,
-                        type: topicType
-                    });
-                } else if (type == 3 || type == 2) {
-                    this.$message.error("请选中分页或者分组添加题目");
-                    return;
-                }
+              this.manualJson[_check[0]].array.push(json);
             }
-            topicType = "";
-            this.$emit("changeJson", this.manualJson);
-        },
-        addQtype(type) {
-            if (type == 1) {
-
-                let type = 1;
-                if (this.manualJson.length > 0) {
-                    for (var i = 0; i < this.manualJson.length; i++) {
-                        if (this.manualJson[i].ttype == 1) {
-                            type = 2;
-                        } else if (this.manualJson[i].ttype == 3) {
-                            type = 3;
-                        }
-                    }
-                }
-                let json = {
-                    ttype: 2,
-                    array: [],
-                    isopen: true
-                }
-                if (type == 1) {
-                    if (this.checkC) {
-                        let _check = this.checkC.replace('x', '').split("-")
-                        this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
-                    } else {
-                        this.manualJson.push(json);
-                    }
-                } else if (type == 2) {
-                    this.manualJson = [
-                        {
-                            ttype: 2,
-                            array: this.depthCopy(this.manualJson),
-                            isopen: true
-                        }
-                    ];
-                } else if (type == 3) {
-                    if (this.checkC) {
-                        let _check = this.checkC.replace('x', '').split("-")
-
-                        if (_check.length > 1 && this.manualJson[_check[0]].array[0] && this.manualJson[_check[0]].array[0].array) {
-                            this.manualJson[_check[0]].array.splice(parseInt(_check[1]) + 1, 0, json);
-                        } else if (this.manualJson[_check[0]].array[0] && !this.manualJson[_check[0]].array[0].array) {
-                            this.manualJson[_check[0]].array = [
-                                {
-                                    ttype: 2,
-                                    array: this.depthCopy(this.manualJson[_check[0]].array),
-                                    isopen: true
-                                }
-                            ]
-                        } else {
-                            this.manualJson[_check[0]].array.push(json);
-                        }
-                    } else {
-                        this.$message.error("请选中分页添加分组");
-                        return;
-                    }
-                }
-
-            } else if (type == 2) {
-
-                let type = 1;
-                if (this.manualJson.length > 0) {
-                    for (var i = 0; i < this.manualJson.length; i++) {
-                        if (this.manualJson[i].ttype == 1 || this.manualJson[i].ttype == 2) {
-                            type = 2;
-                        }
-                    }
-                }
-                if (type == 1) {
-                    let json = {
-                        ttype: 3,
-                        array: [],
-                        isopen: true
-                    }
-                    if (this.checkC) {
-                        let _check = this.checkC.replace('x', '').split("-")
-
-                        this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
-                    } else {
-                        this.manualJson.push(json);
-                    }
-                } else {
-                    this.manualJson = [
-                        {
-                            ttype: 3,
-                            array: this.depthCopy(this.manualJson),
-                            isopen: true
-                        }
-                    ];
-                }
-
+          } else {
+            this.$message.error("请选中分页添加分组");
+            return;
+          }
+        }
+      } else if (type == 2) {
+        let type = 1;
+        if (this.manualJson.length > 0) {
+          for (var i = 0; i < this.manualJson.length; i++) {
+            if (
+              this.manualJson[i].ttype == 1 ||
+              this.manualJson[i].ttype == 2
+            ) {
+              type = 2;
             }
-            this.$emit("changeJson", this.manualJson);
-        },
-    },
-    mounted() {
-        this.manualJson = this.depthCopy(this.checkJson);
+          }
+        }
+        if (type == 1) {
+          let json = {
+            ttype: 3,
+            array: [],
+            isopen: true,
+          };
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
+
+            this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
+          } else {
+            this.manualJson.push(json);
+          }
+        } else {
+          this.manualJson = [
+            {
+              ttype: 3,
+              array: this.depthCopy(this.manualJson),
+              isopen: true,
+            },
+          ];
+        }
+      }
+      this.$emit("changeJson", this.manualJson);
     },
-}
+  },
+  mounted() {
+    this.manualJson = this.depthCopy(this.checkJson);
+  },
+};
 </script>
 
 <style scoped>
 .edit_box {
-    width: 100%;
-    height: 100%;
-    overflow: hidden;
-    display: flex;
-    justify-content: space-between;
-    padding: 0 0 0;
-    box-sizing: border-box;
+  width: 100%;
+  height: 100%;
+  overflow: hidden;
+  display: flex;
+  justify-content: space-between;
+  padding: 0 0 0;
+  box-sizing: border-box;
 }
 
 .e_add {
-    height: 100%;
-    width: 300px;
-    background: #fff;
-    overflow: auto;
-    padding: 20px 10px;
-    box-sizing: border-box;
-    border-right: 1px solid #E5E5E5;
+  height: 100%;
+  width: 300px;
+  background: #fff;
+  overflow: auto;
+  padding: 20px 10px;
+  box-sizing: border-box;
+  border-right: 1px solid #e5e5e5;
 }
 
 .e_content {
-    height: 100%;
-    width: calc(100% - 600px);
-    background: #fff;
-    overflow: auto;
-    padding: 20px 0;
-    box-sizing: border-box;
+  height: 100%;
+  width: calc(100% - 600px);
+  background: #fff;
+  overflow: auto;
+  padding: 20px 0;
+  box-sizing: border-box;
 }
 
-.e_content>.title {
-    font-size: 24px;
-    font-weight: bold;
-    text-align: center;
-    width: 100%;
-    margin-bottom: 10px;
-    word-break: break-all;
+.e_content > .title {
+  font-size: 24px;
+  font-weight: bold;
+  text-align: center;
+  width: 100%;
+  margin-bottom: 10px;
+  word-break: break-all;
 }
 
 .e_order {
-    height: 100%;
-    width: 300px;
-    background: #fff;
-    overflow: auto;
-    padding: 20px 10px;
-    box-sizing: border-box;
+  height: 100%;
+  width: 300px;
+  background: #fff;
+  overflow: auto;
+  padding: 20px 10px;
+  box-sizing: border-box;
 }
 
-.e_add>.title,
-.e_order>.title {
-    text-align: center;
-    font-size: 20px;
+.e_add > .title,
+.e_order > .title {
+  text-align: center;
+  font-size: 20px;
 }
 
 .e_add_box {
-    width: 100%;
-    /* border: 1px solid #dcdcdc; */
-    margin-top: 10px;
-    border-radius: 3px;
-    /* background: #f4f4f4; */
-    box-sizing: border-box;
-    padding: 0 20px 0;
+  width: 100%;
+  /* border: 1px solid #dcdcdc; */
+  margin-top: 10px;
+  border-radius: 3px;
+  /* background: #f4f4f4; */
+  box-sizing: border-box;
+  padding: 0 20px 0;
 }
 
-.e_add_box>.title {
-    margin-bottom: 10px;
-    font-size: 15px;
-    font-weight: 700;
-    display: flex;
-    align-items: center;
+.e_add_box > .title {
+  margin-bottom: 10px;
+  font-size: 15px;
+  font-weight: 700;
+  display: flex;
+  align-items: center;
 }
 
-.e_add_box>.title::before{
-    content: '';
-    width: 10px;
-    height: 10px;
-    border-radius: 50%;
-    background: rgb(54, 129, 252);
-    margin-right: 10px;
-    display: block;
+.e_add_box > .title::before {
+  content: "";
+  width: 10px;
+  height: 10px;
+  border-radius: 50%;
+  background: rgb(54, 129, 252);
+  margin-right: 10px;
+  display: block;
 }
 
-.e_add_box>.e_add_ci {
-    margin-top: 10px;
+.e_add_box > .e_add_ci {
+  margin-top: 10px;
 }
 
-.e_add_box>.e_add_ci>.title {
-    font-size: 14px;
-    margin-bottom: 10px;
+.e_add_box > .e_add_ci > .title {
+  font-size: 14px;
+  margin-bottom: 10px;
 }
 
-.e_add_box>.e_add_ci>.box {
-    display: flex;
-    flex-wrap: wrap;
+.e_add_box > .e_add_ci > .box {
+  display: flex;
+  flex-wrap: wrap;
 }
 
-.e_add_box>.e_add_ci>.box>.btn {
-    margin-bottom: 10px;
-    width: 50%;
-}</style>
+.e_add_box > .e_add_ci > .box > .btn {
+  margin-bottom: 10px;
+  width: 50%;
+}
+</style>

+ 381 - 300
src/components/pages/test/add/setInfo/manualCreated.vue

@@ -1,364 +1,445 @@
 <template>
-    <div class="mc_box">
-        <div class="mc_addBox">
-            <div class="mc_addBox_add">
-                <div class="title">请添加题目类型与数量</div>
-                <div class="select">
-                    <el-select v-model="topicType" placeholder="题目类型" clearable class="e-select">
-                        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
-                        </el-option>
-                    </el-select>
-                    <el-input v-model="number" placeholder="请输入题目数量" size="normal" clearable @change="numberPan"
-                        class="e-input"></el-input>
-                    <img src="@/assets/icon/new/addStage.png" class="e-img" @click="addCheck" />
-                </div>
-            </div>
-            <div class="mc_addBox_add">
-                <div class="title">请添加试卷组件</div>
-                <div class="btnBox">
-                    <!-- <el-button type="primary" size="mini" v-for="item in buttonOptions" :key="item.type" class="e-button"
+  <div class="mc_box">
+    <div class="mc_addBox">
+      <div class="mc_addBox_add">
+        <div class="title">请添加题目类型与数量</div>
+        <div class="select">
+          <el-select
+            v-model="topicType"
+            placeholder="题目类型"
+            clearable
+            class="e-select"
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+          <el-input
+            v-model="number"
+            placeholder="请输入题目数量"
+            size="normal"
+            clearable
+            @change="numberPan"
+            class="e-input"
+          ></el-input>
+          <img
+            src="@/assets/icon/new/addStage.png"
+            class="e-img"
+            @click="addCheck"
+          />
+        </div>
+      </div>
+      <div class="mc_addBox_add">
+        <div class="title">请添加试卷组件</div>
+        <div class="btnBox">
+          <!-- <el-button type="primary" size="mini" v-for="item in buttonOptions" :key="item.type" class="e-button"
                         @click="addQtype(item.type)">{{ item.name }}</el-button> -->
-                    <button v-for="item in buttonOptions" :key="item.type" class="pub_test_btn"
-                        :class="{ pub_test_btn_group: item.type == 1, pub_test_btn_page: item.type == 2 }"
-                        @click="addQtype(item.type)">{{ item.name }}</button>
-                </div>
-            </div>
-            <div class="mc_addBox_add">
-                <div class="title">智能创建</div>
-                <div class="btnBox">
-                    <aiCreate2 :aiJson="manualJson" @changeJson="changeJson"></aiCreate2>
-                </div>
-            </div>
+          <button
+            v-for="item in buttonOptions"
+            :key="item.type"
+            class="pub_test_btn"
+            :class="{
+              pub_test_btn_group: item.type == 1,
+              pub_test_btn_page: item.type == 2,
+            }"
+            @click="addQtype(item.type)"
+          >
+            {{ item.name }}
+          </button>
         </div>
-        <div class="mc_checkBox">
-            <checkOrder :checkC.sync="checkC" :checkJson="checkJson" @changeJson="changeJson"></checkOrder>
-            <div class="e_btn">
-                <el-button type="primary" size="mini" @click="nextSteps()">下一步</el-button>
-            </div>
+      </div>
+      <div class="mc_addBox_add">
+        <div class="title">智能创建</div>
+        <div class="btnBox">
+          <aiCreate2 :aiJson="manualJson" @changeJson="changeJson"></aiCreate2>
         </div>
+      </div>
+    </div>
+    <div class="mc_checkBox">
+      <checkOrder
+        :checkC.sync="checkC"
+        :checkJson="checkJson"
+        @changeJson="changeJson"
+      ></checkOrder>
+      <div class="e_btn">
+        <el-button type="primary" size="mini" @click="nextSteps()"
+          >下一步</el-button
+        >
+      </div>
     </div>
+  </div>
 </template>
 
 <script>
-import checkOrder from '../components/checkOrder.vue';
-import aiCreate2 from './aiCreate2.vue';
-import minxinVue from '../minxins/minxin';
+import checkOrder from "../components/checkOrder.vue";
+import aiCreate2 from "./aiCreate2.vue";
+import minxinVue from "../minxins/minxin";
 
 export default {
-    mixins: [minxinVue],
-    components: {
-        checkOrder,
-        aiCreate2
+  mixins: [minxinVue],
+  components: {
+    checkOrder,
+    aiCreate2,
+  },
+  props: {
+    manualJson: {
+      type: Array,
     },
-    props: {
-        manualJson: {
-            type: Array
-        }
+  },
+  data() {
+    return {
+      topicType: "",
+      number: "",
+      checkJson: [
+        // {
+        //     ttype: 1, //题目分类 1普通题目 2分组 3分页
+        //     type: 1, //题型分类 1选择题,  3问答题 4添加文档
+        //     array:[] //题目
+        // }
+      ],
+      checkC: "",
+    };
+  },
+  watch: {
+    manualJson: {
+      handler: function (newVal, oldVal) {
+        this.checkJson = this.depthCopy(newVal);
+      },
+      deep: true,
     },
-    data() {
-        return {
-            topicType: "",
-            number: "",
-            checkJson: [
-                // {
-                //     ttype: 1, //题目分类 1普通题目 2分组 3分页
-                //     type: 1, //题型分类 1选择题,  3问答题 4添加文档
-                //     array:[] //题目
-                // }
-            ],
-            checkC: "",
-        };
+  },
+  methods: {
+    numberPan() {
+      if (/[^\d]/.test(this.number)) {
+        this.$message.error("请填写数字");
+        this.number = "";
+      }
     },
-    watch: {
-        manualJson: {
-            handler: function (newVal, oldVal) {
-                this.checkJson = this.depthCopy(newVal);
-            },
-            deep: true,
-        }
+    changeJson(json) {
+      this.checkJson = json;
+      this.$emit("update:manualJson", json);
     },
-    methods: {
-        numberPan() {
-            if (/[^\d]/.test(this.number)) {
-                this.$message.error("请填写数字");
-                this.number = "";
+    addCheck() {
+      if (!this.topicType) {
+        this.$message.error("请选择题目类型");
+        return;
+      }
+      if (!this.number) {
+        this.$message.error("请填写题目数量");
+        return;
+      }
+      let type = 1;
+      if (this.checkJson.length > 0) {
+        for (var i = 0; i < this.checkJson.length; i++) {
+          if (this.checkJson[i].ttype == 2) {
+            type = 2;
+          } else if (this.checkJson[i].ttype == 3) {
+            type = 3;
+          }
+        }
+      }
+      if (this.checkC) {
+        let _check = this.checkC.replace("x", "").split("-");
+        let _json = this.checkJson[_check[0]];
+        let json = {
+          ttype: 1,
+          type: this.topicType,
+        };
+        if (this.topicType == 1) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            array: [
+              { option: "选项1", img: "" },
+              { option: "选项2", img: "" },
+            ],
+            answer: "",
+          };
+        } else if (this.topicType == 3) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            answer: "",
+          };
+        } else if (this.topicType == 5) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            detail: "",
+          };
+        }
+        if (_json.array) {
+          if (type == 3 && _check.length == 2) {
+            if (this.checkJson[_check[0]].array[_check[1]].array) {
+              for (var i = 0; i < this.number; i++) {
+                this.checkJson[_check[0]].array[_check[1]].array.push(json);
+              }
+            } else {
+              for (var i = 0; i < this.number; i++) {
+                this.checkJson[_check[0]].array.splice(
+                  parseInt(_check[1]) + 1,
+                  0,
+                  json
+                );
+              }
             }
-        },
-        changeJson(json) {
-            this.checkJson = json;
-            this.$emit("update:manualJson", json);
-        },
-        addCheck() {
-            if (!this.topicType) {
-                this.$message.error("请选择题目类型");
-                return;
+          } else if (type == 3 && _check.length == 3) {
+            for (var i = 0; i < this.number; i++) {
+              this.checkJson[_check[0]].array[_check[1]].array.splice(
+                parseInt(_check[2]) + 1,
+                0,
+                json
+              );
             }
-            if (!this.number) {
-                this.$message.error("请填写题目数量");
-                return;
+          } else if (type == 2 && _check.length == 2) {
+            for (var i = 0; i < this.number; i++) {
+              this.checkJson[_check[0]].array.splice(
+                parseInt(_check[1]) + 1,
+                0,
+                json
+              );
             }
-            let type = 1;
-            if (this.checkJson.length > 0) {
-                for (var i = 0; i < this.checkJson.length; i++) {
-                    if (this.checkJson[i].ttype == 2) {
-                        type = 2;
-                    } else if (this.checkJson[i].ttype == 3) {
-                        type = 3;
-                    }
-                }
+          } else if (type == 2 && _check.length == 1) {
+            for (var i = 0; i < this.number; i++) {
+              this.checkJson[_check[0]].array.push(json);
             }
-            if (this.checkC) {
-                let _check = this.checkC.replace('x', '').split("-")
-                let _json = this.checkJson[_check[0]]
-                let json = {
-                    ttype: 1,
-                    type: this.topicType
-                }
-                if (_json.array) {
-                    if (type == 3 && _check.length == 2) {
-                        if (this.checkJson[_check[0]].array[_check[1]].array) {
-                            for (var i = 0; i < this.number; i++) {
-                                this.checkJson[_check[0]].array[_check[1]].array.push(json)
-                            }
-                        } else {
-                            for (var i = 0; i < this.number; i++) {
-                                this.checkJson[_check[0]].array.splice(parseInt(_check[1]) + 1, 0, json)
-                            }
-                        }
-
-                    } else if (type == 3 && _check.length == 3) {
-                        for (var i = 0; i < this.number; i++) {
-                            this.checkJson[_check[0]].array[_check[1]].array.splice(parseInt(_check[2]) + 1, 0, json)
-                        }
-                    } else if (type == 2 && _check.length == 2) {
-                        for (var i = 0; i < this.number; i++) {
-                            this.checkJson[_check[0]].array.splice(parseInt(_check[1]) + 1, 0, json)
-                        }
-                    } 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++) {
-                        this.checkJson.splice(parseInt(_check[0]) + 1, 0, 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 {
-                if (type == 1) {
-                    for (var i = 0; i < this.number; i++) {
-                        this.checkJson.push({
-                            ttype: 1,
-                            type: this.topicType
-                        });
-                    }
-                } else if (type == 3 || type == 2) {
-                    this.$message.error("请选中分页或者分组添加题目");
-                    return;
-                }
+              for (var i = 0; i < this.number; i++) {
+                this.checkJson[_check[0]].array.push(json);
+              }
             }
-            this.topicType = "";
-            this.number = "";
-            this.$emit("update:manualJson", this.checkJson);
-        },
-        addQtype(type) {
-            if (type == 1) {
-
-                let type = 1;
-                if (this.checkJson.length > 0) {
-                    for (var i = 0; i < this.checkJson.length; i++) {
-                        if (this.checkJson[i].ttype == 1) {
-                            type = 2;
-                        } else if (this.checkJson[i].ttype == 3) {
-                            type = 3;
-                        }
-                    }
-                }
-                let json = {
-                    ttype: 2,
-                    array: [],
-                    isopen: true
-                }
-                if (type == 1) {
-                    if (this.checkC) {
-                        let _check = this.checkC.replace('x', '').split("-")
-                        this.checkJson.splice(parseInt(_check[0]) + 1, 0, json);
-                    } else {
-                        this.checkJson.push(json);
-                    }
-                } else if (type == 2) {
-                    this.checkJson = [
-                        {
-                            ttype: 2,
-                            array: this.depthCopy(this.checkJson),
-                            isopen: true
-                        }
-                    ];
-                } else if (type == 3) {
-                    if (this.checkC) {
-                        let _check = this.checkC.replace('x', '').split("-")
-
-                        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] && !this.checkJson[_check[0]].array[0].array) {
-                            this.checkJson[_check[0]].array = [
-                                {
-                                    ttype: 2,
-                                    array: this.depthCopy(this.checkJson[_check[0]].array),
-                                    isopen: true
-                                }
-                            ]
-                        } else {
-                            this.checkJson[_check[0]].array.push(json);
-                        }
-                    } else {
-                        this.$message.error("请选中分页添加分组");
-                        return;
-                    }
-                }
-
-            } else if (type == 2) {
-
-                let type = 1;
-                if (this.checkJson.length > 0) {
-                    for (var i = 0; i < this.checkJson.length; i++) {
-                        if (this.checkJson[i].ttype == 1 || this.checkJson[i].ttype == 2) {
-                            type = 2;
-                        }
-                    }
-                }
-                if (type == 1) {
-                    let json = {
-                        ttype: 3,
-                        array: [],
-                        isopen: true
-                    }
-                    if (this.checkC) {
-                        let _check = this.checkC.replace('x', '').split("-")
-
-                        this.checkJson.splice(parseInt(_check[0]) + 1, 0, json);
-                    } else {
-                        this.checkJson.push(json);
-                    }
-                } else {
-                    this.checkJson = [
-                        {
-                            ttype: 3,
-                            array: this.depthCopy(this.checkJson),
-                            isopen: true
-                        }
-                    ];
-                }
+          }
+        } else {
+          for (var i = 0; i < this.number; i++) {
+            this.checkJson.splice(parseInt(_check[0]) + 1, 0, json);
+          }
+        }
+      } else {
+        if (type == 1) {
+          for (var i = 0; i < this.number; i++) {
+            this.checkJson.push({
+              ttype: 1,
+              type: this.topicType,
+            });
+          }
+        } else if (type == 3 || type == 2) {
+          this.$message.error("请选中分页或者分组添加题目");
+          return;
+        }
+      }
+      this.topicType = "";
+      this.number = "";
+      this.$emit("update:manualJson", this.checkJson);
+    },
+    addQtype(type) {
+      if (type == 1) {
+        let type = 1;
+        if (this.checkJson.length > 0) {
+          for (var i = 0; i < this.checkJson.length; i++) {
+            if (this.checkJson[i].ttype == 1) {
+              type = 2;
+            } else if (this.checkJson[i].ttype == 3) {
+              type = 3;
+            }
+          }
+        }
+        let json = {
+          ttype: 2,
+          array: [],
+          isopen: true,
+        };
+        if (type == 1) {
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
+            this.checkJson.splice(parseInt(_check[0]) + 1, 0, json);
+          } else {
+            this.checkJson.push(json);
+          }
+        } else if (type == 2) {
+          this.checkJson = [
+            {
+              ttype: 2,
+              array: this.depthCopy(this.checkJson),
+              isopen: true,
+            },
+          ];
+        } else if (type == 3) {
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
 
+            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] &&
+              !this.checkJson[_check[0]].array[0].array
+            ) {
+              this.checkJson[_check[0]].array = [
+                {
+                  ttype: 2,
+                  array: this.depthCopy(this.checkJson[_check[0]].array),
+                  isopen: true,
+                },
+              ];
+            } else {
+              this.checkJson[_check[0]].array.push(json);
+            }
+          } else {
+            this.$message.error("请选中分页添加分组");
+            return;
+          }
+        }
+      } else if (type == 2) {
+        let type = 1;
+        if (this.checkJson.length > 0) {
+          for (var i = 0; i < this.checkJson.length; i++) {
+            if (this.checkJson[i].ttype == 1 || this.checkJson[i].ttype == 2) {
+              type = 2;
             }
-            this.$emit("update:manualJson", this.checkJson);
-        },
-        depthCopy(s) {
-            return JSON.parse(JSON.stringify(s));
-        },
+          }
+        }
+        if (type == 1) {
+          let json = {
+            ttype: 3,
+            array: [],
+            isopen: true,
+          };
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
 
-        nextSteps() {
-            this.$emit("nextSteps")
+            this.checkJson.splice(parseInt(_check[0]) + 1, 0, json);
+          } else {
+            this.checkJson.push(json);
+          }
+        } else {
+          this.checkJson = [
+            {
+              ttype: 3,
+              array: this.depthCopy(this.checkJson),
+              isopen: true,
+            },
+          ];
         }
+      }
+      this.$emit("update:manualJson", this.checkJson);
+    },
+    depthCopy(s) {
+      return JSON.parse(JSON.stringify(s));
+    },
+
+    nextSteps() {
+      this.$emit("nextSteps");
     },
-    mounted() {
-        this.checkJson = this.depthCopy(this.manualJson);
-        this.$forceUpdate()
-    }
+  },
+  mounted() {
+    this.checkJson = this.depthCopy(this.manualJson);
+    this.$forceUpdate();
+  },
 };
 </script>
 
 <style scoped>
 .mc_box {
-    width: 90%;
-    margin: 10px auto;
-    display: flex;
+  width: 90%;
+  margin: 10px auto;
+  display: flex;
 }
 
 .mc_addBox {
-    width: 400px;
-    border: 1px solid #898989;
-    border-radius: 8px;
-    padding: 20px 20px;
-    box-sizing: border-box;
-    min-height: 350px;
-    height: fit-content;
+  width: 400px;
+  border: 1px solid #898989;
+  border-radius: 8px;
+  padding: 20px 20px;
+  box-sizing: border-box;
+  min-height: 350px;
+  height: fit-content;
 }
 
-.mc_addBox_add {}
+.mc_addBox_add {
+}
 
-.mc_addBox_add+.mc_addBox_add {
-    margin-top: 10px;
+.mc_addBox_add + .mc_addBox_add {
+  margin-top: 10px;
 }
 
 .mc_addBox_add .title {
-    margin-bottom: 10px;
-    font-size: 15px;
-    font-weight: 700;
-    display: flex;
-    align-items: center;
+  margin-bottom: 10px;
+  font-size: 15px;
+  font-weight: 700;
+  display: flex;
+  align-items: center;
 }
 
 .mc_addBox_add .title::before {
-    content: '';
-    width: 10px;
-    height: 10px;
-    border-radius: 50%;
-    background: rgb(54, 129, 252);
-    margin-right: 10px;
-    display: block;
+  content: "";
+  width: 10px;
+  height: 10px;
+  border-radius: 50%;
+  background: rgb(54, 129, 252);
+  margin-right: 10px;
+  display: block;
 }
 
 .mc_addBox_add .select {
-    display: flex;
-    align-items: center;
+  display: flex;
+  align-items: center;
 }
 
 .mc_addBox_add .btnBox {
-    display: flex;
-    flex-wrap: wrap;
+  display: flex;
+  flex-wrap: wrap;
 }
 
-.mc_addBox_add .select .e-select {}
+.mc_addBox_add .select .e-select {
+}
 
 .mc_addBox_add .select .e-input {
-    margin-left: 10px;
+  margin-left: 10px;
 }
 
 .mc_addBox_add .select .e-img {
-    cursor: pointer;
-    width: 20px;
-    margin-left: 10px;
+  cursor: pointer;
+  width: 20px;
+  margin-left: 10px;
 }
 
-.mc_addBox_add .btnBox .e-button {}
+.mc_addBox_add .btnBox .e-button {
+}
 
 .mc_checkBox {
-    width: calc(100% - 420px);
-    margin-left: 20px;
-    border: 1px solid #898989;
-    border-radius: 8px;
-    padding: 20px;
-    box-sizing: border-box;
-    display: flex;
-    flex-direction: column;
+  width: calc(100% - 420px);
+  margin-left: 20px;
+  border: 1px solid #898989;
+  border-radius: 8px;
+  padding: 20px;
+  box-sizing: border-box;
+  display: flex;
+  flex-direction: column;
 }
 
-
 .e_btn {
-    width: 100%;
-    margin-top: auto;
-    display: flex;
-    justify-content: center;
+  width: 100%;
+  margin-top: auto;
+  display: flex;
+  justify-content: center;
 }
 </style>