Tang 2 年 前
コミット
e59db94844

+ 8 - 2
src/common/tools.js

@@ -188,7 +188,8 @@ export default {
 
 
 	imageToBase64(url, quality = 0.8) {
-		return new Promise(resolve => {
+		console.log(url,'1')
+		return new Promise((resolve,reject) => {
 			var image = new Image();
 			// 解决跨域 Canvas 污染问题,
 			image.setAttribute("crossorigin", "anonymous");
@@ -199,9 +200,14 @@ export default {
 				var context = canvas.getContext("2d");
 				context.drawImage(image, 0, 0, image.width, image.height);
 				var url = canvas.toDataURL("image/jpeg", quality); //将图片格式转为base64
-
+				console.log(url,'2')
+				console.log("success")
 				resolve(url)
 			};
+			image.onerror = function () {
+				console.log("error")
+				resolve(false)
+			};  
 			image.src = url + "?time=" + Date.now();
 		})
 

+ 6 - 3
src/components/rebuildModal/index.vue

@@ -31,15 +31,18 @@
                 >
                   <div class="title">
                     <span class="note" v-if="item.type == 0"> 测试 </span>
-                    <span class="note note--yellow" v-if="item.type == 1"
+                    <span class="note note--yellow" v-else-if="item.type == 1 && item.sectionType == 1"
                       >视频</span
                     >
-                    <span class="note note--yellow" v-if="item.type == 2"
+                    <span class="note note--yellow" v-else-if="item.type == 1 && item.sectionType == 2"
                       >直播</span
                     >
-                    <span class="note note--yellow" v-if="item.type == 3"
+                    <span class="note note--yellow" v-else-if="item.type == 1 && item.sectionType == 3"
                       >回放</span
                     >
+                    <span class="note note--yellow" v-else-if="item.type == 2"
+                      >试卷</span
+                    >
                     {{ index + 1 }}、{{ item.name }}
                   </div>
                   <div class="desc">

+ 39 - 9
src/pages/course-detail/index.vue

@@ -499,7 +499,7 @@
                     : ''
                 "
               >
-                <div class="upload-box">
+                <div class="upload-box" :id="item.fieldKey === 'idcard_face_photo'?'idcard_face_photo':null">
                   <div
                     :style="
                       item.fieldKey === 'recent_photos'
@@ -1392,8 +1392,7 @@ export default {
     this.dictList();
 
     this.getbaseprofiletplists().then(async res => {
-      
-      console.log('tanglian2')
+      console.log("tanglian2");
       await this.courseCourseList();
       this.getRebuildCourse();
     });
@@ -1736,6 +1735,7 @@ export default {
     },
 
     async changePhotoListHeader2(params, fileList) {
+      console.log('err1')
       let file = await this.uploadRules(params);
       if (fileList.length == 1) {
         fileList.splice(0, 1);
@@ -1747,7 +1747,24 @@ export default {
         return;
       }
 
-      this.$refs.idcard_face_photo[0].clearFiles();
+        if (this.infoForm.name) {
+          if (this.infoForm.name != res.data.IdName) {
+            this.$message.warning(
+              "输入的姓名和身份证人像面照片姓名不匹配,请联系客服"
+            );
+            return;
+          }
+        }
+        if (this.infoForm.idcard) {
+          if (this.infoForm.idcard != res.data.IdNum) {
+            this.$message.warning(
+              "输入的身份证号和身份证人像面照片身份证号不匹配,请联系客服"
+            );
+            return;
+          }
+        }
+        this.$refs.idcard_face_photo[0].clearFiles();
+
       this.$set(this.infoForm, "idcard_face_photo", res.data.IdImgPath);
       this.fileList2 = [
         {
@@ -2122,24 +2139,30 @@ export default {
     async uploadDatas(data) {
       let self = this;
       if (this.infoForm.recent_photos && this.infoForm.idcard_face_photo) {
-        let base = await this.$tools.imageToBase64(
-          this.$tools.splitImgHost(this.infoForm.idcard_face_photo)
-        );
-
+        
         let resData = {};
         try {
+          let base = await this.$tools.imageToBase64(
+          this.$tools.splitImgHost(this.infoForm.idcard_face_photo)
+        );
           resData = await this.$request.faceCertificationIDCardOCR({
             cardSide: 1, //1人像  2 国徽
             cardImageBase64: base,
             gradeId: this.gradeId
           });
         } catch (err) {
+      //生成唯一ID定位Start
+      document.getElementById("idcard_face_photo").scrollIntoView(true);
+      //生成唯一ID定位End
           self.$message.warning("身份证人像面照片异常,请重新上传");
           self.uploading = false;
           return;
         }
 
         if (!resData.data) {
+      //生成唯一ID定位Start
+      document.getElementById("idcard_face_photo").scrollIntoView(true);
+      //生成唯一ID定位End
           this.$message.warning("身份证人像面照片异常,请重新上传");
           this.uploading = false;
           return;
@@ -2148,6 +2171,10 @@ export default {
         this.veryIdName = resData.data.IdName;
         if (this.infoForm.name) {
           if (this.infoForm.name != this.veryIdName) {
+            
+      //生成唯一ID定位Start
+      document.getElementById("idcard_face_photo").scrollIntoView(true);
+      //生成唯一ID定位End
             this.$message.warning(
               "输入的姓名和身份证人像面照片姓名不匹配,请联系客服"
             );
@@ -2157,6 +2184,9 @@ export default {
         }
         if (this.infoForm.idcard) {
           if (this.infoForm.idcard != this.veryIdCard) {
+      //生成唯一ID定位Start
+      document.getElementById("idcard_face_photo").scrollIntoView(true);
+      //生成唯一ID定位End
             this.$message.warning(
               "输入的身份证号和身份证人像面照片身份证号不匹配,请联系客服"
             );
@@ -3281,7 +3311,7 @@ export default {
         let self = this;
         this.$request.goodsDetail(this.goodsId).then(res => {
           self.goodsData = res.data;
-          console.log('tanglian1')
+          console.log("tanglian1");
           self.gradeId = self.goodsData.gradeId;
           if (this.goodsData.categoryName) {
             this.infoForm.apply_post = this.goodsData.categoryName;