Ver código fonte

feat(workPage): 新增投票问题组件及设置组件

新增voteQuestion.vue和setVoteQuestion.vue组件,实现投票问题的展示和设置功能
voteQuestion组件支持单选/多选投票展示,setVoteQuestion组件提供题目编辑、选项管理等功能
lsc 1 dia atrás
pai
commit
1544b4569a

+ 57 - 0
src/components/pages/pptEasy/addCourse3.vue

@@ -2956,6 +2956,45 @@ export default {
         this.editId = null;
         this.editId = null;
       });
       });
     },
     },
+    addVote() {
+      let testJson = JSON.parse(JSON.stringify(this.testJson));
+      testJson.testJson = this.testJson.testJson.filter(el => {
+        var elc = el.checkList.filter(element => {
+          return element != "";
+        });
+        return (
+          (el.teststitle != "" || el.timuList.length > 0) && elc.length != 0
+        );
+      });
+
+      testJson.testCount = testJson.testJson.length;
+
+      let _data = { id: new Date().getTime(), tool: 78, title: this.lang.ssChoice, brief: this.lang.ssChoiceTool2, json: testJson, url: "" }
+      if (this.editId) {
+        let oldData = this.pptCourseJson.toolsList.find(i => i.id === this.editId);
+        _data.id = oldData.id;
+        _data.title = oldData.title;
+        _data.brief = oldData.brief;
+        this.pptCourseJson.toolsList.splice(this.pptCourseJson.toolsList.findIndex(i => i.id === this.editId), 1, _data);
+      } else {
+        this.pptCourseJson.toolsList.push(_data);
+      }
+
+      this.dialogVisibleChoice = false;
+      this.getWorkPageId(_data.id, 78, testJson).then(res => {
+        let baseUrl = this.setUrl()
+        let url = `${baseUrl}/pbl-teacher-table/dist/workPage.html#/setWorkPage?id=${res}&type=${_data.tool}`
+        this.pptCourseJson.toolsList.find(i => i.id === _data.id).url = url;
+        this.setPPtToolList();
+        _data.url = url
+        if (!this.editId) {
+          this.addContent(_data)
+        } else {
+          this.addContent(_data, 2)
+        }
+        this.editId = null;
+      });
+    },
     deletecheckList(json, index) {
     deletecheckList(json, index) {
       // json.checkList.length--;
       // json.checkList.length--;
       json.checkList.splice(index, 1);
       json.checkList.splice(index, 1);
@@ -3287,6 +3326,24 @@ export default {
           ]
           ]
         };
         };
          this.addTest()
          this.addTest()
+      } else if (tool == 78) {
+        this.testJsonName = "";
+        this.testJsonBrief = "";
+        this.testJson = {
+          testCount: 1,
+          testTitle: "",
+          testJson: [
+            {
+              teststitle: "",
+              testItem: 1,
+              checkList: [],
+              timuList: [],
+              answer: [],
+              type: "1"
+            }
+          ]
+        };
+        this.addVote()
       } else if (tool == 15) {
       } else if (tool == 15) {
         this.answerQ = "";
         this.answerQ = "";
         this.addAnswer();
         this.addAnswer();

+ 737 - 0
src/components/pages/workPage/components/setVoteQuestion.vue

@@ -0,0 +1,737 @@
+<template>
+  <div class="setChoiceQuestion">
+    <div class="head_title">{{ lang.ssVoteTopic }}</div>
+    <div class="testItem" v-for="(item, index) in jsonData.testJson" :key="item.id">
+      <div class="ti_title">
+        <el-input class="ti_t_input" type="textarea" v-model="item.teststitle" :rows="3" :autosize="{ minRows: 3, maxRows: 6 }" resize="none" :placeholder="lang.ssEnterTextTitle" @input="setTestTitle(item.id)"></el-input>
+        <div class="uploadImage" @click="uploadImage(item.id)">
+          <svg viewBox="0 0 1024 1024" version="1.1" p-id="15953" width="200" height="200">
+            <path
+              d="M368 480c-62.4 0-112-49.6-112-112s49.6-112 112-112 112 49.6 112 112-49.6 112-112 112z m0-160c-27.2 0-48 20.8-48 48s20.8 48 48 48 48-20.8 48-48-20.8-48-48-48z m464 608H192c-52.8 0-96-43.2-96-96V192c0-52.8 43.2-96 96-96h640c52.8 0 96 43.2 96 96v640c0 52.8-43.2 96-96 96zM192 160c-17.6 0-32 14.4-32 32v640c0 17.6 14.4 32 32 32h640c17.6 0 32-14.4 32-32V192c0-17.6-14.4-32-32-32H192z m259.2 556.8c-25.6 0-51.2-11.2-70.4-30.4l-38.4-40c-12.8-12.8-33.6-12.8-46.4 0l-49.6 52.8c-12.8 12.8-32 12.8-44.8 1.6s-12.8-32-1.6-44.8l49.6-52.8c17.6-19.2 43.2-30.4 68.8-30.4s51.2 11.2 70.4 30.4l38.4 40c12.8 12.8 33.6 12.8 46.4 0l160-168c17.6-19.2 43.2-30.4 70.4-30.4s51.2 11.2 70.4 30.4L920 628.8c12.8 12.8 11.2 33.6-1.6 44.8-12.8 12.8-33.6 11.2-44.8-1.6L728 518.4c-12.8-12.8-33.6-12.8-46.4 0L521.6 688c-19.2 17.6-44.8 28.8-70.4 28.8z"
+              fill="#333333" p-id="15954"></path>
+          </svg>
+        </div>
+      </div>
+      <!-- 图片 -->
+      <div class="imageList">
+        <div v-for="(image, imageIndex) in item.timuList" :key="item.id + '_' + imageIndex">
+          <el-image style="width: 100px; height: 100px" :src="image.url" :preview-src-list="[image.url]"
+            fit="cover"></el-image>
+          <svg @click="delImage(item.id, imageIndex)" t="1774237005199" viewBox="0 0 1024 1024" width="200"
+            height="200">
+            <path
+              d="M512 1024A512 512 0 1 1 512 0a512 512 0 0 1 0 1024zM305.956571 370.395429L447.488 512 305.956571 653.604571a45.568 45.568 0 1 0 64.438858 64.438858L512 576.512l141.604571 141.531429a45.568 45.568 0 0 0 64.438858-64.438858L576.512 512l141.531429-141.604571a45.568 45.568 0 1 0-64.438858-64.438858L512 447.488 370.395429 305.956571a45.568 45.568 0 0 0-64.438858 64.438858z"
+              fill="#FF2525" p-id="4716"></path>
+          </svg>
+        </div>
+      </div>
+
+      <!-- 选择题 -->
+      <div class="checkList">
+        <div class="checkItem" v-for="(check, checkIndex) in item.checkList" :key="checkIndex"
+            draggable="true"
+            @dragstart="dragStart($event, item, checkIndex)"
+            @dragover.prevent="dragOver($event, item, checkIndex)"
+            @drop="drop($event, item, checkIndex)"
+            @dragend="dragEnd">
+          <div class="drag" draggable="true" @dragstart="dragStart($event, item, checkIndex)">
+            <svg viewBox="0 0 1024 1024" width="200" height="200">
+              <path
+                d="M867.995 459.647h-711.99c-27.921 0-52.353 24.434-52.353 52.353s24.434 52.353 52.353 52.353h711.99c27.921 0 52.353-24.434 52.353-52.353s-24.434-52.353-52.353-52.353z"
+                p-id="9455"></path>
+              <path
+                d="M867.995 763.291h-711.99c-27.921 0-52.353 24.434-52.353 52.353s24.434 52.353 52.353 52.353h711.99c27.921 0 52.353-24.434 52.353-52.353s-24.434-52.353-52.353-52.353z"
+                p-id="9456"></path>
+              <path
+                d="M156.005 260.709h711.99c27.921 0 52.353-24.434 52.353-52.353s-24.434-52.353-52.353-52.353h-711.99c-27.921 0-52.353 24.434-52.353 52.353s24.434 52.353 52.353 52.353z">
+              </path>
+            </svg>
+          </div>
+          <!-- <div class="check" :class="{ 'checked': item.answer.includes(checkIndex) }"
+            @click="checkClick(item.id, checkIndex)">
+            <svg v-if="item.answer.includes(checkIndex)" t="1773996159000" viewBox="0 0 1024 1024" version="1.1"
+              xmlns="http://www.w3.org/2000/svg" p-id="5894" width="200" height="200">
+              <path
+                d="M404.352 685.354667L789.632 213.333333 853.333333 267.52 409.941333 810.666667 170.666667 566.4l58.581333-59.818667z"
+                p-id="5895"></path>
+            </svg>
+          </div> -->
+          <el-input v-model="item.checkList[checkIndex]" :placeholder="lang.ssEnterOption"
+            @input="setTestJson()"></el-input>
+          <div class="btn">
+
+            <div @click="addCheck(item.id, checkIndex)">
+              <svg style="width: 1.1rem; height: 1.1rem;" viewBox="0 0 1024 1024" width="200" height="200">
+                <path
+                  d="M47.653 439.326c-24.501 0-44.368 19.881-44.368 44.4v56.548c0 24.492 19.862 44.4 44.368 44.4h928.694c24.501 0 44.368-19.881 44.368-44.4v-56.548c0-24.497-19.862-44.4-44.368-44.4H47.653z"
+                  p-id="11474"></path>
+                <path
+                  d="M586.326 47.653c0-24.501-19.881-44.368-44.4-44.368h-56.548c-24.492 0-44.4 19.862-44.4 44.368v928.694c0 24.501 19.881 44.368 44.4 44.368h56.548c24.497 0 44.4-19.862 44.4-44.368V47.653z">
+                </path>
+              </svg>
+            </div>
+
+            <div @click="delCheck(item.id, checkIndex)" v-if="item.checkList.length > 2">
+              <svg viewBox="0 0 1024 1024" width="200" height="200">
+                <path
+                  d="M632.117978 513.833356l361.805812 361.735298a85.462608 85.462608 0 1 1-121.001515 120.789974L511.116463 634.552816 146.913186 998.756094a86.026718 86.026718 0 0 1-121.706652-121.706652L389.480325 512.775651 27.674513 150.969839A85.392095 85.392095 0 0 1 148.393973 30.250379L510.199785 392.056191l366.671258-366.671258a86.026718 86.026718 0 0 1 121.706652 121.706652z">
+                </path>
+              </svg>
+            </div>
+          </div>
+        </div>
+        <div class="addCheck" @click="addCheck(item.id)">
+          <svg viewBox="0 0 1024 1024" version="1.1" p-id="2732" width="200" height="200">
+            <path
+              d="M925.696 384q19.456 0 37.376 7.68t30.72 20.48 20.48 30.72 7.68 37.376q0 20.48-7.68 37.888t-20.48 30.208-30.72 20.48-37.376 7.68l-287.744 0 0 287.744q0 20.48-7.68 37.888t-20.48 30.208-30.72 20.48-37.376 7.68q-20.48 0-37.888-7.68t-30.208-20.48-20.48-30.208-7.68-37.888l0-287.744-287.744 0q-20.48 0-37.888-7.68t-30.208-20.48-20.48-30.208-7.68-37.888q0-19.456 7.68-37.376t20.48-30.72 30.208-20.48 37.888-7.68l287.744 0 0-287.744q0-19.456 7.68-37.376t20.48-30.72 30.208-20.48 37.888-7.68q39.936 0 68.096 28.16t28.16 68.096l0 287.744 287.744 0z"
+              p-id="2733"></path>
+          </svg>
+          <span>{{ lang.ssOption }}</span>
+        </div>
+      </div>
+
+      <!-- 解释说明 -->
+      <!-- <div class="explanation">
+        <div class="e_header">
+          <span>{{ lang.ssExplanationTip }}</span>
+          <div v-show="false">
+            <svg t="1774233113566" viewBox="0 0 1027 1024" width="200" height="200">
+              <path
+                d="M511.979521 544.586217a54.525819 54.525819 0 0 1-23.359066-5.247791L31.038758 321.427143a54.397824 54.397824 0 0 1 0-98.236071L488.620455 5.279789c14.719411-7.039718 31.99872-7.039718 46.718131 0l457.581697 217.911283a54.397824 54.397824 0 0 1 0 98.236071l-457.581697 217.911283A54.525819 54.525819 0 0 1 511.979521 544.586217zM180.984761 272.341106L511.979521 429.966801l331.058757-157.625695L511.979521 114.587417 180.984761 272.341106z m354.417823 746.402144l457.517699-217.911283a54.397824 54.397824 0 1 0-46.718131-98.236071L511.979521 909.371625l-434.158634-206.775729a54.397824 54.397824 0 0 0-46.718131 98.236071l457.581697 217.911283a54.525819 54.525819 0 0 0 46.718131 0z m0-239.73441l457.517699-217.847286a54.397824 54.397824 0 1 0-46.718131-98.300068L511.979521 669.573217l-434.158634-206.711731a54.397824 54.397824 0 0 0-46.718131 98.300068l457.581697 217.847286a54.525819 54.525819 0 0 0 46.718131 0z"
+                p-id="9073"></path>
+            </svg>
+            <span>{{ lang.ssAIGenerate }}</span>
+          </div>
+        </div>
+        <el-input type="textarea" rows="3" style="font-size: 1.2rem;" resize="none" v-model="item.explanation"
+          :placeholder="lang.ssEnterExplanation" @input="setTestJson()"></el-input>
+      </div> -->
+    </div>
+
+
+    <!-- 添加题目 -->
+    <!-- <div class="addTest" @click="addTest()">
+      <svg viewBox="0 0 1024 1024" version="1.1" p-id="2732" width="200" height="200">
+        <path
+          d="M925.696 384q19.456 0 37.376 7.68t30.72 20.48 20.48 30.72 7.68 37.376q0 20.48-7.68 37.888t-20.48 30.208-30.72 20.48-37.376 7.68l-287.744 0 0 287.744q0 20.48-7.68 37.888t-20.48 30.208-30.72 20.48-37.376 7.68q-20.48 0-37.888-7.68t-30.208-20.48-20.48-30.208-7.68-37.888l0-287.744-287.744 0q-20.48 0-37.888-7.68t-30.208-20.48-20.48-30.208-7.68-37.888q0-19.456 7.68-37.376t20.48-30.72 30.208-20.48 37.888-7.68l287.744 0 0-287.744q0-19.456 7.68-37.376t20.48-30.72 30.208-20.48 37.888-7.68q39.936 0 68.096 28.16t28.16 68.096l0 287.744 287.744 0z"
+          p-id="2733"></path>
+      </svg>
+      <span>{{ lang.ssTopic }}</span>
+    </div> -->
+
+  </div>
+</template>
+
+<script>
+import { v4 as uuidv4 } from 'uuid';
+import { uploadOneFile } from '@/components/tools/uploadFile'
+export default {
+  emits: ['setTestJson', 'save'],
+  props: {
+    workData: {
+      type: Object,
+      default: () => { }
+    }
+  },
+  data() {
+    return {
+      jsonData: {},
+      dragItem: null,
+      delJson:null,
+    }
+  },
+  watch: {
+    workData: {
+      handler(newVal, oldVal) {
+        if (newVal.type == 78) {
+          if (JSON.stringify(newVal.json) != JSON.stringify(this.jsonData)) {
+            let editJson = JSON.parse(JSON.stringify(newVal.json))
+            editJson.testJson.forEach(item => {
+              if(typeof item.answer == 'string' || typeof item.answer == 'number'){
+                item.answer = [item.answer];
+              }
+            })
+            this.jsonData = editJson;
+            if(this.jsonData.testJson.length == 0){
+              this.addTest();
+            }
+          }
+        }
+      },
+      deep: true,
+      immediate: true
+    }
+  },
+  methods: {
+    // 更新题目
+    setTestJson() {
+      // console.log(this.jsonData)
+      this.jsonData.testCount = this.jsonData.testJson.length;
+      this.$emit('setTestJson', this.jsonData);
+    },
+    // 添加题目
+    addTest() {
+      this.jsonData.testJson.push({
+        id: uuidv4(),
+        type: "2",
+        teststitle: "",
+        checkList: ['', '', ''],
+        timuList: [],
+        answer: [],
+        userAnswer: [],
+        explanation: '',
+      });
+      this.setTestJson();
+    },
+    //修改标题
+    setTestTitle(id, target) {
+      // let title = target.innerText;
+      // let test = this.jsonData.testJson.find(item => item.id == id);
+      // if (test) {
+      //   test.teststitle = title;
+      // }
+      this.setTestJson();
+    },
+    // 点击复选框
+    checkClick(id, index) {
+      let test = this.jsonData.testJson.find(item => item.id == id);
+      if (test) {
+        if (test.answer.includes(index)) {
+          test.answer.splice(test.answer.indexOf(index), 1);
+        } else {
+          test.answer.push(index);
+        }
+      }
+      this.setTestJson();
+    },
+    // 删除题目
+    deleteTest(id) {
+      this.delJson = JSON.stringify(this.jsonData.testJson);
+      let index = this.jsonData.testJson.findIndex(item => item.id == id);
+      this.jsonData.testJson.splice(index, 1);
+      this.setTestJson();
+    },
+    // 添加选项
+    addCheck(id, checkIndex = null) {
+      let index = this.jsonData.testJson.findIndex(item => item.id == id);
+      let test = this.jsonData.testJson[index];
+      if (!checkIndex) {
+        checkIndex = test.checkList.length;
+      }else{
+        checkIndex = checkIndex + 1;
+      }
+      test.checkList.splice(checkIndex, 0, '');
+      this.setTestJson();
+    },
+    // 删除选项
+    delCheck(id, index) {
+      let test = this.jsonData.testJson.find(item => item.id == id);
+      if (test) {
+        if (test.checkList.length == 1) {
+          this.$message.error("至少保留一个选项");
+          return;
+        }
+        test.checkList.splice(index, 1);
+      }
+      this.setTestJson();
+    },
+    // 上传图片
+    uploadImage(id) {
+      const input = document.createElement('input');
+      input.type = 'file';
+      input.accept = 'image/*';
+      input.click();
+      input.onchange = (e) => {
+        if (e.target.files[0]) {
+          uploadOneFile(e.target.files[0]).then(res => {
+            res.src = res.url
+            this.jsonData.testJson.find(item => item.id == id).timuList = [res];
+            this.setTestJson();
+          })
+        }
+      }
+    },
+    // 复制题目
+    copyTest(id) {
+      let test = this.jsonData.testJson.find(item => item.id == id);
+      if (test) {
+        test = JSON.parse(JSON.stringify(test));
+        test.id = uuidv4();
+        this.jsonData.testJson.push(test);
+        this.setTestJson();
+      }
+    },
+    // 删除图片
+    delImage(id, index) {
+      let test = this.jsonData.testJson.find(item => item.id == id);
+      if (test) {
+        test.timuList.splice(index, 1);
+      }
+      this.setTestJson();
+    },
+    // 移动题目
+    changeIndex(item, index, direction) {
+      let test = this.jsonData.testJson.find(i => i.id == item.id);
+      if (test) {
+        if (direction == 'up') {
+          if (index == 0) {
+            //this.$message.info("已到顶部");
+            return;
+          }
+          this.jsonData.testJson.splice(index, 1);
+          this.jsonData.testJson.splice(index - 1, 0, JSON.parse(JSON.stringify(test)));
+        } else if (direction == 'down') {
+          if (index == this.jsonData.testJson.length - 1) {
+            //this.$message.info("已到底部");
+            return;
+          }
+          this.jsonData.testJson.splice(index, 1);
+          this.jsonData.testJson.splice(index + 1, 0, JSON.parse(JSON.stringify(test)));
+        }
+        this.setTestJson();
+      }
+    },
+    // 拖拽相关方法
+    dragStart(e, item, checkIndex) {
+      if (!e.target.closest('.drag')) {
+        e.preventDefault();
+        return;
+      }
+      console.log('e',e)
+      this.dragItem = { item, checkIndex };
+      const checkItem = e.target.closest('.checkItem');
+      if (checkItem) checkItem.classList.add('dragging');
+      e.dataTransfer.effectAllowed = 'move';
+    },
+    dragOver(e, item, checkIndex) {
+      e.preventDefault();
+      e.dataTransfer.dropEffect = 'move';
+
+      document.querySelectorAll('.checkItem').forEach(el => {
+        el.style.borderTop = '';
+        el.style.borderBottom = '';
+      });
+
+      const checkItems = e.target.closest('.checkItem');
+      if (checkItems && this.dragItem && this.dragItem.checkIndex !== checkIndex) {
+        if (this.dragItem.checkIndex < checkIndex) {
+          checkItems.style.borderBottom = '2px solid #ffa502';
+        } else {
+          checkItems.style.borderTop = '2px solid #ffa502';
+        }
+      }
+    },
+    drop(e, targetItem, targetCheckIndex) {
+      e.preventDefault();
+      document.querySelectorAll('.checkItem').forEach(el => {
+        el.style.borderTop = '';
+        el.style.borderBottom = '';
+        el.classList.remove('dragging');
+      });
+      if (!this.dragItem) return;
+
+      const { item: sourceItem, checkIndex: sourceCheckIndex } = this.dragItem;
+
+      if (sourceItem.id !== targetItem.id) return;
+      if (sourceCheckIndex === targetCheckIndex) return;
+
+      const test = this.jsonData.testJson.find(i => i.id === sourceItem.id);
+      if (test) {
+        let newAnswerIndex;
+
+        if (sourceCheckIndex < targetCheckIndex) {
+          newAnswerIndex = targetCheckIndex - 1;
+        } else {
+          newAnswerIndex = targetCheckIndex;
+        }
+
+        const item = test.checkList[sourceCheckIndex];
+        test.checkList.splice(sourceCheckIndex, 1);
+        test.checkList.splice(targetCheckIndex, 0, item);
+
+        if (test.answer.includes(sourceCheckIndex)) {
+          const answerIndex = test.answer.indexOf(sourceCheckIndex);
+          test.answer.splice(answerIndex, 1);
+          test.answer.push(newAnswerIndex);
+          test.answer.sort((a, b) => a - b);
+        } else {
+          test.answer = test.answer.map(idx => {
+            if (sourceCheckIndex < targetCheckIndex) {
+              return idx > sourceCheckIndex && idx <= targetCheckIndex ? idx - 1 : idx;
+            } else {
+              return idx >= targetCheckIndex && idx < sourceCheckIndex ? idx + 1 : idx;
+            }
+          });
+        }
+
+        this.setTestJson();
+      }
+      this.dragItem = null;
+    },
+    dragEnd(e) {
+      const checkItem = e.target.closest('.checkItem');
+      if (checkItem) checkItem.classList.remove('dragging');
+      document.querySelectorAll('.checkItem').forEach(el => {
+        el.style.borderTop = '';
+        el.style.borderBottom = '';
+      });
+      this.dragItem = null;
+    },
+    // ctrl+z 撤销删除
+    undoDelete() {
+      if (this.delJson) {
+        this.jsonData.testJson = JSON.parse(this.delJson);
+        this.setTestJson();
+        this.delJson = null;
+      }
+    },
+  },
+  mounted() {
+    window.addEventListener('keydown', (e)=>{
+      if (e.ctrlKey && e.key === 'z') {
+        this.undoDelete();
+      }
+    });
+  },
+}
+</script>
+
+<style scoped>
+.setChoiceQuestion {
+  width: 100%;
+  height: auto;
+  background: #fff;
+  display: flex;
+  flex-direction: column;
+  overflow: auto;
+  padding: 4rem;
+  box-sizing: border-box;
+  gap: 1rem;
+}
+
+.addTest {
+  border-radius: 5px;
+  border: 1px dashed #d1d5db;
+  padding: .5rem 1rem;
+  height: fit-content;
+  width: fit-content;
+  display: flex;
+  align-items: center;
+  gap: .5rem;
+  cursor: pointer;
+}
+
+.addTest>svg {
+  width: 1.2rem;
+  height: 1.2rem;
+  fill: #6E7583;
+}
+
+.addTest>span {
+  font-weight: bold;
+  font-size: 1.4rem;
+  color: #6b7280;
+}
+
+.testItem {
+  width: 100%;
+  height: auto;
+  display: flex;
+  align-items: center;
+  gap: 1rem;
+  flex-direction: column;
+}
+
+.head_title {
+  font-size: 1.4rem;
+  font-weight: 600;
+  color: #ff9300;
+}
+
+.ti_title {
+  width: 100%;
+  height: fit-content;
+  padding-bottom: 2rem;
+  min-height: 4rem;
+  background: #FAFBFC;
+  border-radius: 8px;
+  border: 1px solid #E5E7EB;
+  position: relative;
+}
+
+.ti_t_input {
+  width: 100%;
+  height: 100%;
+  padding: 1rem;
+  box-sizing: border-box;
+  border: none;
+  outline: none;
+  background: none;
+  font-size: 1.2rem;
+  resize: none;
+  /* max-height: 10rem; */
+  overflow: auto;
+  /* padding-right: 2rem; */
+}
+
+.ti_t_input /deep/ .el-textarea__inner {
+  padding: 0;
+  width: 100%;
+  height: 100%;
+  box-sizing: border-box;
+  border: none;
+  outline: none;
+  background: none;
+  font-size: 1.2rem;
+  resize: none;
+  /* max-height: 10rem; */
+  overflow: auto;
+}
+
+.uploadImage {
+  position: absolute;
+  bottom: 0.5rem;
+  right: 0.5rem;
+  background: #fff;
+  border-radius: .5rem;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border: 1px solid #E5E7EB;
+  cursor: pointer;
+  padding: .5rem;
+}
+
+.uploadImage>svg {
+  width: 1.4rem;
+  height: 1.4rem;
+}
+
+.checkList {
+  width: 100%;
+  height: auto;
+  display: flex;
+  flex-direction: column;
+  gap: 1rem;
+  /* padding-left: 4rem; */
+}
+
+.checkItem {
+  width: 100%;
+  height: auto;
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+  gap: .5rem;
+  padding: .5rem .7rem;
+  transition: .2s;
+}
+
+.checkItem:hover {
+  background: #F9FAFB;
+}
+
+.drag {
+  width: 1.5rem;
+  height: 1.5rem;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  cursor: move;
+  margin-right: 1rem;
+  opacity: 0;
+  transition: .2s;
+}
+
+.checkItem:hover > .drag {
+  opacity: 1;
+}
+
+.checkItem[draggable="true"] {
+  cursor: move;
+}
+
+.checkItem.dragging {
+  opacity: 0.5;
+  background: #FEF3C7;
+}
+
+.drag>svg {
+  width: 100%;
+  height: 100%;
+  fill: #D1D5DC;
+}
+
+
+.check {
+  width: 1.5rem;
+  height: 1.5rem;
+  border: solid 1px #D1D5DB;
+  border-radius: .25rem;
+  cursor: pointer;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+}
+
+.checked {
+  background: #FF9300;
+}
+
+.checked>svg {
+  width: 1.1rem;
+  height: 1.1rem;
+  fill: #fff;
+}
+
+.checkItem>.el-input {
+  width: calc(100% - 10rem);
+  font-size: 1.2rem;
+}
+
+.checkItem>.el-input /deep/ .el-input__inner:focus {
+  border-color: #FF935A !important;
+}
+
+.addCheck {
+  border-radius: 5px;
+  border: 1px dashed #d1d5db;
+  padding: .3rem .8rem;
+  height: fit-content;
+  width: fit-content;
+  display: flex;
+  align-items: center;
+  gap: .5rem;
+  cursor: pointer;
+  margin-left: 3.7rem;
+}
+
+.addCheck>svg {
+  width: .9rem;
+  height: .9rem;
+  fill: #6E7583;
+}
+
+.addCheck>span {
+  font-weight: bold;
+  font-size: 1.2rem;
+  color: #6b7280;
+}
+
+.btn {
+  display: flex;
+  align-items: center;
+  gap: 1em;
+  opacity: 0;
+  margin-left: 1rem;
+}
+
+.checkItem:hover>.btn {
+  opacity: 1;
+}
+
+
+
+.btn>div {
+  width: 1.4rem;
+  height: 1.4rem;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  /* background: #F9FAFB; */
+  border-radius: .4px;
+  cursor: pointer;
+}
+
+.btn>div>svg {
+  width: 1rem;
+  height: 1rem;
+  fill: #9DA3AF;
+}
+
+.explanation {
+  width: 100%;
+  height: auto;
+  padding: 1rem;
+  background: #FAFBFC;
+  border-radius: 5px;
+  display: flex;
+  flex-direction: column;
+  gap: 1rem;
+  border-radius: .8rem;
+}
+
+.explanation /deep/ .el-textarea__inner:focus {
+  border-color: #FF935A !important;
+}
+
+.e_header {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+
+.e_header>span {
+  color: #6b7280;
+  font-size: 1.2rem;
+  font-weight: 500;
+}
+
+.e_header>div {
+  display: flex;
+  align-items: center;
+  gap: .5rem;
+  background: #ff9300;
+  color: #fff;
+  padding: .3rem .8rem;
+  font-size: 1.2rem;
+  font-weight: 500;
+  border-radius: .5rem;
+  cursor: pointer;
+}
+
+.e_header>div>svg {
+  width: 1.2rem;
+  height: 1.2rem;
+  fill: #fff;
+}
+
+.imageList {
+  width: 100%;
+  height: auto;
+  display: flex;
+  flex-wrap: wrap;
+  gap: 1rem;
+}
+
+.imageList>div {
+  width: 100px;
+  height: 100px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  /* overflow: hidden; */
+  border-radius: .5rem;
+  position: relative;
+
+}
+
+.imageList>div:hover>svg {
+  display: flex;
+}
+
+.imageList>div>svg {
+  width: 1.2rem;
+  height: 1.2rem;
+  position: absolute;
+  top: -.4rem;
+  right: -.4rem;
+  font-weight: 500;
+  border-radius: .5rem;
+  cursor: pointer;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  display: none;
+}
+</style>

+ 472 - 0
src/components/pages/workPage/components/voteQuestion.vue

@@ -0,0 +1,472 @@
+<template>
+  <div class="choiceQuestion">
+    <div class="cq_title" v-if="work.testJson[showIndex]">
+      <span>{{ work.testJson[showIndex].teststitle }}</span>
+
+      <!-- <div class="cq_changeBtnArea" v-if="work.testJson.length>1">
+        <span :class="{cq_cba_disabled: showIndex == 0}" @click="changeQuestion('prev')">{{ lang.ssPrevQ }}</span>
+        <span :class="{cq_cba_disabled: showIndex == work.testJson.length - 1}" @click="changeQuestion('next')">{{ lang.ssNextQ }}</span>
+      </div> -->
+    </div>
+
+
+    <img class="cq_image"
+      v-if="work.testJson[showIndex] && work.testJson[showIndex].timuList && work.testJson[showIndex].timuList.length > 0"
+      :src="work.testJson[showIndex].timuList[0].src"
+      @click="$hevueImgPreview(work.testJson[showIndex].timuList[0].src)">
+
+    <div class="cq_type" v-if="work.testJson[showIndex]">
+      {{ lang.ssChoice }}
+      <!-- {{ work.testJson[showIndex].type == '1' ? lang.SingleChoice : lang.MultipleChoice }} -->
+      <!-- <span v-if="work.testJson.length>1">({{showIndex+1}}/{{work.testJson.length}})</span> -->
+
+    </div>
+    <div class="cq_checkListArea">
+      <div class="cq_ca_type1" v-if="
+        work.testJson[showIndex] && work.testJson[showIndex].showType == '1'
+      ">
+        <div class="cq_ca_t1_item" :class="{
+          cq_ca_t1_item_active:
+            work.testJson[showIndex].type == '1'
+              ? work.testJson[showIndex].userAnswer === index
+              : work.testJson[showIndex].userAnswer.includes(index)
+        }" v-for="(item, index) in work.testJson[showIndex].checkList" :key="showIndex + '_' + index"
+          @click="choiceAnswer(index)">
+          <div>
+            <span>{{ options[index] }}</span>
+          </div>
+          <img v-if="item.imgType && item.imgType == '1'" :src="item.src" @click="$hevueImgPreview(item.src)">
+          <span v-else>{{ item }}</span>
+        </div>
+      </div>
+
+      <div class="cq_ca_type2" v-if="
+        work.testJson[showIndex] && work.testJson[showIndex].showType == '2'
+      ">
+        <div class="cq_ca_t2_item" :class="{
+          cq_ca_t2_item_active:
+            work.testJson[showIndex].type == '1'
+              ? work.testJson[showIndex].userAnswer === index
+              : work.testJson[showIndex].userAnswer.includes(index)
+        }" v-for="(item, index) in work.testJson[showIndex].checkList" :key="showIndex + '_' + index"
+          @click="choiceAnswer(index)">
+          <div>
+            <span>{{ options[index] }}</span>
+          </div>
+          <img v-if="item.imgType && item.imgType == '1'" :src="item.src" @click="$hevueImgPreview(item.src)">
+          <span v-else>{{ item }}</span>
+        </div>
+      </div>
+    </div>
+
+    <div class="cq_changeBtn" v-if="work.testJson.length > 1">
+      <div :class="{ cq_cb_disabled: showIndex == 0 }" @click="changeQuestion('prev')">
+        <svg style="transform: rotate(-90deg);" viewBox="0 0 1024 1024" version="1.1" width="200" height="200">
+          <path
+            d="M512 330.666667c14.933333 0 29.866667 4.266667 40.533333 14.933333l277.33333399 234.666667c27.733333 23.466667 29.866667 64 8.53333301 89.6-23.466667 27.733333-64 29.866667-89.6 8.53333299L512 477.866667l-236.8 200.53333299c-27.733333 23.466667-68.266667 19.19999999-89.6-8.53333299-23.466667-27.733333-19.19999999-68.266667 8.53333301-89.6l277.33333399-234.666667c10.666667-10.666667 25.6-14.933333 40.533333-14.933333z"
+            fill=""></path>
+        </svg>
+      </div>
+      <span>{{ showIndex + 1 }}/{{ work.testJson.length }}</span>
+      <div :class="{ cq_cb_disabled: showIndex == work.testJson.length - 1 }" @click="changeQuestion('next')">
+        <svg style="transform: rotate(90deg);" viewBox="0 0 1024 1024" version="1.1" width="200" height="200">
+          <path
+            d="M512 330.666667c14.933333 0 29.866667 4.266667 40.533333 14.933333l277.33333399 234.666667c27.733333 23.466667 29.866667 64 8.53333301 89.6-23.466667 27.733333-64 29.866667-89.6 8.53333299L512 477.866667l-236.8 200.53333299c-27.733333 23.466667-68.266667 19.19999999-89.6-8.53333299-23.466667-27.733333-19.19999999-68.266667 8.53333301-89.6l277.33333399-234.666667c10.666667-10.666667 25.6-14.933333 40.533333-14.933333z"
+            fill=""></path>
+        </svg>
+      </div>
+      <!-- <span :class="{cq_cba_disabled: showIndex == 0}" @click="changeQuestion('prev')">{{ lang.ssPrevQ }}</span>
+      <span :class="{cq_cba_disabled: showIndex == work.testJson.length - 1}" @click="changeQuestion('next')">{{ lang.ssNextQ }}</span> -->
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    workData: {
+      type: Object,
+      default: () => {
+        return {};
+      }
+    }
+  },
+
+  data() {
+    return {
+      work: {
+        testJson: []
+      },
+      showIndex: 0,
+      options: [
+        "A",
+        "B",
+        "C",
+        "D",
+        "E",
+        "F",
+        "G",
+        "H",
+        "I",
+        "J",
+        "K",
+        "L",
+        "M",
+        "N",
+        "O",
+        "P",
+        "Q",
+        "R",
+        "S",
+        "T",
+        "U",
+        "V",
+        "W",
+        "X",
+        "Y",
+        "Z"
+      ]
+    };
+  },
+  watch: {
+    work: {
+      handler(newValue) {
+        if (JSON.stringify(newValue) != JSON.stringify(this.workData.json)) {
+          this.changeWorkData(newValue);
+        }
+      },
+      deep: true
+    },
+    workData: {
+      handler(newValue) {
+        this.work = JSON.parse(JSON.stringify(newValue.json));
+        this.work.testJson.forEach(i => {
+          let maxLength = i.checkList.reduce((pre, cur) => {
+            if (pre < cur.length) return cur.length;
+            return pre;
+          }, 0);
+
+          if (maxLength <= 6 && i.checkList.length <= 4) {
+            i.showType = "1";
+          } else {
+            i.showType = "2";
+          }
+        });
+      },
+      deep: true,
+      immediate: true
+    }
+  },
+  methods: {
+    changeWorkData(newValue) {
+      this.$emit("changeWorkData", JSON.stringify(newValue));
+    },
+    //选择题目
+    choiceAnswer(index) {
+      if (this.work.testJson[this.showIndex].type == "1") {
+        this.work.testJson[this.showIndex].userAnswer = index;
+      } else {
+        if (typeof this.work.testJson[this.showIndex].userAnswer !== 'object') this.work.testJson[this.showIndex].userAnswer = [];
+        if (this.work.testJson[this.showIndex].userAnswer.includes(index)) {
+          this.work.testJson[this.showIndex].userAnswer = this.work.testJson[
+            this.showIndex
+          ].userAnswer.filter(i => i != index);
+        } else {
+          this.work.testJson[this.showIndex].userAnswer.push(index);
+        }
+      }
+    },
+    //切换题目
+    changeQuestion(type) {
+      if (type == 'prev') {
+        if (this.showIndex == 0) return;
+        this.showIndex--;
+      } else {
+        if (this.showIndex == this.work.testJson.length - 1) return;
+        this.showIndex++;
+      }
+    }
+
+  },
+  mounted() {
+
+  }
+};
+</script>
+
+<style scoped>
+.choiceQuestion {
+  width: 100%;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  /* justify-content: center; */
+  flex-direction: column;
+  box-sizing: border-box;
+  padding: 70px 5%;
+  overflow: auto;
+  position: relative;
+}
+
+.cq_title {
+  font-size: 2rem;
+  font-weight: bold;
+  text-align: center;
+  max-width: 95%;
+  position: relative;
+}
+
+.cq_image {
+  width: auto;
+  height: 300px;
+  object-fit: cover;
+  margin: 20px 0;
+  cursor: pointer;
+}
+
+.cq_changeBtnArea {
+  position: absolute;
+  top: 0px;
+  right: -200px;
+  width: 200px;
+  height: auto;
+  display: flex;
+  justify-content: flex-end;
+  align-items: flex-start;
+}
+
+.cq_changeBtnArea>span {
+  padding: .5rem 1rem;
+  background: #3681FC;
+  border-radius: 8px;
+  color: #fff;
+  font-size: 1rem;
+  text-align: center;
+  font-weight: 600;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+  margin-left: 20px;
+  transition: .2s;
+  white-space: nowrap;
+}
+
+.cq_changeBtnArea>span:hover {
+  background: #5893FF;
+}
+
+.cq_cba_disabled {
+  background: #D9D9D9 !important;
+  cursor: not-allowed !important;
+}
+
+.cq_type {
+  margin: 20px 0 40px 0;
+  font-size: 1rem;
+  color: #808080;
+}
+
+.cq_checkListArea {
+  width: 100%;
+  height: auto;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.cq_ca_type1 {
+  width: auto;
+  height: auto;
+  display: grid;
+  grid-template-columns: repeat(2, 1fr);
+  grid-template-rows: repeat(2, 1fr);
+  gap: 30px;
+  /* 可根据需要调整间距 */
+  justify-content: center;
+  align-items: center;
+  margin: 40px 20px;
+}
+
+.cq_ca_t1_item {
+  width: 100%;
+  max-width: 400px;
+  min-width: 300px;
+  height: 90px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+
+  background: #fff;
+  box-shadow: 2px 4px 20px 0px rgba(0, 0, 0, 0.2);
+  border-radius: 12px;
+  margin: auto;
+  cursor: pointer;
+  transition: 0.3s;
+  font-size: 1rem;
+  color: #000;
+  user-select: none;
+  /* 不可选中 */
+  /* box-sizing: border-box;
+  padding: 20px 40px; */
+}
+
+.cq_ca_t1_item_active {
+  box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
+}
+
+.cq_ca_t1_item>div {
+  color: #fff;
+  position: relative;
+  margin-right: 20px;
+}
+
+.cq_ca_t1_item>img {
+  width: 60px;
+  height: 60px;
+  cursor: pointer;
+  object-fit: cover;
+}
+
+.cq_ca_t1_item>div>span {
+  position: relative;
+  z-index: 2;
+  color: #fff;
+  font-size: 1rem;
+}
+
+.cq_ca_t1_item>div::after {
+  content: "";
+  width: 30px;
+  height: 30px;
+  background: rgba(252, 207, 0, 1);
+  border-radius: 50%;
+  position: absolute;
+  left: 50%;
+  top: 50%;
+  transform: translate(-50%, -50%);
+  z-index: 1;
+  /* after在内容下方 */
+  pointer-events: none;
+}
+
+.cq_ca_type2 {
+  width: 100%;
+  height: auto;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: column;
+}
+
+.cq_ca_t2_item {
+  width: 100%;
+  height: auto;
+  min-height: 55px;
+  display: flex;
+  align-items: center;
+  justify-content: flex-start;
+  box-sizing: border-box;
+  padding: 20px;
+  margin-bottom: 20px;
+  background: #fff;
+  box-shadow: 2px 4px 20px 0px rgba(0, 0, 0, 0.2);
+  border-radius: 12px;
+  cursor: pointer;
+  transition: 0.3s;
+  font-size: 1rem;
+  color: #000;
+  user-select: none;
+  overflow: auto;
+  overflow-y: hidden;
+}
+
+.cq_ca_t2_item>div {
+  color: #fff;
+  position: relative;
+  margin-right: 20px;
+}
+
+.cq_ca_t2_item>span {
+  display: flex;
+  align-items: center;
+}
+
+.cq_ca_t2_item>img {
+  width: 70px;
+  height: 70px;
+  cursor: pointer;
+  object-fit: cover;
+}
+
+
+.cq_ca_t2_item_active {
+  box-shadow: 4px 4px 14px 0px rgba(252, 207, 0, 0.5);
+}
+
+.cq_ca_t2_item>div {
+  color: #fff;
+  position: relative;
+  margin-right: 20px;
+}
+
+.cq_ca_t2_item>div>span {
+  position: relative;
+  z-index: 2;
+  color: #fff;
+  font-size: 1rem;
+}
+
+.cq_ca_t2_item>div::after {
+  content: "";
+  width: 30px;
+  height: 30px;
+  background: rgba(252, 207, 0, 1);
+  border-radius: 50%;
+  position: absolute;
+  left: 50%;
+  top: 50%;
+  transform: translate(-50%, -50%);
+  z-index: 1;
+  /* after在内容下方 */
+  pointer-events: none;
+}
+
+.cq_changeBtn {
+  display: flex;
+  align-items: center;
+  gap: 1.5rem;
+  margin-top: 2rem;
+}
+
+.cq_changeBtn>div {
+  padding: .6rem;
+  border-radius: .5rem;
+  border: solid 2px #F6C82B;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  cursor: pointer;
+
+}
+
+.cq_changeBtn>span {
+  font-weight: 500;
+}
+
+.cq_changeBtn>div>svg {
+  fill: #F6C82D;
+  width: 1rem;
+  height: 1rem;
+}
+
+.cq_cb_disabled {
+  cursor: not-allowed !important;
+  border-color: #FEF8E9 !important;
+}
+
+.cq_cb_disabled>svg {
+  fill: #A3A3A3 !important;
+}
+</style>

+ 31 - 3
src/components/pages/workPage/index_new.vue

@@ -4,6 +4,8 @@
       @changeWorkData="changeWorkData" />
       @changeWorkData="changeWorkData" />
     <choiceQuestion ref="choiceQuestionRef" v-if="workData.type === '45'" :workData="workData"
     <choiceQuestion ref="choiceQuestionRef" v-if="workData.type === '45'" :workData="workData"
       @changeWorkData="changeWorkData" />
       @changeWorkData="changeWorkData" />
+    <voteQuestion ref="voteQuestionRef" v-if="workData.type === '78'" :workData="workData"
+      @changeWorkData="changeWorkData" />
   </div>
   </div>
 </template>
 </template>
 
 
@@ -12,10 +14,12 @@ import katex from "katex";
 import "katex/dist/katex.min.css";
 import "katex/dist/katex.min.css";
 import questionsAndAnswers from "./components/questionsAndAnswers.vue";
 import questionsAndAnswers from "./components/questionsAndAnswers.vue";
 import choiceQuestion from "./components/choiceQuestion.vue";
 import choiceQuestion from "./components/choiceQuestion.vue";
+import voteQuestion from "./components/voteQuestion.vue";
 export default {
 export default {
   components: {
   components: {
     questionsAndAnswers,
     questionsAndAnswers,
-    choiceQuestion
+    choiceQuestion,
+    voteQuestion
   },
   },
   data() {
   data() {
     return {
     return {
@@ -244,9 +248,21 @@ export default {
             content: encodeURIComponent(JSON.stringify(this.workData.json)),
             content: encodeURIComponent(JSON.stringify(this.workData.json)),
             type: "8"
             type: "8"
           });
           });
+        } else if (this.workData.type == "78") {
+          //投票题
+          params.push({
+            uid: this.userid,
+            cid: this.courseid,
+            stage: 0,
+            task: task,
+            tool: 0,
+            atool: "78",
+            content: encodeURIComponent(JSON.stringify(this.workData.json)),
+            type: "22"
+          });
         }
         }
         if (
         if (
-          ["3", "8"].includes(params[0].type) &&
+          ["3", "8", "22"].includes(params[0].type) &&
           params[0].uid &&
           params[0].uid &&
           params[0].cid
           params[0].cid
         ) {
         ) {
@@ -313,7 +329,7 @@ export default {
             this.loading = false;
             this.loading = false;
             if (_data.length) {
             if (_data.length) {
               _data = _data[0];
               _data = _data[0];
-              if (["15", "45"].includes(_data.atool)) {
+              if (["15", "45", "78"].includes(_data.atool)) {
                 let _work = JSON.parse(decodeURIComponent(_data.content));
                 let _work = JSON.parse(decodeURIComponent(_data.content));
                 this.studentWork = _work;
                 this.studentWork = _work;
                 this.studentWorkToWorkData();
                 this.studentWorkToWorkData();
@@ -339,6 +355,18 @@ export default {
           this.workData.json.fileList = _work.fileList;
           this.workData.json.fileList = _work.fileList;
         } else if (this.workData.type == "45") {
         } else if (this.workData.type == "45") {
 
 
+          this.workData.json.testJson.forEach((item, index) => {
+            if (
+              item.type == _work.testJson[index].type &&
+              item.teststitle == _work.testJson[index].teststitle &&
+              JSON.stringify(item.checkList) ==
+              JSON.stringify(_work.testJson[index].checkList)
+            ) {
+              this.workData.json.testJson[index].userAnswer =
+                _work.testJson[index].userAnswer;
+            }
+          });
+        } else if (this.workData.type == "78") {
           this.workData.json.testJson.forEach((item, index) => {
           this.workData.json.testJson.forEach((item, index) => {
             if (
             if (
               item.type == _work.testJson[index].type &&
               item.type == _work.testJson[index].type &&

+ 12 - 1
src/components/pages/workPage/setIndex.vue

@@ -3,12 +3,14 @@
     <!-- 选择题设置 -->
     <!-- 选择题设置 -->
     <setChoiceQuestion :workData="workData" v-if="workData.type == 45" @setTestJson="setTestJson" @save="saveTest"/>
     <setChoiceQuestion :workData="workData" v-if="workData.type == 45" @setTestJson="setTestJson" @save="saveTest"/>
     <setQuestionsAndAnswers :workData="workData" v-if="workData.type == 15" @setTestJson="setTestJson" @save="saveTest"/>
     <setQuestionsAndAnswers :workData="workData" v-if="workData.type == 15" @setTestJson="setTestJson" @save="saveTest"/>
+    <setVoteQuestion :workData="workData" v-if="workData.type == 78" @setTestJson="setTestJson" @save="saveTest"/>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import setChoiceQuestion from './components/setChoiceQuestion.vue'
 import setChoiceQuestion from './components/setChoiceQuestion.vue'
 import setQuestionsAndAnswers from './components/setQuestionsAndAnswers.vue'
 import setQuestionsAndAnswers from './components/setQuestionsAndAnswers.vue'
+import setVoteQuestion from './components/setVoteQuestion.vue'
 
 
 function debounce(func, wait) {
 function debounce(func, wait) {
   let timeout;
   let timeout;
@@ -23,7 +25,8 @@ function debounce(func, wait) {
 export default {
 export default {
   components: {
   components: {
     setChoiceQuestion,
     setChoiceQuestion,
-    setQuestionsAndAnswers
+    setQuestionsAndAnswers,
+    setVoteQuestion
   },
   },
   data() {
   data() {
     return {
     return {
@@ -67,6 +70,14 @@ export default {
                   item.userAnswer = "";
                   item.userAnswer = "";
                 }
                 }
               });
               });
+            } else if (_data.type == 78) {
+              _data.json.testJson.forEach(item => {
+                // if (item.type == "2") {
+                item.userAnswer = [];
+                // } else if (item.type == "1") {
+                //   item.userAnswer = "";
+                // }
+              });
             }
             }
             this.type = _data.type;
             this.type = _data.type;
 
 

+ 2 - 1
src/lang/cn.json

@@ -2048,5 +2048,6 @@
   "ssSelectedApp":"已选择 * 个应用",
   "ssSelectedApp":"已选择 * 个应用",
   "ssSyncImportClassInfo":"提示: 如需同步导入班级信息,请于此处下载导入模板,并于【班级】列准确输入年级+班级名称作为学生班级(兴趣班不支持导入学生)。",
   "ssSyncImportClassInfo":"提示: 如需同步导入班级信息,请于此处下载导入模板,并于【班级】列准确输入年级+班级名称作为学生班级(兴趣班不支持导入学生)。",
   "ssNoSettingAnswer":"未设置正确答案",
   "ssNoSettingAnswer":"未设置正确答案",
-  "allGrades": "全部年级"
+  "allGrades": "全部年级",
+  "ssVoteTopic": "投票主题"
 }
 }

+ 2 - 1
src/lang/en.json

@@ -2047,5 +2047,6 @@
   "ssSelectedApp":"Selected * apps",
   "ssSelectedApp":"Selected * apps",
   "ssNoSettingAnswer":"No correct answer set",
   "ssNoSettingAnswer":"No correct answer set",
   "ssSyncImportClassInfo":"Tip: If you need to synchronize import class information, please download the import template here, and accurately enter the grade + class name as the student class in the [Class] column (interest classes do not support importing students).",
   "ssSyncImportClassInfo":"Tip: If you need to synchronize import class information, please download the import template here, and accurately enter the grade + class name as the student class in the [Class] column (interest classes do not support importing students).",
-  "allGrades": "All Grades"
+  "allGrades": "All Grades",
+  "ssVoteTopic": "Voting Theme"
 }
 }

+ 2 - 1
src/lang/hk.json

@@ -2048,5 +2048,6 @@
   "ssCocoNoteUpdateTips":"協同建構不支持修改基本信息,只支持加入分組。",
   "ssCocoNoteUpdateTips":"協同建構不支持修改基本信息,只支持加入分組。",
   "ssNoSettingAnswer":"未設置正確答案",
   "ssNoSettingAnswer":"未設置正確答案",
   "ssSyncImportClassInfo":"提示: 如需同步導入班級信息,請於此處下載導入模板,並於【班級】列準確輸入年級+班級名稱作為學生班級(興趣班不支持導入學生)。",
   "ssSyncImportClassInfo":"提示: 如需同步導入班級信息,請於此處下載導入模板,並於【班級】列準確輸入年級+班級名稱作為學生班級(興趣班不支持導入學生)。",
-  "allGrades": "全部年級"
+  "allGrades": "全部年級",
+  "ssVoteTopic": "投票主題"
 }
 }