Forráskód Böngészése

问卷调查功能

zengyicheng 3 éve
szülő
commit
37e14b555b
2 módosított fájl, 198 hozzáadás és 2 törlés
  1. 4 1
      src/components/courseDetail.vue
  2. 194 1
      src/components/study.vue

+ 4 - 1
src/components/courseDetail.vue

@@ -498,6 +498,9 @@ export default {
 }
 
 .type_children + .type_children {
-  margin-left: 5px;
+  margin-left: 10px;
+}
+.all_choose{
+  margin-right: 15px;
 }
 </style>

+ 194 - 1
src/components/study.vue

@@ -630,6 +630,78 @@
     <el-dialog :visible.sync="pictureDialog" size="tiny">
       <img width="100%" :src="dialogImageUrl" alt="" />
     </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 chapInfoList[courseType].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>
+          <div style="font-size: 20px">{{ item.askTitle }}</div>
+        </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 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="!isAsk">
+                <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="dialogVisible5 = false">取 消</el-button>
+        <el-button type="primary" @click="addStudentAsk">确 定</el-button>
+      </span>
+    </el-dialog>
     <el-dialog
       title="提示"
       :visible.sync="dialogVisible4"
@@ -722,6 +794,9 @@ export default {
       toolTypeList: [],
       dialogVisible4: false,
       isNoHomeWork: false,
+      dialogVisible5: false,
+      radio: [],
+      isAsk: false,
     };
   },
   methods: {
@@ -917,7 +992,9 @@ export default {
           upFile: [],
         },
       ]),
+      this.radio = [];
         this.getHomeWork();
+      this.getStudentAsk();
       this.getCourseDetail();
     },
     addQuestion() {
@@ -1112,6 +1189,56 @@ export default {
       //   },
       // ];
     },
+    addStudentAsk() {
+      if ((this.isAsk = true)) {
+        this.dialogVisible5 = false;
+      } else {
+        let params = [
+          {
+            cid: this.id,
+            stage: this.courseType,
+            content: this.radio.join(","),
+            uid: this.userid,
+          },
+        ];
+        this.ajax
+          .post(this.$store.state.api + "addAskList", params)
+          .then((res) => {
+            this.$message({
+              message: "提交成功",
+              type: "success",
+            });
+            this.dialogVisible5 = false;
+            this.getStudentAsk();
+          })
+          .catch((err) => {
+            this.$message.error("提交失败");
+            console.error(err);
+          });
+      }
+    },
+    getStudentAsk() {
+      let params = {
+        cid: this.id,
+        stage: this.courseType,
+      };
+      this.ajax
+        .get(this.$store.state.api + "getAskListByCidStage", params)
+        .then((res) => {
+          if (res.data[0].length > 0) {
+            var a = res.data[0][0].content.split(",");
+            for (var i = 0; i < a.length; i++) {
+              this.radio.push(parseInt(a[i]));
+            }
+            this.isAsk = true;
+          } else {
+            this.isAsk = false;
+          }
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
     addWork() {
       if (this.studyJuri[0].content == "") {
         this.$message.error("请将信息填写完整");
@@ -1293,7 +1420,8 @@ export default {
           a = this.askCount;
           this.toolsCount(a, t);
         }
-        window.parent.postMessage({ tools: "4" }, "*");
+        this.dialogVisible5 = true;
+        // window.parent.postMessage({ tools: "4" }, "*");
       } else if (t == 5) {
         if (this.scoreCount > 0) {
           this.updateCount(this.scoreCount, t);
@@ -1378,6 +1506,7 @@ export default {
     this.getCourseDetail();
     this.selectCount();
     this.getHomeWork();
+    this.getStudentAsk();
     document.scrollingElement.scrollTop = 0;
 
     window.onresize = function () {
@@ -2013,4 +2142,68 @@ export default {
 .binfo_input:focus-visible {
   border: 1px solid rgba(61, 103, 188);
 }
+.dialog_diy >>> .el-dialog__header {
+  background: #3d67bc !important;
+  padding: 15px 20px;
+}
+.dialog_diy >>> .el-dialog__title {
+  color: #fff;
+}
+.dialog_diy >>> .el-dialog__headerbtn {
+  top: 19px;
+}
+.dialog_diy >>> .el-dialog__headerbtn .el-dialog__close {
+  color: #fff;
+}
+.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>