Browse Source

修改问题

zengyicheng 2 years ago
parent
commit
f517068432
1 changed files with 31 additions and 33 deletions
  1. 31 33
      src/components/liveProjectDetail.vue

+ 31 - 33
src/components/liveProjectDetail.vue

@@ -339,7 +339,7 @@
               <div
                 class="nextStepOne"
                 style="float: right"
-                @click="getImg"
+                @click="addWork(4)"
                 v-if="toolCount == 1 || toolCount == 3 || toolCount == 7"
               >
                 截图
@@ -655,9 +655,7 @@ export default {
       isAnswer: false,
       upload: [
         {
-          upImg: [],
-          upVedio: [],
-          upIntro: "",
+          url: "",
         },
       ],
       noneBtnImg: false,
@@ -828,33 +826,26 @@ export default {
       this.dialogVisible = true;
     },
     isChooseActive(t) {
-      if (this.isAnswer == true) {
-        return;
+      if (this.typeC.length == 0) {
+        this.typeC.push(t);
       } else {
-        if (this.typeC.length == 0) {
-          this.typeC.push(t);
+        if (this.typeC.indexOf(t) != -1) {
+          this.typeC.splice(this.typeC.indexOf(t), 1);
         } else {
-          if (this.typeC.indexOf(t) != -1) {
-            this.typeC.splice(this.typeC.indexOf(t), 1);
-          } else {
-            this.typeC.push(t);
-          }
+          this.typeC.push(t);
         }
       }
     },
     showMember(i) {
       if (this.typeC.length > 0) {
-        // this.steps = 2;
-        this.isAnswer = true;
         this.addWork(1);
-        // this.dialogVisible = true;
       } else {
         this.$message.error("至少选择一个答案!");
       }
     },
     clean(type) {
       if (type == 1) {
-        this.upload[0].upImg.splice(0, 1);
+        this.upload[0].url.splice(0, 1);
       } else if (type == 2) {
         this.upload[0].upVedio.splice(0, 1);
       }
@@ -865,7 +856,7 @@ export default {
     },
     imgChange(file, fileList, type) {
       if (type == 1) {
-        var _tmp = this.upload[0].upImg;
+        var _tmp = this.upload[0].url;
       } else if (type == 2) {
         var _tmp = this.upload[0].upVedio;
       } else if (type == 100) {
@@ -921,13 +912,9 @@ export default {
               a.splice(a.length - 1, a.length);
               _this.$message.error("上传失败");
             } else {
-              _this.upload[0].upImg = [];
+              _this.upload[0].url = "";
               if (type == 1) {
-                _this.upload[0].upImg.push({
-                  name: file.name,
-                  url: data.Location,
-                  uid: file.uid,
-                });
+                _this.upload[0].url = data.Location;
                 _this.imgChange(null, null, type);
                 _this.addWork(4);
               } else if (type == 2) {
@@ -999,12 +986,7 @@ export default {
       }
     },
     addWork(type) {
-      if (type == 4) {
-        if (this.upload[0].upImg.length == 0) {
-          this.$message.error("请上传图片");
-          return;
-        }
-      } else if (type == 5) {
+      if (type == 5) {
         if (this.tkAnswer.length == 0) {
           this.$message.error("请选择对应的答案");
           return;
@@ -1029,17 +1011,23 @@ export default {
           }
         )
           .then(() => {
+            if (type == 4) {
+              this.getImg();
+            }
             this.addSWork(type);
           })
           .catch(() => {});
       } else {
+        if (type == 4) {
+          this.getImg();
+        }
         this.addSWork(type);
       }
     },
     addSWork(type) {
       var a;
       if (type == 4) {
-        a = JSON.stringify(this.upload[0].upImg[0].url);
+        a = this.upload[0].url;
       } else if (type == 6) {
         a = JSON.stringify(this.rateList);
       } else if (type == 1) {
@@ -1073,6 +1061,8 @@ export default {
         });
     },
     selectSWork() {
+      this.isAnswer = false;
+      this.isNoHomeWork = false;
       let params = {
         uid: this.userid,
         cid: this.cid,
@@ -1082,10 +1072,18 @@ export default {
         .get(this.$store.state.api + "selectSWork", params)
         .then((res) => {
           if (res.data[0].length > 0) {
-            if (res.data[0].type == 1) {
+            if (res.data[0][0].type == 1) {
               this.isAnswer = true;
+              this.typeC = JSON.parse(res.data[0][0].upload);
             } else {
               this.isNoHomeWork = true;
+              if (res.data[0][0].type == 5) {
+                this.tkAnswer = JSON.parse(res.data[0][0].upload);
+              } else if (res.data[0][0].type == 4) {
+                this.upload[0].url = res.data[0][0].upload;
+              } else if (res.data[0][0].type == 6) {
+                this.rateList = JSON.parse(res.data[0][0].upload);
+              }
             }
           }
         })
@@ -1305,7 +1303,7 @@ export default {
               return;
             } else {
               this.ppage = res.data[0][0].page;
-              // this.ppage = 15;
+              // this.ppage = 11;
               this.typeC = [];
               this.isAnswer = false;
               this.howPage(this.ppage);