lsc 1 year ago
parent
commit
00463b38bb

+ 1 - 1
dist/index.html

@@ -25,7 +25,7 @@
       height: 100%;
       width: 100%;
       background: #e6eaf0;
-    }</style><link href=./static/css/app.978c9c293c3d2c14cbd65c37e251e8df.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3512a67a6213c2df4180.js></script><script type=text/javascript src=./static/js/vendor.1b8e037bd3fbbd358d74.js></script><script type=text/javascript src=./static/js/app.53b5f449f9cbf85e4094.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.bc77bc8cec5402375e566a6f41cfca1a.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3512a67a6213c2df4180.js></script><script type=text/javascript src=./static/js/vendor.1b8e037bd3fbbd358d74.js></script><script type=text/javascript src=./static/js/app.544e9c56d8ba4f6dd674.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.978c9c293c3d2c14cbd65c37e251e8df.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.bc77bc8cec5402375e566a6f41cfca1a.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.bc77bc8cec5402375e566a6f41cfca1a.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.544e9c56d8ba4f6dd674.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.544e9c56d8ba4f6dd674.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.3512a67a6213c2df4180.js.map


+ 6 - 0
src/components/pages/dataBoard/school/teacherInfo/index.vue

@@ -206,12 +206,18 @@ export default {
             immediate: true,
             deep: true,
             handler(newValue, oldValue) {
+                // newValue = newValue.filter(item => {
+                //     return ['一年级','二年级','三年级','四年级','五年级','六年级','七年级'].indexOf(item.name) !== -1
+                // })
                 this.setJson(newValue)
                 this.$forceUpdate();
             },
         },
     },
     mounted() {
+        // this.courseArray = this.courseArray.filter(item => {
+        //     return ['一年级','二年级','三年级','四年级','五年级','六年级','七年级'].indexOf(item.name) !== -1
+        // })
         this.setJson(this.courseArray)
         var _this = this;
         window.addEventListener("resize", () => {

+ 110 - 0
src/components/pages/test/add/edit/check/choice.vue

@@ -0,0 +1,110 @@
+<template>
+    <div class="c_box">
+        <!-- <div class="mask"></div> -->
+        <div v-if="!checkJson">暂未设置题目</div>
+        <div v-else class="choice_box">
+            <div class="title">{{ `(${option[checkJson.type].name})` + checkJson.title }}</div>
+            <div class="choices">
+                <div class="choice" v-for="(item, index) in checkJson.array" :key="index">
+                    <div class="choice_c" v-if="checkJson.type == 2"><el-checkbox v-model="checkJson.answer2" :label="index"></el-checkbox><span>{{ item.option }}</span></div>
+                    <div class="choice_c" v-if="checkJson.type == 1"><el-radio v-model="checkJson.answer2[0]" :label="index"></el-radio><span>{{ item.option }}</span></div>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+export default {
+    props: {
+        cJson: {
+            type: Object,
+        },
+    },
+    data() {
+        return {
+            option: {
+                1: { name: '单选题' },
+                2: { name: '多选题' }
+            },
+            checkJson:undefined
+        }
+    },
+    watch: {
+        checkJson: {
+            handler(newValue){
+                this.$emit('update:cJson', newValue)
+            },
+            deep: true
+        }
+    },
+    methods: {
+        depthCopy(s) {
+            return JSON.parse(JSON.stringify(s));
+        },
+    },
+    mounted(){
+        this.checkJson = this.cJson ? this.depthCopy(this.cJson) : undefined
+    }
+}
+</script>
+
+<style scoped>
+.c_box {
+    width: 100%;
+    position: relative;
+}
+.mask{
+    position: absolute;
+    height: 100%;
+    width: 100%;
+    z-index: 2;
+}
+.choice_box {
+    
+}
+
+.choice_box>.title {
+    font-weight: bold;
+    width: 100%;
+    word-break: break-all;
+}
+.choice_box>.choices {
+   margin-top:10px;
+   padding: 0 10px;
+}
+.choice_box>.choices >.choice{
+    word-break: break-all;
+}
+.choice_box>.choices >.choice + .choice{
+    margin-top: 5px;
+}
+.choice_box>.choices >.choice > .choice_c{
+    display: flex;
+}
+.choice_box>.choices >.choice > .choice_c > span{
+    /* margin-left: 10px; */
+}
+.choice_box>.choices >.choice > .choice_c > .el-checkbox{
+    margin-top: 4px;
+    margin-right: 10px;
+}
+.choice_box>.choices >.choice > .choice_c > .el-radio{
+    margin-top: 4px;
+    margin-right: 10px;
+}
+.choice_c>>>.el-checkbox__label {
+    display: none;
+}
+
+.choice_c>>>.el-radio__label {
+    display: none;
+}
+
+.choice_c .right{
+    color: #efa030;
+}
+.choice_c .right::after{
+    content: '(正确答案)';
+}
+</style>

+ 197 - 0
src/components/pages/test/add/edit/check/index.vue

@@ -0,0 +1,197 @@
+<template>
+  <div class="c_box">
+    <div class="c_box_title">{{ title }}</div>
+    <div class="c_body">
+      <div v-if="type == 3">
+        <div v-for="(item, index) in checkArray[page].array" :key="index" class="check_box">
+          <div class="title">{{ selectType(item, index) }}</div>
+          <div v-if="item.ttype == 1" class="answerBox"><choiceV :cJson.sync="item.json"></choiceV></div>
+          <div v-for="(item2, index2) in item.array" :key="`${index}-${index2}`" class="check_box_xia">
+            <div class="title">{{ selectType(item2, index2) }}</div>
+            <div v-if="item2.ttype == 1" class="answerBox"><choiceV :cJson.sync="item2.json"></choiceV></div>
+          </div>
+        </div>
+      </div>
+      <div v-else>
+        <div v-for="(item, index) in checkArray" :key="index" class="check_box">
+          <div class="title">{{ selectType(item, index) }}</div>
+          <div v-if="item.ttype == 1" class="answerBox"><choiceV :cJson.sync="item.json"></choiceV></div>
+          <div v-for="(item2, index2) in item.array" :key="`${index}-${index2}`" class="check_box_xia">
+            <div class="title">{{ selectType(item2, index2) }}</div>
+            <div v-if="item2.ttype == 1" class="answerBox"><choiceV :cJson.sync="item2.json"></choiceV></div>
+          </div>
+        </div>
+      </div>
+
+      <div v-if="checkArray.length > 1 && type == 3" class="page">
+        <el-button type="primary" size="mini" :disabled="page == 0" @click="page--">上一页</el-button>
+        <div class="p_page"><span>{{ page + 1 }}</span><span>/</span><span>{{ checkArray.length }}</span></div>
+        <el-button type="primary" size="mini" :disabled="page == (checkArray.length - 1)" @click="page++">下一页</el-button>
+
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import choiceV from './choice.vue';
+export default {
+  props: {
+    cJson: {
+      type: Array,
+    },
+    title: {
+      type: String,
+    }
+  },
+  components: {
+    choiceV
+  },
+  data() {
+    return {
+      checkArray: [],
+      type: 1,
+      page: 0,
+      options2: {
+        1: "选择题",
+        2: "问答题",
+        3: "填空题",
+        4: "添加文档"
+      },
+    }
+  },
+  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: {
+    cJson: {
+      handler(newVal, oldVal) {
+        console.log(newVal);
+        console.log(oldVal);
+        this.checkArray = this.setJson(this.depthCopy(newVal))
+      },
+      deep: true
+    }
+  },
+  methods: {
+    depthCopy(s) {
+      return JSON.parse(JSON.stringify(s));
+    },
+    setJson(json) {
+      if (json.length > 0) {
+        let _json = this.depthCopy(json)
+        this.type = _json[0].ttype
+        let checkArray = _json.filter(item => {
+          if (item.array) {
+            item.array = item.array.filter(item2 => {
+              if (item2.ttype == 1 && item2.json && !item2.json.answer2) {
+                item2.json.answer2 = []
+              }
+              if (item2.array) {
+                  item2.array = item2.array.filter(item3 => {
+                    if (item3.ttype == 1 && item3.json && !item3.json.answer2) {
+                      item3.json.answer2 = []
+                    }
+                    return item3
+                  })
+                }
+              return (item2.ttype != 1 && item2.array.length > 0) || (item2.ttype == 1)
+            })
+          }
+          if (item.ttype == 1 && item.json && !item.json.answer2) {
+            item.json.answer2 = []
+          }
+          console.log(item.array);
+          return (item.ttype != 1 && item.array.length > 0) || (item.ttype == 1)
+        })
+        console.log(checkArray);
+        return checkArray
+      } else {
+        return []
+      }
+    }
+  },
+  mounted() {
+    this.checkArray = this.setJson(this.depthCopy(this.cJson))
+  },
+}
+</script>
+
+<style scoped>
+.c_box {
+  padding: 10px 0 0;
+  box-sizing: border-box;
+  width: 95%;
+  margin: 10px auto 0;
+  background: #fff;
+  height: calc(100% - 10px);
+  overflow: auto;
+}
+
+.c_box_title {
+  width: 90%;
+  text-align: center;
+  font-size: 24px;
+  font-weight: bold;
+  word-break: break-all;
+  margin: 20px;
+}
+
+.c_body {
+  width: 90%;
+  margin: 0 auto;
+}
+
+.check_box{
+
+}
+.check_box + .check_box{
+  margin-top: 10px;
+}
+.check_box > .title{
+  font-size:20px;
+  word-break: break-all;
+  font-weight: bold;
+}
+.check_box > .answerBox{
+  margin-top: 10px;
+
+}
+.check_box > .noanswerBox{
+  margin-top: 10px;
+}
+.check_box_xia{
+  margin-top: 10px;
+}
+
+.check_box_xia > .title{
+  font-size: 18px;
+  font-weight: bold;
+}
+.check_box_xia > .answerBox{
+  margin-top: 10px;
+}
+.check_box_xia > .noanswerBox{
+  margin-top: 10px;
+}
+
+.page{
+  margin: 20px;
+  display: flex;
+  align-items: center;
+}
+
+.p_page{
+  margin: 0 10px;
+}
+</style>

+ 7 - 3
src/components/pages/test/add/edit/index.vue

@@ -4,8 +4,8 @@
       <div class="edit_btn">
         <span :class="{ active: type == 1 }" @click="type = 1">编辑</span>
         <span :class="{ active: type == 2 }" @click="type = 2">预览</span>
-        <span :class="{ active: type == 3 }" @click="type = 3">回答</span>
-        <span :class="{ active: type == 4 }" @click="type = 4">统计</span>
+        <!-- <span :class="{ active: type == 3 }" @click="type = 3">回答</span>
+        <span :class="{ active: type == 4 }" @click="type = 4">统计</span> -->
       </div>
       <div class="op_btn">
         <el-button type="primary" size="small" @click="lastSteps">上一步</el-button>
@@ -16,15 +16,19 @@
     </div>
     <div class="e_box">
       <editBox v-if="type == 1" :checkJson="checkJson"  @changeJson="changeJson" :title="title"></editBox>
+      <checkBox v-if="type == 2" :cJson="checkJson" :title="title"></checkBox>
     </div>
   </div>
 </template>
 
 <script>
 import editBox from './edit/index.vue'
+import checkBox from './check/index.vue'
+
 export default {
   components: {
     editBox,
+    checkBox
   },
   props: {
     title: {
@@ -68,7 +72,7 @@ export default {
       this.$emit("publish")
     },
     depthCopy(s) {
-      return JSON.parse(JSON.stringify(s))
+      return s ? JSON.parse(JSON.stringify(s)) : ''
     },
     changeJson(json) {
       this.$emit("update:cJson", json);

+ 1 - 1
src/components/pages/test/add/minxins/minxin.js

@@ -36,7 +36,7 @@ const minxin = {
   activated() {},
   methods: {
     depthCopy(s) {
-      return JSON.parse(JSON.stringify(s));
+      return s ? JSON.parse(JSON.stringify(s)) : '';
     }
   }
 };

Some files were not shown because too many files changed in this diff