Browse Source

解决冲突

zhudengkai 4 years ago
parent
commit
d4a7856d44
1 changed files with 74 additions and 18 deletions
  1. 74 18
      src/components/WebQn.vue

+ 74 - 18
src/components/WebQn.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <!-- page title -->
-    <div v-if="stage == 0">
+    <div v-if="showHello">
       <mt-header type="default" title="问卷调查-问候语" fixed></mt-header>
     </div>
     <div v-else-if="stage == 1">
@@ -11,10 +11,13 @@
     </div>
     <div v-else-if="stage == 2">
       <mt-header title="问卷调查-结束语" fixed></mt-header>
+      <p>
+        <el-image style="width: 100%;" :src="end_image" :fit="scale-down"></el-image>
+      </p>
     </div>
 
     <!-- 问候语 -->
-    <div v-if="stage == 0">
+    <div v-if="showHello">
       <p style="margin: 80px 0;">{{questionaire.info.hello}}</p>
       <mt-button type="primary" @click="start" class="button-bottom">继续</mt-button>
     </div>
@@ -29,6 +32,7 @@
           <span class="h3">{{questionHEAD + 1}}、</span>
           <span class="h3" style="margin-left: 5;">[</span>
           <span class="h3">{{questionType}}</span>
+          <span class="h3">{{multipleTip}}</span>
           <span class="h3" style="margin-right: 5;">]</span>
         </div>
 
@@ -67,7 +71,7 @@
                 <Label class="body" :text="questionaire.info.bye" textWrap="true" verticalAlignment="top" />
                 <Button text="继续" @tap="onFinishTap" row="1" />
     </div>-->
-    <div v-if="stage == 2">
+    <div v-else-if="stage == 2">
       <p style="margin: 80px 0;">{{questionaire.info.bye}}</p>
     </div>
   </div>
@@ -88,6 +92,7 @@ export default {
   name: "WebQn",
   data: function() {
     return {
+      showHello: true,
       webQuestionaire: {},
       questionaire: { info: {} },
       questionHEAD: 0,
@@ -115,7 +120,8 @@ export default {
       lastCheckList: [],
 
       // 选择题选中开放式选项的开放回答值
-      selectedOpenList: []
+      selectedOpenList: [],
+      end_image: ""
     };
   },
   mounted: function() {
@@ -139,11 +145,13 @@ export default {
           // this.webQuestionaire = webQnResponse.data;
           // this.questionaire.info = r.data.info;
           console.log("匿名方式问卷内容:", this.questionaire);
+          this.axiosGetEndImage(r.data.info.id);
         });
       } else {
         console.log("登录方式问卷打开");
         axios.get(this.webQnUrl).then(webQnResponse => {
           let qnId = webQnResponse.data.qnId;
+          this.axiosGetEndImage(qnId);
           let qnDataUrl = this.webQnUrl + "/complete-info";
           console.log("qnDataUrl", qnDataUrl);
           axios.get(qnDataUrl).then(r => {
@@ -235,6 +243,21 @@ export default {
         return "开放题";
       }
     },
+    multipleTip() {
+      let type = this.currentQuestion.type;
+      if (type == 1) {
+        if (this.currentQuestion.maxOptions > 1) {
+          return (
+            "(" +
+            this.currentQuestion.minOptions +
+            "-" +
+            this.currentQuestion.maxOptions +
+            "个)"
+          );
+        }
+      }
+      return "";
+    },
     questionBody() {
       // 处理${ID}的情况
       return this.replaceDollarId(this.currentQuestion.body);
@@ -356,16 +379,19 @@ export default {
     //     }
     // },
     start() {
-      if (this.openWay == "Project") {
-        // 匿名方式打开
-        this.webQuestionaire.status = 2;
-      } else {
-        // 登录状态打开方式
-        this.webQuestionaire.status = 2;
-        axios
-          .put(this.webQnUrl, { status: 2 })
-          .then(() => console.log("update status success"));
+      if (this.stage < 2) {
+        if (this.openWay == "Project") {
+          // 匿名方式打开
+          this.webQuestionaire.status = 2;
+        } else {
+          // 登录状态打开方式
+          this.webQuestionaire.status = 2;
+          axios
+            .put(this.webQnUrl, { status: 2 })
+            .then(() => console.log("update status success"));
+        }
       }
+      this.showHello = false;
     },
     getUserName() {
       if (this.openWay == "Project") {
@@ -441,11 +467,9 @@ export default {
         let isUnselect = this.lastCheckList.length > index.length;
 
         if (isUnselect) {
-          let selSet = new Set(index)
-          let lastSet = new Set(this.lastCheckList)
-          let unselectSet = new Set(
-            [...lastSet].filter(x => !selSet.has(x))
-          );
+          let selSet = new Set(index);
+          let lastSet = new Set(this.lastCheckList);
+          let unselectSet = new Set([...lastSet].filter(x => !selSet.has(x)));
           let unselectItem = Array.from(unselectSet)[0];
 
           for (
@@ -825,6 +849,17 @@ export default {
           }
         }
       );
+    },
+    axiosGetEndImage(id) {
+      // 加载结束图片
+      axios({
+        method: "GET",
+        url: this.$baseUrl + "/web-qn/end-image",
+        responseType: "blob",
+        params: { projectId: id }
+      }).then(response => {
+        this.end_image = window.URL.createObjectURL(response.data);
+      });
     }
     // updateAnswerSheetData(answerJson) {
     //     this.$db.execSQL('update answer_sheet set endTime = ?, answerJson = ?, status = ? where sheetName = ?',
@@ -872,4 +907,25 @@ export default {
 .select-open-dialog textarea {
   height: 100px;
 }
+.mint-cell {
+  display: inherit;
+}
+
+/* 取消选择框上下线 */
+.mint-cell-wrapper {
+  background-image: none;
+  margin-right: 4px;
+}
+.mint-cell:last-child {
+  background-image: none;
+}
+/* .mint-radio-input:checked + .mint-radio-core {
+  background-color: #e80413;
+  border-color: #e80413;
+} */
+
+.mint-cell {
+  float: left;
+  display: inline-block;
+}
 </style>