Browse Source

问卷调查功能

zengyicheng 3 years ago
parent
commit
d96aa46edc
2 changed files with 436 additions and 81 deletions
  1. 174 42
      src/components/pages/addCourse.vue
  2. 262 39
      src/components/pages/worksDetail.vue

+ 174 - 42
src/components/pages/addCourse.vue

@@ -876,7 +876,7 @@
                               </div>
                             </div>
                             <div class="tool">
-                              <div class="whiteBIcon" @click="addTools(4)">
+                              <div class="whiteBIcon" @click="openTools(4)">
                                 <img
                                   src="../../assets/icon/thirdToolList/ask.png"
                                   alt=""
@@ -1198,6 +1198,100 @@
         <el-button type="primary" @click="isAddPP">确定</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="创建问卷调查"
+      :visible.sync="dialogVisible5"
+      :append-to-body="true"
+      width="800px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
+      <div
+        v-for="(item, index) in unitJson[unitIndex].chapterInfo"
+        :key="index"
+      >
+        <div
+          class="a_add_title"
+          style="
+            display: flex;
+            flex-direction: row;
+            align-items: center;
+            justify-content: center;
+          "
+        >
+          <div style="margin-right: 20px; font-size: 20px">问卷标题:</div>
+          <el-input
+            v-model="item.askTitle"
+            placeholder="请输入问卷标题"
+            style="width: 400px"
+          ></el-input>
+        </div>
+        <div class="a_addBox">
+          <div style="font-size: 16px; color: #c7c7c7">请输入问卷内容</div>
+          <div
+            class="a_add_box"
+            v-for="(item1, index1) in item.askCount"
+            :key="index1"
+          >
+            <div class="a_add_head">
+              <div>
+                {{ index1 + 1 + "、" }}
+                <el-input
+                  class="a_add_head_input"
+                  v-model="item.askJson[index1].askstitle"
+                  placeholder="请输入问卷题目..."
+                ></el-input>
+              </div>
+              <div class="a_add_head_div">
+                <el-button type="primary" size="small" @click="addAskList()"
+                  >添加</el-button
+                >
+                <el-button
+                  type="primary"
+                  size="small"
+                  @click="deleteAskList()"
+                  v-if="index1 != 0"
+                  >删除</el-button
+                >
+              </div>
+            </div>
+            <div class="a_add_body">
+              <div class="a_add_input">
+                <el-input
+                  v-for="(item2, checkIndex) in item.askJson[index1].askItem"
+                  :key="checkIndex"
+                  v-model="item.askJson[index1].checkList[checkIndex]"
+                  placeholder="请输入选项..."
+                  style="width: 150px; margin: 10px 10px 0 0"
+                ></el-input>
+              </div>
+              <div class="a_add_body_div">
+                <el-button
+                  style="margin: 10px 0px 0 0"
+                  type="primary"
+                  size="small"
+                  @click="addcheckList(item.askJson[index1])"
+                  v-if="item.askJson[index1].askItem < 4"
+                  >添加</el-button
+                >
+                <el-button
+                  type="primary"
+                  size="small"
+                  style="margin: 10px 0 0 0"
+                  @click="deletecheckList(item.askJson[index1])"
+                  v-if="item.askJson[index1].askItem != 1"
+                  >删除</el-button
+                >
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible5 = false">取 消</el-button>
+        <el-button type="primary" @click="addAsk">确 定</el-button>
+      </span>
+    </el-dialog>
     <el-dialog
       title="提示"
       :visible.sync="dialogVisible4"
@@ -1239,6 +1333,7 @@ export default {
       dialogVisible2: false,
       dialogVisible3: false,
       dialogVisible4: false,
+      dialogVisible5: false,
       publicTool: 0,
       searchPeople: "",
       userid: this.$route.query.userid,
@@ -1419,20 +1514,35 @@ export default {
       } else if (this.steps == 3) {
         if (this.cid == "" || this.cid == undefined) {
           if (
-            this.unitJson[this.unitIndex].dyName == "" || 
+            this.unitJson[this.unitIndex].dyName == "" ||
             this.unitJson[this.unitIndex].task == "" ||
             this.unitJson[this.unitIndex].taskDetail == "" ||
             this.unitJson[this.unitIndex].toolText == "" ||
-            this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.length == 0 ||
-            this.unitJson[this.unitIndex].chapterInfo[0].homeworkList.length == 0 ||
-            this.unitJson[this.unitIndex].chapterInfo[0].chapterData.length == 0 ||
+            this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.length ==
+              0 ||
+            this.unitJson[this.unitIndex].chapterInfo[0].homeworkList.length ==
+              0 ||
+            this.unitJson[this.unitIndex].chapterInfo[0].chapterData.length ==
+              0 ||
             this.unitJson[this.unitIndex].chapterInfo[0].chapterData.length == 0
           ) {
             this.$message.error("请将信息填写完整");
             return;
           } else {
-            this.addWork();
-            this.steps++;
+            if (
+              this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.indexOf(
+                4
+              ) != -1
+            ) {
+              this.addWork();
+              this.steps++;
+            } else {
+              this.unitJson[this.unitIndex].chapterInfo[0].askJson = [
+                { askstitle: "", askItem: 1, checkList: [] },
+              ];
+              this.addWork();
+              this.steps++;
+            }
           }
         } else {
           if (
@@ -1440,16 +1550,31 @@ export default {
             this.unitJson[this.unitIndex].task == "" ||
             this.unitJson[this.unitIndex].taskDetail == "" ||
             this.unitJson[this.unitIndex].toolText == "" ||
-            this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.length == 0 ||
-            this.unitJson[this.unitIndex].chapterInfo[0].homeworkList.length == 0 ||
-            this.unitJson[this.unitIndex].chapterInfo[0].chapterData.length == 0 ||
+            this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.length ==
+              0 ||
+            this.unitJson[this.unitIndex].chapterInfo[0].homeworkList.length ==
+              0 ||
+            this.unitJson[this.unitIndex].chapterInfo[0].chapterData.length ==
+              0 ||
             this.unitJson[this.unitIndex].chapterInfo[0].chapterData.length == 0
           ) {
             this.$message.error("请将信息填写完整");
             return;
           } else {
-            this.updateWork();
-            this.steps++;
+            if (
+              this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.indexOf(
+                4
+              ) != -1
+            ) {
+              this.updateWork();
+              this.steps++;
+            } else {
+              this.unitJson[this.unitIndex].chapterInfo[0].askJson = [
+                { askstitle: "", askItem: 1, checkList: [] },
+              ];
+              this.updateWork();
+              this.steps++;
+            }
           }
         }
       }
@@ -1958,23 +2083,26 @@ export default {
     goTo(path) {
       this.$router.push(path);
     },
-    // openTools(i) {
-    //   if (i == 1) {
-    //     window.parent.postMessage({ tools: "1" }, "*");
-    //   } else if (i == 2) {
-    //     window.parent.postMessage({ tools: "2" }, "*");
-    //   } else if (i == 3) {
-    //     window.parent.postMessage({ tools: "3" }, "*");
-    //   } else if (i == 4) {
-    //     window.parent.postMessage({ tools: "4" }, "*");
-    //   }
-    //   // else if(i == 5){
-    //   //   window.parent.postMessage({ tools: "5" }, "*");
-    //   // }
-    //   else {
-    //     window.parent.postMessage({ tools: "6" }, "*");
-    //   }
-    // },
+    openTools(i) {
+      // if (i == 1) {
+      //   window.parent.postMessage({ tools: "1" }, "*");
+      // } else if (i == 2) {
+      //   window.parent.postMessage({ tools: "2" }, "*");
+      // } else if (i == 3) {
+      //   window.parent.postMessage({ tools: "3" }, "*");
+      // } else if (i == 4) {
+      //   window.parent.postMessage({ tools: "4" }, "*");
+      // }
+      // // else if(i == 5){
+      // //   window.parent.postMessage({ tools: "5" }, "*");
+      // // }
+      // else {
+      //   window.parent.postMessage({ tools: "6" }, "*");
+      // }
+      if (i == 4) {
+        this.dialogVisible5 = true;
+      }
+    },
     addTools(i) {
       if (this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.length == 0) {
         this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.push(i);
@@ -1994,18 +2122,22 @@ export default {
       this.$forceUpdate();
     },
     // cleanAsk(p) {
-    //   this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.splice(
-    //     this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.indexOf(p),
-    //     1
-    //   );
-    //   this.unitJson[this.unitIndex].chapterInfo[0].askTitle = "";
-    //   this.unitJson[this.unitIndex].chapterInfo[0].askJson = [];
-    //   this.unitJson[this.unitIndex].chapterInfo[0].askJson.push({
-    //     askstitle: "",
-    //     askItem: 1,
-    //     checkList: [],
-    //   });
-    //   this.dialogVisible4 = false;
+    //   if (this.unitJson[this.unitIndex].chapterInfo[0].askCount == 1) {
+    //     this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.splice(
+    //       this.unitJson[this.unitIndex].chapterInfo[0].toolChoose.indexOf(p),
+    //       1
+    //     );
+    //     this.unitJson[this.unitIndex].chapterInfo[0].askTitle = "";
+    //     this.unitJson[this.unitIndex].chapterInfo[0].askJson = [];
+    //     this.unitJson[this.unitIndex].chapterInfo[0].askJson.push({
+    //       askstitle: "",
+    //       askItem: 1,
+    //       checkList: [],
+    //     });
+    //     this.dialogVisible5 = false;
+    //   } else {
+    //     this.dialogVisible5 = false;
+    //   }
     // },
     addAskList() {
       this.unitJson[this.unitIndex].chapterInfo[0].checkJson.push({
@@ -2099,7 +2231,7 @@ export default {
         });
         return el.askstitle != "" && elc.length != 0;
       });
-      this.dialogVisible4 = false;
+      this.dialogVisible5 = false;
     },
     selectCourseDetail() {
       if (this.cid == "" || this.cid == undefined) {

+ 262 - 39
src/components/pages/worksDetail.vue

@@ -16,7 +16,10 @@
       <div class="student_head">
         <div style="padding: 10px 0px 20px 0">
           <el-breadcrumb separator-class="el-icon-arrow-right">
-            <el-breadcrumb-item :to="{ path: '/works?userid=' + userid + '&oid=' + oid }">评价管理</el-breadcrumb-item>
+            <el-breadcrumb-item
+              :to="{ path: '/works?userid=' + userid + '&oid=' + oid }"
+              >评价管理</el-breadcrumb-item
+            >
             <el-breadcrumb-item>作业管理</el-breadcrumb-item>
           </el-breadcrumb>
         </div>
@@ -35,7 +38,11 @@
 							:value="item.id"
 						></el-option>
           </el-select>-->
-          <el-select v-model="sClass" placeholder="请选择班级" @change="searchWork">
+          <el-select
+            v-model="sClass"
+            placeholder="请选择班级"
+            @change="searchWork"
+          >
             <el-option label="所有班级" value></el-option>
             <el-option
               v-for="(item, index) in grade"
@@ -61,18 +68,44 @@
           :row-class-name="tableRowClassName"
           stripe
         >
-          <el-table-column prop="sName" label="姓名" min-width="15" align="center"></el-table-column>
-          <el-table-column prop="class" label="班级" min-width="20" align="center"></el-table-column>
-          <el-table-column prop="course" label="项目" min-width="20" align="center"></el-table-column>
-          <el-table-column prop="time" label="时间" min-width="15" align="center"></el-table-column>
+          <el-table-column
+            prop="sName"
+            label="姓名"
+            min-width="15"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="class"
+            label="班级"
+            min-width="20"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="course"
+            label="项目"
+            min-width="20"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            prop="time"
+            label="时间"
+            min-width="15"
+            align="center"
+          ></el-table-column>
           <el-table-column label="操作" min-width="30">
             <template slot-scope="scope">
               <el-button
                 type="primary"
                 size="small"
                 @click="lookWork(scope.row.id, scope.row.userid)"
-              >查看作业</el-button>
-              <el-button type="primary" size="small" @click="lookData(scope.row.userid)">生成报告</el-button>
+                >查看作业</el-button
+              >
+              <el-button
+                type="primary"
+                size="small"
+                @click="lookData(scope.row.userid)"
+                >生成报告</el-button
+              >
               <!-- <el-button
                 class="de_button"
                 type="primary"
@@ -88,11 +121,9 @@
           :before-close="handleClose"
           class="add_work"
         >
-          <div class="zyBoxC" v-for="(item,index) in worksDetail" :key="index">
+          <div class="zyBoxC" v-for="(item, index) in worksDetail" :key="index">
             <div class="courseTitle">
-              {{
-              '第'+(item.stage+1)+'阶段'+item.chapterTitle
-              }}
+              {{ "第" + (item.stage + 1) + "阶段" + item.chapterTitle }}
             </div>
             <div class="zyBox">
               <div class="left">
@@ -109,9 +140,10 @@
                 <div class="bigImg" v-else>
                   <img
                     :src="
-                    item.thumbnail.length > 0 && item.thumbnail[1].length ? item.thumbnail[1][0].url
-                      : ''
-                  "
+                      item.thumbnail.length > 0 && item.thumbnail[1].length
+                        ? item.thumbnail[1][0].url
+                        : ''
+                    "
                     alt
                   />
                 </div>
@@ -121,14 +153,19 @@
                     v-if="item.upVedio.length"
                     :class="item.tType == 0 ? 'isClick' : ''"
                   >
-                    <img src="../../assets/icon/spIcon.png" alt @click="item.tType = 0" />
+                    <img
+                      src="../../assets/icon/spIcon.png"
+                      alt
+                      @click="item.tType = 0"
+                    />
                   </div>
                   <div :class="item.tType == 1 ? 'isClick' : ''">
                     <img
                       :src="
-                    item.thumbnail.length > 0 && item.thumbnail[1].length ? item.thumbnail[1][0].url
-                      : ''
-                  "
+                        item.thumbnail.length > 0 && item.thumbnail[1].length
+                          ? item.thumbnail[1][0].url
+                          : ''
+                      "
                       alt
                       @click="item.tType = 1"
                     />
@@ -142,18 +179,17 @@
                   <div class="nav">
                     <div class="studentName">{{ sInfo.sName }}</div>
                     <div class="studentAnswer">
-                      {{
-                      item.content != ""
-                      ? item.content
-                      : "暂无内容"
-                      }}
+                      {{ item.content != "" ? item.content : "暂无内容" }}
                       <!-- 雨荒深院菊,霜倒半池莲.唐杜甫《宿赞公房》 -->
                     </div>
                   </div>
                 </div>
               </div>
-              <div style="width: 290px;margin-right: 10px;">
-                <div class="sd_score" style="box-sizing: border-box; width: 100%; box-shadow: none">
+              <div style="width: 290px; margin-right: 10px">
+                <div
+                  class="sd_score"
+                  style="box-sizing: border-box; width: 100%; box-shadow: none"
+                >
                   <div class="score_box">
                     <span>意识能力</span>
                     <el-rate v-model="item.rate.ca"></el-rate>
@@ -211,13 +247,13 @@
                 <div
                   class="lastTop"
                   style="
-                  width: 100%;
-                  padding: 5px 0px 0px;
-                  box-sizing: border-box;
-                  height: 225px;
-                  margin-top: 10px;
-                  box-shadow: none;
-                "
+                    width: 100%;
+                    padding: 5px 0px 0px;
+                    box-sizing: border-box;
+                    height: 225px;
+                    margin-top: 10px;
+                    box-shadow: none;
+                  "
                 >
                   <div class="moreSay">更多评价</div>
                   <div class="more_say_input">
@@ -233,7 +269,12 @@
                 </div>
               </div>
               <!-- <div class="rbButtom" @click="giveScore">评分</div> -->
-              <div class="rbButtom" @click="updateWorks(item.id,item.rate,index)">评分</div>
+              <div
+                class="rbButtom"
+                @click="updateWorks(item.id, item.rate, index)"
+              >
+                评分
+              </div>
             </div>
           </div>
         </el-dialog>
@@ -261,9 +302,9 @@
               <div>课程名称</div>
               <div>
                 {{
-                chapInfo[publicIndex] != null
-                ? chapInfo[publicIndex].dyName
-                : "暂无课程"
+                  chapInfo[publicIndex] != null
+                    ? chapInfo[publicIndex].dyName
+                    : "暂无课程"
                 }}
               </div>
             </div>
@@ -321,7 +362,9 @@
             </div>
           </div>
 
-          <div class="assess_right" @click="updateWorks" v-if="!uploadBoolean">提交</div>
+          <div class="assess_right" @click="updateWorks" v-if="!uploadBoolean">
+            提交
+          </div>
           <div class="assess_right" @click="updateWorks" v-else>提交</div>
         </el-dialog>
       </div>
@@ -356,6 +399,137 @@
         <el-button @click="dataVisible = false">关 闭</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="查看问卷调查"
+      :visible.sync="dialogVisible4"
+      :append-to-body="true"
+      width="800px"
+      :before-close="handleClose"
+      class="dialog_diy"
+    >
+      <!-- <div
+        v-for="(item, index) in chapInfoList[courseType].chapterInfo"
+        :key="index"
+      > -->
+      <div>
+        <div
+          class="a_add_title"
+          style="
+            display: flex;
+            flex-direction: row;
+            align-items: center;
+            justify-content: center;
+          "
+        >
+          <div style="margin-right: 20px; font-size: 20px">问卷标题:</div>
+          <!-- <div style="font-size: 20px">{{ item.askTitle }}</div> -->
+          <div style="font-size: 20px"></div>
+        </div>
+        <div class="a_addBox">
+          <div style="font-size: 16px; color: #c7c7c7">问卷内容</div>
+          <div class="a_add_box">
+            <div class="a_add_head">
+              <div style="display: flex">
+                <!-- {{ index1 + 1 + "、" }} -->1、
+                <!-- <div>问卷题目:{{ item.askJson[index1].askstitle }}</div> -->
+                <div>问卷题目:</div>
+              </div>
+            </div>
+            <div class="a_add_body">
+              <div class="a_add_input">
+                <!-- <el-radio-group v-model="radio[index1]"> -->
+                  <el-radio-group >
+                    <el-radio
+                    
+                    class="redioStyle"
+                    disabled
+                    >西瓜</el-radio
+                  >
+                </el-radio-group>
+                  <!-- <el-radio
+                    v-for="(item3, checkIndex1) in item.askJson[index1]
+                      .checkList"
+                    :key="checkIndex1"
+                    :label="checkIndex1"
+                    class="redioStyle"
+                    disabled
+                    >{{ item3 }}</el-radio
+                  >
+                </el-radio-group> -->
+              </div>
+              <!-- <div class="a_add_input" v-if="radio.length == 0">
+                <el-radio-group v-model="radio[index1]">
+                  <el-radio
+                    v-for="(item2, checkIndex) in item.askJson[index1]
+                      .checkList"
+                    :key="checkIndex"
+                    :label="checkIndex"
+                    class="redioStyle"
+                    >{{ item2 }}</el-radio
+                  >
+                </el-radio-group>
+              </div>
+              <div class="a_add_input" v-else>
+                <el-radio-group v-model="radio[index1]">
+                  <el-radio
+                    v-for="(item3, checkIndex1) in item.askJson[index1]
+                      .checkList"
+                    :key="checkIndex1"
+                    :label="checkIndex1"
+                    class="redioStyle"
+                    disabled
+                    >{{ item3 }}</el-radio
+                  >
+                </el-radio-group>
+              </div> -->
+            </div>
+          </div>
+          <!-- <div
+            class="a_add_box"
+            v-for="(item1, index1) in item.askCount"
+            :key="index1"
+          >
+            <div class="a_add_head">
+              <div style="display: flex">
+                {{ index1 + 1 + "、" }}
+                <div>问卷题目:{{ item.askJson[index1].askstitle }}</div>
+              </div>
+            </div>
+            <div class="a_add_body">
+              <div class="a_add_input" v-if="radio.length == 0">
+                <el-radio-group v-model="radio[index1]">
+                  <el-radio
+                    v-for="(item2, checkIndex) in item.askJson[index1]
+                      .checkList"
+                    :key="checkIndex"
+                    :label="checkIndex"
+                    class="redioStyle"
+                    >{{ item2 }}</el-radio
+                  >
+                </el-radio-group>
+              </div>
+              <div class="a_add_input" v-else>
+                <el-radio-group v-model="radio[index1]">
+                  <el-radio
+                    v-for="(item3, checkIndex1) in item.askJson[index1]
+                      .checkList"
+                    :key="checkIndex1"
+                    :label="checkIndex1"
+                    class="redioStyle"
+                    disabled
+                    >{{ item3 }}</el-radio
+                  >
+                </el-radio-group>
+              </div>
+            </div>
+          </div> -->
+        </div>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible4 = false">取 消</el-button>
+        <el-button type="primary" @click="dialogVisible4 = false">确 定</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -379,6 +553,7 @@ export default {
       dialogVisible1: false,
       dialogVisible2: false,
       dialogVisible3: false,
+      dialogVisible4: false,
       dataVisible: false,
       studentInfo: {},
       courseByUser: "诗词中的植物",
@@ -623,7 +798,7 @@ export default {
           //   this.dialogVisible = true;
           this.rateList = this.chapInfo[this.publicIndex].rate;
           this.dialogVisible3 = true;
-
+          this.dialogVisible4 = true;
           // this.ooption[0].value = this.rateList.ca;
           // this.ooption[1].value = this.rateList.sia;
           // this.ooption[2].value = this.rateList.eta;
@@ -1328,4 +1503,52 @@ export default {
 .dialog_diy >>> .el-dialog__headerbtn .el-dialog__close:hover {
   color: #fff;
 }
+.dialog_diy >>> .el-dialog__body,
+.dialog_diy >>> .el-dialog__footer {
+  background: #fafafa;
+}
+.a_addBox {
+  margin: 10px 0;
+  background: #fff;
+  padding: 15px;
+  max-height: 400px;
+  overflow: auto;
+}
+.a_add_box {
+  border-bottom: 2px solid #eee;
+  padding-bottom: 10px;
+}
+
+.a_add_head {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+  margin: 10px 0;
+  font-size: 18px;
+}
+.a_add_head .a_add_head_input {
+  width: 300px;
+}
+.a_add_head .a_add_head_div {
+  display: flex;
+  align-items: center;
+  justify-content: space-between;
+}
+.a_add_body {
+  display: flex;
+  align-items: center;
+}
+.a_add_input {
+  display: flex;
+  align-items: center;
+  flex-wrap: wrap;
+  /* flex-direction: column; */
+  /* width: 100%; */
+}
+.a_add_input >>> el-radio-group {
+  margin: 10px 0;
+}
+.redioStyle >>> .el-radio__label {
+  font-size: 18px;
+}
 </style>