lsc 1 년 전
부모
커밋
6727bba235

+ 1 - 1
dist/index.html

@@ -25,7 +25,7 @@
       height: 100%;
       width: 100%;
       background: #e6eaf0;
-    }</style><link href=./static/css/app.149d727fa89bdb0a6e9e8d50de254ea5.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3512a67a6213c2df4180.js></script><script type=text/javascript src=./static/js/vendor.76fd85af8d485ac3a12b.js></script><script type=text/javascript src=./static/js/app.40abd4b28168c683a7f9.js></script></body></html><script>function stopSafari() {
+    }</style><link href=./static/css/app.af334cb6c944734ce4a1874392cb8574.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.3512a67a6213c2df4180.js></script><script type=text/javascript src=./static/js/vendor.76fd85af8d485ac3a12b.js></script><script type=text/javascript src=./static/js/app.93733e0c3196dccdbf89.js></script></body></html><script>function stopSafari() {
     //阻止safari浏览器双击放大功能
     let lastTouchEnd = 0  //更新手指弹起的时间
     document.documentElement.addEventListener("touchstart", function (event) {

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/static/css/app.149d727fa89bdb0a6e9e8d50de254ea5.css.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/static/css/app.af334cb6c944734ce4a1874392cb8574.css


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/static/css/app.af334cb6c944734ce4a1874392cb8574.css.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/static/js/app.93733e0c3196dccdbf89.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/static/js/app.93733e0c3196dccdbf89.js.map


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
dist/static/js/manifest.3512a67a6213c2df4180.js.map


BIN
src/assets/icon/studentManage/class-a.png


BIN
src/assets/icon/studentManage/class.png


BIN
src/assets/icon/studentManage/grade-a.png


BIN
src/assets/icon/studentManage/grade.png


BIN
src/assets/icon/studentManage/student-a.png


BIN
src/assets/icon/studentManage/student.png


+ 107 - 113
src/components/pages/library.vue

@@ -3,32 +3,18 @@
     <div class="pb_head top">
       <span>素材库</span>
       <div v-if="choose == 0" @click="addImg($event)">
-        <input
-          type="file"
-          accept="image/*"
-          capture="camera"
-          style="display: none"
-          @change="beforeUpload1($event, 1)"
-        />
+        <input type="file" accept="image/*" capture="camera" style="display: none" @change="beforeUpload1($event, 1)" />
         <div class="uploadThing">上传图片</div>
       </div>
       <div v-if="choose == 1" @click="addImg($event)">
-        <input
-          type="file"
-          accept="video/mp4,video/quicktime,video/x-msvideo"
-          capture="camera"
-          style="display: none"
-          @change="beforeUpload2($event, 2)"
-        />
+        <input type="file" accept="video/mp4,video/quicktime,video/x-msvideo" capture="camera" style="display: none"
+          @change="beforeUpload2($event, 2)" />
         <div class="uploadThing">上传视频</div>
       </div>
       <div v-if="choose == 2" @click="addImg($event)">
-        <input
-          type="file"
+        <input type="file"
           accept="application/pdf,.ppt,.pptx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"
-          style="display: none"
-          @change="beforeUpload2($event, 3)"
-        />
+          style="display: none" @change="beforeUpload2($event, 3)" />
         <div class="uploadThing">上传附件</div>
       </div>
     </div>
@@ -40,92 +26,85 @@
           <div :class="choose == 2 ? 'choose' : ''" @click="sMtl(2)">附件</div>
         </div>
       </div>
-      <div class="student_table">
+      <div class="student_table" v-loading="isLoading">
         <div v-if="this.choose == 0" class="boxCss">
           <div class="out_box" v-for="(item, index) in chapInfo" :key="index">
             <div class="tup">
-              <img
-                :src="
-                  item.chapdataInfo ? JSON.parse(item.chapdataInfo).url : mtp
-                "
-                alt=""
-                @click="
-                  handlePictureCardPreview(JSON.parse(item.chapdataInfo).url)
-                "
-              />
+              <img :src="item.chapdataInfo ? JSON.parse(item.chapdataInfo).url : mtp
+                " alt="" @click="
+    handlePictureCardPreview(JSON.parse(item.chapdataInfo).url)
+    " />
               <div class="deleteWord" @click="deleteM(item.id)">
                 <img src="../../assets/icon/delete.png" alt="" />
               </div>
             </div>
             <div class="bottom_box">
-              <div>
-                {{
-                  item.chapdataInfo
+              <el-tooltip :content="item.chapdataInfo
+                ? JSON.parse(item.chapdataInfo).name
+                : '暂无名称'" placement="top" effect="dark">
+                <div>
+                  {{
+                    item.chapdataInfo
                     ? JSON.parse(item.chapdataInfo).name
-                    : "图片暂无名称"
-                }}
-              </div>
+                    : "暂无名称"
+                  }}
+                </div>
+              </el-tooltip>
             </div>
           </div>
         </div>
         <div v-if="this.choose == 1" class="boxCss">
           <div class="out_box" v-for="(item, index) in chapInfo" :key="index">
             <div class="tup">
-              <img
-                :src="msp"
-                alt=""
-                @click="
-                  handlePictureCardPreview1(JSON.parse(item.chapdataInfo).url)
-                "
-              />
+              <img :src="msp" alt="" @click="
+                handlePictureCardPreview1(JSON.parse(item.chapdataInfo).url)
+                " />
               <div class="deleteWord" @click="deleteM(item.id)">
                 <img src="../../assets/icon/delete.png" alt="" />
               </div>
             </div>
             <div class="bottom_box">
-              <div>
-                {{
-                  item.chapdataInfo
+              <el-tooltip :content="item.chapdataInfo
+                ? JSON.parse(item.chapdataInfo).name
+                : '暂无名称'" placement="top" effect="dark">
+                <div>
+                  {{
+                    item.chapdataInfo
                     ? JSON.parse(item.chapdataInfo).name
-                    : "图片暂无名称"
-                }}
-              </div>
+                    : "暂无名称"
+                  }}
+                </div>
+              </el-tooltip>
             </div>
           </div>
         </div>
         <div v-if="this.choose == 2" class="boxCss">
           <div class="out_box" v-for="(item, index) in chapInfo" :key="index">
             <div class="tup">
-              <img
-                :src="mfj"
-                alt=""
-                @click="downFile(JSON.parse(item.chapdataInfo).url)"
-              />
+              <img :src="mfj" alt="" @click="downFile(JSON.parse(item.chapdataInfo).url)" />
               <div class="deleteWord" @click="deleteM(item.id)">
                 <img src="../../assets/icon/delete.png" alt="" />
               </div>
             </div>
             <div class="bottom_box">
-              <div>
-                {{
-                  item.chapdataInfo
+              <el-tooltip :content="item.chapdataInfo
+                ? JSON.parse(item.chapdataInfo).name
+                : '暂无名称'" placement="top" effect="dark">
+                <div>
+                  {{
+                    item.chapdataInfo
                     ? JSON.parse(item.chapdataInfo).name
-                    : "图片暂无名称"
-                }}
-              </div>
+                    : "暂无名称"
+                  }}
+                </div>
+              </el-tooltip>
             </div>
           </div>
         </div>
       </div>
       <div class="student_page">
-        <el-pagination
-          background
-          layout="prev, pager, next"
-          :page-size="10"
-          :total="total"
-          v-if="page && chapInfo.length"
-          @current-change="handleCurrentChange"
-        >
+        <el-pagination background layout="prev, pager, next" :page-size="10" :total="total" v-if="page && chapInfo.length"
+          @current-change="handleCurrentChange">
         </el-pagination>
       </div>
     </div>
@@ -133,26 +112,15 @@
       <img width="100%" :src="dialogImageUrl" alt="" />
     </el-dialog>
     <el-dialog :visible.sync="vedioDialog" size="tiny">
-      <video-player
-        class="video-player vjs-custom-skin"
-        ref="videoPlayer"
-        :playsinline="true"
-        :options="playerO"
-        @play="onPlayerPlay($event)"
-        style="width: 100%; height: 100%"
-      ></video-player>
+      <video-player v-if="vedioDialog" class="video-player vjs-custom-skin" ref="videoPlayer" :playsinline="true"
+        :options="playerO" @play="onPlayerPlay($event)" style="width: 100%; height: 100%"></video-player>
     </el-dialog>
     <div v-if="proVisible" class="mask">
       <div class="progressBox">
         <div class="lbox">
           <img :src="require('../../assets/loading.gif')" />上传中,请稍后
         </div>
-        <el-progress
-          :text-inside="true"
-          :stroke-width="20"
-          :percentage="progress"
-          style="width: 80%"
-        ></el-progress>
+        <el-progress :text-inside="true" :stroke-width="20" :percentage="progress" style="width: 80%"></el-progress>
       </div>
     </div>
   </div>
@@ -168,8 +136,8 @@ export default {
       isLoading: false,
       noneBtnImg: false,
       mtp: require("../../assets/tup1.png"),
-      msp: require("../../assets/sp1.png"),
-      mfj: require("../../assets/uploadImg.png"),
+      msp: require("../../assets/icon/fileIcon/isVideo.png"),
+      mfj: require("../../assets/icon/fileIcon/word2.png"),
       page: 1,
       total: 0,
       dialogImageUrl: "",
@@ -220,7 +188,9 @@ export default {
       this.noneBtnImg = _tmp.length >= 1;
     },
     downFile(url) {
-      window.open(url);
+      window.open( "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/"+encodeURIComponent(url.split(
+          "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/"
+        )[1]));
     },
     beforeUpload1(event, type) {
       var file = event.target.files[0];
@@ -275,7 +245,6 @@ export default {
               });
               _this.addMtl();
               _this.cImgInfo = [];
-              _this.selectMtl();
               _this.imgChange(null, null, type);
               console.log(data.Location);
             }
@@ -305,7 +274,8 @@ export default {
 
       var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
       var _this = this;
-
+      _this.progress = 0;
+      _this.proVisible = true;
       if (file) {
         var params = {
           Key:
@@ -328,8 +298,13 @@ export default {
           .on("httpUploadProgress", function (evt) {
             //这里可以写进度条
             // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
+            _this.progress = parseInt((evt.loaded * 80) / evt.total);
           })
           .send(function (err, data) {
+            _this.progress = 100;
+            setTimeout(() => {
+              _this.proVisible = false;
+            }, 1000);
             if (err) {
               var a = _this.$refs.upload1.uploadFiles;
               a.splice(a.length - 1, a.length);
@@ -342,7 +317,6 @@ export default {
                 });
                 _this.addMtl();
                 _this.cImgInfo = [];
-                _this.selectMtl();
                 _this.imgChange(null, null, type);
               } else if (type == 3) {
                 _this.cImgInfo.push({
@@ -351,7 +325,6 @@ export default {
                 });
                 _this.addMtl();
                 _this.cImgInfo = [];
-                _this.selectMtl();
                 _this.imgChange(null, null, type);
               }
               console.log(data.Location);
@@ -369,6 +342,7 @@ export default {
         .get(this.$store.state.api + "addMtl", params)
         .then((res) => {
           this.$message.success("上传素材成功");
+          this.selectMtl();
         })
         .catch((err) => {
           console.error(err);
@@ -398,23 +372,33 @@ export default {
         });
     },
     deleteM(id) {
-      this.isLoading = true;
-      let params = {
-        id: id,
-      };
-      this.ajax
-        .get(this.$store.state.api + "deleteM", params)
-        .then((res) => {
-          this.isLoading = false;
-          this.$message.success("删除成功");
-          this.selectMtl();
+      this
+        .$confirm("确定删除吗", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
         })
-        .catch((err) => {
-          this.isLoading = false;
-          console.error(err);
+        .then(() => {
+          let params = {
+            id: id,
+          };
+          this.ajax
+            .get(this.$store.state.api + "deleteM", params)
+            .then((res) => {
+              this.$message.success("删除成功");
+              this.selectMtl();
+            })
+            .catch((err) => {
+              this.isLoading = false;
+              console.error(err);
+            });
+        })
+        .catch(() => {
+
         });
+
     },
-    onPlayerPlay() {},
+    onPlayerPlay() { },
   },
   created() {
     this.selectMtl();
@@ -428,13 +412,15 @@ export default {
 																														overflow: hidden;
 																														height: 40px;
 																													} */
-.student_head >>> .el-button--primary {
+.student_head>>>.el-button--primary {
   background-color: #2268bc;
 }
+
 .student_head {
   display: flex;
   justify-content: space-between;
 }
+
 .three {
   display: flex;
   flex-direction: row;
@@ -443,7 +429,7 @@ export default {
   height: 30px;
 }
 
-.three > div {
+.three>div {
   cursor: pointer;
 }
 
@@ -459,13 +445,13 @@ export default {
 }
 
 .tup {
-  width: 200px;
-  height: 191px;
+  width: calc(100% - 20px);
+  height: 120px;
   margin: 0 auto;
   position: relative;
 }
 
-.tup:hover .deleteWord {
+.out_box:hover .deleteWord {
   display: block;
 }
 
@@ -479,20 +465,22 @@ export default {
   display: none;
 }
 
-.tup > img,
-.deleteWord > img {
+.tup>img,
+.deleteWord>img {
   width: 100%;
   height: 100%;
+  object-fit: cover;
 }
 
 .out_box {
   display: flex;
   flex-direction: column;
   flex-wrap: nowrap;
-  width: 250px;
+  width: 235px;
   padding: 10px 0;
   background: #fff;
-  margin: 0 25px 15px 0;
+  margin: 0 20px 20px 0;
+  height: fit-content;
 }
 
 .bottom_box {
@@ -501,13 +489,15 @@ export default {
   margin: 0 auto;
   padding: 10px 0 5px 0;
 }
-.bottom_box > div:nth-child(1) {
+
+.bottom_box>div:nth-child(1) {
   white-space: nowrap;
   text-overflow: ellipsis;
   overflow: hidden;
   word-break: break-all;
   width: 200px;
 }
+
 .uploadThing {
   background: #2268bc;
   width: 90px;
@@ -524,9 +514,11 @@ export default {
   display: flex;
   justify-content: space-between;
 }
+
 .student_page {
   margin-top: 30px;
 }
+
 .boxCss {
   padding: 15px 5px;
   display: flex;
@@ -547,6 +539,7 @@ export default {
   align-items: center;
   justify-content: center;
 }
+
 .progressBox {
   width: 500px;
   height: 180px;
@@ -558,6 +551,7 @@ export default {
   justify-content: center;
   flex-direction: column;
 }
+
 .progressBox .lbox {
   height: 100px;
   font-size: 19px;
@@ -570,7 +564,7 @@ export default {
   margin-right: 20px;
 }
 
-.progressBox >>> .el-progress-bar__outer {
+.progressBox>>>.el-progress-bar__outer {
   background-color: #d1dfff !important;
 }
 </style>

+ 1430 - 0
src/components/pages/studentManage/class.vue

@@ -0,0 +1,1430 @@
+<template>
+  <div class="pb_content" style="background: unset">
+    <div class="sm_box">
+      <div class="sm_left"></div>
+      <div class="sm_right">
+        <div v-if="ctype == 1" class="pb_content_body" style="
+        background: #fff;
+        padding: 0px 25px;
+        box-sizing: border-box;
+        border-radius: 5px;
+      ">
+          <div class="pb_head top">
+            <div style="display: flex; align-items: center">
+              <span>班级管理</span>
+            </div>
+            <div style="border-radius: 4px">
+              <el-button type="primary" class="bgColor student_button" @click="dialogVisible = true">添加班级</el-button>
+            </div>
+          </div>
+          <div class="student_head">
+            <div class="student_search">
+              <span>
+                <el-input placeholder="请输入班级名称" v-model="sClassName" clearable class="student_input">
+                </el-input>
+              </span>
+              <el-button type="primary" @click="searchClass" class="student_button">查询</el-button>
+            </div>
+          </div>
+        </div>
+        <div class="pb_content_body" v-if="ctype == 1">
+          <div class="student_table">
+            <el-table v-if="ctype == 1" ref="table" :key="1" :data="tableData" border :height="tableHeight" :fit="true"
+              v-loading="isLoading" style="width: 100%; height: 60%" :header-cell-style="{ background: '#f1f1f1' }"
+              :row-class-name="tableRowClassName">
+              <el-table-column prop="name" label="班级名称" align="center">
+              </el-table-column>
+              <el-table-column label="所属年级" align="center">
+                <template slot-scope="{ row }">
+                  {{ getGrade(row.pid) }}
+                </template>
+              </el-table-column>
+              <el-table-column prop="pnum" label="人数" align="center">
+              </el-table-column>
+              <el-table-column label="操作" width="600px">
+                <template slot-scope="scope">
+                  <div class="classButtonBox">
+                    <el-button type="primary" size="small" @click="getStudent(scope.row.id)">查看学生</el-button>
+                    <el-button type="primary" size="small" @click="updateG(scope.row.pid, scope.row.id)">修改年级</el-button>
+                    <el-button type="primary" size="small"
+                      @click="openUpdate(scope.row.id, scope.row.name)">修改名称</el-button>
+                    <el-button class="de_button" type="primary" size="small" @click="
+                      goTo(
+                        '/studentEva?userid=' +
+                        userid +
+                        '&oid=' +
+                        oid +
+                        '&org=' +
+                        org +
+                        '&cid=' +
+                        scope.row.id +
+                        '&role=' +
+                        role
+                      )
+                      ">查看评价</el-button>
+                    <el-button type="primary" size="small" @click="deleteClass(scope.row.id)">删除</el-button>
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+          <div class="student_page">
+            <el-pagination background layout="prev, pager, next" :page-size="10" :total="total" v-if="page"
+              @current-change="handleCurrentChange">
+            </el-pagination>
+          </div>
+        </div>
+        <div v-if="ctype == 2" class="pb_content_body" style="
+        background: #fff;
+        padding: 0px 25px;
+        box-sizing: border-box;
+        border-radius: 5px;
+      ">
+          <div class="pb_head top">
+            <span>查看学生</span>
+            <div style="border-radius: 4px">
+              <el-button type="primary" class="bgColor student_button" @click="(ctype = 1), getClass()">返回</el-button>
+            </div>
+          </div>
+          <div class="student_head">
+            <div class="head_left">
+              <el-input v-model="sPhoneUser" class="student_input" placeholder="请输入用户名"></el-input>
+              <el-select disabled v-model="cid" placeholder="请选择班级" class="student_input" @change="searchStudent">
+                <el-option label="所有人" value=""></el-option>
+                <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name"
+                  :value="item.id"></el-option>
+              </el-select>
+              <el-button type="primary" class="student_button" @click="searchStudent">查询</el-button>
+            </div>
+            <div class="head_right">
+              <el-button @click="addStudent" class="student_button">添加学生</el-button>
+            </div>
+          </div>
+        </div>
+        <div class="pb_content_body" v-if="ctype == 2">
+          <div class="student_table">
+            <el-table v-if="ctype == 2" :key="2" ref="table2" :data="tableData2" border :height="tableHeight" :fit="true"
+              v-loading="isLoading" style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
+              :row-class-name="tableRowClassName">
+              <el-table-column label="姓名" min-width="10" align="center">
+                <template slot-scope="scope">
+                  <div class="userImg">
+                    <div class="tx">
+                      <img :src="scope.row.headportrait != null
+                          ? scope.row.headportrait
+                          : tx
+                        " alt />
+                    </div>
+                    <div style="
+                    width: 150px;
+                    text-align: left;
+                    white-space: nowrap;
+                    overflow: hidden;
+                    text-overflow: ellipsis;
+                  ">
+                      {{ scope.row.name }}
+                    </div>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="学生账号" min-width="15" align="center">
+                <template slot-scope="scope">
+                  <div>{{ scope.row.un ? scope.row.un : "" }}</div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="classname2" label="班级" min-width="15" align="center">
+              </el-table-column>
+              <el-table-column label="操作" width="250px">
+                <template slot-scope="scope">
+                  <div class="btnBox">
+                    <el-button class="de_button" type="primary" size="small"
+                      @click="iniPassword(scope.row.userid)">初始化密码</el-button>
+                    <el-button class="de_button" type="primary" size="small"
+                      @click="updateStudentA(scope.row)">修改</el-button>
+                    <el-button class="de_button" type="primary" size="small"
+                      @click="deleteClassStudent(scope.row.userid)">移除</el-button>
+                    <!-- <div class="delete">
+                  <img src="../../../assets/remove.png" alt @click="deleteStudent(scope.row.userid, scope.row.state)" />
+                </div> -->
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+          <div class="student_page">
+            <el-pagination background layout="prev, pager, next" :page-size="10" :total="total2" v-if="page2"
+              @current-change="handleCurrentChange2"></el-pagination>
+          </div>
+        </div>
+      </div>
+    </div>
+    <el-dialog :visible.sync="dialogVisibleAddStudent" :append-to-body="true" width="700px" :before-close="handleClose"
+      class="add_student">
+      <div slot="title" class="header-title">
+        <div class="logoImg">
+          <img src="../../../assets/logo.png" alt />
+        </div>
+        <div class="title_add_student">添加学生</div>
+      </div>
+      <el-form>
+        <el-form-item label="学生姓名" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生姓名" clearable v-model="sName" class="add_input"></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 placeholder="请输入学生手机号" clearable v-model="sPhone" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生账号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生账号" clearable v-model="sMail" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="所属学校" :label-width="formLabelWidth">
+          <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
+        </el-form-item>
+        <el-form-item label="班级" :label-width="formLabelWidth">
+          <el-select v-model="cid" placeholder="请选择班级" disabled>
+            <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <div style="text-align: center; color: #adb3b7">
+          注:添加学生的账号密码为123456
+        </div>
+      </el-form>
+      <span slot="footer" class="dialog-footer flex">
+        <el-button class="right" @click="insertStudent">确认</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog :visible.sync="dialogVisibleUpdate" :append-to-body="true" width="700px" :before-close="handleClose"
+      class="add_student">
+      <div slot="title" class="header-title">
+        <div class="logoImg">
+          <img src="../../../assets/logo.png" alt />
+        </div>
+        <div class="title_add_student">修改学生</div>
+      </div>
+      <el-form>
+        <el-form-item label="学生名称" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生姓名" clearable v-model="userinfo.name" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生学号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生学号" clearable v-model="userinfo.studentid" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生手机号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生手机号" clearable v-model="userinfo.phonenumber" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生账号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生账号" clearable v-model="userinfo.un" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="所属学校" :label-width="formLabelWidth">
+          <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
+        </el-form-item>
+        <el-form-item label="班级" :label-width="formLabelWidth">
+          <el-select multiple collapse-tags v-model="userinfo.classid" placeholder="请选择班级">
+            <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <div style="text-align: center; color: #adb3b7">
+          注:添加学生的账号密码为123456
+        </div>
+      </el-form>
+      <span slot="footer" class="dialog-footer flex">
+        <el-button class="right" @click="updateStudent">修改</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="添加班级" :visible.sync="dialogVisible" :append-to-body="true" width="25%" :before-close="handleClose"
+      class="dialog_diy">
+      <el-form>
+        <el-form-item label="班级名称" :label-width="formLabelWidth">
+          <el-input v-model="className" auto-complete="off" placeholder="请输入班级..."></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="insertClass">确 定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="修改年级" :visible.sync="dialogVisibleGrade" :append-to-body="true" width="25%"
+      :before-close="handleClose" class="dialog_diy">
+      <el-form>
+        <el-form-item label="选择年级" :label-width="formLabelWidth">
+          <el-select v-model="gid" placeholder="请选择班级" class="student_input" clearable>
+            <el-option v-for="(item, index) in grade" :key="index" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisibleGrade = false">取 消</el-button>
+        <el-button type="primary" @click="updateGrade">确 定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="修改班级" :visible.sync="dialogVisible1" :append-to-body="true" width="25%" :before-close="handleClose"
+      class="dialog_diy">
+      <el-form>
+        <el-form-item label="班级名称" :label-width="formLabelWidth">
+          <el-input v-model="className1" auto-complete="off" placeholder="请输入班级..."></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible1 = false">取 消</el-button>
+        <el-button type="primary" @click="updateClass">确 定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="添加学生" :visible.sync="dialogVisibleMember" :append-to-body="true" width="500px" height="80%"
+      :before-close="handleClose" class="addNewPP">
+      <div class="people">
+        <div class="people_top">
+          <div class="people_top_right">
+            <div class="people_search">
+              <el-input placeholder="搜索学生姓名" v-model="searchTN" @keyup.enter.native="getClassStudent"></el-input>
+              <div class="search_img" @click="getClassStudent">
+                <img src="../../../assets/icon/search.png" alt />
+              </div>
+            </div>
+          </div>
+          <div class="people_nav">选择成员</div>
+        </div>
+        <div class="t_j_box" style="
+            padding: 20px 0 0 25px;
+            width: calc(100% - 55px);
+            margin-left: 25px;
+          ">
+          <span>姓名</span>
+          <span>账号</span>
+        </div>
+        <el-checkbox-group v-model="checkboxList3" class="people_name" v-if="teacherJuri.length" v-loading="isLoading2">
+          <el-checkbox v-for="item in teacherJuri" :key="item.userid" :label="item.userid">
+            <div class="t_j_box">
+              <el-tooltip placement="top" :content="item.name ? item.name : '暂无姓名'">
+                <span>{{ item.name ? item.name : "暂无姓名" }}</span>
+              </el-tooltip>
+              <el-tooltip placement="top" :content="item.username">
+                <span>{{ item.username }}</span>
+              </el-tooltip>
+            </div>
+          </el-checkbox>
+        </el-checkbox-group>
+        <div style="text-align: center; margin-top: 10px" v-else>暂无数据</div>
+      </div>
+      <div style="margin-top: 10px">
+        <el-pagination background layout="prev, pager, next" :page-size="pageSize3" :total="total3"
+          v-if="page3 && teacherJuri.length" style="padding-bottom: 20px"
+          @current-change="handleCurrentChange3"></el-pagination>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisibleMember = false">取 消</el-button>
+        <el-button type="primary" @click="addClassStudent">确定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import TaskListHeader from "gantt-elastic/src/components/TaskList/TaskListHeader.vue";
+
+export default {
+  data() {
+    return {
+      tableHeight: "500px",
+      isLoading: false,
+      formLabelWidth: "100px",
+      sClassName: "",
+      className: "",
+      className1: "",
+      classid: "",
+      dialogVisible: false,
+      dialogVisible1: false,
+      dialogVisibleUpdate: false,
+      dialogVisibleAddStudent: false,
+      tableData: [],
+      page: 1,
+      total: 0,
+      tableData2: [],
+      page2: 1,
+      total2: 0,
+      userid: this.$route.query.userid,
+      org: this.$route.query.org,
+      oid: this.$route.query.oid,
+      role: this.$route.query.role,
+      cid: "",
+      ctype: 1,
+      sName: "",
+      sPhone: "",
+      sId: "",
+      schoolName: "",
+      sByClass: "",
+      sMail: "",
+      classJuri: [],
+      userinfo: {},
+      userinfoA: {},
+      sPhoneUser: "",
+      tx: require("../../../assets/avatar.png"),
+      dialogVisibleMember: false,
+      checkboxList3: [],
+      teacherJuri: [],
+      pageSize3: 10,
+      total3: 0,
+      page3: 1,
+      isLoading2: false,
+      searchTN: "",
+      grade: [],
+      gid: "",
+      dialogVisibleGrade: false,
+    };
+  },
+  created() {
+    this.page = 1;
+    this.getClass();
+    this.getClass2();
+    this.selectGrage();
+    this.getSchoolName();
+  },
+  computed: {
+    getGrade() {
+      return function (gid) {
+        let name = "";
+        this.grade.forEach((element) => {
+          if (element.id == gid) {
+            name = element.name;
+          }
+        });
+        return name ? name : "暂无";
+      };
+    },
+  },
+  mounted() {
+    this.$nextTick(function () {
+      this.tableHeight =
+        window.innerHeight - this.$refs.table.$el.offsetTop - 200;
+      if (this.tableHeight <= 530) {
+        this.tableHeight = 530;
+      }
+      // 监听窗口大小变化
+      let self = this;
+      window.onresize = function () {
+        self.tableHeight =
+          window.innerHeight - self.$refs.table.$el.offsetTop - 200;
+        if (self.tableHeight <= 530) {
+          self.tableHeight = 530;
+        }
+      };
+    });
+  },
+  methods: {
+    goTo(path) {
+      this.$router.push(path);
+    },
+    //获取班级列表
+    selectGrage() {
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectGrageBySchool", params)
+        .then((res) => {
+          this.grade = res.data[0];
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    tableRowClassName({ row, rowIndex }) {
+      if ((rowIndex + 1) % 2 === 0) {
+        return "even_row";
+      } else {
+        return "";
+      }
+    },
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getClass();
+    },
+    handleClose(done) {
+      done();
+    },
+    time() {
+      if (!this.now) {
+        this.now = new Date().getTime();
+        return true;
+      } else {
+        let time = new Date().getTime();
+        if (time - this.now > 3000) {
+          this.now = time;
+          return true;
+        } else {
+          return false;
+        }
+      }
+    },
+    searchClass() {
+      this.page = 1;
+      this.getClass();
+    },
+    updateG(gid, id) {
+      this.gid = gid;
+      this.classid = id;
+      this.dialogVisibleGrade = true;
+    },
+    updateGrade() {
+      this.$confirm("确定修改吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          let params = [
+            {
+              cid: this.gid,
+              student: JSON.stringify([this.classid]),
+            },
+          ];
+          this.ajax
+            .post(this.$store.state.api + "addGradeClass", params)
+            .then((res) => {
+              this.gid = "";
+              this.classid = "";
+              this.dialogVisibleGrade = false;
+              this.getClass();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
+    openUpdate(id, n) {
+      this.classid = id;
+      this.className1 = n;
+      this.dialogVisible1 = true;
+    },
+    //新增班级
+    insertClass() {
+      let params = {
+        name: this.className,
+        oid: this.oid,
+        uid: this.userid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "insertClass", params)
+        .then((res) => {
+          if (res.data[0] && res.data[0][0].classname == 1) {
+            this.$message({
+              message: "不能与其他班级名称相同!",
+              type: "error",
+            });
+          } else {
+            this.$message({
+              message: "新增成功",
+              type: "success",
+            });
+            this.dialogVisible = false;
+            this.sClassName = "";
+            this.getClass();
+            this.className = "";
+          }
+        })
+        .catch((err) => {
+          this.$message({
+            message: "新增失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    //修改班级
+    updateClass() {
+      let params = {
+        id: this.classid,
+        n: this.className1,
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "updateClass", params)
+        .then((res) => {
+          if (res.data[0] && res.data[0][0].classname == 1) {
+            this.$message({
+              message: "不能与其他班级名称相同!",
+              type: "error",
+            });
+          } else {
+            this.$message({
+              message: "修改成功",
+              type: "success",
+            });
+            this.dialogVisible1 = false;
+            this.getClass();
+            this.classid = "";
+            this.className1 = "";
+          }
+        })
+        .catch((err) => {
+          this.$message({
+            message: "修改失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    //获取班级列表
+    getClass() {
+      this.isLoading = true;
+      let params = {
+        // username: this.$store.state.userInfo.userid,
+        cu: "",
+        oid: this.oid,
+        cn: this.sClassName,
+        page: this.page,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectClass", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.tableData = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    //删除班级
+    deleteClass(id) {
+      let params = {
+        id: id,
+      };
+      if (this.time()) {
+        this.$confirm("确定删除此班级吗?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+          .then(() => {
+            this.ajax
+              .get(this.$store.state.api + "deleteClass", params)
+              .then((res) => {
+                this.$message({
+                  message: "删除成功",
+                  type: "success",
+                });
+                if (this.page != 1 && this.tableData.length == 1) {
+                  this.page - 1;
+                }
+                this.getClass();
+              })
+              .catch((err) => {
+                this.$message.error("删除失败");
+                console.error(err);
+              });
+          })
+          .catch(() => { });
+      }
+    },
+    addStudent() {
+      // this.dialogVisibleAddStudent = true;
+      // (this.sName = ""), (this.sPhone = ""), (this.sByClass = ""), this.sMail;
+      // this.getClass2();
+      this.dialogVisibleMember = true;
+      this.searchTN = "";
+      this.getClassStudent();
+    },
+    //新增学生
+    insertStudent() {
+      if (this.sName === "") {
+        this.$message.error("学生姓名不能为空");
+        return;
+      } else if (
+        this.sPhone != "" &&
+        !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.sPhone)
+      ) {
+        this.$message.error("手机号格式不正确");
+        return;
+      } else if (
+        !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)
+      ) {
+        this.$message.error("邮箱格式不正确");
+        return;
+      }
+
+      if (this.time()) {
+        let params = { un: this.sMail };
+        this.ajax
+          .get(this.$store.state.api + "findMail", params)
+          .then((res) => {
+            if (res.data[0].length > 0) {
+              this.$message.error("此学生账号已被注册");
+            } else {
+              this.add_Student();
+            }
+          })
+          .catch((err) => {
+            console.error(err);
+          });
+      }
+    },
+    add_Student() {
+      let params = [
+        {
+          username: this.sMail,
+          userpassword: 123456,
+          alias: this.sName,
+          oid: this.oid,
+          ph: this.sPhone,
+          sid: this.sId,
+          cid: this.cid,
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "batchRegistration", params)
+        .then((res) => {
+          let params = [
+            {
+              userid: res.data.uid,
+              username: this.sName,
+              sid: this.sId,
+              type: 2,
+              oid: res.data.oid,
+              phone: res.data.ph,
+              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);
+            });
+          this.$message({
+            message: "新增成功",
+            type: "success",
+          });
+          this.dialogVisibleAddStudent = false;
+          this.sPhone = "";
+          this.sName = "";
+          this.sByClass = [];
+          this.sMail = "";
+          this.getStudent(this.cid);
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          this.$message({
+            message: "新增失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    updateStudentA(res) {
+      this.userinfo = JSON.parse(JSON.stringify(res));
+      this.userinfoA = JSON.parse(JSON.stringify(res));
+      this.userinfo.classid = this.userinfo.classid.split(",");
+      this.dialogVisibleUpdate = true;
+    },
+    updateStudent() {
+      if (this.userinfo.name === "") {
+        this.$message.error("学生姓名不能为空");
+        return;
+      } else if (!this.userinfo.classid) {
+        this.$message.error("请为学生选择班级");
+        return;
+      } else if (
+        this.userinfo.phonenumber &&
+        !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.userinfo.phonenumber)
+      ) {
+        this.$message.error("手机号格式不正确");
+        return;
+      } else if (
+        !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
+          this.userinfo.un
+        )
+      ) {
+        this.$message.error("邮箱格式不正确");
+        return;
+      }
+
+      if (this.time()) {
+        if (this.userinfoA.un != this.userinfo.un) {
+          let params = { un: this.userinfo.un };
+          this.ajax
+            .get(this.$store.state.api + "findMail", params)
+            .then((res) => {
+              if (res.data[0].length > 0) {
+                this.$message.error("此学生账号已被注册");
+              } else {
+                this.update_Student();
+              }
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        } else {
+          this.update_Student();
+        }
+      }
+    },
+    update_Student() {
+      let params = [
+        {
+          userid: this.userinfo.userid,
+          username: this.userinfo.un,
+          alias: this.userinfo.name,
+          ph: this.userinfo.phonenumber,
+          sid: this.userinfo.studentid,
+          cid: this.userinfo.classid.join(","),
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "updateStudentInfo", params)
+        .then((res) => {
+          this.$message({
+            message: "修改成功",
+            type: "success",
+          });
+          this.dialogVisibleUpdate = false;
+          this.getStudent(this.cid);
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          this.$message({
+            message: "修改失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    deleteClassStudent(id) {
+      let params = [{ uid: id, cid: this.cid }];
+      this.$confirm("确定移除此学生在本班级吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteClassStudent", params)
+            .then((res) => {
+              this.$message({
+                message: "操作成功",
+                type: "success",
+              });
+              this.getStudent(this.cid);
+            })
+            .catch((err) => {
+              this.$message.error("操作失败");
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
+    //获取班级列表
+    getClass2() {
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectClassBySchool", params)
+        .then((res) => {
+          this.classJuri = res.data[0];
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    getSchoolName() {
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectSchoolName2", params)
+        .then((res) => {
+          this.schoolName = res.data[0][0].name;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    searchStudent() {
+      this.page2 = 1;
+      this.getStudent(this.cid);
+    },
+    handleCurrentChange2(val) {
+      this.page2 = val;
+      this.getStudent(this.cid);
+    },
+    handleCurrentChange3(val) {
+      this.page3 = val;
+      this.getClassStudent();
+    },
+    getStudent(cid) {
+      this.cid = cid;
+      this.ctype = 2;
+      this.isLoading = true;
+      let params = {
+        oid: this.oid,
+        cid: this.cid,
+        cu: "",
+        cn: this.sPhoneUser,
+        page: this.page2,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectStudent2", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.total2 = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.tableData2 = res.data[0];
+          this.getClass2();
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    getClassStudent() {
+      this.isLoading2 = true;
+      let params = {
+        oid: this.oid,
+        cid: this.cid,
+        cn: this.searchTN,
+        page: this.page3,
+        num: this.pageSize3,
+      };
+      this.ajax
+        .get(this.$store.state.api + "getClassStudent", params)
+        .then((res) => {
+          this.isLoading2 = false;
+          this.total3 = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.teacherJuri = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading2 = false;
+          console.error(err);
+        });
+    },
+    addClassStudent() {
+      if (!this.checkboxList3.length) {
+        this.$message.error("请选择要添加班级的学生");
+        return;
+      }
+      let params = [
+        {
+          cid: this.cid,
+          student: JSON.stringify(this.checkboxList3),
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "addClassStudent", params)
+        .then((res) => {
+          this.checkboxList3 = [];
+          this.dialogVisibleMember = false;
+          this.getStudent(this.cid);
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    iniPassword(id) {
+      this.$confirm("确定" + "初始化" + "此学生的密码吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          let params = [
+            {
+              uid: id,
+              pa: 123456,
+            },
+          ];
+          this.ajax
+            .post(this.$store.state.api + "iniPassword", params)
+            .then((res) => {
+              this.$message({
+                message: "初始化密码成功!",
+                type: "success",
+              });
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
+  },
+};
+</script>
+
+<style scoped>
+.dialog_diy>>>.el-dialog__header {
+  background: #3d67bc !important;
+  padding: 15px 20px;
+}
+
+.dialog_diy>>>.el-dialog__title {
+  color: #fff;
+}
+
+.student_table>>>.el-table--border td {
+  border-right: 0px !important;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn {
+  top: 19px;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
+  color: #fff;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
+  color: #fff;
+}
+
+.student_head>>>.el-button--primary {
+  background-color: #2268bc;
+}
+
+.xls_button {
+  font-size: 14px;
+  cursor: pointer;
+  text-decoration: underline;
+  color: rgb(34, 104, 188);
+}
+
+.pb_head {
+  margin: 0 !important;
+  width: 100% !important;
+}
+
+.student_page {
+  margin-top: 10px;
+  display: flex;
+  justify-content: flex-end;
+}
+
+.student_head {
+  margin-top: 10px;
+  padding-bottom: 15px;
+  display: flex;
+  justify-content: space-between;
+}
+
+.student_search {
+  display: flex;
+  width: 300px;
+  line-height: 40px;
+  align-items: center;
+}
+
+.student_search span {
+  /* margin: 0 10px 0 0; */
+}
+
+.student_button {
+  /* display: flex; */
+  /* height: 40px; */
+}
+
+.student_button .el-button--primary {
+  /* margin-right: 10px; */
+}
+
+.upload-demo {
+  display: flex;
+  flex-direction: column;
+  align-items: end;
+  /* position: relative; */
+  width: 100px;
+  overflow: hidden;
+}
+
+.student_table {
+  /* margin: 20px 0; */
+}
+
+.el-table>>>.even_row {
+  background-color: #f1f1f1;
+}
+
+.top {
+  display: flex;
+  justify-content: space-between;
+}
+
+.bgColor {
+  background: #2167bc;
+}
+
+.student_table>>>.el-table,
+.student_table>>>.el-table__body-wrapper {
+  height: auto !important;
+}
+
+.student_head {
+  margin-top: 10px;
+  padding-bottom: 10px;
+  display: flex;
+  justify-content: space-between;
+}
+
+.head_left {
+  display: flex;
+  align-items: center;
+  line-height: 40px;
+}
+
+.head_right {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+  line-height: 40px;
+}
+
+/* .student_input>>>.el-input__inner {
+  width: 190px;
+  font-size: 13px;
+  padding: 0 10px;
+}
+ */
+.student_button {
+  color: #fff;
+  background: #2268bc;
+}
+
+.head_right>button:nth-child(1) {
+  color: #fff;
+  background: #2268bc;
+}
+
+.head_right>div {
+  line-height: 40px;
+  margin-left: 10px;
+  color: #2a6dbe;
+  text-decoration: underline;
+  cursor: pointer;
+}
+
+.userImg {
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+  align-items: center;
+}
+
+.tx {
+  width: 40px;
+  margin-right: 10px;
+}
+
+.delete {
+  width: 25px;
+  height: 25px;
+  cursor: pointer;
+  margin-left: 10px;
+}
+
+.tx>img,
+.delete>img {
+  width: 100%;
+  height: 100%;
+}
+
+.btnBox {
+  display: flex;
+  align-items: center;
+}
+
+.add_student>>>.el-dialog__header {
+  padding: 20px 20px 10px;
+  text-align: center;
+  background: #32455b;
+}
+
+.add_student>>>.el-dialog__title {
+  font-size: 14px !important;
+  color: #fff !important;
+}
+
+.add_student>>>.el-dialog__headerbtn {
+  font-size: 20px !important;
+}
+
+.add_student>>>.el-form-item__label {
+  margin-left: 65px;
+}
+
+.add_student>>>.el-form-item {
+  display: flex;
+}
+
+.add_student>>>.el-form-item__content {
+  margin: 0 !important;
+}
+
+.add_input {
+  width: 365px;
+}
+
+.add_student>>>.el-dialog__footer {
+  text-align: center !important;
+}
+
+.right {
+  width: 250px;
+  color: #fff;
+  background: #0e72e6;
+  margin-bottom: 20px;
+}
+
+.header-title {
+  display: flex;
+}
+
+.logoImg {
+  width: 30px;
+}
+
+.logoImg>img {
+  width: 100%;
+  height: 100%;
+}
+
+.title_add_student {
+  margin: 0 auto;
+  color: #fff;
+}
+
+.upload-demo {
+  line-height: 0px !important;
+}
+
+.upload-demo>>>.el-button {
+  color: #fff;
+  background: #2268bc;
+  width: 70px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 0 !important;
+}
+
+.people {
+  border: 1px solid rgb(229 229 229);
+  height: 495px;
+  border-radius: 5px;
+  width: 100%;
+  overflow: auto;
+}
+
+.people_top {
+  display: flex;
+  width: 100%;
+  /* justify-content: space-between; */
+  /* align-items: center; */
+  flex-direction: column;
+  padding: 10px 25px 0;
+  box-sizing: border-box;
+}
+
+.people_nav,
+.people_top_right {
+  /* padding: 20px 0 0 20px; */
+}
+
+.people_top_right {
+  height: 40px;
+  margin-bottom: 10px;
+}
+
+.people_search {
+  display: flex;
+  position: relative;
+}
+
+.people_search>>>.el-input__inner {
+  /* height: 25px; */
+  width: 95%;
+}
+
+.search_img {
+  width: 20px;
+  height: 20px;
+  position: absolute;
+  right: 30px;
+  top: 50%;
+  transform: translateY(-50%);
+}
+
+.search_img>img {
+  width: 100%;
+  height: 100%;
+}
+
+.people_name {
+  display: flex;
+  justify-content: flex-start;
+  padding: 10px 0 0 25px;
+  flex-direction: column;
+  flex-wrap: nowrap;
+  height: calc(100% - 140px);
+  overflow-y: auto;
+  overflow-x: hidden;
+  flex-direction: column;
+}
+
+.people_name>>>.el-checkbox {
+  width: 100%;
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+}
+
+.people_name>>>.el-checkbox__label {
+  text-overflow: ellipsis;
+  overflow: hidden;
+  width: 100%;
+}
+
+.addNewPP>>>.el-dialog__body {
+  padding: 5px 20px;
+}
+
+.t_j_box {
+  display: flex;
+}
+
+.t_j_box span:nth-child(1) {
+  width: 50%;
+  overflow: hidden;
+  margin-right: 10px;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.t_j_box span:nth-child(2) {
+  width: 50%;
+  overflow: hidden;
+  margin-right: 10px;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.student_input>>>.el-input__inner {
+  height: 30px;
+  width: 190px;
+  font-size: 13px;
+  padding: 0 10px;
+}
+
+.student_input.el-input {
+  width: auto;
+}
+
+.student_input {
+  margin-right: 10px;
+}
+
+.student_input>>>.el-input__icon {
+  line-height: unset;
+}
+
+.student_button {
+  color: #fff;
+  background: #2268bc;
+  width: 60px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 30px;
+}
+
+.sub_head {
+  position: relative;
+}
+
+.sub_head::after {
+  content: "";
+  width: 100%;
+  background: #5a9cea;
+  height: 2px;
+  position: absolute;
+  left: 0;
+  bottom: -10px;
+}
+
+.subClick {
+  /* font-size: 16px; */
+  font-size: 26px;
+  cursor: pointer;
+  /* margin-left: 17.5px; */
+  /* color: #ab582f; */
+  /* color: #409eff; */
+  color: #999;
+}
+
+.subClick:hover {
+  color: #000;
+}
+
+.sub_head+.subClick,
+.subClick+.subClick,
+.subClick+.sub_head {
+  margin-left: 17.5px;
+}
+
+.classButtonBox {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: wrap;
+  align-items: center;
+}
+
+.classButtonBox>>>.el-button:not(:last-child),
+.classButtonBox>>>.el-button:not(:first-child) {
+  margin-left: 10px;
+}
+
+.pb_content_body {
+  width: 100% !important;
+}
+
+.sm_box {
+  display: flex;
+  width: calc(100% - 20px);
+  margin: 0 auto;
+}
+
+.sm_right {
+  width: calc(100% - 210px);
+  margin-left: 210px;
+}
+
+.sm_left {
+  width: 200px;
+  background: #fff;
+  height: calc(100vh - 20px);
+  position: fixed;
+  left: 10px;
+  top: 10px;
+  border-radius: 5px;
+}
+</style>

+ 1314 - 0
src/components/pages/studentManage/grade/index.vue

@@ -0,0 +1,1314 @@
+<template>
+  <div class="pb_content" style="background: unset">
+    <div class="sm_box">
+      <div class="sm_left"></div>
+      <div class="sm_right">
+        <div v-if="ctype == 1" class="pb_content_body" style="
+        background: #fff;
+        padding: 0px 25px;
+        box-sizing: border-box;
+        border-radius: 5px;
+      ">
+          <div class="pb_head top">
+            <div style="
+            display: flex;
+            align-items: center;
+        ">
+              <span>年级管理</span>
+            </div>
+            <div style="border-radius: 4px">
+              <el-button type="primary" class="bgColor student_button" @click="dialogVisible = true">添加年级</el-button>
+            </div>
+          </div>
+          <div class="student_head">
+            <div class="student_search">
+              <span>
+                <el-input class="student_input" placeholder="请输入年级名称" v-model="sClassName" clearable>
+                </el-input>
+              </span>
+              <el-button class="student_button" type="primary" @click="searchClass">查询</el-button>
+            </div>
+          </div>
+        </div>
+        <div class="pb_content_body" v-if="ctype == 1">
+          <div class="student_table">
+            <el-table v-if="ctype == 1" ref="table" :key="1" :data="tableData" border :height="tableHeight" :fit="true"
+              v-loading="isLoading" style="width: 100%; height: 60%" :header-cell-style="{ background: '#f1f1f1' }"
+              :row-class-name="tableRowClassName">
+              <el-table-column prop="name" label="年级名称" min-width="40%" align="center">
+              </el-table-column>
+              <el-table-column prop="pnum" label="班级数" min-width="40%" align="center">
+              </el-table-column>
+              <el-table-column label="操作" min-width="20%">
+                <template slot-scope="scope">
+                  <el-button type="primary" size="small" @click="getStudent(scope.row.id)">查看班级</el-button>
+                  <el-button type="primary" size="small" @click="openUpdate(scope.row.id, scope.row.name)">修改</el-button>
+                  <el-button type="primary" size="small" @click="deleteGrade(scope.row.id)">删除</el-button>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+          <div class="student_page">
+            <el-pagination background layout="prev, pager, next" :page-size="10" :total="total" v-if="page"
+              @current-change="handleCurrentChange">
+            </el-pagination>
+          </div>
+        </div>
+        <div v-if="ctype == 2" class="pb_content_body" style="
+        background: #fff;
+        padding: 0px 25px;
+        box-sizing: border-box;
+        border-radius: 5px;
+      ">
+          <div class="pb_head top">
+            <span>查看班级-{{ getGrade(cid) }} </span>
+            <div class="student_button" style="border-radius: 4px">
+              <el-button type="primary" class="bgColor student_button" @click="(ctype = 1), getClass()">返回</el-button>
+            </div>
+          </div>
+          <div class="student_head">
+            <div class="student_search">
+              <span>
+                <el-input class="student_input" v-model="sPhoneUser" placeholder="请输入班级"></el-input>
+              </span>
+              <el-button class="student_button" @click="searchStudent">查询</el-button>
+            </div>
+            <div>
+              <el-button @click="addStudent" class="student_button">添加班级</el-button>
+            </div>
+          </div>
+        </div>
+        <div class="pb_content_body" v-if="ctype == 2">
+          <div class="student_table">
+            <el-table v-if="ctype == 2" :key="2" ref="table2" :data="tableData2" border :height="tableHeight" :fit="true"
+              v-loading="isLoading" style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
+              :row-class-name="tableRowClassName">
+              <el-table-column label="班级" min-width="10" align="center">
+                <template slot-scope="scope">
+                  <div>
+                    {{ scope.row.name }}
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column prop="pnum" label="学生数" min-width="15" align="center">
+              </el-table-column>
+              <el-table-column label="操作" width="250px">
+                <template slot-scope="scope">
+                  <div class="btnBox">
+                    <el-button class="de_button" type="primary" size="small"
+                      @click="deleteClassStudent(scope.row.id)">移除</el-button>
+                    <!-- <div class="delete">
+                    <img src="../../../../assets/remove.png" alt @click="deleteStudent(scope.row.userid, scope.row.state)" />
+                  </div> -->
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+          <div class="student_page">
+            <el-pagination background layout="prev, pager, next" :page-size="10" :total="total2" v-if="page2"
+              @current-change="handleCurrentChange2"></el-pagination>
+          </div>
+        </div>
+      </div>
+    </div>
+    <el-dialog :visible.sync="dialogVisibleAddStudent" :append-to-body="true" width="700px" :before-close="handleClose"
+      class="add_student">
+      <div slot="title" class="header-title">
+        <div class="logoImg">
+          <img src="../../../../assets/logo.png" alt />
+        </div>
+        <div class="title_add_student">添加学生</div>
+      </div>
+      <el-form>
+        <el-form-item label="学生姓名" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生姓名" clearable v-model="sName" class="add_input"></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 placeholder="请输入学生手机号" clearable v-model="sPhone" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生账号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生账号" clearable v-model="sMail" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="所属学校" :label-width="formLabelWidth">
+          <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
+        </el-form-item>
+        <el-form-item label="班级" :label-width="formLabelWidth">
+          <el-select v-model="cid" placeholder="请选择班级" disabled>
+            <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <div style="text-align: center; color: #adb3b7">
+          注:添加学生的账号密码为123456
+        </div>
+      </el-form>
+      <span slot="footer" class="dialog-footer flex">
+        <el-button class="right" @click="insertStudent">确认</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog :visible.sync="dialogVisibleUpdate" :append-to-body="true" width="700px" :before-close="handleClose"
+      class="add_student">
+      <div slot="title" class="header-title">
+        <div class="logoImg">
+          <img src="../../../../assets/logo.png" alt />
+        </div>
+        <div class="title_add_student">修改学生</div>
+      </div>
+      <el-form>
+        <el-form-item label="学生名称" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生姓名" clearable v-model="userinfo.name" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生学号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生学号" clearable v-model="userinfo.studentid" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生手机号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生手机号" clearable v-model="userinfo.phonenumber" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生账号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生账号" clearable v-model="userinfo.un" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="所属学校" :label-width="formLabelWidth">
+          <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
+        </el-form-item>
+        <el-form-item label="班级" :label-width="formLabelWidth">
+          <el-select multiple collapse-tags v-model="userinfo.classid" placeholder="请选择班级">
+            <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <div style="text-align: center; color: #adb3b7">
+          注:添加学生的账号密码为123456
+        </div>
+      </el-form>
+      <span slot="footer" class="dialog-footer flex">
+        <el-button class="right" @click="updateStudent">修改</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="添加年级" :visible.sync="dialogVisible" :append-to-body="true" width="400px" :before-close="handleClose"
+      class="dialog_diy">
+      <el-form>
+        <el-form-item label="添加年级" :label-width="formLabelWidth">
+          <el-input v-model="className" auto-complete="off" placeholder="请输入年级..."></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="insertGrade">确 定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="修改年级" :visible.sync="dialogVisible1" :append-to-body="true" width="25%" :before-close="handleClose"
+      class="dialog_diy">
+      <el-form>
+        <el-form-item label="年级名称" :label-width="formLabelWidth">
+          <el-input v-model="className1" auto-complete="off" placeholder="请输入年级..."></el-input>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible1 = false">取 消</el-button>
+        <el-button type="primary" @click="updateGrade">确 定</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog title="选择班级" :visible.sync="dialogVisibleMember" :append-to-body="true" width="500px" height="80%"
+      :before-close="handleClose" class="addNewPP">
+      <div class="people">
+        <div class="people_top">
+          <div class="people_top_right">
+            <div class="people_search">
+              <el-input placeholder="搜索班级名称" v-model="searchTN" @keyup.enter.native="getClassStudent"></el-input>
+              <div class="search_img" @click="getClassStudent">
+                <img src="../../../../assets/icon/search.png" alt />
+              </div>
+            </div>
+          </div>
+          <div class="people_nav">选择班级</div>
+        </div>
+        <!-- <div
+          class="t_j_box"
+          style="
+            padding: 20px 0 0 25px;
+            width: calc(100% - 55px);
+            margin-left: 25px;
+          "
+        >
+          <span>班级</span>
+        </div> -->
+        <el-checkbox-group v-model="checkboxList3" class="people_name" v-if="teacherJuri.length" v-loading="isLoading2">
+          <el-checkbox v-for="item in teacherJuri" :key="item.id" :label="item.id">
+            <div class="t_j_box">
+              <span>{{ item.name }}</span>
+            </div>
+          </el-checkbox>
+        </el-checkbox-group>
+        <div style="text-align: center; margin-top: 10px" v-else>暂无数据</div>
+      </div>
+      <div style="margin-top: 10px">
+        <el-pagination background layout="prev, pager, next" :page-size="pageSize3" :total="total3"
+          v-if="page3 && teacherJuri.length" style="padding-bottom: 20px"
+          @current-change="handleCurrentChange3"></el-pagination>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisibleMember = false">取 消</el-button>
+        <el-button type="primary" @click="addClassStudent">确定</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+  
+<script>
+
+export default {
+  data() {
+    return {
+      tableHeight: "500px",
+      isLoading: false,
+      formLabelWidth: "100px",
+      sClassName: "",
+      className: "",
+      className1: "",
+      classid: "",
+      dialogVisible: false,
+      dialogVisible1: false,
+      dialogVisibleUpdate: false,
+      dialogVisibleAddStudent: false,
+      tableData: [],
+      page: 1,
+      total: 0,
+      tableData2: [],
+      page2: 1,
+      total2: 0,
+      userid: this.$route.query.userid,
+      org: this.$route.query.org,
+      oid: this.$route.query.oid,
+      role: this.$route.query.role,
+      cid: "",
+      ctype: 1,
+      sName: "",
+      sPhone: "",
+      sId: "",
+      schoolName: "",
+      sByClass: "",
+      sMail: "",
+      classJuri: [],
+      userinfo: {},
+      userinfoA: {},
+      sPhoneUser: "",
+      tx: require("../../../../assets/avatar.png"),
+      dialogVisibleMember: false,
+      checkboxList3: [],
+      teacherJuri: [],
+      pageSize3: 10,
+      total3: 0,
+      page3: 1,
+      isLoading2: false,
+      searchTN: "",
+    };
+  },
+  created() {
+    this.page = 1;
+    this.getClass();
+    this.getClass2();
+    this.getSchoolName();
+  },
+  computed: {
+    getGrade() {
+      return function (gid) {
+        let name = "";
+        this.classJuri.forEach((element) => {
+          if (element.id == gid) {
+            name = element.name;
+          }
+        });
+        return name ? name : "暂无";
+      };
+    },
+  },
+  mounted() {
+    this.$nextTick(function () {
+      this.tableHeight =
+        window.innerHeight - this.$refs.table.$el.offsetTop - 200;
+      if (this.tableHeight <= 530) {
+        this.tableHeight = 530;
+      }
+      // 监听窗口大小变化
+      let self = this;
+      window.onresize = function () {
+        self.tableHeight =
+          window.innerHeight - self.$refs.table.$el.offsetTop - 200;
+        if (self.tableHeight <= 530) {
+          self.tableHeight = 530;
+        }
+      };
+    });
+  },
+  methods: {
+    goTo(path) {
+      this.$router.push(path);
+    },
+    tableRowClassName({ row, rowIndex }) {
+      if ((rowIndex + 1) % 2 === 0) {
+        return "even_row";
+      } else {
+        return "";
+      }
+    },
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getClass();
+    },
+    handleClose(done) {
+      done();
+    },
+    time() {
+      if (!this.now) {
+        this.now = new Date().getTime();
+        return true;
+      } else {
+        let time = new Date().getTime();
+        if (time - this.now > 3000) {
+          this.now = time;
+          return true;
+        } else {
+          return false;
+        }
+      }
+    },
+    searchClass() {
+      this.page = 1;
+      this.getClass();
+    },
+    openUpdate(id, n) {
+      this.classid = id;
+      this.className1 = n;
+      this.dialogVisible1 = true;
+    },
+    //新增年级
+    insertGrade() {
+      let params = {
+        name: this.className,
+        oid: this.oid,
+        uid: this.userid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "insertGrade", params)
+        .then((res) => {
+          if (res.data[0] && res.data[0][0].classname == 1) {
+            this.$message({
+              message: "不能与其他年级名称相同!",
+              type: "error",
+            });
+          } else {
+            this.$message({
+              message: "新增成功",
+              type: "success",
+            });
+            this.dialogVisible = false;
+            this.sClassName = "";
+            this.getClass();
+            this.className = "";
+          }
+        })
+        .catch((err) => {
+          this.$message({
+            message: "新增失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    //修改年级
+    updateGrade() {
+      let params = {
+        id: this.classid,
+        n: this.className1,
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "updateGrade", params)
+        .then((res) => {
+          if (res.data[0] && res.data[0][0].classname == 1) {
+            this.$message({
+              message: "不能与其他年级名称相同!",
+              type: "error",
+            });
+          } else {
+            this.$message({
+              message: "修改成功",
+              type: "success",
+            });
+            this.dialogVisible1 = false;
+            this.getClass();
+            this.classid = "";
+            this.className1 = "";
+          }
+        })
+        .catch((err) => {
+          this.$message({
+            message: "修改失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    //获取年级列表
+    getClass() {
+      this.isLoading = true;
+      let params = {
+        // username: this.$store.state.userInfo.userid,
+        cu: "",
+        oid: this.oid,
+        cn: this.sClassName,
+        page: this.page,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectGrade", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.tableData = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    //删除年级
+    deleteGrade(id) {
+      let params = {
+        id: id,
+      };
+      if (this.time()) {
+        this.$confirm("确定删除此年级吗?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+          .then(() => {
+            this.ajax
+              .get(this.$store.state.api + "deleteGrade", params)
+              .then((res) => {
+                this.$message({
+                  message: "删除成功",
+                  type: "success",
+                });
+                if (this.page != 1 && this.tableData.length == 1) {
+                  this.page - 1;
+                }
+                this.getClass();
+              })
+              .catch((err) => {
+                this.$message.error("删除失败");
+                console.error(err);
+              });
+          })
+          .catch(() => { });
+      }
+    },
+    addStudent() {
+      // this.dialogVisibleAddStudent = true;
+      // (this.sName = ""), (this.sPhone = ""), (this.sByClass = ""), this.sMail;
+      // this.getClass2();
+      this.dialogVisibleMember = true;
+      this.searchTN = "";
+      this.getClassStudent();
+    },
+    //新增学生
+    insertStudent() {
+      if (this.sName === "") {
+        this.$message.error("学生姓名不能为空");
+        return;
+      } else if (
+        this.sPhone != "" &&
+        !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.sPhone)
+      ) {
+        this.$message.error("手机号格式不正确");
+        return;
+      } else if (
+        !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)
+      ) {
+        this.$message.error("邮箱格式不正确");
+        return;
+      }
+
+      if (this.time()) {
+        let params = { un: this.sMail };
+        this.ajax
+          .get(this.$store.state.api + "findMail", params)
+          .then((res) => {
+            if (res.data[0].length > 0) {
+              this.$message.error("此学生账号已被注册");
+            } else {
+              this.add_Student();
+            }
+          })
+          .catch((err) => {
+            console.error(err);
+          });
+      }
+    },
+    add_Student() {
+      let params = [
+        {
+          username: this.sMail,
+          userpassword: 123456,
+          alias: this.sName,
+          oid: this.oid,
+          ph: this.sPhone,
+          sid: this.sId,
+          cid: this.cid,
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "batchRegistration", params)
+        .then((res) => {
+          let params = [
+            {
+              userid: res.data.uid,
+              username: this.sName,
+              sid: this.sId,
+              type: 2,
+              oid: res.data.oid,
+              phone: res.data.ph,
+              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);
+            });
+          this.$message({
+            message: "新增成功",
+            type: "success",
+          });
+          this.dialogVisibleAddStudent = false;
+          this.sPhone = "";
+          this.sName = "";
+          this.sByClass = [];
+          this.sMail = "";
+          this.getStudent(this.cid);
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          this.$message({
+            message: "新增失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    updateStudentA(res) {
+      this.userinfo = JSON.parse(JSON.stringify(res));
+      this.userinfoA = JSON.parse(JSON.stringify(res));
+      this.userinfo.classid = this.userinfo.classid.split(",");
+      this.dialogVisibleUpdate = true;
+    },
+    updateStudent() {
+      if (this.userinfo.name === "") {
+        this.$message.error("学生姓名不能为空");
+        return;
+      } else if (!this.userinfo.classid) {
+        this.$message.error("请为学生选择年级");
+        return;
+      } else if (
+        this.userinfo.phonenumber &&
+        !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.userinfo.phonenumber)
+      ) {
+        this.$message.error("手机号格式不正确");
+        return;
+      } else if (
+        !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
+          this.userinfo.un
+        )
+      ) {
+        this.$message.error("邮箱格式不正确");
+        return;
+      }
+
+      if (this.time()) {
+        if (this.userinfoA.un != this.userinfo.un) {
+          let params = { un: this.userinfo.un };
+          this.ajax
+            .get(this.$store.state.api + "findMail", params)
+            .then((res) => {
+              if (res.data[0].length > 0) {
+                this.$message.error("此学生账号已被注册");
+              } else {
+                this.update_Student();
+              }
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        } else {
+          this.update_Student();
+        }
+      }
+    },
+    update_Student() {
+      let params = [
+        {
+          userid: this.userinfo.userid,
+          username: this.userinfo.un,
+          alias: this.userinfo.name,
+          ph: this.userinfo.phonenumber,
+          sid: this.userinfo.studentid,
+          cid: this.userinfo.classid.join(","),
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "updateStudentInfo", params)
+        .then((res) => {
+          this.$message({
+            message: "修改成功",
+            type: "success",
+          });
+          this.dialogVisibleUpdate = false;
+          this.getStudent(this.cid);
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          this.$message({
+            message: "修改失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    deleteClassStudent(id) {
+      let params = [{ uid: id, cid: this.cid }];
+      this.$confirm("确定在本年级移除此班级吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteGradeClass", params)
+            .then((res) => {
+              this.$message({
+                message: "操作成功",
+                type: "success",
+              });
+              this.getStudent(this.cid);
+            })
+            .catch((err) => {
+              this.$message.error("操作失败");
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
+    //获取班级列表
+    getClass2() {
+      this.isLoading = true;
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectGrageBySchool", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.classJuri = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    getSchoolName() {
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectSchoolName2", params)
+        .then((res) => {
+          this.schoolName = res.data[0][0].name;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    searchStudent() {
+      this.page2 = 1;
+      this.getStudent(this.cid);
+    },
+    handleCurrentChange2(val) {
+      this.page2 = val;
+      this.getStudent(this.cid);
+    },
+    handleCurrentChange3(val) {
+      this.page3 = val;
+      this.getClassStudent();
+    },
+    getStudent(cid) {
+      this.cid = cid;
+      this.ctype = 2;
+      this.isLoading = true;
+      let params = {
+        cid: this.cid,
+        oid: this.oid,
+        cn: this.sPhoneUser,
+        page: this.page2,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectClass2", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.total2 = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.tableData2 = res.data[0];
+          this.getClass2();
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    getClassStudent() {
+      this.isLoading2 = true;
+      let params = {
+        oid: this.oid,
+        cid: this.cid,
+        cn: this.searchTN,
+        page: this.page3,
+        num: this.pageSize3,
+      };
+      this.ajax
+        .get(this.$store.state.api + "getGradeClass", params)
+        .then((res) => {
+          this.isLoading2 = false;
+          this.total3 = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.teacherJuri = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading2 = false;
+          console.error(err);
+        });
+    },
+    addClassStudent() {
+      if (!this.checkboxList3.length) {
+        this.$message.error("请选择要添加的班级");
+        return;
+      }
+      let params = [
+        {
+          cid: this.cid,
+          student: JSON.stringify(this.checkboxList3),
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "addGradeClass", params)
+        .then((res) => {
+          this.checkboxList3 = [];
+          this.dialogVisibleMember = false;
+          this.getStudent(this.cid);
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    iniPassword(id) {
+      this.$confirm("确定" + "初始化" + "此学生的密码吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          let params = [
+            {
+              uid: id,
+              pa: 123456,
+            },
+          ];
+          this.ajax
+            .post(this.$store.state.api + "iniPassword", params)
+            .then((res) => {
+              this.$message({
+                message: "初始化密码成功!",
+                type: "success",
+              });
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
+  },
+};
+</script>
+  
+<style scoped>
+.dialog_diy>>>.el-dialog__header {
+  background: #3d67bc !important;
+  padding: 15px 20px;
+}
+
+.dialog_diy>>>.el-dialog__title {
+  color: #fff;
+}
+
+.student_table>>>.el-table--border td {
+  border-right: 0px !important;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn {
+  top: 19px;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
+  color: #fff;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
+  color: #fff;
+}
+
+.student_head>>>.el-button--primary {
+  background-color: #2268bc;
+}
+
+.xls_button {
+  font-size: 14px;
+  cursor: pointer;
+  text-decoration: underline;
+  color: rgb(34, 104, 188);
+}
+
+.pb_head {
+  margin: 0 !important;
+  width: 100% !important;
+}
+
+.student_page {
+  margin-top: 10px;
+  display: flex;
+  justify-content: flex-end;
+}
+
+.student_head {
+  margin-top: 10px;
+  padding-bottom: 15px;
+  display: flex;
+  justify-content: space-between;
+}
+
+.student_search {
+  display: flex;
+  align-items: center;
+  width: 300px;
+  line-height: 40px;
+}
+
+.student_search span {
+  /* margin: 0 10px 0 0; */
+}
+
+.student_button {
+  /* display: flex; */
+  /* height: 40px; */
+}
+
+.student_button .el-button--primary {
+  /* margin-right: 10px; */
+}
+
+.upload-demo {
+  display: flex;
+  flex-direction: column;
+  align-items: end;
+  /* position: relative; */
+  width: 100px;
+  overflow: hidden;
+}
+
+.student_table {
+  /* margin: 20px 0; */
+}
+
+.el-table>>>.even_row {
+  background-color: #f1f1f1;
+}
+
+.top {
+  display: flex;
+  justify-content: space-between;
+}
+
+.bgColor {
+  background: #2167bc;
+}
+
+.student_table>>>.el-table,
+.student_table>>>.el-table__body-wrapper {
+  height: auto !important;
+}
+
+.student_head {
+  margin-top: 10px;
+  padding-bottom: 10px;
+  display: flex;
+  justify-content: space-between;
+}
+
+.head_left {
+  display: flex;
+  align-items: center;
+  line-height: 40px;
+}
+
+.head_right {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+  line-height: 40px;
+}
+
+/* .student_input >>> .el-input__inner {
+  width: 190px;
+  font-size: 13px;
+  padding: 0 10px;
+} */
+
+.student_button {
+  color: #fff;
+  background: #2268bc;
+}
+
+.head_right>button:nth-child(1) {
+  color: #fff;
+  background: #2268bc;
+}
+
+.head_right>div {
+  line-height: 40px;
+  margin-left: 10px;
+  color: #2a6dbe;
+  text-decoration: underline;
+  cursor: pointer;
+}
+
+.userImg {
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+  align-items: center;
+}
+
+.tx {
+  width: 40px;
+  margin-right: 10px;
+}
+
+.delete {
+  width: 25px;
+  height: 25px;
+  cursor: pointer;
+  margin-left: 10px;
+}
+
+.tx>img,
+.delete>img {
+  width: 100%;
+  height: 100%;
+}
+
+.btnBox {
+  display: flex;
+  align-items: center;
+}
+
+.add_student>>>.el-dialog__header {
+  padding: 20px 20px 10px;
+  text-align: center;
+  background: #32455b;
+}
+
+.add_student>>>.el-dialog__title {
+  font-size: 14px !important;
+  color: #fff !important;
+}
+
+.add_student>>>.el-dialog__headerbtn {
+  font-size: 20px !important;
+}
+
+.add_student>>>.el-form-item__label {
+  margin-left: 65px;
+}
+
+.add_student>>>.el-form-item {
+  display: flex;
+}
+
+.add_student>>>.el-form-item__content {
+  margin: 0 !important;
+}
+
+.add_input {
+  width: 365px;
+}
+
+.add_student>>>.el-dialog__footer {
+  text-align: center !important;
+}
+
+.right {
+  width: 250px;
+  color: #fff;
+  background: #0e72e6;
+  margin-bottom: 20px;
+}
+
+.header-title {
+  display: flex;
+}
+
+.logoImg {
+  width: 30px;
+}
+
+.logoImg>img {
+  width: 100%;
+  height: 100%;
+}
+
+.title_add_student {
+  margin: 0 auto;
+  color: #fff;
+}
+
+.upload-demo {
+  line-height: 0px !important;
+}
+
+.upload-demo>>>.el-button {
+  color: #fff;
+  background: #2268bc;
+  width: 70px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 0 !important;
+}
+
+.people {
+  border: 1px solid rgb(229 229 229);
+  height: 450px;
+  border-radius: 5px;
+  width: 100%;
+  overflow: auto;
+}
+
+.people_top {
+  display: flex;
+  width: 100%;
+  /* justify-content: space-between; */
+  /* align-items: center; */
+  flex-direction: column;
+  padding: 10px 25px 0;
+  box-sizing: border-box;
+}
+
+.people_nav,
+.people_top_right {
+  /* padding: 20px 0 0 20px; */
+}
+
+.people_top_right {
+  height: 40px;
+  margin-bottom: 10px;
+}
+
+.people_search {
+  display: flex;
+  position: relative;
+}
+
+.people_search>>>.el-input__inner {
+  /* height: 25px; */
+  width: 95%;
+}
+
+.search_img {
+  width: 20px;
+  height: 20px;
+  position: absolute;
+  right: 30px;
+  top: 50%;
+  transform: translateY(-50%);
+}
+
+.search_img>img {
+  width: 100%;
+  height: 100%;
+}
+
+.people_name {
+  display: flex;
+  justify-content: flex-start;
+  padding: 10px 0 0 25px;
+  flex-direction: column;
+  flex-wrap: nowrap;
+  height: calc(100% - 140px);
+  overflow-y: auto;
+  overflow-x: hidden;
+  flex-direction: column;
+}
+
+.people_name>>>.el-checkbox {
+  width: 100%;
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+}
+
+.people_name>>>.el-checkbox__label {
+  text-overflow: ellipsis;
+  overflow: hidden;
+  width: 100%;
+}
+
+.addNewPP>>>.el-dialog {
+  margin-top: 5vh !important;
+}
+
+.addNewPP>>>.el-dialog__body {
+  padding: 5px 20px;
+}
+
+.t_j_box {
+  display: flex;
+}
+
+.t_j_box span:nth-child(1) {
+  width: 100%;
+  overflow: hidden;
+  margin-right: 10px;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.t_j_box span:nth-child(2) {
+  width: 50%;
+  overflow: hidden;
+  margin-right: 10px;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+
+.student_input>>>.el-input__inner {
+  height: 30px;
+  width: 190px;
+  font-size: 13px;
+  padding: 0 10px;
+}
+
+.student_input.el-input {
+  width: auto;
+}
+
+.student_input {
+  margin-right: 10px;
+}
+
+.student_input>>>.el-input__icon {
+  line-height: unset;
+}
+
+
+.student_button {
+  color: #fff;
+  background: #2268bc;
+  width: 60px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 30px;
+}
+
+.sub_head {
+  position: relative;
+}
+
+.sub_head::after {
+  content: "";
+  width: 100%;
+  background: #5a9cea;
+  height: 2px;
+  position: absolute;
+  left: 0;
+  bottom: -10px;
+}
+
+.subClick {
+  /* font-size: 16px; */
+  font-size: 26px;
+  cursor: pointer;
+  /* margin-left: 17.5px; */
+  /* color: #ab582f; */
+  /* color: #409eff; */
+  color: #999;
+}
+
+.subClick:hover {
+  color: #000;
+}
+
+
+.sub_head+.subClick,
+.subClick+.subClick,
+.subClick+.sub_head {
+  margin-left: 17.5px;
+}
+
+.pb_content_body {
+  width: 100% !important;
+}
+
+.sm_box {
+  display: flex;
+  width: calc(100% - 20px);
+  margin: 0 auto;
+}
+
+.sm_right {
+  width: calc(100% - 210px);
+  margin-left: 210px;
+}
+
+.sm_left {
+  width: 200px;
+  background: #fff;
+  height: calc(100vh - 20px);
+  position: fixed;
+  left: 10px;
+  top: 10px;
+  border-radius: 5px;
+}
+</style>
+  

+ 1499 - 0
src/components/pages/studentManage/student.vue

@@ -0,0 +1,1499 @@
+<template>
+  <div class="pb_content" style="background: unset">
+    <div class="sm_box">
+      <div class="sm_left">
+        <div class="nav" @click="
+              goTo(
+                '/grade?userid=' +
+                  userid +
+                  '&oid=' +
+                  oid +
+                  '&org=' +
+                  org +
+                  '&role=' +
+                  role
+              )
+            ">
+          <span class="icon gradeI"></span>
+          <span class="name">年级管理</span>
+        </div>
+        <div class="nav" @click="
+              goTo(
+                '/class?userid=' +
+                  userid +
+                  '&oid=' +
+                  oid +
+                  '&org=' +
+                  org +
+                  '&role=' +
+                  role
+              )
+            ">
+          <span class="icon classI"></span>
+          <span class="name">班级管理</span>
+        </div>
+        <div class="nav active">
+          <span class="icon studentI"></span>
+          <span class="name">学生管理</span>
+        </div>
+      </div>
+      <div class="sm_right">
+        <div class="pb_content_body" style="
+        background: #fff;
+        padding: 0px 25px;
+        box-sizing: border-box;
+        border-radius: 5px;
+      ">
+          <div class="pb_head">
+            <div style="
+            display: flex;
+            align-items: center;
+        ">
+              <span>学生管理</span>
+            </div>
+          </div>
+          <div class="student_head">
+            <div class="head_left">
+              <el-input v-model="sPhoneUser" class="student_input" placeholder="请输入用户名"></el-input>
+              <el-select v-model="cid" placeholder="请选择班级" class="student_input" @change="searchStudent">
+                <el-option label="所有人" value=""></el-option>
+                <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name"
+                  :value="item.id"></el-option>
+              </el-select>
+              <el-button class="student_button" @click="searchStudent" type="primary">查询</el-button>
+            </div>
+            <div class="head_right">
+              <el-button @click="addStudent" type="primary" class="student_button">添加学生</el-button>
+              <el-upload class="upload-demo newCss" :http-request="handleChange" :on-remove="handleRemove" action="#"
+                :file-list="fileListUpload" accept=".xlsx">
+                <el-button size="primary" type="primary">批量添加</el-button>
+                <div slot="tip" class="el-upload__tip" style="margin-left: 10px">
+                  只能上传xlsx文件,且不超过500kb
+                </div>
+              </el-upload>
+              <!-- <el-button @click="exportExcel">导出学生</el-button> -->
+              <div @click="getExcel">xls 上传样例</div>
+            </div>
+          </div>
+        </div>
+        <div class="pb_content_body">
+          <div class="student_table">
+            <el-table ref="table" :data="tableData" border :height="tableHeight" :fit="true" v-loading="isLoading"
+              style="width: 100%" :header-cell-style="{ background: '#f1f1f1', fontSize: '17px' }"
+              :row-class-name="tableRowClassName">
+              <el-table-column label="姓名" min-width="10" align="center">
+                <template slot-scope="scope">
+                  <div class="userImg">
+                    <div class="tx">
+                      <img :src="scope.row.headportrait != null
+                        ? scope.row.headportrait
+                        : tx
+                        " alt />
+                    </div>
+                    <div style="
+                      width: 150px;
+                      text-align: left;
+                      white-space: nowrap;
+                      overflow: hidden;
+                      text-overflow: ellipsis;
+                    ">
+                      {{ scope.row.name }}
+                    </div>
+                  </div>
+                </template>
+              </el-table-column>
+              <el-table-column label="学生账号" min-width="15" align="center">
+                <template slot-scope="scope">
+                  <div>{{ scope.row.un ? scope.row.un : "" }}</div>
+                </template>
+              </el-table-column>
+              <!-- <el-table-column label="电话" min-width="15" align="center">
+              <template slot-scope="scope">
+                <div>{{scope.row.phonenumber ? scope.row.phonenumber : "" }}</div>
+              </template>
+            </el-table-column> -->
+              <!-- <el-table-column prop="studentid" label="学号" min-width="10" align="center"></el-table-column> -->
+              <!-- <el-table-column
+              prop="school"
+              label="学校"
+              min-width="30"
+              align="center"
+            >
+            </el-table-column>-->
+              <el-table-column prop="classname2" label="班级" min-width="15" align="center">
+              </el-table-column>
+              <el-table-column label="操作" width="250px">
+                <template slot-scope="scope">
+                  <div class="btnBox">
+                    <el-button class="de_button" type="primary" size="small" style="
+                      width: auto;
+                      padding: 5px !important;
+                      line-height: 15px;
+                    " @click="iniPassword(scope.row.userid)">初始化密码</el-button>
+                    <el-button class="de_button" type="primary" size="small"
+                      @click="updateStudentA(scope.row)">修改</el-button>
+                    <div class="delete">
+                      <img src="../../../assets/remove.png" alt
+                        @click="deleteStudent(scope.row.userid, scope.row.state)" />
+                    </div>
+                  </div>
+                </template>
+              </el-table-column>
+            </el-table>
+          </div>
+          <div class="student_page">
+            <el-pagination background layout="prev, pager, next" :page-size="10" :total="total" v-if="page"
+              @current-change="handleCurrentChange"></el-pagination>
+          </div>
+        </div>
+      </div>
+    </div>
+    <el-dialog :visible.sync="dialogVisible" :append-to-body="true" width="700px" :before-close="handleClose"
+      class="add_student">
+      <div slot="title" class="header-title">
+        <div class="logoImg">
+          <img src="../../../assets/logo.png" alt />
+        </div>
+        <div class="title_add_student">添加学生</div>
+      </div>
+      <el-form>
+        <el-form-item label="学生姓名" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生姓名" clearable v-model="sName" class="add_input"></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
+              placeholder="请输入学生手机号"
+              clearable
+              v-model="sPhone"
+              class="add_input"
+            ></el-input>
+          </span>
+        </el-form-item> -->
+        <el-form-item label="学生账号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生账号" clearable v-model="sMail" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="所属学校" :label-width="formLabelWidth">
+          <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
+        </el-form-item>
+        <el-form-item label="班级" :label-width="formLabelWidth">
+          <el-select multiple collapse-tags v-model="sByClass" placeholder="请选择班级">
+            <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <div style="text-align: center; color: #adb3b7">
+          注:添加学生的账号密码为123456
+        </div>
+      </el-form>
+      <span slot="footer" class="dialog-footer flex">
+        <el-button class="right" @click="insertStudent">确认</el-button>
+      </span>
+    </el-dialog>
+    <el-dialog :visible.sync="dialogVisibleUpdate" :append-to-body="true" width="700px" :before-close="handleClose"
+      class="add_student">
+      <div slot="title" class="header-title">
+        <div class="logoImg">
+          <img src="../../../assets/logo.png" alt />
+        </div>
+        <div class="title_add_student">修改学生</div>
+      </div>
+      <el-form>
+        <el-form-item label="学生名称" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生姓名" clearable v-model="userinfo.name" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <!-- <el-form-item label="学生学号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生学号" clearable v-model="userinfo.studentid" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="学生手机号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生手机号" clearable v-model="userinfo.phonenumber" class="add_input"></el-input>
+          </span>
+        </el-form-item> -->
+        <el-form-item label="学生账号" :label-width="formLabelWidth">
+          <span>
+            <el-input placeholder="请输入学生账号" clearable v-model="userinfo.un" class="add_input"></el-input>
+          </span>
+        </el-form-item>
+        <el-form-item label="所属学校" :label-width="formLabelWidth">
+          <el-input disabled style="width: 300px" v-model="schoolName"></el-input>
+        </el-form-item>
+        <el-form-item label="班级" :label-width="formLabelWidth">
+          <el-select multiple collapse-tags v-model="userinfo.classid" placeholder="请选择班级">
+            <el-option v-for="(item, index) in classJuri" :key="index" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <div style="text-align: center; color: #adb3b7">
+          注:添加学生的账号密码为123456
+        </div>
+      </el-form>
+      <span slot="footer" class="dialog-footer flex">
+        <el-button class="right" @click="updateStudent">修改</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import $ from "jquery";
+import pinyin from "../../../../node_modules/js-pinyin/index";
+export default {
+  data() {
+    return {
+      tableHeight: "500px",
+      isLoading: false,
+      formLabelWidth: "100px",
+      tableData: [],
+      dialogVisible: false,
+      dialogVisibleUpdate: false,
+      userinfo: {},
+      userinfoA: {},
+      sName: "",
+      sPhone: "",
+      sId: "",
+      schoolName: "",
+      // sBySchool: [],
+      // sBySchoolName:"",
+      sByClass: "",
+      sMail: "",
+      schoolJuri: [],
+      classJuri: [],
+      fileListUpload: [],
+      page: 1,
+      total: 0,
+      sPhoneUser: "",
+      userid: this.$route.query.userid,
+      oid: this.$route.query.oid,
+      org: this.$route.query.org,
+      role: this.$route.query.role,
+      cid: "",
+      tx: require("../../../assets/avatar.png"),
+      userSuffix: ""
+    };
+  },
+  mounted() {
+    this.$nextTick(function () {
+      this.getUser()
+      this.tableHeight =
+        window.innerHeight - this.$refs.table.$el.offsetTop - 200;
+      if (this.tableHeight <= 530) {
+        this.tableHeight = 530;
+      }
+      // 监听窗口大小变化
+      let self = this;
+      window.onresize = function () {
+        self.tableHeight =
+          window.innerHeight - self.$refs.table.$el.offsetTop - 200;
+        if (self.tableHeight <= 530) {
+          self.tableHeight = 530;
+        }
+      };
+    });
+  },
+  methods: {
+    goTo(path) {
+      this.$router.push(path);
+    },
+    getUser() {
+      let params = {
+        userid: this.userid
+      }
+      this.ajax
+        .get(this.$store.state.api + "selectUser", params)
+        .then((res) => {
+          this.userSuffix = res.data[0][0].accountNumber.split("@")[1]
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    tableRowClassName({ row, rowIndex }) {
+      if ((rowIndex + 1) % 2 === 0) {
+        return "even_row";
+      } else {
+        return "";
+      }
+    },
+    searchStudent() {
+      this.page = 1;
+      this.getStudent();
+    },
+    addStudent() {
+      this.dialogVisible = true;
+      (this.sName = ""), (this.sPhone = ""), (this.sByClass = ""), this.sMail;
+      this.getClass();
+      // this.getSchool();
+    },
+    handleClose(done) {
+      done();
+    },
+    getExcel(res) {
+      require.ensure([], () => {
+        const { export_json_to_excel } = require("../../../common/Export2Excel");
+        const tHeader = ["学生姓名", "学生账号", "班级"];//"学号", "学生手机号", 
+        const data = [];
+        export_json_to_excel(tHeader, data, "上传学生样例");
+      });
+    },
+    handleCurrentChange(val) {
+      this.page = val;
+      this.getStudent();
+    },
+    time() {
+      if (!this.now) {
+        this.now = new Date().getTime();
+        return true;
+      } else {
+        let time = new Date().getTime();
+        if (time - this.now > 3000) {
+          this.now = time;
+          return true;
+        } else {
+          return false;
+        }
+      }
+    },
+    //新增学生
+    insertStudent() {
+      this.dialogVisible = true;
+      if (this.sName === "") {
+        this.$message.error("学生姓名不能为空");
+        return;
+      } else if (this.sByClass === "") {
+        this.$message.error("请为学生选择班级");
+        return;
+      } else if (
+        this.sPhone != "" &&
+        !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.sPhone)
+      ) {
+        this.$message.error("手机号格式不正确");
+        return;
+      } else if (
+        // !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(this.sMail)
+        this.sMail === ""
+      ) {
+        // this.$message.error("邮箱格式不正确");
+        this.$message.error("学生账号不能为空");
+        return;
+      }
+
+      // else if (this.sId === "") {
+      //   this.$message.error("学生学号不能为空");
+      //   return;
+      // } else if (this.sPhone === "") {
+      //   this.$message.error("学生手机号不能为空");
+      //   return;
+      // }
+      if (this.time()) {
+        // let params = { un: this.sPhone };
+        // this.ajax
+        //   .get(this.$store.state.api + "findPhone", params)
+        //   .then((res) => {
+        //     if (res.data[0].length > 0) {
+        //       this.$message.error("此学生手机号码已被注册");
+        //     } else {
+        let params = { un: this.sMail + '@' + this.userSuffix };
+        this.ajax
+          .get(this.$store.state.api + "findMail", params)
+          .then((res) => {
+            if (res.data[0].length > 0) {
+              this.$message.error("此学生账号已被注册");
+            } else {
+              // 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) => {
+            console.error(err);
+          });
+        // }
+        // })
+        // .catch((err) => {
+        //   console.error(err);
+        // });
+      }
+    },
+    add_Student() {
+      let params = [
+        {
+          username: this.sMail + '@' + this.userSuffix,
+          userpassword: 123456,
+          alias: this.sName,
+          oid: this.oid,
+          ph: this.sPhone,
+          sid: this.sId,
+          cid: this.sByClass.join(","),
+          org: this.org,
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "batchRegistrationOrg", params)
+        .then((res) => {
+          // console.log(res.data.uid, res.data.ph, res.data.oid, res.data.cid);
+          // this.isLoading = false;
+
+          let params = [
+            {
+              userid: res.data.uid,
+              username: this.sName,
+              sid: this.sId,
+              type: 2,
+              oid: res.data.oid,
+              phone: res.data.ph,
+              cid: res.data.cid,
+              intro: "",
+              sex: "0",
+              org: this.org,
+            },
+          ];
+          this.ajax
+            // .post(this.$store.state.api + "updateUser", params)
+            .post(this.$store.state.api + "updateUserByEduOrg", params)
+            .then((res) => {
+              console.log(res);
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+          this.$message({
+            message: "新增成功",
+            type: "success",
+          });
+          this.dialogVisible = false;
+          this.sPhone = "";
+          this.sName = "";
+          // this.sBySchool = [];
+          this.sByClass = [];
+          this.sMail = "";
+          this.getStudent();
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          this.$message({
+            message: "新增失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+    //获取班级列表
+    getClass() {
+      this.isLoading = true;
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectClassBySchool", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.classJuri = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    // getSchool() {
+    // 	this.isLoading = true;
+    // 	let params = {
+    // 		page: this.page,
+    // 	};
+    // 	this.ajax
+    // 		.get(this.$store.state.api + "selectOrg", params)
+    // 		.then((res) => {
+    // 			this.isLoading = false;
+    // 			this.schoolJuri = res.data[0];
+    // 		})
+    // 		.catch((err) => {
+    // 			this.isLoading = false;
+    // 			console.error(err);
+    // 		});
+    // },
+    getStudent() {
+      this.isLoading = true;
+      let params = {
+        oid: this.oid,
+        cid: this.cid,
+        cu: "",
+        cn: this.sPhoneUser,
+        page: this.page,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectStudent2", params)
+        .then((res) => {
+          this.isLoading = false;
+          this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+          this.tableData = res.data[0];
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          console.error(err);
+        });
+    },
+    handleChange(file) {
+      this.fileTemp = file.file;
+      if (this.fileTemp) {
+        if (
+          this.fileTemp.type ==
+          "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
+          this.fileTemp.type == "application/vnd.ms-excel"
+        ) {
+          this.importCount = 1;
+          this.importfxx(this.fileTemp);
+        } else {
+          this.$message({
+            type: "warning",
+            message: "附件格式错误,请删除后重新上传!",
+          });
+        }
+      } else {
+        this.$message({
+          type: "warning",
+          message: "请上传附件!",
+        });
+      }
+    },
+    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)",
+        target: document.body,
+      });
+      var _$ = $;
+      this.importCount++;
+      let _this = this;
+      // 通过DOM取文件数据
+      this.file = obj;
+      var rABS = false; //是否将文件读取为二进制字符串
+      var f = this.file;
+      var reader = new FileReader();
+      //if (!FileReader.prototype.readAsBinaryString) {
+      FileReader.prototype.readAsBinaryString = function (f) {
+        var binary = "";
+        var rABS = false; //是否将文件读取为二进制字符串
+        var pt = this;
+        var wb; //读取完成的数据
+        var outdata;
+        var reader = new FileReader();
+        reader.onload = function (e) {
+          var bytes = new Uint8Array(reader.result);
+          var length = bytes.byteLength;
+          for (var i = 0; i < length; i++) {
+            binary += String.fromCharCode(bytes[i]);
+          }
+          var XLSX = require("xlsx");
+          if (rABS) {
+            wb = XLSX.read(btoa(fixdata(binary)), {
+              //手动转化
+              type: "base64",
+            });
+          } else {
+            wb = XLSX.read(binary, {
+              type: "binary",
+            });
+          }
+          outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]); //outdata就是你想要的东西
+          this.da = [...outdata];
+          let arr = [];
+          this.da.map((v) => {
+            let obj = {};
+            let a = "";
+            var num = "";
+            for (var cj = 0; cj < 3; cj++) {
+              num += Math.floor(Math.random() * 10);
+            }
+            a =
+              pinyin.getFullChars(v["学生姓名"]).toLowerCase() +
+              num +
+              "@cocorobo.cc";
+            obj.sId = v["学号"];
+            obj.name = v["学生姓名"];
+            obj.mail = v["学生账号"] ? v["学生账号"] : a;
+            obj.phone = v["学生手机号"];
+            obj.class = v["班级"];
+            arr.push(obj);
+          });
+          console.log(arr);
+          let _b = 1;
+          for (var i = 0; i < arr.length; i++) {
+            let item = arr[i];
+            if (item.class === "") {
+              _b = 1;
+              _this.$message.error("学生班级不能为空,请重新上传");
+              break;
+            } else if (item.name === "") {
+              _b = 1;
+              _this.$message.error("学生姓名不能为空,请重新上传");
+              break;
+            } else if (item.sId === "") {
+              _b = 1;
+              _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 (
+              !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
+                item.mail
+              )
+            ) {
+              _b = 1;
+              _this.$message.error("有学生账号格式不正确,请重新上传");
+              break;
+            }
+            //  else if (item.school === "") {
+            // 	_b = 1;
+            // 	_this.$message.error("学生学校不能为空,请重新上传");
+            // 	break;
+            // }
+            // else if (item.sex === "") {
+            // 	_b = 1;
+            // 	_this.$message.error("学生性别不能为空,请重新上传");
+            // 	break;
+            // }
+            // 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;
+            //   }
+            // }
+            // if (item.school != "") {
+            // 	let _a;
+            // 	let params = {
+            // 		schoolName: item.school,
+            // 	};
+
+            // 	_$.ajax({
+            // 		url: _this.$store.state.api + "selectS", //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.schoolid = res[0][0].id;
+            // 			}
+            // 		},
+            // 		error: function (xhr, textStatus) {
+            // 			console.log(textStatus);
+            // 		},
+            // 		complete: function () {},
+            // 	});
+            // 	if (_a == 1) {
+            // 		_b = 1;
+            // 		break;
+            // 	}
+            // }
+            //   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) {
+
+            // 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
+            //     .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();
+          }
+          let z = 2;
+          let newArr = JSON.stringify(arr);
+          let params = [
+            {
+              arr: newArr,
+              userpassword: 123456,
+              oid: _this.oid,
+            },
+          ];
+          _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",
+                });
+                _this.getStudent();
+              }
+              loading.close();
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+          _this.fileListUpload = [];
+        };
+
+        reader.readAsArrayBuffer(f);
+      };
+
+      if (rABS) {
+        reader.readAsArrayBuffer(f);
+      } else {
+        reader.readAsBinaryString(f);
+      }
+    },
+    getSchoolName() {
+      let params = {
+        oid: this.oid,
+      };
+      this.ajax
+        .get(this.$store.state.api + "selectSchoolName2", params)
+        .then((res) => {
+          this.schoolName = res.data[0][0].name;
+        })
+        .catch((err) => {
+          console.error(err);
+        });
+    },
+    deleteStudent(id, state) {
+      state = 0;
+      let params = [{ uid: id, state: state }];
+      this.$confirm("确定" + "删除" + "此学生吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          this.ajax
+            .post(this.$store.state.api + "deleteStudent", params)
+            .then((res) => {
+              this.$message({
+                message: "操作成功",
+                type: "success",
+              });
+              this.getStudent();
+            })
+            .catch((err) => {
+              this.$message.error("操作失败");
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
+    iniPassword(id) {
+      this.$confirm("确定" + "初始化" + "此学生的密码吗?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          let params = [
+            {
+              uid: id,
+              pa: 123456,
+            },
+          ];
+          this.ajax
+            .post(this.$store.state.api + "iniPassword", params)
+            .then((res) => {
+              this.$message({
+                message: "初始化密码成功!",
+                type: "success",
+              });
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        })
+        .catch(() => { });
+    },
+    updateStudentA(res) {
+      this.userinfo = JSON.parse(JSON.stringify(res));
+      this.userinfoA = JSON.parse(JSON.stringify(res));
+      this.userinfo.classid = this.userinfo.classid.split(",");
+      this.dialogVisibleUpdate = true;
+    },
+    updateStudent() {
+      if (this.userinfo.name === "") {
+        this.$message.error("学生姓名不能为空");
+        return;
+      } else if (!this.userinfo.classid) {
+        this.$message.error("请为学生选择班级");
+        return;
+      } else if (
+        this.userinfo.phonenumber &&
+        !/^[1][3,4,5,7,8][0-9]{9}$/.test(this.userinfo.phonenumber)
+      ) {
+        this.$message.error("手机号格式不正确");
+        return;
+      } else if (
+        !/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/.test(
+          this.userinfo.un
+        )
+      ) {
+        this.$message.error("邮箱格式不正确");
+        return;
+      }
+
+      if (this.time()) {
+        if (this.userinfoA.un != this.userinfo.un) {
+          let params = { un: this.userinfo.un };
+          this.ajax
+            .get(this.$store.state.api + "findMail", params)
+            .then((res) => {
+              if (res.data[0].length > 0) {
+                this.$message.error("此学生账号已被注册");
+              } else {
+                this.update_Student();
+              }
+            })
+            .catch((err) => {
+              console.error(err);
+            });
+        } else {
+          this.update_Student();
+        }
+      }
+    },
+    update_Student() {
+      let params = [
+        {
+          userid: this.userinfo.userid,
+          username: this.userinfo.un,
+          alias: this.userinfo.name,
+          ph: this.userinfo.phonenumber,
+          sid: this.userinfo.studentid,
+          cid: this.userinfo.classid.join(","),
+        },
+      ];
+      this.ajax
+        .post(this.$store.state.api + "updateStudentInfo", params)
+        .then((res) => {
+          this.$message({
+            message: "修改成功",
+            type: "success",
+          });
+          this.dialogVisibleUpdate = false;
+          this.getStudent();
+        })
+        .catch((err) => {
+          this.isLoading = false;
+          this.$message({
+            message: "修改失败",
+            type: "error",
+          });
+          console.error(err);
+        });
+    },
+  },
+  created() {
+    this.page = 1;
+    this.getStudent();
+    this.getSchoolName();
+    this.getClass();
+  },
+};
+</script>
+
+<style scoped>
+.pb_head>span:nth-child(2) {
+  font-size: 20px;
+  margin-left: 5px;
+  color: #828282;
+}
+
+.pb_head {
+  margin: 0 !important;
+  width: 100% !important;
+}
+
+.student_page {
+  margin-top: 10px;
+  display: flex;
+  justify-content: flex-end;
+}
+
+.student_head {
+  margin-top: 10px;
+  padding-bottom: 10px;
+  display: flex;
+  justify-content: space-between;
+}
+
+.head_left {
+  display: flex;
+  align-items: center;
+  line-height: 40px;
+}
+
+.head_right {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+}
+
+.student_input>>>.el-input__inner {
+  height: 30px;
+  width: 190px;
+  font-size: 13px;
+  padding: 0 10px;
+}
+
+.student_button {
+  color: #fff;
+  background: #2268bc;
+  width: 60px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 30px;
+}
+
+.head_right>button:nth-child(1) {
+  color: #fff;
+  background: #2268bc;
+  width: 70px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 30px;
+}
+
+.head_right>button:nth-child(2) {
+  color: #fff;
+  background: #2268bc;
+  width: 70px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 30px;
+}
+
+.head_right>div {
+  font-size: 12px;
+  line-height: 40px;
+  margin-left: 10px;
+  color: #2a6dbe;
+  text-decoration: underline;
+  cursor: pointer;
+}
+
+.student_table>>>.el-table--border td {
+  border-right: 0px !important;
+}
+
+.student_table>>>.el-table,
+.student_table>>>.el-table__body-wrapper {
+  height: auto !important;
+}
+
+.el-table>>>.even_row {
+  background-color: #f1f1f1 !important;
+}
+
+.de_button {
+  color: #fff;
+  background: #5190fd;
+  width: 50px;
+  height: 25px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 25px;
+}
+
+.add_student>>>.el-dialog__header {
+  padding: 20px 20px 10px;
+  text-align: center;
+  background: #32455b;
+}
+
+.add_student>>>.el-dialog__title {
+  font-size: 14px !important;
+  color: #fff !important;
+}
+
+.add_student>>>.el-dialog__headerbtn {
+  font-size: 20px !important;
+}
+
+.add_student>>>.el-form-item__label {
+  margin-left: 65px;
+}
+
+.add_student>>>.el-form-item {
+  display: flex;
+}
+
+.add_student>>>.el-form-item__content {
+  margin: 0 !important;
+}
+
+.add_input {
+  width: 365px;
+}
+
+.add_student>>>.el-dialog__footer {
+  text-align: center !important;
+}
+
+.right {
+  width: 250px;
+  color: #fff;
+  background: #0e72e6;
+  margin-bottom: 20px;
+}
+
+.header-title {
+  display: flex;
+}
+
+.logoImg {
+  width: 30px;
+}
+
+.logoImg>img {
+  width: 100%;
+  height: 100%;
+}
+
+.title_add_student {
+  margin: 0 auto;
+  color: #fff;
+}
+
+.upload-demo {
+  line-height: 0px !important;
+}
+
+.upload-demo>>>.el-button {
+  color: #fff;
+  background: #2268bc;
+  width: 70px;
+  height: 30px;
+  padding: 0 !important;
+  font-size: 12px;
+  line-height: 0 !important;
+}
+
+.userImg {
+  display: flex;
+  flex-direction: row;
+  justify-content: center;
+  align-items: center;
+}
+
+.tx {
+  width: 40px;
+  margin-right: 10px;
+}
+
+.delete {
+  width: 25px;
+  height: 25px;
+  cursor: pointer;
+  margin-left: 10px;
+}
+
+.tx>img,
+.delete>img {
+  width: 100%;
+  height: 100%;
+}
+
+.newCss {
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: baseline;
+}
+
+.student_input.el-input {
+  width: auto;
+}
+
+.student_input {
+  margin-right: 10px;
+}
+
+.student_input>>>.el-input__icon {
+  line-height: unset;
+}
+
+.btnBox {
+  display: flex;
+  align-items: center;
+}
+
+.sub_head {
+  position: relative;
+}
+
+.sub_head::after {
+  content: "";
+  width: 100%;
+  background: #5a9cea;
+  height: 2px;
+  position: absolute;
+  left: 0;
+  bottom: -10px;
+}
+
+.subClick {
+  /* font-size: 16px; */
+  font-size: 26px;
+  cursor: pointer;
+  /* margin-left: 17.5px; */
+  /* color: #ab582f; */
+  /* color: #409eff; */
+  color: #999;
+}
+
+.subClick:hover {
+  color: #000;
+}
+
+.sub_head+.subClick,
+.subClick+.subClick,
+.subClick+.sub_head {
+  margin-left: 17.5px;
+}
+
+.pb_content_body {
+  width: 100% !important;
+}
+
+.sm_box {
+  display: flex;
+  width: calc(100% - 20px);
+  margin: 0 auto;
+}
+
+.sm_right {
+  width: calc(100% - 210px);
+  margin-left: 210px;
+}
+
+.sm_left {
+  width: 200px;
+  background: #fff;
+  height: calc(100vh - 20px);
+  position: fixed;
+  left: 10px;
+  top: 10px;
+  border-radius: 5px;
+  overflow: hidden;
+}
+
+
+
+.nav {
+  height: 55px;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+  color: #777777;
+  transition: all .5s;
+}
+
+.nav:hover {
+  background: rgb(204, 204, 204);
+}
+
+.nav.active {
+  background: #3d67bc !important;
+  color: #fff;
+}
+
+.nav .icon {
+  width: 16px;
+  height: 16px;
+  margin-right: 5px;
+  background-size: 100% 100%;
+}
+
+.nav .name {}
+
+.nav .icon.gradeI {
+  background-image: url(../../../assets/icon/studentManage/grade.png);
+}
+
+.nav .icon.classI {
+  background-image: url(../../../assets/icon/studentManage/class.png);
+}
+
+.nav .icon.studentI {
+  background-image: url(../../../assets/icon/studentManage/student.png);
+}
+
+.nav.active .icon.gradeI {
+  background-image: url(../../../assets/icon/studentManage/grade-a.png);
+}
+
+.nav.active .icon.classI {
+  background-image: url(../../../assets/icon/studentManage/class-a.png);
+}
+
+.nav.active .icon.studentI {
+  background-image: url(../../../assets/icon/studentManage/student-a.png);
+}</style>

+ 351 - 0
src/components/pages/test/add/addTestXin.vue

@@ -0,0 +1,351 @@
+<template>
+    <div class="pb_content" style="background: #F0F2F5;" v-loading="loading">
+        <div class="pb_content_body" style="position: relative; margin: 0">
+            <div class="right">
+                <div class="courseTop">
+                    <div class="stepsNav">
+                        <el-breadcrumb separator-class="el-icon-arrow-right">
+                            <el-breadcrumb-item :to="{
+                                path:
+                                    '/test?userid=' +
+                                    userid +
+                                    '&oid=' +
+                                    oid +
+                                    '&org=' +
+                                    org +
+                                    '&role=' +
+                                    role,
+                            }">表单管理</el-breadcrumb-item>
+                            <el-breadcrumb-item>
+                                <span style="color: rgb(15, 126, 255)">新建表单</span>
+                            </el-breadcrumb-item>
+                        </el-breadcrumb>
+                    </div>
+                    <div class="r_pub_button_retrun" @click="retrunCourse">返回</div>
+                </div>
+                <div class="step_box" :style="{ width: steps == 2 && '100%' }">
+                    <setInfo v-if="steps == 1 && !loading" :oid="oid" :org="org" :steps.sync="steps" :title.sync="title"
+                        :testType.sync="testType" :see.sync="see" :cJson.sync="cJson" :typeid.sync="typeid" :brief.sync="brief" :juri.sync="juri" :overDate.sync="overDate" :juriList.sync="juriList"></setInfo>
+                    <editInfo v-if="steps == 2 && !loading" :oid="oid" :org="org" :steps.sync="steps" :title.sync="title"
+                        :cJson.sync="cJson" @save="save" @publish="publish"></editInfo>
+                </div>
+            </div>
+        </div>
+    </div>
+</template>
+
+<script>
+import setInfo from './setInfo/index.vue'
+import editInfo from './edit/index.vue'
+export default {
+    components: {
+        setInfo, editInfo
+    },
+    data() {
+        return {
+            userid: this.$route.query.userid,
+            oid: this.$route.query.oid,
+            org: this.$route.query.org,
+            role: this.$route.query.role,
+            cid: this.$route.query.cid,
+            steps: 2,
+            title: "",
+            testType: [],
+            see: false,
+            cJson: [],
+            loading:false,
+            look:"",
+            typeid:"",
+            brief:"",
+            juri:'0',
+            overDate:"",
+            juriList:"",
+        }
+    },
+    watch: {
+        steps(newValue, oldValue) {
+            if (!this.title) {
+                this.$message.error("请补充填写课程名称");
+                this.steps = 1
+                return;
+            }
+            // else if(!this.juriList.length){
+            //     this.$message.error("请选择权限")
+            //     this.steps = 1
+            //     return
+            // } 
+            if (this.cid) {
+                this.updateWork(this.look)
+            } else {
+                this.addWork();
+            }
+        }
+    },
+    methods: {
+        retrunCourse() {
+            this
+                .$confirm("是否保存已编辑内容?", "提示", {
+                    confirmButtonText: "保存",
+                    cancelButtonText: "不保存",
+                    distinguishCancelAndClose: true,
+                    type: "warning",
+                })
+                .then(() => {
+                    if (this.cid == "" || this.cid == undefined) {
+                        if (this.title == "") {
+                            this.$message.error("请补充填写课程名称");
+                            return;
+                        }else {
+                            this.addWork(5);
+                        }
+                        // else if(!this.juriList.length){
+                        //     this.$message.error("请选择权限")
+                        //     return
+                        // }
+                    } else {
+                        if (this.title == "") {
+                            this.$message.error("请补充填写课程名称");
+                            return;
+                        }else {
+                            this.updateWork(5);
+                        }
+                        // else if(!this.juriList.length){
+                        //     this.$message.error("请选择权限")
+                        //     return
+                        // }
+                    }
+                })
+                .catch((v) => {
+                    console.log(v)
+                    if (v == "cancel") {
+                        this.goTo(
+                            "/test?userid=" +
+                            this.userid +
+                            "&oid=" +
+                            this.oid +
+                            "&org=" +
+                            this.org +
+                            "&role=" +
+                            this.role
+                        );
+                    }
+                });
+        },
+        goTo(path) {
+            this.$router.push(path);
+        },
+        addWork(look) {
+            let params = [
+                {
+                    uid: this.userid,
+                    title: this.title.replace(/%/g, "%25"),
+                    brief: this.brief.replace(/%/g, "%25"),
+                    cover: "",
+                    evaId: "",
+                    astudent: this.juri,
+                    see: this.see == true ? 1 : 0,
+                    chapters: JSON.stringify(this.cJson).replaceAll(/%/g, "%25"),
+                    template: "",
+                    courseType: JSON.stringify(this.testType),
+                    ateacher: "",
+                    inviteCode: "",
+                    typeid: this.typeid ? this.typeid : '',
+                    overtime: this.overDate ? this.formatTime(this.overDate) : '',
+                    j2: this.juriList.length ? this.juriList.join(",") : ''
+                },
+            ];
+            this.ajax
+                .post(this.$store.state.api + "addTestCourse", params)
+                .then((res) => {
+                    this.cid = res.data.courseId;
+                    if(look == 5){
+                        this.$message.success("保存成功")
+                        this.goTo(
+                            "/test?userid=" +
+                            this.userid +
+                            "&oid=" +
+                            this.oid +
+                            "&org=" +
+                            this.org +
+                            "&role=" +
+                            this.role
+                        );
+                    }
+                    setTimeout(() => {
+                        this.getData(2);
+                    }, 1000);
+                })
+                .catch((err) => {
+                    this.$message.error("网络不佳");
+                    console.error(err);
+                });
+        },
+        formatTime(timestamp) {
+            const date = new Date(timestamp);
+            const year = date.getFullYear();
+            const month = String(date.getMonth() + 1).padStart(2, '0');
+            const day = String(date.getDate()).padStart(2, '0');
+            
+            return `${year}-${month}-${day}`;
+        },
+        updateWork(look) {
+            let params = [
+                {
+                    cid: this.cid,
+                    title: this.title.replace(/%/g, "%25"),
+                    brief: this.brief.replace(/%/g, "%25"),
+                    cover: "",
+                    evaId: "",
+                    astudent: this.juri,
+                    see: this.see == true ? 1 : 0,
+                    chapters: JSON.stringify(this.cJson).replaceAll(/%/g, "%25"),
+                    uid: this.userid,
+                    courseType: JSON.stringify(this.testType),
+                    ateacher: "",
+                    inviteCode: "",
+                    look: look == 3 ? 2 : look == 4 ? this.look : look == 5 ? this.look : look,
+                    typeid: this.typeid ? this.typeid : '',
+                    overtime: this.overDate ? this.formatTime(this.overDate) : '',
+                    j2: this.juriList.length ? this.juriList.join(",") : ''
+                },
+            ];
+            this.ajax
+                .post(this.$store.state.api + "updateTestCourse", params)
+                .then((res) => {
+                    if(look == 3){
+                        this.$message.success("发布成功")
+                        this.goTo(
+                            "/test?userid=" +
+                            this.userid +
+                            "&oid=" +
+                            this.oid +
+                            "&org=" +
+                            this.org +
+                            "&role=" +
+                            this.role
+                        );
+                    }else if(look == 4){
+                        this.$message.success("保存成功")
+                    }else if( look == 1 || look == 2){
+                        // this.$message.success("保存成功")
+                    }else if(look == 5){
+                        this.$message.success("保存成功")
+                        this.goTo(
+                            "/test?userid=" +
+                            this.userid +
+                            "&oid=" +
+                            this.oid +
+                            "&org=" +
+                            this.org +
+                            "&role=" +
+                            this.role
+                        );
+                    }
+                    setTimeout(() => {
+                        this.getData(2);
+                    }, 1000);
+                })
+                .catch((err) => {
+                    this.$message.error("网络不佳");
+                    console.error(err);
+                });
+        },
+        getData(type) {
+            if (this.cid == "" || this.cid == undefined) {
+                console.log("这是新增课程");
+            } else {
+                if(type != 2){
+                    this.loading = true
+                }
+                let params = {
+                    cid: this.cid,
+                };
+                this.ajax
+                    .get(this.$store.state.api + "getTestCourseDetail", params)
+                    .then((res) => {
+                        this.cJson = JSON.parse(res.data[0][0].chapters);
+                        this.title = res.data[0][0].title;
+                        this.juri = res.data[0][0].juri ? res.data[0][0].juri : '0';
+                        this.overDate = res.data[0][0].overTime ? res.data[0][0].overTime : '';
+                        this.juriList = res.data[0][0].juri2 ? res.data[0][0].juri2.split(',') : [];
+                        this.see = res.data[0][0].open == 1 ? true : false;
+
+                        this.typeid = res.data[0][0].typeid;
+                        this.brief = res.data[0][0].brief;
+                        this.testType = [];
+                        for (var i = 0; i < res.data[1].length; i++) {
+                            this.testType.push(res.data[1][i].typeid);
+                        }
+                        console.log(this.testType);
+                        this.look = res.data[0][0].look
+                        this.$forceUpdate()
+                        if(type != 2){
+                            this.loading = false
+                        }
+                    })
+                    .catch((err) => {
+                        console.error(err);
+                    });
+            }
+        },
+        save(look) {
+            this.updateWork(look == 4 ? look : this.look)
+        },
+        publish() {
+            this.updateWork(3)
+        },
+    },
+    mounted () {
+        this.getData();
+    },
+}
+</script>
+
+<style scoped>
+.pb_content {
+    height: 100% !important;
+    /* margin: 0 20px 0 20px; */
+}
+
+.pb_content_body {
+    width: 100% !important;
+    height: 100%;
+}
+
+.right {
+    height: 100%;
+    width: 100%;
+    display: flex;
+    overflow: hidden;
+    flex-direction: column;
+}
+
+.basic_box {
+    margin: 0 auto;
+    position: relative;
+    padding: 0 20px 0 20px;
+}
+
+.courseTop {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+    align-items: center;
+    width: calc(100% - 40px);
+    margin: 0 auto;
+    padding: 10px 0;
+}
+
+.stepsNav {
+    display: flex;
+    flex-direction: row;
+    justify-content: flex-start;
+    align-items: center;
+}
+
+.step_box {
+    width: calc(100% - 40px);
+    margin: 0 auto;
+    height: calc(100% - 38px);
+}
+</style>

+ 37 - 9
src/components/pages/test/add/edit/check/file.vue

@@ -14,7 +14,8 @@
                 <!-- + `(${option[checkJson.type].name})` -->
                 <span style="min-width: fit-content;">{{ tindex + 1 + "、" }}</span>
                 <span>{{ checkJson.title }}</span>
-                <span style="color: #efa030;min-width: fit-content;" v-if="checkJson.score">({{ '分值:' + checkJson.score + '分' }})</span>
+                <span style="color: #efa030;min-width: fit-content;" v-if="checkJson.score">({{ '分值:' + checkJson.score +
+                    '分' }})</span>
                 <!-- </div><div v-html="checkJson.title"></div> -->
             </div>
             <div class="choices">
@@ -39,13 +40,15 @@
                                 </div>
                             </div>
                         </div>
-                        <div class="btn" @click.stop="addImg($event)">
-                            <span>点击添加本地文件</span>
+                        <!-- @click.stop="addImg($event)" -->
+                        <div class="btn" @click.stop="openFileBox()">
+                            <span>点击添加文件</span>
                             <input type="file" accept="*" style="display: none" @change="beforeUpload($event)" />
                         </div>
                     </div>
-                    <div class="uploadQ" @click.stop="addImg($event)" v-else>
-                        <span>点击添加本地文件</span>
+                    <!-- @click.stop="addImg($event)" -->
+                    <div class="uploadQ" @click.stop="openFileBox()" v-else>
+                        <span>点击添加文件</span>
                         <input type="file" accept="*" style="display: none" @change="beforeUpload($event)" />
                     </div>
                     <div v-if="proVisible" class="mask">
@@ -76,6 +79,7 @@
         <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
         <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
         <wOffice :dialogVisibleOffice.sync="dialogVisibleOffice" :url="wurl"></wOffice>
+        <checkfile :dialogVisiblefile.sync="dialogVisiblefile" @setCheckJson="setCheckJson"></checkfile>
     </div>
 </template>
 
@@ -89,14 +93,16 @@ import fileIcon from '../../../../../../assets/icon/fileIcon/word2.png'
 import wVideo from "../../../file/wVideo.vue";
 import wpdf from "../../../file/wPdf2.vue";
 import wOffice from "../../../file/wOffice.vue";
+import checkfile from "../../../file/checkfile.vue";
 export default {
     components: {
         wpdf,
         wVideo,
         wOffice,
+        checkfile
     },
     props: {
-        tindex:{
+        tindex: {
             type: Number
         },
         cJson: {
@@ -127,6 +133,7 @@ export default {
             dialogVisiblePdf: false,
             dialogVisibleVideo: false,
             dialogVisibleOffice: false,
+            dialogVisiblefile: false,
             wurl: "",
         }
     },
@@ -142,6 +149,9 @@ export default {
         depthCopy(s) {
             return JSON.parse(JSON.stringify(s));
         },
+        openFileBox() {
+            this.dialogVisiblefile = true
+        },
         addImg(e) {
             var el = e.currentTarget;
             el.getElementsByTagName("input")[0].click();
@@ -322,6 +332,23 @@ export default {
                     });
             }
         },
+        setCheckJson(name, url, type) {
+            if (this.checkJson.file) {
+                this.checkJson.file.push({
+                    name: name,
+                    url: url,
+                    type: type,
+                });
+            } else {
+                this.checkJson.file = []
+                this.checkJson.file.push({
+                    name: name,
+                    url: url,
+                    type: type,
+                });
+            }
+            this.$forceUpdate();
+        },
         checkFile(item) {
             if (item.type == 3) {
                 this.$hevueImgPreview(item.url);
@@ -398,12 +425,12 @@ export default {
     position: relative;
 }
 
-.mask {
+/* .mask {
     position: absolute;
     height: 100%;
     width: 100%;
     z-index: 2;
-}
+} */
 
 .choice_box {
     white-space: pre-line;
@@ -587,4 +614,5 @@ export default {
     align-items: center;
     justify-content: center;
     cursor: pointer;
-}</style>
+}
+</style>

+ 481 - 0
src/components/pages/test/add/edit/edit/indexXin.vue

@@ -0,0 +1,481 @@
+<template>
+  <div class="edit_box">
+    <div class="e_add">
+      <div class="title" style="margin-bottom: 20px">题目添加</div>
+      <div class="e_add_box">
+        <div class="title">基础题型</div>
+        <div class="e_add_ci">
+          <!-- <div class="title">基础题型</div> -->
+          <div class="box">
+            <div
+              class="btn"
+              v-for="item in options"
+              :key="item.label"
+              @click="addCheck(item.value)"
+            >
+              <!-- <el-button type="primary"
+                                size="mini">{{ item.label }}</el-button> -->
+              <button
+                class="pub_test_btn"
+                :class="{
+                  pub_test_btn_text: item.value == 3,
+                  pub_test_btn_choose: item.value == 1,
+                  pub_test_btn_file: item.value == 5,
+                }"
+              >
+                {{ item.label }}
+              </button>
+            </div>
+          </div>
+        </div>
+      </div>
+      <div class="e_add_box">
+        <div class="title">添加组件</div>
+        <div class="e_add_ci">
+          <div class="box">
+            <div
+              class="btn"
+              v-for="item in buttonOptions"
+              :key="item.name"
+              @click="addQtype(item.type)"
+            >
+              <!-- <el-button type="primary"
+                                size="mini">{{ item.name }}</el-button> -->
+              <button
+                class="pub_test_btn"
+                :class="{
+                  pub_test_btn_group: item.type == 1,
+                  pub_test_btn_page: item.type == 2,
+                }"
+              >
+                {{ item.name }}
+              </button>
+            </div>
+          </div>
+        </div>
+      </div>
+    </div>
+    <div class="e_content">
+      <div class="title">{{ title }}</div>
+      <div class="e_order_box">
+        <checkOrder
+          :checkC.sync="checkC"
+          :checkJson="manualJson"
+          @changeJson="changeJson"
+          etype="edit"
+          :cJson.sync="cJson"
+        >
+        </checkOrder>
+      </div>
+    </div>
+    <div class="e_order">
+      <div class="title">
+        题目排序
+        <span style="font-size: 14px; color: #373737">总分:{{ score }}分</span>
+      </div>
+      <div class="e_order_box" style="margin-top: 20px">
+        <checkOrder
+          :checkC.sync="checkC"
+          :checkJson="manualJson"
+          @changeJson="changeJson"
+          etype="order"
+          :cJson.sync="cJson"
+        >
+        </checkOrder>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import checkOrder from "../../components/checkOrder.vue";
+import minxinVue from "../../minxins/minxin";
+export default {
+  components: {
+    checkOrder,
+  },
+  mixins: [minxinVue],
+  props: {
+    checkJson: {
+      type: Array,
+    },
+    title: {
+      type: String,
+    },
+  },
+  data() {
+    return {
+      manualJson: [],
+      checkC: "",
+      cJson: {},
+    };
+  },
+  watch: {
+    checkJson: {
+      handler(newVal) {
+        this.manualJson = this.depthCopy(newVal);
+      },
+      deep: true,
+    },
+  },
+  computed: {
+    score() {
+      let score = 0;
+      this.manualJson.forEach((el) => {
+        if ((el.ttype == 3 || el.ttype == 2) && el.array.length > 0) {
+          el.array.forEach((item) => {
+            if (item.ttype == 2 && item.array.length > 0) {
+              item.array.forEach((item2) => {
+                if (item2.ttype == 1 && item2.json) {
+                  score += item2.json.score ? parseFloat(item2.json.score) : 0;
+                }
+              });
+            } else if (item.ttype == 1 && item.json) {
+              score += item.json.score ? parseFloat(item.json.score) : 0;
+            }
+          });
+        } else if (el.ttype == 1 && el.json) {
+          score += el.json.score ? parseFloat(el.json.score) : 0;
+        }
+      });
+      return score > 0 ? score : "未设置分数";
+    },
+  },
+  methods: {
+    changeJson(json) {
+      this.manualJson = json;
+      this.$emit("changeJson", json);
+    },
+    addCheck(topicType) {
+      let type = 1;
+      if (this.manualJson.length > 0) {
+        for (var i = 0; i < this.manualJson.length; i++) {
+          if (this.manualJson[i].ttype == 2) {
+            type = 2;
+          } else if (this.manualJson[i].ttype == 3) {
+            type = 3;
+          }
+        }
+      }
+      if (this.checkC) {
+        let _check = this.checkC.replace("x", "").split("-");
+        let _json = this.manualJson[_check[0]];
+        let json = {
+          ttype: 1,
+          type: topicType,
+        };
+        if (topicType == 1) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            array: [
+              { option: "选项1", img: "" },
+              { option: "选项2", img: "" },
+            ],
+            answer: "",
+          };
+        } else if (topicType == 3) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            answer: "",
+          };
+        } else if (topicType == 5) {
+          json.json = {
+            title: "标题",
+            type: 1,
+            detail: "",
+          };
+        }
+        if (_json.array) {
+          if (type == 3 && _check.length == 2) {
+            if (this.manualJson[_check[0]].array[_check[1]].array) {
+              this.manualJson[_check[0]].array[_check[1]].array.push(json);
+            } else {
+              this.manualJson[_check[0]].array.splice(
+                parseInt(_check[1]) + 1,
+                0,
+                json
+              );
+            }
+          } else if (type == 3 && _check.length == 3) {
+            this.manualJson[_check[0]].array[_check[1]].array.splice(
+              parseInt(_check[2]) + 1,
+              0,
+              json
+            );
+          } else if (type == 2 && _check.length == 2) {
+            this.manualJson[_check[0]].array.splice(
+              parseInt(_check[1]) + 1,
+              0,
+              json
+            );
+          } else if (type == 2 && _check.length == 1) {
+            this.manualJson[_check[0]].array.push(json);
+          } else if (type == 3 && _check.length == 1) {
+            if (
+              this.manualJson[_check[0]].array[0] &&
+              this.manualJson[_check[0]].array[0].array
+            ) {
+              this.manualJson[_check[0]].array[0].array.push(json);
+            } else {
+              this.manualJson[_check[0]].array.push(json);
+            }
+          }
+        } else {
+          this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
+        }
+      } else {
+        if (type == 1) {
+          let json1 = {
+            ttype: 1,
+            type: topicType,
+          };
+
+          if (topicType == 1) {
+            json1.json = {
+              title: "标题",
+              type: 1,
+              array: [
+                { option: "选项1", img: "" },
+                { option: "选项2", img: "" },
+              ],
+              answer: "",
+            };
+          } else if (topicType == 3) {
+            json1.json = {
+              title: "标题",
+              type: 1,
+              answer: "",
+            };
+          } else if (topicType == 5) {
+            json1.json = {
+              title: "标题",
+              type: 1,
+              detail: "",
+            };
+          }
+          this.manualJson.push(json1);
+          this.$forceUpdate()
+        } else if (type == 3 || type == 2) {
+          this.$message.error("请选中分页或者分组添加题目");
+          return;
+        }
+      }
+      topicType = "";
+      this.$forceUpdate()
+      this.$emit("changeJson", this.manualJson);
+    },
+    addQtype(type) {
+      if (type == 1) {
+        let type = 1;
+        if (this.manualJson.length > 0) {
+          for (var i = 0; i < this.manualJson.length; i++) {
+            if (this.manualJson[i].ttype == 1) {
+              type = 2;
+            } else if (this.manualJson[i].ttype == 3) {
+              type = 3;
+            }
+          }
+        }
+        let json = {
+          ttype: 2,
+          array: [],
+          isopen: true,
+        };
+        if (type == 1) {
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
+            this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
+          } else {
+            this.manualJson.push(json);
+          }
+        } else if (type == 2) {
+          this.manualJson = [
+            {
+              ttype: 2,
+              array: this.depthCopy(this.manualJson),
+              isopen: true,
+            },
+          ];
+        } else if (type == 3) {
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
+
+            if (
+              _check.length > 1 &&
+              this.manualJson[_check[0]].array[0] &&
+              this.manualJson[_check[0]].array[0].array
+            ) {
+              this.manualJson[_check[0]].array.splice(
+                parseInt(_check[1]) + 1,
+                0,
+                json
+              );
+            } else if (
+              this.manualJson[_check[0]].array[0] &&
+              !this.manualJson[_check[0]].array[0].array
+            ) {
+              this.manualJson[_check[0]].array = [
+                {
+                  ttype: 2,
+                  array: this.depthCopy(this.manualJson[_check[0]].array),
+                  isopen: true,
+                },
+              ];
+            } else {
+              this.manualJson[_check[0]].array.push(json);
+            }
+          } else {
+            this.$message.error("请选中分页添加分组");
+            return;
+          }
+        }
+      } else if (type == 2) {
+        let type = 1;
+        if (this.manualJson.length > 0) {
+          for (var i = 0; i < this.manualJson.length; i++) {
+            if (
+              this.manualJson[i].ttype == 1 ||
+              this.manualJson[i].ttype == 2
+            ) {
+              type = 2;
+            }
+          }
+        }
+        if (type == 1) {
+          let json = {
+            ttype: 3,
+            array: [],
+            isopen: true,
+          };
+          if (this.checkC) {
+            let _check = this.checkC.replace("x", "").split("-");
+
+            this.manualJson.splice(parseInt(_check[0]) + 1, 0, json);
+          } else {
+            this.manualJson.push(json);
+          }
+        } else {
+          this.manualJson = [
+            {
+              ttype: 3,
+              array: this.depthCopy(this.manualJson),
+              isopen: true,
+            },
+          ];
+        }
+      }
+      this.$emit("changeJson", this.manualJson);
+    },
+  },
+  mounted() {
+    this.manualJson = this.depthCopy(this.checkJson);
+  },
+};
+</script>
+
+<style scoped>
+.edit_box {
+  width: 100%;
+  height: 100%;
+  overflow: hidden;
+  display: flex;
+  justify-content: space-between;
+  padding: 0 0 0;
+  box-sizing: border-box;
+}
+
+.e_add {
+  height: 100%;
+  width: 300px;
+  background: #fff;
+  overflow: auto;
+  padding: 20px 10px;
+  box-sizing: border-box;
+  /* border-right: 1px solid #e5e5e5; */
+  border-radius: 5px;
+}
+
+.e_content {
+  height: 100%;
+  width: calc(100% - 640px);
+  background: #fff;
+  overflow: auto;
+  padding: 20px 0;
+  box-sizing: border-box;
+  border-radius: 5px;
+}
+
+.e_content > .title {
+  font-size: 24px;
+  font-weight: bold;
+  text-align: center;
+  width: 100%;
+  margin-bottom: 10px;
+  word-break: break-all;
+}
+
+.e_order {
+  height: 100%;
+  width: 300px;
+  background: #fff;
+  overflow: auto;
+  padding: 20px 10px;
+  box-sizing: border-box;
+  border-radius: 5px;
+}
+
+.e_add > .title,
+.e_order > .title {
+  text-align: center;
+  font-size: 20px;
+}
+
+.e_add_box {
+  width: 100%;
+  /* border: 1px solid #dcdcdc; */
+  margin-top: 10px;
+  border-radius: 3px;
+  /* background: #f4f4f4; */
+  box-sizing: border-box;
+  padding: 0 20px 0;
+}
+
+.e_add_box > .title {
+  margin-bottom: 10px;
+  font-size: 15px;
+  font-weight: 700;
+  display: flex;
+  align-items: center;
+}
+
+.e_add_box > .title::before {
+  content: "";
+  width: 10px;
+  height: 10px;
+  border-radius: 50%;
+  background: rgb(54, 129, 252);
+  margin-right: 10px;
+  display: block;
+}
+
+.e_add_box > .e_add_ci {
+  margin-top: 10px;
+}
+
+.e_add_box > .e_add_ci > .title {
+  font-size: 14px;
+  margin-bottom: 10px;
+}
+
+.e_add_box > .e_add_ci > .box {
+  display: flex;
+  flex-wrap: wrap;
+}
+
+.e_add_box > .e_add_ci > .box > .btn {
+  margin-bottom: 10px;
+  width: 50%;
+}
+</style>

+ 219 - 0
src/components/pages/test/add/edit/indexXin.vue

@@ -0,0 +1,219 @@
+<template>
+  <div class="rightBox">
+    <!-- <div class="title">
+      <div class="c_info_title">创建表单内容</div>
+    </div> -->
+    <div class="edit_top">
+      <div class="edit_btn">
+        <span class="edit" :class="{ active: type == 1 }" @click="type = 1">编辑</span>
+        <span class="check" :class="{ active: type == 2 }" @click="type = 2">预览</span>
+        <!-- <span :class="{ active: type == 3 }" @click="type = 3">回答</span>
+        <span :class="{ active: type == 4 }" @click="type = 4">统计</span> -->
+      </div>
+      <div class="op_btn">
+        <!-- <el-button type="primary" size="small" @click="lastSteps">上一步</el-button> -->
+        <el-button type="primary" size="small" @click="save">保存</el-button>
+        <el-button type="primary" size="small" @click="publish">发布</el-button>
+
+      </div>
+    </div>
+    <div class="e_box">
+      <editBox v-if="type == 1" :checkJson="checkJson" @changeJson="changeJson" :title="title"></editBox>
+      <checkBox v-if="type == 2" :cJson="checkJson" :title="title"></checkBox>
+    </div>
+  </div>
+</template>
+
+<script>
+import editBox from './edit/index.vue'
+import checkBox from './check/index.vue'
+
+export default {
+  components: {
+    editBox,
+    checkBox
+  },
+  props: {
+    title: {
+      type: String
+    },
+    testType: {
+      type: Array
+    },
+    see: {
+      type: Boolean
+    },
+    steps: {
+      type: Number
+    },
+    cJson: {
+      type: Array
+    }
+  },
+  data() {
+    return {
+      type: 1,
+      checkJson: [],
+    }
+  },
+  watch: {
+    cJson: {
+      handler: function (newVal, oldVal) {
+        this.checkJson = this.depthCopy(newVal);
+      },
+      deep: true,
+    },
+  },
+  methods: {
+    lastSteps() {
+      this.$emit('update:steps', this.steps - 1)
+    },
+    save() {
+      this.$emit("save", 4)
+    },
+    publish() {
+      this.$emit("publish")
+    },
+    depthCopy(s) {
+      return s ? JSON.parse(JSON.stringify(s)) : ''
+    },
+    changeJson(json) {
+      this.$emit("update:cJson", json);
+    }
+  },
+  mounted() {
+    this.checkJson = this.depthCopy(this.cJson);
+  },
+}
+</script>
+
+<style scoped>
+.c_info_title {
+  padding: 15px 0 15px 0;
+  font-size: 16px;
+  font-weight: bold;
+  margin: 0 0 0 0;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  line-height: 20px;
+}
+
+.c_info_title::before {
+  content: '';
+  display: block;
+  width: 3px;
+  height: 20px;
+  background: #0061FF;
+  border-radius: 3px;
+  margin: 0 5px 0 0;
+}
+
+.rightBox {
+  width: calc(100%);
+  /* background: #F0F2F5; */
+  /* background: #fff; */
+  overflow: auto;
+  height: calc(100%);
+  margin: 0 auto;
+  position: relative;
+  box-sizing: border-box;
+}
+
+.rightBox>.title {
+  background: #fff;
+  width: 100%;
+  padding: 0 20px 0;
+  box-sizing: border-box;
+}
+
+.edit_top {
+  height: 50px;
+  background: #fff;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  position: relative;
+}
+
+.edit_top>.edit_btn {
+  display: flex;
+  height: 40px;
+  align-items: center;
+  border: 1px solid #E5E5E5;
+  box-sizing: border-box;
+  padding: 4px;
+  border-radius: 4px;
+}
+
+.edit_top>.edit_btn>span {
+  cursor: pointer;
+  padding-bottom: 5px;
+  display: block;
+  width: 90px;
+  padding: 0 15px;
+  height: 100%;
+  font-size: 14px;
+  box-sizing: border-box;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  border-radius: 4px;
+}
+
+.edit_top>.edit_btn>.active {
+  color: #3e88f4;
+  /* border-bottom: 2px solid #2f80f3; */
+  background: rgb(224, 234, 251);
+}
+
+.edit_top>.edit_btn>span+span {
+  margin-left: 10px;
+}
+
+
+.edit_top>.edit_btn>span::before {
+  content: '';
+  display: block;
+  background-size: 100% 100%;
+  margin-right: 8px;
+}
+
+.edit_top>.edit_btn>.check::before {
+  width: 15px;
+  height: 15px;
+  background-image: url(../../../../../assets/icon/test/add_check_icon.png);
+}
+
+.edit_top>.edit_btn>.edit::before {
+  width: 15px;
+  height: 16px;
+  background-image: url(../../../../../assets/icon/test/add_edit_icon.png);
+}
+
+.edit_top>.edit_btn>.active.check::before {
+  background-image: url(../../../../../assets/icon/test/add_check_icon_active.png);
+}
+
+.edit_top>.edit_btn>.active.edit::before {
+  background-image: url(../../../../../assets/icon/test/add_edit_icon_active.png);
+}
+
+
+.edit_top>.op_btn {
+  position: absolute;
+  right: 30px;
+}
+
+.e_box {
+  height: calc(100% - 90px);
+  width: calc(100% - 40px);
+  overflow: hidden;
+  /* background: rgb(196, 226, 241); */
+  /* background: #fff; */
+  /* border: 1px solid #E5E5E5; */
+  -webkit-box-sizing: border-box;
+  box-sizing: border-box;
+  margin: 15px auto 0;
+  border-radius: 5px;
+}</style>

+ 752 - 0
src/components/pages/test/file/checkfile.vue

@@ -0,0 +1,752 @@
+<template>
+    <el-dialog title="上传文件" :visible.sync="dialogVisiblefile" :append-to-body="true" width="600px"
+        :before-close="handleClose" class="dialog_diy">
+        <div class="fileCss">
+            <div>
+                <button class="info_btn" @click="addImg($event)">
+                    选择本地文件
+                    <input type="file" accept="*" style="display: none" @change="beforeUpload" />
+                </button>
+                <div class="spanName">选择本地文件</div>
+            </div>
+            <div>
+                <el-button @click="openFile">选择素材库文件</el-button>
+                <div class="spanName">选择素材库文件</div>
+            </div>
+        </div>
+        <div v-if="proVisible" class="mask">
+            <div class="progressBox">
+                <div class="lbox">
+                    <img src="../../../../assets/loading.gif" />上传中,请稍后
+                </div>
+                <div style="margin-bottom: 10px">
+                    <span>{{
+                        isFinishSize
+                    }}M</span>
+                    /
+                    <span>{{
+                        isAllSize
+                    }}M</span>
+                </div>
+                <el-progress :text-inside="true" :stroke-width="20" :percentage="progress
+                    ? progress
+                    : 0
+                    " style="width: 80%"></el-progress>
+            </div>
+        </div>
+        <el-dialog title="选择素材库文件" :visible.sync="dialogVisiblefile2" :append-to-body="true" width="710px"
+            :before-close="handleClose2" class="dialog_diy">
+            <div class="file_box">
+                <div class="student_head">
+                    <div class="three">
+                        <div :class="choose == 0 ? 'choose' : ''" @click="sMtl(0)">图片</div>
+                        <div :class="choose == 1 ? 'choose' : ''" @click="sMtl(1)">视频</div>
+                        <div :class="choose == 2 ? 'choose' : ''" @click="sMtl(2)">附件</div>
+                    </div>
+                </div>
+                <div class="student_table" v-loading="isLoading">
+                    <div v-if="this.choose == 0" class="boxCss">
+                        <div class="out_box" v-for="(item, index) in chapInfo" :key="index">
+                            <div class="tup">
+                                <img :src="item.chapdataInfo ? JSON.parse(item.chapdataInfo).url : mtp
+                                    " alt="" @click="checkJson(JSON.parse(item.chapdataInfo))" />
+                                <div class="deleteWord">
+                                    <img src="../../../../assets/icon/delete.png" alt="" />
+                                </div>
+                            </div>
+                            <div class="bottom_box">
+                                <el-tooltip :content="item.chapdataInfo
+                                    ? JSON.parse(item.chapdataInfo).name
+                                    : '暂无名称'" placement="top" effect="dark">
+                                    <div>
+                                        {{
+                                            item.chapdataInfo
+                                            ? JSON.parse(item.chapdataInfo).name
+                                            : "暂无名称"
+                                        }}
+                                    </div>
+                                </el-tooltip>
+                            </div>
+                        </div>
+                    </div>
+                    <div v-if="this.choose == 1" class="boxCss">
+                        <div class="out_box" v-for="(item, index) in chapInfo" :key="index">
+                            <div class="tup">
+                                <img :src="msp" alt="" @click="checkJson(JSON.parse(item.chapdataInfo))" />
+                                <div class="deleteWord">
+                                    <img src="../../../../assets/icon/delete.png" alt="" />
+                                </div>
+                            </div>
+                            <div class="bottom_box">
+                                <el-tooltip :content="item.chapdataInfo
+                                    ? JSON.parse(item.chapdataInfo).name
+                                    : '暂无名称'" placement="top" effect="dark">
+                                    <div>
+                                        {{
+                                            item.chapdataInfo
+                                            ? JSON.parse(item.chapdataInfo).name
+                                            : "暂无名称"
+                                        }}
+                                    </div>
+                                </el-tooltip>
+                            </div>
+                        </div>
+                    </div>
+                    <div v-if="this.choose == 2" class="boxCss">
+                        <div class="out_box" v-for="(item, index) in chapInfo" :key="index">
+                            <div class="tup">
+                                <img :src="mfj" alt="" @click="checkJson(JSON.parse(item.chapdataInfo))" />
+                                <div class="deleteWord">
+                                    <img src="../../../../assets/icon/delete.png" alt="" />
+                                </div>
+                            </div>
+                            <div class="bottom_box">
+                                <el-tooltip :content="item.chapdataInfo
+                                    ? JSON.parse(item.chapdataInfo).name
+                                    : '暂无名称'" placement="top" effect="dark">
+                                    <div>
+                                        {{
+                                            item.chapdataInfo
+                                            ? JSON.parse(item.chapdataInfo).name
+                                            : "暂无名称"
+                                        }}
+                                    </div>
+                                </el-tooltip>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="student_page">
+                    <el-pagination background layout="prev, pager, next" :page-size="10" :total="total"
+                        v-if="page && chapInfo.length" @current-change="handleCurrentChange">
+                    </el-pagination>
+                </div>
+            </div>
+        </el-dialog>
+    </el-dialog>
+</template>
+  
+<script>
+export default {
+    props: {
+        dialogVisiblefile: {
+            type: Boolean,
+            default: false
+        },
+    },
+    data() {
+        return {
+            progress: 0,
+            isFinishSize: 0,
+            proVisible: false,
+            isAllSize: 0,
+            dialogVisiblefile2: false,
+            userid: this.$route.query.userid,
+            page: 1,
+            isLoading: false,
+            total: 0,
+            chapInfo: [],
+            choose: 0,
+            mtp: require("../../../../assets/tup1.png"),
+            msp: require("../../../../assets/icon/fileIcon/isVideo.png"),
+            mfj: require("../../../../assets/icon/fileIcon/word2.png"),
+        };
+    },
+    methods: {
+        handleClose(done) {
+            this.close();
+            done();
+        },
+        handleClose2(done) {
+            done();
+        },
+        close() {
+            this.$emit("update:dialogVisiblefile", false);
+        },
+        openFile() {
+            this.dialogVisiblefile2 = true
+            this.selectMtl();
+        },
+        sMtl(choose) {
+            this.choose = choose
+            this.page = 1
+            this.selectMtl()
+        },
+        handleCurrentChange(val) {
+            this.page = val
+            this.selectMtl()
+        },
+        selectMtl() {
+            this.isLoading = true;
+            let params = {
+                t: this.choose,
+                uid: this.userid,
+                page: this.page,
+            };
+            this.ajax
+                .get(this.$store.state.api + "selectMtl2", params)
+                .then((res) => {
+                    this.isLoading = false;
+                    this.total = res.data[0].length > 0 ? res.data[0][0].num : 0;
+                    this.chapInfo = res.data[0];
+                })
+                .catch((err) => {
+                    this.isLoading = false;
+                    console.error(err);
+                });
+        },
+        addImg(e) {
+            var el = e.currentTarget;
+            el.getElementsByTagName("input")[0].click();
+            e.target.value = "";
+        },
+        beforeUpload(event, type) {
+            // const loading = this.openLoading();
+            var file = event.target.files[0];
+            var credentials = {
+                accessKeyId: "AKIATLPEDU37QV5CHLMH",
+                secretAccessKey: "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",
+            }; //秘钥形式的登录上传
+            window.AWS.config.update(credentials);
+            window.AWS.config.region = "cn-northwest-1"; //设置区域
+
+            var bucket = new window.AWS.S3({ params: { Bucket: "ccrb" } }); //选择桶
+            var _this = this;
+
+            _this.progress = 0;
+            _this.proVisible = true;
+            _this.isFinishSize = 0;
+            _this.isAllSize = (file.size / 1024 / 1024).toFixed(2);
+            _this.$forceUpdate();
+            if (file) {
+                var params = {
+                    Key:
+                        file.name.split(".")[0] +
+                        new Date().getTime() +
+                        "." +
+                        file.name.split(".")[file.name.split(".").length - 1],
+                    ContentType: file.type,
+                    Body: file,
+                    "Access-Control-Allow-Credentials": "*",
+                    ACL: "public-read",
+                }; //key可以设置为桶的相抵路径,Body为文件, ACL最好要设置
+                var options = {
+                    partSize: 2048 * 1024 * 1024,
+                    queueSize: 2,
+                    leavePartsOnError: true,
+                };
+                bucket
+                    .upload(params, options)
+                    .on("httpUploadProgress", function (evt) {
+                        //这里可以写进度条
+                        // console.log("Uploaded : " + parseInt((evt.loaded * 80) / evt.total) + '%');
+                        _this.progress = parseInt((evt.loaded / evt.total) * 100);
+                        _this.isFinishSize = (evt.loaded / 1024 / 1024).toFixed(2);
+                        _this.$forceUpdate();
+                    })
+                    .send(function (err, data) {
+                        _this.progress = 100;
+                        _this.isFinishSize = _this.isAllSize;
+                        _this.$forceUpdate();
+                        setTimeout(() => {
+                            _this.proVisible = false;
+                            _this.$forceUpdate();
+                        }, 1000);
+                        // loading.close();
+                        if (err) {
+                            _this.$message.error("上传失败");
+                        } else {
+                            let _type = 2;
+                            var imgA = [
+                                "png",
+                                "jpg",
+                                "jpeg",
+                                "bmp",
+                                "gif",
+                                "webp",
+                                "psd",
+                                "svg",
+                                "tiff",
+                            ];
+                            var fileA = [
+                                "DOC",
+                                "DOCX",
+                                "DOCM",
+                                "DOTM",
+                                "DOTX",
+                                "PPTX",
+                                "PPSX",
+                                "PPT",
+                                "PPS",
+                                "PPTM",
+                                "POTM",
+                                "PPAM",
+                                "POTX",
+                                "PPSM",
+                                "XLSX",
+                                "XLS",
+                            ];
+                            var videoA = [
+                                "AVI",
+                                "NAVI",
+                                "MPEG",
+                                "ASF",
+                                "MOV",
+                                "WMV",
+                                "3GP",
+                                "RM",
+                                "RMVB",
+                                "FLV",
+                                "F4V",
+                                "H.264",
+                                "H.265",
+                                "REAL VIDEO",
+                                "MKV",
+                                "WebM",
+                                "HDDVD",
+                                "MP4",
+                                "MPG",
+                                "M4V",
+                                "MGV",
+                                "OGV",
+                                "QTM",
+                                "STR",
+                                "AMC",
+                                "DVX",
+                                "EVO",
+                                "DAT",
+                                "OGG",
+                                "OGM",
+                            ];
+                            if (
+                                fileA.indexOf(
+                                    data.Location.split(".")[
+                                        data.Location.split(".").length - 1
+                                    ].toLocaleUpperCase()
+                                ) != -1
+                            ) {
+                                _type = 1; //word 文件
+                            } else if (
+                                videoA.indexOf(
+                                    data.Location.split(".")[
+                                        data.Location.split(".").length - 1
+                                    ].toLocaleUpperCase()
+                                ) != -1
+                            ) {
+                                _type = 2; //视频
+                            } else if (
+                                imgA.indexOf(
+                                    data.Location.split(".")[
+                                        data.Location.split(".").length - 1
+                                    ].toLocaleLowerCase()
+                                ) != -1
+                            ) {
+                                _type = 3; //图片
+                            } else if (
+                                'pdf'.indexOf(
+                                    data.Location.split(".")[
+                                        data.Location.split(".").length - 1
+                                    ].toLocaleLowerCase()
+                                ) != -1
+                            ) {
+                                _type = 4; //pdf
+                            } else {
+                                _type = 5; //文件
+                            }
+                            // if (_this.checkJson.file) {
+                            // _this.checkJson.file.push({
+                            //     name: file.name,
+                            //     url: data.Location,
+                            //     type: _type,
+                            // });
+                            // } else {
+                            //     _this.checkJson.file = []
+                            //     _this.checkJson.file.push({
+                            //         name: file.name,
+                            //         url: data.Location,
+                            //         type: _type,
+                            //     });
+                            // }
+                            _this.$emit("setCheckJson", file.name, data.Location, _type);
+                            _this.close();
+                            _this.$forceUpdate();
+
+                            console.log(_this.checkJson);
+                            console.log(data.Location);
+                        }
+                    });
+            }
+        },
+        checkJson(json) {
+            let _type = 2;
+            let url = "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/"+encodeURIComponent(json.url.split(
+          "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/"
+        )[1]);
+            let name = json.name
+            var imgA = [
+                "png",
+                "jpg",
+                "jpeg",
+                "bmp",
+                "gif",
+                "webp",
+                "psd",
+                "svg",
+                "tiff",
+            ];
+            var fileA = [
+                "DOC",
+                "DOCX",
+                "DOCM",
+                "DOTM",
+                "DOTX",
+                "PPTX",
+                "PPSX",
+                "PPT",
+                "PPS",
+                "PPTM",
+                "POTM",
+                "PPAM",
+                "POTX",
+                "PPSM",
+                "XLSX",
+                "XLS",
+            ];
+            var videoA = [
+                "AVI",
+                "NAVI",
+                "MPEG",
+                "ASF",
+                "MOV",
+                "WMV",
+                "3GP",
+                "RM",
+                "RMVB",
+                "FLV",
+                "F4V",
+                "H.264",
+                "H.265",
+                "REAL VIDEO",
+                "MKV",
+                "WebM",
+                "HDDVD",
+                "MP4",
+                "MPG",
+                "M4V",
+                "MGV",
+                "OGV",
+                "QTM",
+                "STR",
+                "AMC",
+                "DVX",
+                "EVO",
+                "DAT",
+                "OGG",
+                "OGM",
+            ];
+            if (
+                fileA.indexOf(
+                    url.split(".")[
+                    url.split(".").length - 1
+                    ].toLocaleUpperCase()
+                ) != -1
+            ) {
+                _type = 1; //word 文件
+            } else if (
+                videoA.indexOf(
+                    url.split(".")[
+                    url.split(".").length - 1
+                    ].toLocaleUpperCase()
+                ) != -1
+            ) {
+                _type = 2; //视频
+            } else if (
+                imgA.indexOf(
+                    url.split(".")[
+                    url.split(".").length - 1
+                    ].toLocaleLowerCase()
+                ) != -1
+            ) {
+                _type = 3; //图片
+            } else if (
+                'pdf'.indexOf(
+                    url.split(".")[
+                    url.split(".").length - 1
+                    ].toLocaleLowerCase()
+                ) != -1
+            ) {
+                _type = 4; //pdf
+            } else {
+                _type = 5; //文件
+            }
+            this.$emit("setCheckJson", name, url, _type);
+            this.dialogVisiblefile2 = false
+            this.close();
+        }
+    }
+};
+</script>
+  
+<style scoped>
+.dialog_diy>>>.el-dialog {
+    /* height: 100%; */
+    margin: 10vh auto !important;
+}
+
+.dialog_diy>>>.el-dialog__header {
+    background: #454545 !important;
+    padding: 15px 20px;
+}
+
+.dialog_diy>>>.el-dialog__body {
+    height: calc(100% - 124px);
+    box-sizing: border-box;
+    padding: 0px;
+}
+
+.dialog_diy>>>.el-dialog__title {
+    color: #fff;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn {
+    top: 19px;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
+    color: #fff;
+}
+
+.dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
+    color: #fff;
+}
+
+.dialog_diy>>>.el-dialog__body,
+.dialog_diy>>>.el-dialog__footer {
+    background: #fafafa;
+}
+
+
+.fileCss {
+    width: 100%;
+    display: flex;
+    flex-direction: row;
+    flex-wrap: nowrap;
+    justify-content: space-around;
+    align-items: center;
+    padding: 40px 0;
+    box-sizing: border-box;
+}
+
+.fileCss>div {
+    display: flex;
+    flex-direction: column;
+    align-items: center;
+}
+
+.fileCss .spanName {
+    margin-top: 10px
+}
+
+
+.info_btn,
+.teacherWord {
+    color: #fff;
+    background-color: #0f7eff;
+    padding: 8px 24px;
+    font-size: 0.9375rem;
+    box-shadow: 0px 1px 3px 0px rgb(0 0 0 / 20%), 0px 2px 2px 0px rgb(0 0 0 / 14%),
+        0px 3px 1px -2px rgb(0 0 0 / 12%);
+    min-width: 64px;
+    font-weight: 500;
+    border-radius: 4px;
+    box-sizing: border-box;
+    border: none;
+    cursor: pointer;
+}
+
+.mask {
+    background-color: rgb(0 0 0 / 30%);
+    /* position: fixed; */
+    position: absolute;
+    top: 0;
+    left: 0;
+    width: 100%;
+    height: 100%;
+    z-index: 90;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+}
+
+.progressBox {
+    width: 300px;
+    height: 150px;
+    background: #fff;
+    border-radius: 10px;
+    box-shadow: 0 0 6px 1px #bfbfbf;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    flex-direction: column;
+    position: relative;
+    color: #6c6c6c;
+}
+
+.progressBox>>>.el-progress-bar__outer {
+    background-color: #d1dfff !important;
+}
+
+.progressBox .lbox {
+    height: 50px;
+    font-size: 19px;
+    display: flex;
+    align-items: center;
+    color: #747474;
+}
+
+.progressBox .lbox img {
+    width: 40px;
+    margin-right: 20px;
+}
+
+.closeCss {
+    position: absolute;
+    top: 8px;
+    right: 8px;
+    cursor: pointer;
+    width: 20px;
+    height: 20px;
+}
+
+.closeCss>img {
+    width: 100%;
+    height: 100%;
+}
+
+.file_box {
+    width: 100%;
+    padding: 15px;
+    box-sizing: border-box;
+}
+
+.student_head>>>.el-button--primary {
+    background-color: #2268bc;
+}
+
+.student_head {
+    display: flex;
+    justify-content: space-between;
+}
+
+.three {
+    display: flex;
+    flex-direction: row;
+    justify-content: space-between;
+    width: 200px;
+    height: 30px;
+}
+
+.three>div {
+    cursor: pointer;
+}
+
+.choose {
+    border-bottom: 5px solid #3994fd;
+}
+
+.student_table {
+    width: 100%;
+    height: 100%;
+    background: #f2f2f2;
+    margin-top: 10px;
+}
+
+.tup {
+    width: calc(100% - 20px);
+    height: 120px;
+    margin: 0 auto;
+    position: relative;
+}
+
+.out_box:hover .deleteWord {
+    /* display: block; */
+}
+
+.deleteWord {
+    width: 25px;
+    height: 25px;
+    position: absolute;
+    right: -25px;
+    top: -10px;
+    cursor: pointer;
+    display: none;
+}
+
+.tup>img,
+.deleteWord>img {
+    width: 100%;
+    height: 100%;
+    object-fit: cover;
+}
+
+.out_box {
+    display: flex;
+    flex-direction: column;
+    flex-wrap: nowrap;
+    width: 216px;
+    padding: 10px 0;
+    background: #fff;
+    margin: 0 10px 10px 0;
+    height: fit-content;
+    cursor: pointer;
+}
+
+.out_box:nth-child(3n){
+    margin-right: 0;
+}
+
+.bottom_box {
+    display: flex;
+    text-align: center;
+    margin: 0 auto;
+    padding: 10px 0 5px 0;
+}
+
+.bottom_box>div:nth-child(1) {
+    white-space: nowrap;
+    text-overflow: ellipsis;
+    overflow: hidden;
+    word-break: break-all;
+    width: 200px;
+}
+
+.uploadThing {
+    background: #2268bc;
+    width: 90px;
+    height: 35px;
+    color: #fff;
+    font-size: 12px;
+    text-align: center;
+    line-height: 35px;
+    cursor: pointer;
+    border-radius: 4px;
+}
+
+.top {
+    display: flex;
+    justify-content: space-between;
+}
+
+.student_page {
+    margin-top: 30px;
+}
+
+.boxCss {
+    padding: 15px 5px;
+    display: flex;
+    flex-direction: row;
+    flex-wrap: wrap;
+    min-height: 250px;
+}
+</style>
+  

+ 30 - 6
src/components/pages/testStudent/view/component/file.vue

@@ -42,13 +42,13 @@
                                 </div>
                             </div>
                         </div>
-                        <div class="btn" @click.stop="addImg($event)" v-if="checktype == 1">
-                            <span>点击添加本地文件</span>
+                        <div class="btn" @click.stop="openFileBox()" v-if="checktype == 1">
+                            <span>点击添加文件</span>
                             <input type="file" accept="*" style="display: none" @change="beforeUpload($event)" />
                         </div>
                     </div>
-                    <div class="uploadQ" @click.stop="addImg($event)" v-else-if="checktype == 1">
-                        <span>点击添加本地文件</span>
+                    <div class="uploadQ" @click.stop="openFileBox()" v-else-if="checktype == 1">
+                        <span>点击添加文件</span>
                         <input type="file" accept="*" style="display: none" @change="beforeUpload($event)" />
                     </div>
                     <div class="uploadQ" v-else>
@@ -82,6 +82,7 @@
         <wpdf :dialogVisiblePdf.sync="dialogVisiblePdf" :url="wurl"></wpdf>
         <wVideo :dialogVisibleVideo.sync="dialogVisibleVideo" :url="wurl"></wVideo>
         <wOffice :dialogVisibleOffice.sync="dialogVisibleOffice" :url="wurl"></wOffice>
+        <checkfile :dialogVisiblefile.sync="dialogVisiblefile" @setCheckJson="setCheckJson"></checkfile>
     </div>
 </template>
 
@@ -94,12 +95,14 @@ import fileIcon from '../../../../../assets/icon/fileIcon/word2.png'
 import wpdf from "../../../test/file/wPdf2.vue";
 import wVideo from "../../../test/file/wVideo.vue";
 import wOffice from "../../../test/file/wOffice.vue";
+import checkfile from "../../../test/file/checkfile.vue";
 
 export default {
     components: {
         wpdf,
         wVideo,
         wOffice,
+        checkfile
     },
     props: {
         tindex:{
@@ -138,6 +141,7 @@ export default {
             dialogVisiblePdf:false,
             dialogVisibleVideo:false,
             dialogVisibleOffice:false,
+            dialogVisiblefile: false,
             wurl: "",
         }
     },
@@ -153,6 +157,9 @@ export default {
         depthCopy(s) {
             return JSON.parse(JSON.stringify(s));
         },
+        openFileBox() {
+            this.dialogVisiblefile = true
+        },
         addImg(e) {
             var el = e.currentTarget;
             el.getElementsByTagName("input")[0].click();
@@ -385,6 +392,23 @@ export default {
 
             });
         },
+        setCheckJson(name, url, type) {
+            if (this.checkJson.file) {
+                this.checkJson.file.push({
+                    name: name,
+                    url: url,
+                    type: type,
+                });
+            } else {
+                this.checkJson.file = []
+                this.checkJson.file.push({
+                    name: name,
+                    url: url,
+                    type: type,
+                });
+            }
+            this.$forceUpdate();
+        },
         checkFile(item){
             if(item.type == 3){
                 this.$hevueImgPreview(item.url);
@@ -419,12 +443,12 @@ export default {
     position: relative;
 }
 
-.mask {
+/* .mask {
     position: absolute;
     height: 100%;
     width: 100%;
     z-index: 2;
-}
+} */
 
 .choice_box {
     white-space: pre-line;

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.