瀏覽代碼

教师端更新

zengyicheng 2 年之前
父節點
當前提交
a1a9e6814f

+ 1 - 1
dist/index.html

@@ -25,4 +25,4 @@
       height: 100%;
       width: 100%;
       background: #e6eaf0;
-    }</style><link href=./static/css/app.775cc246219cd03be49c5ffcaab18982.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.093df9138434d51e559a.js></script><script type=text/javascript src=./static/js/vendor.779ee1bbeec2c196af1e.js></script><script type=text/javascript src=./static/js/app.565157bc999b43c2fc05.js></script></body></html>
+    }</style><link href=./static/css/app.f594e0ab3d43edc2c2eab0c51d6488d7.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.093df9138434d51e559a.js></script><script type=text/javascript src=./static/js/vendor.69cd6886a56eb8550be1.js></script><script type=text/javascript src=./static/js/app.33d7004fc7c2a060a801.js></script></body></html>

File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.775cc246219cd03be49c5ffcaab18982.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.f594e0ab3d43edc2c2eab0c51d6488d7.css


File diff suppressed because it is too large
+ 0 - 0
dist/static/css/app.f594e0ab3d43edc2c2eab0c51d6488d7.css.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.33d7004fc7c2a060a801.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.33d7004fc7c2a060a801.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.565157bc999b43c2fc05.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/app.565157bc999b43c2fc05.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/manifest.093df9138434d51e559a.js.map


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/vendor.69cd6886a56eb8550be1.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/vendor.69cd6886a56eb8550be1.js.map


+ 5 - 0
package-lock.json

@@ -5380,6 +5380,11 @@
       "integrity": "sha1-9OaGxd4eofhn28rT1G2WlCjfmMQ=",
       "dev": true
     },
+    "js-pinyin": {
+      "version": "0.1.9",
+      "resolved": "https://registry.npmmirror.com/js-pinyin/-/js-pinyin-0.1.9.tgz",
+      "integrity": "sha512-svn/0UsB2daFriHmqfCYX2xFWaNJs0iyoCMHVIwTFdc86mZhP0ZXfgI02/K1BC7aNE4fMjxx2kZMJBZ21kvp+Q=="
+    },
     "js-tokens": {
       "version": "3.0.2",
       "resolved": "https://registry.npm.taobao.org/js-tokens/download/js-tokens-3.0.2.tgz?cache=0&sync_timestamp=1586796260005&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjs-tokens%2Fdownload%2Fjs-tokens-3.0.2.tgz",

+ 1 - 0
package.json

@@ -16,6 +16,7 @@
     "element-ui": "^2.15.1",
     "file-saver": "^2.0.5",
     "jquery": "^3.6.0",
+    "js-pinyin": "^0.1.9",
     "qs": "^6.10.1",
     "v-viewer": "^1.6.4",
     "vant": "^2.12.10",

+ 137 - 62
src/components/pages/addCourse.vue

@@ -75,18 +75,21 @@
               </div>
               <div>填写基本信息</div>
             </div>
-            <div v-if="steps == 2" class="second" @click="navSteps(2)">
-              <div>
-                <img src="../../assets/icon/second.png" alt />
+            <div v-show="cid == ''" class="secondNo">
+              <div v-if="steps == 2" class="newSteps second" @click="navSteps(2)">
+                <div style="margin: 5px 10px 0 0; width: 2rem">
+                  <img src="../../assets/icon/second.png" alt />
+                </div>
+                <div>选择文档模板</div>
               </div>
-              <div>选择文档模板</div>
-            </div>
-            <div v-else class="secondNo" @click="navSteps(2)">
-              <div>
-                <img src="../../assets/icon/secondNo.png" alt />
+              <div v-else class="newSteps secondNo" @click="navSteps(2)">
+                <div>
+                  <img src="../../assets/icon/secondNo.png" alt />
+                </div>
+                <div>选择文档模板</div>
               </div>
-              <div>选择文档模板</div>
             </div>
+
             <div v-if="steps == 3" class="third" @click="navSteps(3)">
               <div>
                 <img src="../../assets/icon/third.png" alt />
@@ -720,7 +723,7 @@
                         教学附件添加
                         <input
                           type="file"
-                          accept="application/pdf, .ppt, .pptx, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+                          accept="application/pdf, .ppt, .pptx, .xlsx, .xls, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                           style="display: none"
                           v-if="inputShow"
                           @change="
@@ -1671,7 +1674,7 @@ export default {
       searchPeople: "",
       userid: this.$route.query.userid,
       oid: this.$route.query.oid,
-      cid: this.$route.query.cid != "" ? this.$route.query.cid : "",
+      cid: this.$route.query.cid != undefined ? this.$route.query.cid : "",
       cover: [], //课程封面
       myWord: [],
       askJson: {
@@ -1747,6 +1750,7 @@ export default {
       toolType: 0,
       inputShow: true,
       toolIndex: 0,
+      cidType: 0,
     };
   },
   computed: {
@@ -1825,67 +1829,125 @@ export default {
         //   "./course.vue?userid=" + this.userid + "&oid=" + this.oid;
         this.goTo("/course?userid=" + this.userid + "&oid=" + this.oid);
       } else {
-        this.steps--;
+        if (this.cidType == 0) {
+          this.steps--;
+        } else {
+          if (this.steps == 3) {
+            this.steps = 1;
+          }
+        }
       }
     },
     navSteps(s) {
-      if (s == 1) {
-        this.steps = 1;
-      }
-      if (s == 2) {
-        this.steps = 2;
-      }
-      if (s == 3) {
-        this.cTemplate = this.templateC.content;
-        this.dialogVisible2 = false;
-        this.steps = 3;
-      }
-    },
-    nextSteps() {
-      if (this.steps == 1) {
-        if (
-          this.courseName != "" &&
-          this.courseText != "" &&
-          this.cover.length != 0
-        ) {
-          this.steps++;
-        } else {
-          this.$message.error("请将信息填写完整");
-          return;
+      if (this.cidType == 0) {
+        if (s == 1) {
+          this.steps = 1;
+        }
+        if (s == 2) {
+          this.steps = 2;
+        }
+        if (s == 3) {
+          this.cTemplate = this.templateC.content;
+          this.dialogVisible2 = false;
+          this.steps = 3;
+        }
+      } else {
+        if (s == 1) {
+          this.steps = 1;
         }
-      } else if (this.steps == 2) {
-        if (this.templateC.id != "" || this.templateC.id != undefined) {
-          // this.$message.error("请选择文档");
-          // return;
+        if (s == 3) {
           this.cTemplate = this.templateC.content;
+          this.dialogVisible2 = false;
+          this.steps = 3;
         }
-        // this.cTemplate = this.templateC.content;
-        this.dialogVisible2 = false;
-        this.steps++;
-      } else if (this.steps == 3) {
-        if (this.cid == "" || this.cid == undefined) {
+      }
+    },
+    nextSteps() {
+      if (this.cidType == 1) {
+        if (this.steps == 1) {
           if (
-            this.courseName == "" ||
-            this.courseText == "" ||
-            this.cover.length == 0
+            this.courseName != "" &&
+            this.courseText != "" &&
+            this.cover.length != 0
           ) {
+            this.steps = 3;
+          } else {
             this.$message.error("请将信息填写完整");
             return;
+          }
+        }else if (this.steps == 3) {
+          if (this.cid == "" || this.cid == undefined) {
+            if (
+              this.courseName == "" ||
+              this.courseText == "" ||
+              this.cover.length == 0
+            ) {
+              this.$message.error("请将信息填写完整");
+              return;
+            } else {
+              this.addWork();
+              this.steps++;
+            }
           } else {
-            this.addWork();
-            this.steps++;
+            if (
+              this.courseName == "" ||
+              this.courseText == "" ||
+              this.cover.length == 0
+            ) {
+              this.$message.error("请将信息填写完整");
+              return;
+            } else {
+              this.updateWork();
+              this.steps++;
+            }
           }
-        } else {
+        }
+      } else {
+        if (this.steps == 1) {
           if (
-            this.courseName == "" ||
-            this.courseText == "" ||
-            this.cover.length == 0
+            this.courseName != "" &&
+            this.courseText != "" &&
+            this.cover.length != 0
           ) {
+            this.steps++;
+          } else {
             this.$message.error("请将信息填写完整");
             return;
+          }
+        } else if (this.steps == 2) {
+          if (this.templateC.id != "" || this.templateC.id != undefined) {
+            // this.$message.error("请选择文档");
+            // return;
+            this.cTemplate = this.templateC.content;
+          }
+          // this.cTemplate = this.templateC.content;
+          this.dialogVisible2 = false;
+          this.steps++;
+        } else if (this.steps == 3) {
+          if (this.cid == "" || this.cid == undefined) {
+            if (
+              this.courseName == "" ||
+              this.courseText == "" ||
+              this.cover.length == 0
+            ) {
+              this.$message.error("请将信息填写完整");
+              return;
+            } else {
+              this.addWork();
+              this.steps++;
+            }
           } else {
-            this.updateWork();
-            this.steps++;
+            if (
+              this.courseName == "" ||
+              this.courseText == "" ||
+              this.cover.length == 0
+            ) {
+              this.$message.error("请将信息填写完整");
+              return;
+            } else {
+              this.updateWork();
+              this.steps++;
+            }
           }
         }
       }
@@ -2012,7 +2074,7 @@ export default {
     addAttText(i) {
       this.AttText = {
         title: "",
-        text:"",
+        text: "",
       };
       this.taskCount = i;
       this.AttTextType = 0;
@@ -2370,12 +2432,10 @@ export default {
         console.log("还不能下载图片喔");
       }
     },
-    deleteChapterData(e, i, j, ic,taskI) {
+    deleteChapterData(e, i, j, ic, taskI) {
       // window.U.UF.EV.stopBubble();
       e.stopPropagation();
-      this.unitJson[i].chapterInfo[j].taskJson[
-        taskI
-      ].chapterData.splice(ic, 1);
+      this.unitJson[i].chapterInfo[j].taskJson[taskI].chapterData.splice(ic, 1);
     },
     updataVideoT(e, i, j, ic) {
       e.stopPropagation();
@@ -2482,6 +2542,7 @@ export default {
             type: "success",
           });
           this.number = this.nbOrder;
+          this.courseId = this.cid;
         })
         .catch((err) => {
           this.$message.error("修改失败");
@@ -2558,7 +2619,7 @@ export default {
     clearAttText() {
       this.AttText = {
         title: "",
-        text:"",
+        text: "",
       };
       this.dialogVisible6 = false;
     },
@@ -2737,7 +2798,7 @@ export default {
     updateLine() {
       this.unitJson[this.unitIndex].chapterInfo[0].taskJson[
         this.taskCount
-      ].chapterData[this.lineCount].url  = this.line;
+      ].chapterData[this.lineCount].url = this.line;
       this.dialogVisible7 = false;
     },
     addPP() {
@@ -2996,6 +3057,7 @@ export default {
       if (this.cid == "" || this.cid == undefined) {
         console.log("这是新增课程");
       } else {
+        this.cidType = 1;
         let params = {
           cid: this.cid,
         };
@@ -4437,4 +4499,17 @@ ol {
 .lineCss >>> .el-form-item__content {
   margin-left: 50px !important;
 }
+.newSteps {
+  display: flex;
+  width: 100% !important;
+  height: 80px;
+  cursor: pointer;
+  margin: 10px 0;
+  border-radius: 10px;
+  flex-direction: row;
+  align-content: center;
+  justify-content: center;
+  align-items: center;
+  margin: 0 !important;
+}
 </style>

+ 338 - 121
src/components/pages/student.vue

@@ -25,7 +25,7 @@
         </div>
         <div class="head_right">
           <el-button @click="addStudent">添加学生</el-button>
-          <!-- <el-upload
+          <el-upload
             class="upload-demo"
             :http-request="handleChange"
             :on-remove="handleRemove"
@@ -34,9 +34,12 @@
             accept=".xlsx"
           >
             <el-button size="primary" type="primary">批量添加</el-button>
-            <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div>
+            <div slot="tip" class="el-upload__tip">
+              只能上传jpg/png文件,且不超过500kb
+            </div>
           </el-upload>
-          <div @click="getExcel">xls 上传样例</div> -->
+          <!-- <el-button @click="exportExcel">导出学生</el-button> -->
+          <div @click="getExcel">xls 上传样例</div>
         </div>
       </div>
     </div>
@@ -66,7 +69,17 @@
                     alt=""
                   />
                 </div>
-                <div style="width:50px;text-align:left;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">{{ scope.row.name }}</div>
+                <div
+                  style="
+                    width: 50px;
+                    text-align: left;
+                    white-space: nowrap;
+                    overflow: hidden;
+                    text-overflow: ellipsis;
+                  "
+                >
+                  {{ scope.row.name }}
+                </div>
               </div>
             </template>
           </el-table-column>
@@ -77,14 +90,13 @@
             align="center"
           >
           </el-table-column>
-          <!-- <el-table-column
-            prop="sex"
-            label="性别"
+          <el-table-column
+            prop="studentid"
+            label="学号"
             min-width="10"
             align="center"
           >
-            {{ this.tableData.sex ? this.tableData.sex : "男" }}
-          </el-table-column> -->
+          </el-table-column>
           <!-- <el-table-column
             prop="school"
             label="学校"
@@ -92,13 +104,13 @@
             align="center"
           >
           </el-table-column> -->
-          <el-table-column
+          <!-- <el-table-column
             prop="classname"
             label="班级"
             min-width="15"
             align="center"
           >
-          </el-table-column>
+          </el-table-column> -->
           <el-table-column label="操作" min-width="20">
             <template slot-scope="scope">
               <!-- <el-button
@@ -154,6 +166,16 @@
             ></el-input>
           </span>
         </el-form-item>
+        <el-form-item label="学生学号" :label-width="formLabelWidth">
+          <span>
+            <el-input
+              placeholder="请输入学生学号"
+              clearable
+              v-model="sId"
+              class="add_input"
+            ></el-input>
+          </span>
+        </el-form-item>
         <el-form-item label="学生手机号" :label-width="formLabelWidth">
           <span>
             <el-input
@@ -205,6 +227,7 @@
 
 <script>
 import $ from "jquery";
+import pinyin from "../../../node_modules/js-pinyin/index";
 export default {
   data() {
     return {
@@ -215,6 +238,7 @@ export default {
       dialogVisible: false,
       sName: "",
       sPhone: "",
+      sId: "",
       schoolName: "",
       // sBySchool: [],
       // sBySchoolName:"",
@@ -273,14 +297,7 @@ export default {
     getExcel(res) {
       require.ensure([], () => {
         const { export_json_to_excel } = require("../../common/Export2Excel");
-        const tHeader = [
-          "学生姓名",
-          "学生手机号",
-          "性别",
-          "学校",
-          "班级",
-          "(注:导入学校为:" + this.schoolName + ")",
-        ];
+        const tHeader = ["学号", "学生姓名", "学生邮箱", "学生手机号", "班级"];
         const data = [];
         export_json_to_excel(tHeader, data, "上传学生样例");
       });
@@ -309,6 +326,9 @@ export default {
       if (this.sName === "") {
         this.$message.error("学生昵称不能为空");
         return;
+      } else if (this.sId === "") {
+        this.$message.error("学生学号不能为空");
+        return;
       } else if (this.sPhone === "") {
         this.$message.error("学生手机号不能为空");
         return;
@@ -339,7 +359,19 @@ export default {
                   if (res.data[0].length > 0) {
                     this.$message.error("此学生邮箱已被注册");
                   } else {
-                    this.add_Student();
+                    let params = { un: this.sId };
+                    this.ajax
+                      .get(this.$store.state.api + "findSid", params)
+                      .then((res) => {
+                        if (res.data[0].length > 0) {
+                          this.$message.error("此学生学号已被注册");
+                        } else {
+                          this.add_Student();
+                        }
+                      })
+                      .catch((err) => {
+                        console.error(err);
+                      });
                   }
                 })
                 .catch((err) => {
@@ -373,10 +405,11 @@ export default {
             {
               userid: res.data.uid,
               username: this.sName,
+              sid: this.sId,
               type: 2,
               oid: res.data.oid,
               phone: res.data.ph,
-              cid:res.data.cid,
+              cid: res.data.cid,
               intro: "",
               sex: "0",
             },
@@ -494,6 +527,52 @@ export default {
     handleRemove(file, fileList) {
       this.fileTemp = null;
     },
+    exportExcel() {
+      try {
+        let params = {
+          oid: this.oid,
+        };
+        this.ajax
+          .get(this.$store.state.api + "selectUserBySchool", params)
+          .then((res) => {
+            var res = res.data[0];
+            //如果value的json字段的key值和想要的headers值不一致时,可做如下更改
+            //将和下面的Object.fromEntries结合,将json字段的key值改变为要求的excel的header值
+            var array = [];
+            for (var i = 0; i < res.length; i++) {
+              var _json = {};
+              _json["用户名"] = res[i].username;
+              _json["姓名"] = res[i].alias ? res[i].alias : "";
+              _json["班级"] = res[i].classid ? res[i].classid : "";
+              array.push(_json);
+            }
+
+            var XLSX = require("xlsx");
+            const workbook = XLSX.utils.book_new(); //创建一个新的工作簿对象
+            let ws = XLSX.utils.json_to_sheet(array); //将json对象数组转化成工作表
+            ws["!cols"] = [
+              //设置每一列的宽度
+              { wch: 50 },
+              { wch: 50 },
+              { wch: 50 },
+            ];
+            XLSX.utils.book_append_sheet(workbook, ws, "sheet1"); //把sheet添加到workbook里,第三个参数是sheet名
+            XLSX.writeFile(workbook, "学生信息.xlsx");
+            // const wopts = { bookType: "xlsx", bookSST: false, type: "array" };//写入的样式bookType:输出的文件类型,type:输出的数据类型,bookSST: 是否生成Shared String Table,官方解释是,如果开启生成速度会下降,但在低版本IOS设备上有更好的兼容性
+            // const wbout = XLSX.write(workbook, wopts);// 浏览器端和node共有的API,实际上node可以直接使用xlsx.writeFile来写入文件,但是浏览器没有该API
+            // FileSaver.saveAs(new Blob([wbout], { type: "application/octet-stream" }), `${title} demo.xlsx`);//保存文件
+            this.$message({
+              message: "导出成功",
+              type: "success",
+            });
+          })
+          .catch((err) => {
+            console.error(err);
+          });
+      } catch (e) {
+        console.log(e, e.stack);
+      }
+    },
     importfxx(obj) {
       const loading = this.$loading.service({
         background: "rgba(255, 255, 255, 0.7)",
@@ -537,10 +616,13 @@ export default {
           let arr = [];
           this.da.map((v) => {
             let obj = {};
-            obj.name = v["学生名称"];
+            let a = "";
+            a =
+              pinyin.getFullChars(v["学生姓名"]).toLowerCase() + "@cocorobo.cc";
+            obj.sId = v["学号"];
+            obj.name = v["学生姓名"];
+            obj.mail = v["学生邮箱"] != undefined ? v["学生邮箱"] : a;
             obj.phone = v["学生手机号"];
-            // obj.sex = v["性別"];
-            // obj.school = this.$store.state.userInfo.organizeid;
             obj.class = v["班级"];
             arr.push(obj);
           });
@@ -556,13 +638,30 @@ export default {
               _b = 1;
               _this.$message.error("学生姓名不能为空,请重新上传");
               break;
-            } else if (item.phone === "") {
+            } else if (item.sId === "") {
               _b = 1;
-              _this.$message.error("学生手机号不能为空,请重新上传");
+              _this.$message.error("学生学号不能为空,请重新上传");
+            }
+            // else if (item.phone === "") {
+            //   _b = 1;
+            //   _this.$message.error("学生手机号不能为空,请重新上传");
+            //   break;
+            // } else if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(item.phone)) {
+            //   _b = 1;
+            //   _this.$message.error("有学生手机号格式不正确,请重新上传");
+            //   break;
+            // }
+            else if (item.mail === "") {
+              _b = 1;
+              _this.$message.error("学生邮箱不能为空,请重新上传");
               break;
-            } else if (!/^[1][3,4,5,7,8][0-9]{9}$/.test(item.phone)) {
+            } else if (
+              !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
+                item.mail
+              )
+            ) {
               _b = 1;
-              _this.$message.error("有学生手机号格式不正确,请重新上传");
+              _this.$message.error("有学生邮箱格式不正确,请重新上传");
               break;
             }
             //  else if (item.school === "") {
@@ -575,40 +674,40 @@ export default {
             // 	_this.$message.error("学生性别不能为空,请重新上传");
             // 	break;
             // }
-            if (item.class != "") {
-              let _a;
-              let params = {
-                className: item.class,
-              };
+            // if (item.class != "") {
+            //   let _a;
+            //   let params = {
+            //     className: item.class,
+            //   };
 
-              _$.ajax({
-                url: _this.$store.state.api + "selectC", //url路径
-                type: "GET", //GET
-                async: false, //或false,是否异步
-                data: params,
-                timeout: 5000, //超时时间
-                dataType: "json", //返回的数据格式:
-                beforeSend: function (xhr) {},
-                success: function (res, textStatus, jqXHR) {
-                  if (res[0].length == 0) {
-                    _a = 1;
-                    _this.$message.error(
-                      "有学生班级不存在,请去添加后并重新上传"
-                    );
-                  } else {
-                    item.classid = res[0][0].id;
-                  }
-                },
-                error: function (xhr, textStatus) {
-                  console.log(textStatus);
-                },
-                complete: function () {},
-              });
-              if (_a == 1) {
-                _b = 1;
-                break;
-              }
-            }
+            //   _$.ajax({
+            //     url: _this.$store.state.api + "selectC", //url路径
+            //     type: "GET", //GET
+            //     async: false, //或false,是否异步
+            //     data: params,
+            //     timeout: 5000, //超时时间
+            //     dataType: "json", //返回的数据格式:
+            //     beforeSend: function (xhr) {},
+            //     success: function (res, textStatus, jqXHR) {
+            //       if (res[0].length == 0) {
+            //         _a = 1;
+            //         _this.$message.error(
+            //           "有学生班级不存在,请去添加后并重新上传"
+            //         );
+            //       } else {
+            //         item.classid = res[0][0].id;
+            //       }
+            //     },
+            //     error: function (xhr, textStatus) {
+            //       console.log(textStatus);
+            //     },
+            //     complete: function () {},
+            //   });
+            //   if (_a == 1) {
+            //     _b = 1;
+            //     break;
+            //   }
+            // }
             // if (item.school != "") {
             // 	let _a;
             // 	let params = {
@@ -643,69 +742,187 @@ export default {
             // 		break;
             // 	}
             // }
-            if (item.phone != "") {
-              let params = { un: item.phone };
-              let _a;
-              _$.ajax({
-                url: _this.$store.state.api + "findPhone", //url路径
-                type: "GET", //GET
-                async: false, //或false,是否异步
-                data: params,
-                timeout: 5000, //超时时间
-                dataType: "json", //返回的数据格式:
-                beforeSend: function (xhr) {},
-                success: function (res, textStatus, jqXHR) {
-                  if (res[0].length > 0) {
-                    _this.$message.error("此学生手机号码已被注册");
-                    _a = 1;
-                  }
-                },
-                error: function (xhr, textStatus) {
-                  console.log(textStatus);
-                },
-                complete: function () {},
-              });
-              if (_a == 1) {
-                _b = 1;
-                break;
-              }
-            }
-            _b = 2;
-          }
-          if (_b == 2) {
-            for (var i = 0; i < arr.length; i++) {
-              let _i = i;
-              let item = arr[i];
-              let params = {
-                ph: item.phone,
-                username: item.name,
+            //   for (var k = 0; k < arr.length; k++) {
+            //     if (item.phone != "") {
+            //       let params = { un: item.phone };
+            //       let _a;
+            //       _$.ajax({
+            //         url: _this.$store.state.api + "findPhone", //url路径
+            //         type: "GET", //GET
+            //         async: false, //或false,是否异步
+            //         data: params,
+            //         timeout: 5000, //超时时间
+            //         dataType: "json", //返回的数据格式:
+            //         beforeSend: function (xhr) {},
+            //         success: function (res, textStatus, jqXHR) {
+            //           if (res[0].length > 0) {
+            //             _this.$message.error("有学生手机号码已被注册");
+            //             _a = 1;
+            //           }
+            //         },
+            //         error: function (xhr, textStatus) {
+            //           console.log(textStatus);
+            //         },
+            //         complete: function () {},
+            //       });
+            //       if (_a == 1) {
+            //         _b = 1;
+            //         break;
+            //       }
+            //     }
+            //     if (item.mail != "") {
+            //       let params = { un: item.mail };
+            //       let _a;
+            //       _$.ajax({
+            //         url: _this.$store.state.api + "findMail", //url路径
+            //         type: "GET", //GET
+            //         async: false, //或false,是否异步
+            //         data: params,
+            //         timeout: 5000, //超时时间
+            //         dataType: "json", //返回的数据格式:
+            //         beforeSend: function (xhr) {},
+            //         success: function (res, textStatus, jqXHR) {
+            //           if (res[0].length > 0) {
+            //             _this.$message.error("有学生邮箱已被注册");
+            //             _a = 1;
+            //           }
+            //         },
+            //         error: function (xhr, textStatus) {
+            //           console.log(textStatus);
+            //         },
+            //         complete: function () {},
+            //       });
+            //       if (_a == 1) {
+            //         _b = 1;
+            //         break;
+            //       }
+            //     }
+            //     if (item.sId != "") {
+            //       let params = { un: item.sId };
+            //       let _a;
+            //       _$.ajax({
+            //         url: _this.$store.state.api + "findSid", //url路径
+            //         type: "GET", //GET
+            //         async: false, //或false,是否异步
+            //         data: params,
+            //         timeout: 5000, //超时时间
+            //         dataType: "json", //返回的数据格式:
+            //         beforeSend: function (xhr) {},
+            //         success: function (res, textStatus, jqXHR) {
+            //           if (res[0].length > 0) {
+            //             _this.$message.error("有学生学号重复");
+            //             _a = 1;
+            //           }
+            //         },
+            //         error: function (xhr, textStatus) {
+            //           console.log(textStatus);
+            //         },
+            //         complete: function () {},
+            //       });
+            //       if (_a == 1) {
+            //         _b = 1;
+            //         break;
+            //       }
+            //     }
+            //     _b = 2;
+            //   }
+            // }
+            // if (_b == 2) {
+            let z = 2;
+            let newArr = JSON.stringify(arr);
+            let params = [
+              {
+                arr: newArr,
                 userpassword: 123456,
-                type: 2,
-                // oid: item.schoolid,
                 oid: _this.oid,
-                tid: _this.userid,
-                cid: item.classid,
-              };
+              },
+            ];
+            _this.ajax
+              .post(_this.$store.state.api + "batchRegistrationMore", params)
+              .then((res) => {
+                if (res.data.type == 1) {
+                  _this.$message.error("有学生手机号码已被注册");
+                  z = 1;
+                }
+                if (res.data.type == 2) {
+                  _this.$message.error("有学生邮箱已被注册");
+                  z = 1;
+                }
+                if (res.data.type == 3) {
+                  _this.$message.error("有学生学号重复");
+                  z = 1;
+                }
+                if (z == 2) {
+                  _this.$message({
+                    message: "新增成功",
+                    type: "success",
+                  });
+                }
+                loading.close();
+              })
+              .catch((err) => {
+                console.error(err);
+              });
+            // for (var i = 0; i < arr.length; i++) {
+            //   let _i = i;
+            //   let item = arr[i];
+            //   let params = [
+            //     {
+            //       alias: item.name,
+            //       username: item.mail,
+            //       userpassword: 123456,
+            //       oid: _this.oid,
+            //       ph: item.phone,
+            //       cid: item.class,
+            //     },
+            //   ];
 
-              _this.ajax
-                .get(_this.$store.state.api + "insertStudent", params)
-                .then((res) => {
-                  if (_i == arr.length - 1) {
-                    loading.close();
-                    _this.$message({
-                      message: "上传成功",
-                      type: "success",
-                    });
-                    _this.getStudent();
-                  }
-                })
-                .catch((err) => {
-                  _this.$message.error("添加失败");
-                  console.error(err);
-                });
-            }
-          } else {
-            loading.close();
+            //   _this.ajax
+            //     .post(_this.$store.state.api + "batchRegistration", params)
+            //     .then((res) => {
+            //       let params = [
+            //         {
+            //           userid: res.data.uid,
+            //           username: item.name,
+            //           sId: item.sId,
+            //           type: 2,
+            //           oid: res.data.oid,
+            //           phone: res.data.ph ? res.data.ph : "",
+            //           cid: res.data.cid ? res.data.cid : "",
+            //           intro: "",
+            //           sex: "0",
+            //         },
+            //       ];
+            //       _this.ajax
+            //         .post(_this.$store.state.api + "updateUserByEdu", params)
+            //         .then((res) => {
+            //           console.log(res);
+            //         })
+            //         .catch((err) => {
+            //           console.error(err);
+            //         });
+            //       loading.close();
+            //       // _this.$message({
+            //       //   message: "新增成功",
+            //       //   type: "success",
+            //       // });
+            //       _this.getStudent();
+            //       // if (_i == arr.length - 1) {
+            //       //   loading.close();
+            //       //   _this.$message({
+            //       //     message: "上传成功",
+            //       //     type: "success",
+            //       //   });
+            //       //   _this.getStudent();
+            //       // }
+            //     })
+            //     .catch((err) => {
+            //       _this.$message.error("上传失败");
+            //       console.error(err);
+            //     });
+            // }
+            // } else {
+            //   loading.close();
           }
 
           _this.fileListUpload = [];

Some files were not shown because too many files changed in this diff