Browse Source

时间选择组件

11wqe1 1 năm trước cách đây
mục cha
commit
64a6ffe156

+ 114 - 0
src/views/testDetail/components/time.vue

@@ -0,0 +1,114 @@
+<template>
+  <div class="c_box">
+    <div class="choice_box" v-if="checkJson">
+      <div class="title" style="display: flex;">
+        <span style="min-width: fit-content;">{{ tindex + 1 + '、' }}</span>
+        <span>{{ checkJson.title }}</span>
+      </div>
+      <div
+        class="detail"
+        v-if="checkJson.detail"
+        v-html="checkJson.detail"
+        style="color: #00000099;margin-top: 5px;"
+      ></div>
+
+      <div style="margin-top: 10px;">
+        <el-date-picker
+          :readonly="checktype == 2"
+          v-model="checkJson.answer2"
+          type="date"
+          format="yyyy 年 MM 月 dd 日"
+          value-format="yyyy年MM月dd日"
+          placeholder="年/月/日"
+        >
+        </el-date-picker>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    tindex: {
+      type: Number
+    },
+    cJson: {
+      type: Object
+    },
+    checktype: {
+      type: Number,
+      default: 1
+    },
+    see: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      option: {
+        1: { name: '附件' }
+      },
+      userid: this.$route.query.userid,
+      checkJson: undefined,
+      progress: 0,
+      yy: '',
+      isFinishSize: 0,
+      proVisible: false,
+      isAllSize: 0,
+      wurl: '',
+      isTong: false
+    }
+  },
+  watch: {
+    checkJson: {
+      handler(newValue) {
+        this.$emit('update:cJson', newValue)
+      },
+      deep: true
+    }
+  },
+  methods: {
+    depthCopy(s) {
+      let t = JSON.parse(JSON.stringify(s))
+      if (!t.answer2.length) {
+        t.answer2 = ''
+      }
+      return t
+    }
+  },
+  mounted() {
+    console.log('this.checkJson', this.cJson)
+    // console.log('this.checkJson', this.cJson == true)
+    // return
+    this.checkJson = this.cJson ? this.depthCopy(this.cJson) : undefined
+  }
+}
+</script>
+
+<style scoped>
+.c_box {
+  width: 100%;
+  position: relative;
+  overflow: unset;
+}
+
+/* .mask {
+    position: absolute;
+    height: 100%;
+    width: 100%;
+    z-index: 2;
+} */
+
+.choice_box {
+  white-space: pre-line;
+}
+
+.choice_box > .title {
+  font-weight: bold;
+  width: 100%;
+  word-break: break-all;
+  font-size: 16px;
+}
+</style>

+ 54 - 1
src/views/testDetail/components/topic.vue

@@ -62,6 +62,14 @@
               :see="see"
               :isTeacher="isTeacher"
             ></evaV>
+            <timeV
+              :tindex="index"
+              :cJson.sync="item.json"
+              :checktype="checktype"
+              v-else-if="item.type == 8"
+              :see="see"
+              :isTeacher="isTeacher"
+            ></timeV>
             <!-- <span v-else>暂未设置题目</span> -->
           </div>
           <div v-for="(item2, index2) in item.array" :key="`${index}-${index2}`" class="check_box_xia">
@@ -117,6 +125,14 @@
                 :see="see"
                 :isTeacher="isTeacher"
               ></evaV>
+              <timeV
+                :tindex="index2"
+                :cJson.sync="item2.json"
+                :checktype="checktype"
+                v-else-if="item2.type == 8"
+                :see="see"
+                :isTeacher="isTeacher"
+              ></timeV>
               <!-- <span v-else>暂未设置题目</span> -->
             </div>
           </div>
@@ -176,6 +192,14 @@
               :see="see"
               :isTeacher="isTeacher"
             ></evaV>
+            <timeV
+              :tindex="index"
+              :cJson.sync="item.json"
+              :checktype="checktype"
+              v-else-if="item.type == 8"
+              :see="see"
+              :isTeacher="isTeacher"
+            ></timeV>
             <!-- <span v-else>暂未设置题目</span> -->
           </div>
           <div v-for="(item2, index2) in item.array" :key="`${index}-${index2}`" class="check_box_xia">
@@ -231,6 +255,14 @@
                 :see="see"
                 :isTeacher="isTeacher"
               ></evaV>
+              <timeV
+                :tindex="index2"
+                :cJson.sync="item2.json"
+                :checktype="checktype"
+                v-else-if="item2.type == 8"
+                :see="see"
+                :isTeacher="isTeacher"
+              ></timeV>
               <!-- <span v-else>暂未设置题目</span> -->
             </div>
           </div>
@@ -257,6 +289,8 @@ import gapV from './gap.vue'
 import fileV from './file.vue'
 import courseV from './course.vue'
 import evaV from './eva.vue'
+import timeV from './time.vue'
+
 export default {
   props: {
     cJson: {
@@ -298,7 +332,8 @@ export default {
     gapV,
     fileV,
     courseV,
-    evaV
+    evaV,
+    timeV
   },
   data() {
     return {
@@ -421,6 +456,14 @@ export default {
                 item2.type == 7
               ) {
                 item2.json.answer2 = ''
+              } else if (
+                item2.ttype == 1 &&
+                item2.json &&
+                !item2.json.answer2 &&
+                item2.json.answer2 !== 0 &&
+                item2.type == 8
+              ) {
+                item2.json.answer2 = ''
               }
               if (item2.array) {
                 item2.array = item2.array.filter(item3 => {
@@ -436,6 +479,14 @@ export default {
                     item3.type == 7
                   ) {
                     item3.json.answer2 = ''
+                  } else if (
+                    item3.ttype == 1 &&
+                    item3.json &&
+                    !item3.json.answer2 &&
+                    item3.json.answer2 !== 0 &&
+                    item3.type == 8
+                  ) {
+                    item3.json.answer2 = ''
                   }
                   return item3
                 })
@@ -449,6 +500,8 @@ export default {
             item.json.answer2 = this.gcourseid ? this.gcourseid : item.json.courses[0]
           } else if (item.ttype == 1 && item.json && !item.json.answer2 && item.json.answer2 !== 0 && item.type == 7) {
             item.json.answer2 = ''
+          } else if (item.ttype == 1 && item.json && !item.json.answer2 && item.json.answer2 !== 0 && item.type == 8) {
+            item.json.answer2 = ''
           }
           console.log(item.array)
           return (item.ttype != 1 && item.array.length > 0) || item.ttype == 1