Ver Fonte

Merge remote-tracking branch 'origin/seec' into seec

yhd12345 há 3 anos atrás
pai
commit
6704f57936

+ 5 - 1
nginx.conf

@@ -23,4 +23,8 @@ server {
         location ~ / {
             try_files $uri $uri/ /index.html;
         }
-}
+}
+
+http {
+        client_max_body_size 1024M;
+}

+ 11 - 1
src/api/courseWare.js

@@ -6,6 +6,10 @@ function createCourseWare(data) {
     return axios.post(`${prefix}/create`, data);
 }
 
+function setCanDownloadById(id, canDownload) {
+    return axios.post(`${prefix}/setCanDownloadById`, null, {params: {id, canDownload}});
+}
+
 function uploadCourseWareFile(name, file) {
     let data = new FormData();
     data.append("name", name);
@@ -60,8 +64,13 @@ function previewpdf(fileUrl) {
     });
 }
 
+function getCanDownloadById(id) {
+    return axios.get(`${prefix}/getCanDownloadById`, {params: {id}});
+}
+
 const courseWareAPIs = {
     createCourseWare,
+    setCanDownloadById,
     deleteCourseWare,
     getCourseWaresByCourseId,
     getCourseWareById,
@@ -70,7 +79,8 @@ const courseWareAPIs = {
     changeCourseWareName,
     getCourseWareUrlById,
     previewpdf,
-    getCourseIdById
+    getCourseIdById,
+    getCanDownloadById
 };
 
 export default courseWareAPIs;

+ 0 - 5
src/api/user.js

@@ -18,10 +18,6 @@ function resetAPI(data) {
   return axios.post(`${prefix}/resetPassword`, data);
 }
 
-function resetGitlabAPI(data) {
-  return axios.post(`${prefix}/resetGitlabPassword`, data);
-}
-
 function getUserAPI(data){
   return axios.get(`${prefix}/findUserById`, {
     params: {
@@ -63,7 +59,6 @@ const userAPIs = {
   registerAPI,
   sendMessageAPI,
   resetAPI,
-  resetGitlabAPI,
   getUserAPI,
   saveNameAPI,
   saveEmailAPI,

+ 3 - 1
src/global/register-element.js

@@ -40,6 +40,7 @@ import {
   ElContainer,ElHeader,ElMain,
   ElBadge, ElOptionGroup, ElTooltip,
   ElAlert,
+  ElProgress
 } from "element-plus";
 
 // NOTE 使用到的组件列表,请确保 import 和 component 的一致性
@@ -90,7 +91,8 @@ const components = [
   ElContainer,
   ElHeader,
   ElMain,
-  ElAlert
+  ElAlert,
+  ElProgress
 ];
 
 export default function (app) {

+ 4 - 4
src/router/index.js

@@ -148,10 +148,7 @@ const unauthorizedRoutes = ["Portal", "Auth", "Course", "Test","Project", "Compl
 router.beforeEach((to, from, next) => {
   let token = localStorage.getItem("token");
   console.log(token);
-    if (unauthorizedRoutes.indexOf(to.name) !== -1) {
-      console.log(1);
-      next();
-    }
+
     // else if (token && to.name === "courseWareDetails") {
     //   console.log(localStorage);
     //   if (localStorage.s === "true") {
@@ -159,6 +156,9 @@ router.beforeEach((to, from, next) => {
     //     next();
     //   }
     // }
+    if (unauthorizedRoutes.indexOf(to.name) !== -1) {
+      next();
+    }
     else if (!store.state.user.token) {
       ElMessage({
         showClose: true,

+ 2 - 2
src/views/AuthPage/components/AuthCard.vue

@@ -120,7 +120,7 @@ export default {
   components: {Message, Cherry, Avatar, SlideVerifier, Lock, Phone, Key},
   data() {
     const inputNumberValidator = (rule, value, callback) => {
-      if (!(/(^[1-9]\d*$)/.test(value))) {
+      if (!(/(^[0-9]\d*$)/.test(value))) {
         callback(new Error("请勿输入非数字"));
       } else {
         callback();
@@ -134,7 +134,7 @@ export default {
       }
     };
     const phoneValidator = (rule, value, callback) => {
-      if (/^(13\d|14\d|15\d|166|18\d|19[6,9]|17\d)\d{8}$/i.test(value) === false) {
+      if (/^(13\d|14\d|15\d|16\d|18\d|19\d|17\d)\d{8}$/i.test(value) === false) {
         callback(new Error("请输入正确格式的手机号"));
       } else {
         callback();

+ 2 - 0
src/views/CoderPage/ExamDetail.vue

@@ -15,6 +15,7 @@
               v-if="isStudentGroup && !exam.joined"
               type="primary"
               @click="dialog.join = true"
+              :disabled="statusTagContent!=='进行中'"
             >
               参加考试
             </el-button>
@@ -23,6 +24,7 @@
                 type="primary"
                 :loading="loading.create"
                 @click="createExamPaper"
+                :disabled="statusTagContent!=='进行中'"
             >
               生成自测试卷
             </el-button>

+ 76 - 48
src/views/CourseDetailPage/tabs/CoursewareTab.vue

@@ -8,7 +8,7 @@
                   plain>新建</el-button>
       </el-col>
       <el-col :span="15">
-          <span style="font-size: smaller; position: absolute; bottom: 25%">(支持拓展名:.pdf .jpg .jpeg .png .exe .zip)</span>
+          <span style="font-size: smaller; position: absolute; bottom: 25%">(支持拓展名:.pdf .jpg .jpeg .png .exe .zip,最大文件大小:100MB)</span>
       </el-col>
     </el-row>
     <el-dialog v-model="uploadDialogVisible" :before-close="handleCancelUpload" :width="700">
@@ -29,7 +29,8 @@
                   :auto-upload="false"
                   :show-file-list="false"
               >
-                  <el-button plain type="primary" class="tabs-function-button">上传文件</el-button>(仅支持上传单个文件)
+                  <el-button plain type="primary" class="tabs-function-button" size="small"
+                  >上传文件</el-button>(仅支持上传单个文件,最大文件大小:100MB)
               </el-upload>
               <el-tag
                       v-if="isNameUnique"
@@ -56,14 +57,16 @@
                   </el-col>
               </el-row>
           </el-form-item>
-          <el-form-item label="允许下载" required>
+          <el-form-item label="允许下载" required v-if="fileType === '.pdf'">
               <el-switch v-model="downloadValue" />
           </el-form-item>
         </el-form>
-        <div style="margin: auto;width: fit-content">
-          <el-button type="primary" @click="handleConfirmUpload">确定</el-button>
-          <el-button @click="handleCancelUpload">取消</el-button>
+        <div style="margin: auto; width: fit-content">
+          <el-button type="primary" @click="handleConfirmUpload" size="small">确定</el-button>
+          <el-button @click="handleCancelUpload" size="small">取消</el-button>
         </div>
+        <el-progress  v-if="percentageVisible" :indeterminate="true" :percentage="100" status="warning"
+                     style="width: 40%; margin-top: 20px; margin-left: 30%"></el-progress>
     </el-dialog>
 
       <el-table :data="fileEntryList" style="width: 100%">
@@ -75,7 +78,7 @@
         <el-table-column
           prop="name"
           label="文件名"
-          width="260"
+          width="280"
           >
           <template #default="scope">
             <el-icon v-if="scope.row['courseWareVO'].useMethod === 'SCAN'" style="color: #337ecc" class="myicon"><Reading /></el-icon>
@@ -113,30 +116,31 @@
 <!--              <el-button style="color: #409EFF; margin-right: 10px" type="text">预览</el-button>-->
 <!--            </a>-->
 
-                  <el-button v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'"
-                             @click="handlePreviewFile(scope.row['courseWareVO'].id)"
-                             style="color: #409EFF; margin-right: 10px" type="text">预览</el-button>
-              <a v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'"
-                 :href="getOfficeFileUrl(scope.row['courseWareVO'].fileUrl)">点击预览</a>
-
-            <a :href="scope.row['courseWareVO'].fileUrl" v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'">
-              <el-button style="color: #67C23A" type="text">下载</el-button>
-            </a>
-
+<!--            <el-button v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'"-->
+<!--                     @click="handlePreviewFile(scope.row['courseWareVO'].id)"-->
+<!--                     style="color: #409EFF; margin-right: 10px" type="text">预览</el-button>-->
+<!--            <a v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'"-->
+<!--             :href="getOfficeFileUrl(scope.row['courseWareVO'].fileUrl)">点击预览</a>-->
+<!--            <a :href="scope.row['courseWareVO'].fileUrl" v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'OFFICE'">-->
+<!--              <el-button style="color: #67C23A" type="text">下载</el-button>-->
+<!--            </a>-->
             <el-button v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'PDF'"
                  @click="handlePreviewFile(scope.row['courseWareVO'].id)"
-                       style="color: #409EFF" type="text">预览</el-button>
-            <el-button v-if="Number(scope.row['courseWareVO'].senderId) === Number(this.$store.state.user.id) && isPdfOrPicture(scope.row['courseWareVO'].name) === 'PDF'
-                            && scope.row['courseWareVO'].canDownload === true"
-                 @click="handleDownloadPdfFile(scope.row['courseWareVO'].fileUrl)"
-                 style="color: #67C23A" type="text">下载</el-button>
-
+                       style="color: #409EFF" type="text">打开</el-button>
             <el-button v-if="scope.row['courseWareVO'].useMethod === 'SCAN' && isPdfOrPicture(scope.row['courseWareVO'].name) === 'PICTUREandATTACHMENT'"
-                 @click="handlePreviewPicture(scope.row['courseWareVO'])"
-                       style="color: #409EFF; margin-right: 10px" type="text">预览</el-button>
-            <a :href="scope.row['courseWareVO'].fileUrl" v-if="isPdfOrPicture(scope.row['courseWareVO'].name) === 'PICTUREandATTACHMENT'">
-              <el-button style="color: #67C23A" type="text">下载</el-button>
-            </a>
+                     @click="handlePreviewPicture(scope.row['courseWareVO'])"
+                     style="color: #409EFF" type="text">打开</el-button>
+
+<!--              <el-button v-if="checkDownloadButton(scope.row['courseWareVO'].id, scope.row['courseWareVO'].name) === '1'"-->
+<!--            <el-button v-if="getCanDownloadById(scope.row['courseWareVO'].id) === true-->
+<!--              <el-button v-if="canDownloadList === '1'-->
+<!--                     && isPdfOrPicture(scope.row['courseWareVO'].name) === 'PDF'"-->
+<!--                     @click="handleDownloadPdfFile(scope.row['courseWareVO'].fileUrl)"-->
+<!--                     style="color: #67C23A" type="text">下载</el-button>-->
+                          <a :href="scope.row['courseWareVO'].fileUrl"
+                             v-if="scope.row['courseWareVO'].useMethod === 'ATTACHMENT' && isPdfOrPicture(scope.row['courseWareVO'].name) === 'PICTUREandATTACHMENT'">
+                            <el-button style="color: #67C23A" type="text">下载</el-button>
+                          </a>
             <el-button v-if="Number(scope.row['courseWareVO'].senderId) === Number(this.$store.state.user.id)"
                        style="color: #F56C6C; margin-left: 10px" type="text"
                        @click="handleRemoveCourseWare(scope.row['courseWareVO'].id)">删除</el-button>
@@ -151,7 +155,10 @@
           <img :src="pictureUrl" alt="" style="width: 100%" class="image" />
           <template #footer>
       <span class="dialog-footer">
-        <el-button type="primary" @click="handleClosePreviewPicture" plain>关闭</el-button>
+          <a :href="pictureUrl">
+              <el-button type="success" style="margin-right: 10px" size="small">下载</el-button>
+          </a>
+          <el-button type="primary" @click="handleClosePreviewPicture" plain size="small">关闭</el-button>
       </span>
           </template>
       </el-dialog>
@@ -173,11 +180,12 @@
 </template>
 
 <script>
-import portal from "@/utils/portal/portal";
-import {ElMessage, ElMessageBox} from "element-plus";
-import * as pdfjs from "pdfjs-dist";
-import * as pdfjsWorker from "pdfjs-dist/build/pdf.worker.entry";
-pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
+    import portal from "@/utils/portal/portal";
+    import {ElMessageBox} from "element-plus";
+    import * as pdfjs from "pdfjs-dist";
+    import * as pdfjsWorker from "pdfjs-dist/build/pdf.worker.entry";
+
+    pdfjs.GlobalWorkerOptions.workerSrc = pdfjsWorker;
 
 export default {
   name: "CoursewareTab",
@@ -211,11 +219,15 @@ export default {
       idToBeChangeName: null,
       newName: null,
       nameAppend: null,
+      fileType: null,
       fileTag: null,
       fileNum: 0,
-      picturesFromPDF: [],
       pdfName: "",
-      downloadValue: true
+      downloadValue: true,
+      canDownloadList: [],
+      courseWareNum: 0,
+      //percentage: 0,
+      percentageVisible: false
     };
   },
 
@@ -231,8 +243,8 @@ export default {
       init() {
           this.$apis.getCourseWaresByCourseId(this.courseId).then(res => {
               this.fileEntryList = res.data.data;
+              this.courseWareNum = this.fileEntryList.length;
           });
-          console.log(this.fileEntryList);
       },
 
       handleChangeNameWhenUpload() {
@@ -347,6 +359,7 @@ export default {
               } else {
                   this.isNameUnique = true;
                   this.fileNum = 1;
+                  this.fileType = "." + fileType;
               }
           });
       },
@@ -369,11 +382,13 @@ export default {
                     });
                     this.newName = null;
                 } else {
+                    //this.percentage= 0;
+                    this.percentageVisible = true;
                     this.$apis.uploadCourseWareFile(this.courseId + "/" + this.newName + this.nameAppend, this.file.raw)
                         .then(res => {
                             const fileUrl = res.data.data;
                             this.$apis.createCourseWare({
-                                name: this.newName === null ? this.file.name : (this.newName + this.nameAppend),
+                                name: this.newName + this.nameAppend,
                                 size: this.file.size,
                                 senderId: this.$store.state.user.id,
                                 courseId: this.courseId,
@@ -381,11 +396,13 @@ export default {
                                 useTime: "BEFORE_CLASS",
                                 useMethod: this.form.useMethod,
                                 fileUrl: fileUrl,
-                                canDownload: this.downloadValue
                             }).then(res => {
+                                //this.percentage= 100;
+                                this.$apis.setCanDownloadById(res.data.data.id, this.downloadValue);
                                 this.$apis.getCourseWaresByCourseId(this.courseId)
                                     .then(res => {
                                         this.fileEntryList = res.data.data;
+                                        this.courseWareNum = this.fileEntryList.length;
                                         this.$message({
                                             message: "上传课件成功",
                                             type: "success"
@@ -397,6 +414,8 @@ export default {
                                         this.newName = null;
                                         this.nameAppend = null;
                                         this.file = null;
+                                        this.fileType = null;
+                                        this.percentageVisible = false;
                                     });
                             });
                         });
@@ -411,11 +430,18 @@ export default {
               this.nameAppend = null;
         }
         else {
+            //this.percentage= 0;
+            this.percentageVisible = true;
+            this.$message({
+                message: "上传中,请稍候",
+                type: "warning",
+                duration: 5000
+            });
             this.$apis.uploadCourseWareFile(this.courseId + "/" + this.file.name, this.file.raw)
                 .then(res => {
                     const fileUrl = res.data.data;
                     this.$apis.createCourseWare({
-                        name: this.newName === null ? this.file.name : (this.newName + this.nameAppend),
+                        name: this.file.name,
                         size: this.file.size,
                         senderId: this.$store.state.user.id,
                         courseId: this.courseId,
@@ -423,11 +449,13 @@ export default {
                         useTime: "BEFORE_CLASS",
                         useMethod: this.form.useMethod,
                         fileUrl: fileUrl,
-                        canDownload: this.downloadValue
                     }).then(res => {
+                        //this.percentage= 100;
+                        this.$apis.setCanDownloadById(res.data.data.id, this.downloadValue);
                         this.$apis.getCourseWaresByCourseId(this.courseId)
                             .then(res => {
                                 this.fileEntryList = res.data.data;
+                                this.courseWareNum = this.fileEntryList.length;
                                 this.$message({
                                     message: "上传课件成功",
                                     type: "success"
@@ -437,13 +465,12 @@ export default {
                                 this.isNameUnique = false;
                                 this.fileNum = 0;
                                 this.file = null;
+                                this.fileType = null;
+                                this.percentageVisible = false;
                             });
                     });
                 });
         }
-
-
-
       },
 
       handleCancelUpload(done) {
@@ -460,6 +487,8 @@ export default {
           this.fileNum = 0;
           this.newName = null;
           this.nameAppend = null;
+          this.fileType = null;
+          this.percentageVisible = false;
           this.clearForm();
           // Zhurui修改,关闭dialog
           done();
@@ -479,6 +508,7 @@ export default {
         .then(() => {
             this.isChangeNameWhenUpload = false;
             this.nameAppend = null;
+            this.fileType = null;
             this.isNameUnique = false;
             this.file = null;
             this.fileNum = 0;
@@ -500,6 +530,7 @@ export default {
         .then(() => {
             this.$apis.deleteCourseWare(id).then(async () => {
                 this.fileEntryList = (await this.$apis.getCourseWaresByCourseId(this.courseId)).data.data;
+                this.courseWareNum = this.fileEntryList.length;
             });
             this.uploadDialogVisible = false;
             this.fileNum = 0;
@@ -560,10 +591,7 @@ export default {
             .then(() => {
                 this.picturePreviewDialogVisible = false;
             });
-      },
-
-
-
+      }
   }
 };
 </script>

+ 10 - 2
src/views/CourseDetailPage/tabs/ProjectTab/ProjectLongCard.vue

@@ -27,7 +27,7 @@
     <el-divider v-if="project.name"/>
     <div v-if="project.name">描述:{{ project.description }}</div>
     <div v-if="project.name">
-      <span>链接:{{ project.gitRemoteUrl }}</span>
+      <span>链接:{{ GitURL }}</span>
       <i class="el-icon-document-copy" @click.stop="copyGitUrl"></i>
     </div>
   </el-card>
@@ -57,7 +57,15 @@ export default {
       members: [],
     };
   },
+  computed:{
+    GitURL(){
+      let list = this.project.gitRemoteUrl.split("/");
+      list[2] = "seecoder-gitlab-gitlab.seec.seecoder.cn";
+      return list.join("/");
+    }
+  },
   async mounted() {
+    console.log(this.GitURL);
     const _this = this;
     const res = (await _this.$apis.findProjectMembers(_this.project.id)).data;
     if (!res.code) {
@@ -73,7 +81,7 @@ export default {
       }
     },
     async copyGitUrl() {
-      await navigator.clipboard.writeText(this.project.gitRemoteUrl);
+      await navigator.clipboard.writeText(this.GitURL);
       this.$message.success("复制成功!");
     },
   },

+ 14 - 1
src/views/CourseWarePage/CourseWarePage.vue

@@ -12,7 +12,8 @@
                 </el-card>
             </el-col>
             <el-col :span="20">
-                <pdf-viewer></pdf-viewer>
+                <div>
+                    <pdf-viewer v-if="renderComponent"></pdf-viewer></div>
             </el-col>
         </el-row>
     </div>
@@ -37,9 +38,15 @@
         },
         data() {
             return {
+                renderComponent: true,
                 //fileUrl: "https://seec-portal.oss-cn-hangzhou.aliyuncs.com/1/07-%E9%9C%80%E6%B1%82%E6%96%87%E6%A1%A3%E5%8C%96%E4%B8%8E%E9%AA%8C%E8%AF%81.pdf",
             };
         },
+        watch: {
+            $route(to, from) {
+                window.location.reload(); //监测到路由发生跳转时刷新一次页面
+            },
+        },
         mounted() {
             const params = {
                 phone: localStorage.phone,
@@ -112,6 +119,12 @@
                     let href = URL.createObjectURL(blob);
                     console.log(href);
                     this.$store.commit(SET_SRC, { src: href });
+                    this.renderComponent = false;
+                    this.$nextTick(() => {
+                        // 在 DOM 中添加 my-component 组件
+                        console.log(1);
+                        this.renderComponent = true;
+                    });
                 });
             });
         },

+ 20 - 5
src/views/CourseWarePage/pdf/Pdf.vue

@@ -1,6 +1,8 @@
 <template>
     <div>
-        <canvas className="pdf pdf-canvas" id="pdf-canvas"></canvas>
+        <div v-if="loading" class="loading">
+            加载中,请稍候...</div>
+        <canvas class="pdf-canvas" id="pdf-canvas"></canvas>
     </div>
 </template>
 
@@ -20,14 +22,14 @@
             };
         },
         mounted() {
+            console.log(this.src);
             this.loading = true;
             this._canvas = document.getElementById("pdf-canvas");
             this._context = this._canvas.getContext("2d");
 
             // Default size
-            this._canvas.height = 300;
-            this._canvas.width = 400;
-            console.log(this.src);
+            this._canvas.height = 450;
+            this._canvas.width = 700;
 
             if (this.src) {
                 this.load(this.src);
@@ -35,7 +37,7 @@
                 // ! 1秒后重试
                 setTimeout(() => {
                     this.load(this.src);
-                }, 1000);
+                }, 10000);
             }
 
         },
@@ -94,4 +96,17 @@
         max-height: 100vh;
     }
 
+    .loading, .focus-mask {
+        position: absolute;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        height: 100%;
+        width: 100%;
+        top: 0;
+        left: 0;
+        color: #7a8a9a;
+        font-size: 40px;
+    }
+
 </style>

+ 6 - 6
src/views/CourseWarePage/pdf/PdfController.vue

@@ -8,7 +8,7 @@
         {{currentPage}} / {{totalPages}}
       </label>
       <label class="to-page-action">
-        <el-input placeholder="to" ref="input" type="number" v-model="toPage" @input="handleToPage"/>
+        <el-input placeholder="to" ref="input" type="number" v-model="currentPage" @input="handleToPage"/>
       </label>
       <el-button @click="handleNext" title="下一页" size="small"><el-icon><ArrowRightBold /></el-icon></el-button>
     </div>
@@ -28,12 +28,13 @@ export default {
       pageMarked: false,
       toPage: 1,
       hide: false,
-      canDownload: true,
+      canDownload: false,
       //currentPage: 1
     };
   },
   mounted() {
     this.handleCanDownload();
+    //this.$router.replace({ path:"/empty/" + this.$route.params.courseWareId});
   },
   computed: {
     ...mapState({
@@ -63,16 +64,15 @@ export default {
       }
     },
     handleCanDownload () {
-      this.$apis.getCourseWareById(this.$route.params.courseWareId).then(res => {
-        console.log(res);
-        this.canDownload = res.data.data.canDownload;
+      this.$apis.getCanDownloadById(this.$route.params.courseWareId).then(res => {
+        this.canDownload = res.data.data;
       });
     },
     handleDownloadPdfFile() {
       this.$apis.getCourseWareById(this.$route.params.courseWareId).then(res => {
         window.open(res.data.data.fileUrl, "_blank");
       });
-    },
+    }
   }
 };
 </script>

+ 0 - 1
src/views/HomePage/HomePage.vue

@@ -36,7 +36,6 @@
 import { Back, Medal, User } from "@element-plus/icons-vue";
 import InformationCard from "@/views/HomePage/components/InformationCard";
 import CertificationCard from "@/views/HomePage/components/CertificationCard";
-import GitlabCard from "@/views/HomePage/components/GitlabCard";
 
 export default {
   name: "HomePage",

+ 0 - 331
src/views/HomePage/components/GitlabCard.vue

@@ -1,331 +0,0 @@
-<template>
-  <el-form id="auth-card-form" ref="cardFormRef" :model="cardForm" :rules="cardFormRule" >
-
-  <el-card id="gitlab-card-body" >
-    <template #header>
-      <span style="font-weight: bold; font-size: larger">
-        gitlab基本信息
-      </span>
-    </template>
-
-    <div>
-      <el-form-item class="item" prop="username">
-      <el-row class="row">
-        <el-col :span="3" class="title">
-          用户名
-        </el-col>
-        <el-col :span="6">
-          <el-input v-model="user.username" class="content" disabled/>
-        </el-col>
-      </el-row>
-      </el-form-item>
-    </div>
-
-    <div>
-      <el-form-item class="item" prop="email">
-      <el-row class="row">
-        <el-col :span="3" class="title">
-          邮箱
-        </el-col>
-        <el-col :span="10">
-          <el-input v-model="user.email" class="content" disabled/>
-        </el-col>
-      </el-row>
-      </el-form-item>
-    </div>
-
-    <div>
-      <el-form-item class="item" prop="phone">
-      <el-row class="row">
-        <el-col :span="3" class="title">
-          手机号
-        </el-col>
-        <el-col :span="6">
-          <el-input v-model="cardForm.phone" class="content" placeholder="请输入手机号"/>
-        </el-col>
-      </el-row>
-      </el-form-item>
-    </div>
-
-    <div>
-      <el-form-item class="item" prop="password">
-      <el-row class="row">
-        <el-col :span="3" class="title">
-          新密码
-        </el-col>
-        <el-col :span="6">
-          <el-input v-model="cardForm.password" class="content" show-password placeholder="请输入新密码"/>
-        </el-col>
-      </el-row>
-      </el-form-item>
-    </div>
-
-    <div>
-      <el-form-item class="item" prop="passwordConfirm">
-      <el-row class="row">
-        <el-col :span="3" class="title">
-          确认密码
-        </el-col>
-        <el-col :span="6">
-          <el-input v-model="cardForm.passwordConfirm" class="content" show-password placeholder="请确认新密码" />
-        </el-col>
-      </el-row>
-      </el-form-item>
-    </div>
-
-    <div>
-      <el-form-item class="item" prop="identifyCode">
-      <el-row class="row">
-        <el-col :span="3" class="title">
-          验证码
-        </el-col>
-        <el-col :span="6">
-          <el-input v-model="cardForm.identifyCode" class="content" show-password placeholder="请输入验证码" />
-        </el-col>
-        <el-button class="button" id="auth-card-code-verifier-button" :disabled="cardButtonDisabled" @click="handleSendMessage">
-          {{ cardButtonText }}
-        </el-button>
-      </el-row>
-      </el-form-item>
-    </div>
-
-    <div class="row">
-      <el-button @click="handleReset">重置gitlab密码</el-button>
-    </div>
-  </el-card>
-    </el-form>
-</template>
-
-<script>
-
-export default {
-  name: "GitlabCard",
-  data() {
-    const inputNumberValidator = (rule, value, callback) => {
-      if (!(/(^[1-9]\d*$)/.test(value))) {
-        callback(new Error("请勿输入非数字"));
-      } else {
-        callback();
-      }
-    };
-    const passwordConfirmValidator = (rule, value, callback) => {
-      if (value !== this.cardForm.password) {
-        callback(new Error("请输入相同的密码"));
-      } else {
-        callback();
-      }
-    };
-    const phoneValidator = (rule, value, callback) => {
-      if (/^(13\d|14\d|15\d|166|18\d|19[6,9]|17\d)\d{8}$/i.test(value) === false) {
-        callback(new Error("请输入正确格式的手机号"));
-      } else {
-        callback();
-      }
-    };
-    const identifyCodeValidator = (rule, value, callback) => {
-      if (value.length !== 6) {
-        this.shakeElem("auth-card-code-verifier");
-        callback(new Error("请正确输入短信验证码"));
-      } else {
-        this.cardVerified = true;
-        callback();
-      }
-    };
-    return {
-      cardForm: {
-        phone: "",
-        name: "",
-        username: "",
-        email: "",
-        password: "",
-        passwordConfirm: "",
-        identifyCode: "",
-      },
-      cardButtonText: "获取验证码",
-      cardButtonDisabled: false,
-      cardVerified: false,
-      cardFormRule: {
-        phone: [
-          {required: true, message: "请输入手机号", trigger: "blur"},
-          {
-            validator: phoneValidator,
-            trigger: "blur"
-          },
-          {
-            validator: inputNumberValidator,
-            trigger: "change"
-          }
-        ],
-        password: [
-          {
-            required: true,
-            message: "请输入密码",
-            trigger: "blur",
-          },
-          {
-            min: 8,
-            max: 20,
-            message: "密码长度应为8-20个字符",
-            trigger: "blur",
-          }
-        ],
-        passwordConfirm: [
-          {required: true, message: "请再次输入密码", trigger: "blur"},
-          {
-            validator: passwordConfirmValidator,
-            trigger: "blur"
-          }
-        ],
-        identifyCode: [
-          {
-            validator: identifyCodeValidator,
-            trigger: "blur",
-          },
-          {
-            validator: inputNumberValidator,
-            trigger: "change",
-          }
-        ]
-      },
-    };
-  },
-  computed: {
-    user() {
-      return this.$store.state.user;
-    },
-    name() {
-      return this.$store.state.user.name;
-    },
-    email() {
-      return this.$store.state.user.email;
-    },
-  },
-  methods: {
-    handleSendMessage() {
-      const thatForm = this.$refs.cardFormRef;
-      thatForm.validateField("phone", v1 => {
-        if (!v1) {
-          this.cardButtonDisabled = true;
-          let time = 60;
-          const myScroll = setInterval(() => {
-            time--;
-            if (time >= 0) {
-              this.cardButtonText = time + "s后可重发";
-            } else {
-              this.cardButtonText = "获取验证码";
-              this.cardButtonDisabled = false;
-              clearTimeout(myScroll);
-              time = 60;
-            }
-          }, 1000);
-          const params = {
-            phone: this.cardForm.phone
-          };
-          console.log(params);
-          this.$apis.sendMessageAPI(params)
-              .then((res) => {
-                if (res.data.code === 0) {
-                  this.$message({
-                    showClose: true,
-                    message: "发送成功,请注意查收验证码",
-                    type: "success"
-                  });
-                } else {
-                  this.$message({
-                    showClose: true,
-                    message: res.data.message,
-                    type: "warning"
-                  });
-                }
-              })
-              .catch((e) => {
-                this.$message({
-                  showClose: true,
-                  message: e,
-                  type: "error"
-                });
-              });
-        }
-      });
-    },
-    shakeElem(elemId) {
-      let elem = document.getElementById(elemId);
-      elem.classList.add("shake");
-      setTimeout(() => {
-        elem.classList.remove("shake");
-      }, 800);
-    },
-    handleReset() {
-      const thatForm = this.$refs.cardFormRef;
-      thatForm.validateField("password", v1 => {
-        thatForm.validateField("passwordConfirm", v2 => {
-          thatForm.validateField("phone", v3 => {
-            thatForm.validateField("identifyCode", v4 => {
-              if (!v1 && !v2 && !v3 && !v4) {
-                if (this.cardVerified) {
-                  const params = {
-                    password: this.cardForm.password,
-                    identifyCode: this.cardForm.identifyCode,
-                    phone: this.cardForm.phone,
-                  };
-                  this.$apis.resetGitlabAPI(params)
-                      .then((res) => {
-                        if (res.data.code === 0) {
-                          this.$message({
-                            showClose: true,
-                            message: "重置成功",
-                            type: "success"
-                          });
-                        } else {
-                          this.$message({
-                            showClose: true,
-                            message: res.data.message,
-                            type: "warning"
-                          });
-                        }
-                      })
-                      .catch((e) => {
-                        this.$message({
-                          showClose: true,
-                          message: e,
-                          type: "error"
-                        });
-                      });
-                } else {
-                  this.shakeElem("auth-card-code-verifier");
-                }
-              }
-            });
-          });
-        });
-      });
-    },
-  }
-};
-</script>
-
-<style scoped>
-:deep(.el-card__body) {
-  padding: 48px;
-  display: grid;
-  grid-gap: 24px;
-}
-
-.title {
-  font-size: medium;
-}
-
-.row {
-  display: flex;
-  align-items: baseline;
-}
-
-.button {
-  margin-left: 24px;
-}
-
-.item {
-  padding: 0px;
-}
-
-</style>