zkl пре 5 година
родитељ
комит
c13debbb40
1 измењених фајлова са 83 додато и 96 уклоњено
  1. 83 96
      discern/src/components/addData/addData.vue

+ 83 - 96
discern/src/components/addData/addData.vue

@@ -388,54 +388,48 @@ export default {
               course: _this.course, //科目
               id: localStorage.getItem("memoryCompileID") //id
             });
-            var isClick = false;
-            if (isClick === true) {
-              _this
-                .$axios({
-                  method: "post",
-                  url: "bigservers/make_data",
-                  data: postData
-                })
-                .then(res => {
-                  if (res.data === 0) {
-                    this.$notify({
-                      title: "成功",
-                      message: "发布成功",
-                      type: "success",
-                      duration: 1500
-                    });
-                    //判断是识别失败进来的还是直接点击的手动输入
-                    if (localStorage.getItem("memoryCompileID") !== null) {
-                      //识别失败
-                      this.$router.replace("/memory");
-                      localStorage.removeItem("memoryCompileID");
-                      localStorage.removeItem("commandIndex");
-                      localStorage.setItem("commandLuru", "全部");
-                    } else {
-                      //手动输入
-                      // this.$router.push("/home");
-                      localStorage.setItem("commandIndex", "all");
-                      localStorage.setItem("commandLuru", "全部");
-                      this.$router.replace("/home");
-                    }
-                    const timeA = setInterval(() => {
-                      location.reload();
-                    }, 1500);
-                  } else if (res.data === 1) {
-                    this.$notify.error({
-                      title: "错误",
-                      message: "发布失败,请重试",
-                      duration: 1500
-                    });
+            _this
+              .$axios({
+                method: "post",
+                url: "bigservers/make_data",
+                data: postData
+              })
+              .then(res => {
+                if (res.data === 0) {
+                  this.$notify({
+                    title: "成功",
+                    message: "发布成功",
+                    type: "success",
+                    duration: 1500
+                  });
+                  //判断是识别失败进来的还是直接点击的手动输入
+                  if (localStorage.getItem("memoryCompileID") !== null) {
+                    //识别失败
+                    this.$router.replace("/memory");
+                    localStorage.removeItem("memoryCompileID");
+                    localStorage.removeItem("commandIndex");
+                    localStorage.setItem("commandLuru", "全部");
+                  } else {
+                    //手动输入
+                    // this.$router.push("/home");
+                    localStorage.setItem("commandIndex", "all");
+                    localStorage.setItem("commandLuru", "全部");
+                    this.$router.replace("/home");
                   }
-                })
-                .catch(err => {
-                  console.log(err);
-                });
-              setTimeout(function() {
-                _this.isClick = true;
-              }, 1500);
-            }
+                  const timeA = setInterval(() => {
+                    location.reload();
+                  }, 1500);
+                } else if (res.data === 1) {
+                  this.$notify.error({
+                    title: "错误",
+                    message: "发布失败,请重试",
+                    duration: 1500
+                  });
+                }
+              })
+              .catch(err => {
+                console.log(err);
+              });
           } else {
             //手动输入
             let postData = _this.$qs.parse({
@@ -448,58 +442,51 @@ export default {
               ret: _this.radio, //病虫害区别
               sort: _this.course //科目
             });
-            var isClick = _this.isClick;
-            if (isClick === true) {
-              _this
-                .$axios({
-                  method: "post",
-                  url: "bigservers/save_disease",
-                  data: postData
-                })
-                .then(res => {
-                  if (res.data === 0) {
-                    this.$notify({
-                      title: "成功",
-                      message: "发布成功",
-                      type: "success",
-                      duration: 1500
-                    });
-                    //判断是识别失败进来的还是直接点击的手动输入
-                    if (localStorage.getItem("memoryCompileID") !== null) {
-                      //识别失败
-                      // this.$router.push("/memory");
-                      this.$router.replace("/memory");
-                      localStorage.removeItem("memoryCompileID");
-                      localStorage.setItem("commandIndex", "all");
-                      localStorage.setItem("commandLuru", "全部");
-                    } else {
-                      //手动输入
-                      // this.$router.push("/home");
-                      localStorage.setItem("commandIndex", "all");
-                      localStorage.setItem("commandLuru", "全部");
-                      this.$router.replace("/home");
-                    }
-                    const timeA = setInterval(() => {
-                      location.reload();
-                    }, 1500);
-                  } else if (res.data === 1) {
-                    this.$notify.error({
-                      title: "错误",
-                      message: "发布失败,请重试",
-                      duration: 1500
-                    });
+            _this
+              .$axios({
+                method: "post",
+                url: "bigservers/save_disease",
+                data: postData
+              })
+              .then(res => {
+                if (res.data === 0) {
+                  this.$notify({
+                    title: "成功",
+                    message: "发布成功",
+                    type: "success",
+                    duration: 1500
+                  });
+                  //判断是识别失败进来的还是直接点击的手动输入
+                  if (localStorage.getItem("memoryCompileID") !== null) {
+                    //识别失败
+                    // this.$router.push("/memory");
+                    this.$router.replace("/memory");
+                    localStorage.removeItem("memoryCompileID");
+                    localStorage.setItem("commandIndex", "all");
+                    localStorage.setItem("commandLuru", "全部");
+                  } else {
+                    //手动输入
+                    // this.$router.push("/home");
+                    localStorage.setItem("commandIndex", "all");
+                    localStorage.setItem("commandLuru", "全部");
+                    this.$router.replace("/home");
                   }
-                })
-                .catch(err => {
-                  console.log(err);
-                });
-              setTimeout(function() {
-                _this.isClick = true;
-              }, 1500);
-            }
+                  const timeA = setInterval(() => {
+                    location.reload();
+                  }, 1500);
+                } else if (res.data === 1) {
+                  this.$notify.error({
+                    title: "错误",
+                    message: "发布失败,请重试",
+                    duration: 1500
+                  });
+                }
+              })
+              .catch(err => {
+                console.log(err);
+              });
           }
         }
-
         setTimeout(function() {
           _this.isClick = true;
         }, 1500);