zengyicheng 2 lat temu
rodzic
commit
086768b48a
1 zmienionych plików z 108 dodań i 10 usunięć
  1. 108 10
      src/components/pages/race/eventCenter/myAnli.vue

+ 108 - 10
src/components/pages/race/eventCenter/myAnli.vue

@@ -196,17 +196,115 @@ export default {
         })
           .then(() => {
             let params = {
-              id: id,
-              s: a,
+              sid: this.oid,
             };
             this.ajax
-              .get(this.$store.state.api + "updateRaceState", params)
+              .get(this.$store.state.api + "selectRaceByOid", params)
               .then((res) => {
-                this.$message({
-                  message: "提交成功",
-                  type: "success",
-                });
-                this.selectAnLi();
+                if (res.data[0].length == 0) {
+                  let paramsa = {
+                    id: id,
+                    s: a,
+                  };
+                  this.ajax
+                    .get(this.$store.state.api + "updateRaceState", paramsa)
+                    .then((res) => {
+                      this.$message({
+                        message: "提交成功",
+                        type: "success",
+                      });
+                      this.selectAnLi();
+                    })
+                    .catch((err) => {
+                      console.error(err);
+                    });
+                } else {
+                  var inType = [];
+                  for (var i = 0; i < res.data[0].length; i++) {
+                    if (inType.length == 0) {
+                      inType = JSON.parse(res.data[0][i].info).type;
+                    } else {
+                      inType += JSON.parse(res.data[0][i].info).type;
+                    }
+                  }
+                  var oldType = [];
+                  for (var j = 0; j < this.anliBox.length; j++) {
+                    if (id == this.anliBox[j].id) {
+                      oldType = JSON.parse(this.anliBox[j].info).type;
+                      break;
+                    }
+                  }
+                  if (
+                    res.data[0][0].name != "华南师大附属中学" ||
+                    res.data[0][0].name != "广东实验中学" ||
+                    res.data[0][0].name != "华南师大附属小学"
+                  ) {
+                    var isIndex = 0;
+                    for (var k = 0; k < oldType.length; k++) {
+                      if (inType.indexOf(oldType[k]) != -1) {
+                        this.$message({
+                          message: "每校每类别案例限报一项!",
+                          type: "error",
+                        });
+                        isIndex = 1;
+                      }
+                    }
+                    if (isIndex == 0) {
+                      let paramsb = {
+                        id: id,
+                        s: a,
+                      };
+                      this.ajax
+                        .get(this.$store.state.api + "updateRaceState", paramsb)
+                        .then((res) => {
+                          this.$message({
+                            message: "提交成功",
+                            type: "success",
+                          });
+                          this.selectAnLi();
+                        })
+                        .catch((err) => {
+                          console.error(err);
+                        });
+                    }
+                  } else {
+                    var isNum = 0;
+                    for (var z = 0; z < res.data[0].length; z++) {
+                      for (var p = 0; p < oldType.length; p++) {
+                        if (
+                          JSON.parse(res.data[0][z].info).type.indexOf(
+                            oldType[p]
+                          ) != -1
+                        ) {
+                          isNum++;
+                        }
+                      }
+                    }
+                    if (isNum < 2) {
+                      let paramsb = {
+                        id: id,
+                        s: a,
+                      };
+                      this.ajax
+                        .get(this.$store.state.api + "updateRaceState", paramsb)
+                        .then((res) => {
+                          this.$message({
+                            message: "提交成功",
+                            type: "success",
+                          });
+                          this.selectAnLi();
+                        })
+                        .catch((err) => {
+                          console.error(err);
+                        });
+                    } else {
+                      this.$message({
+                        message: "每校每类别案例限报两项!",
+                        type: "error",
+                      });
+                    }
+                  }
+                }
               })
               .catch((err) => {
                 console.error(err);
@@ -220,12 +318,12 @@ export default {
           type: "warning",
         })
           .then(() => {
-            let params = {
+            let paramsd = {
               id: id,
               s: a,
             };
             this.ajax
-              .get(this.$store.state.api + "updateRaceState", params)
+              .get(this.$store.state.api + "updateRaceState", paramsd)
               .then((res) => {
                 this.$message({
                   message: "取消提交成功",