xuqiaoying 3 سال پیش
والد
کامیت
e1bdc3a71c
6فایلهای تغییر یافته به همراه220 افزوده شده و 135 حذف شده
  1. 2 0
      common/signature.js
  2. 5 0
      pages2/appointment/index.vue
  3. 99 77
      pages2/appointment/order.vue
  4. 18 14
      pages2/exam/exam_appointment.vue
  5. 73 43
      pages2/exam/signCommit.vue
  6. 23 1
      pages5/examList/index.vue

+ 2 - 0
common/signature.js

@@ -27,6 +27,7 @@ class Handwriting {
 	startValue = 0;
 	constructor(opts) {
 		console.log(opts);
+		console.log('canvas', opts)
 		this.lineColor = opts.lineColor || '#1A1A1A' // 颜色
 		this.slideValue = opts.slideValue || 50
 		this.canvasName = opts.canvasName || 'handWriting'
@@ -386,6 +387,7 @@ class Handwriting {
 	}
 
 	saveCanvas() {
+		console.log('canvasName',this.canvasName)
 		return new Promise((resolve, rej) => {
 			uni.canvasToTempFilePath({
 				canvasId: this.canvasName,

+ 5 - 0
pages2/appointment/index.vue

@@ -104,6 +104,7 @@ export default {
       }, //页面数据
       radioInfo: "",
       goodsIdBK: null, //补考商品ID
+      reportStatus: 0, // 是否线上签署疫情防控承诺书, 1是,0否
     };
   },
   onLoad(option) {
@@ -147,11 +148,14 @@ export default {
         orderGoodsId: this.orderGoodsId,
         applyId: this.applyId,
       };
+      // /apply/subscribe
       this.$api.getApplysubscribe(data).then((res) => {
         if (res.data.data.applyStatus) {
           res.data.data.applyStatus = res.data.data.applyStatus.split(",");
         }
         this.listData = res.data.data;
+        this.reportStatus = res.data.data.reportStatus
+        console.log('reportStatus', this.reportStatus)
       });
     },
     next() {
@@ -185,6 +189,7 @@ export default {
               dataId: res.data.data,
               applyId: this.applyId,
               orderGoodsId: this.orderGoodsId,
+              reportStatus: this.reportStatus,
             });
           }
           if (res.data.data === 3) {

+ 99 - 77
pages2/appointment/order.vue

@@ -162,11 +162,13 @@ export default {
       dataId: null, //跳转拷贝
       handwriting: '',
       lineColor: "black",
-      slideValue: 50,
+      slideValue: 30,
       openVerify: false, // 控制是否手动验证
       commitment_electr_signature: '',
       isUploading: false,
       siteId: '', // 考试id
+      reportStatus: 0, // 是否线上签署疫情防控承诺书, 1是,0否
+      baseAddress: '', // 签名转成base64
     };
   },
   async onLoad(option) {
@@ -175,6 +177,7 @@ export default {
     this.applyStatus = Number(option.applyStatus);
     this.dataId = Number(option.dataId);
     this.orderGoodsId = Number(option.orderGoodsId);
+    this.reportStatus = option.reportStatus
     await this.commonSystemTime();
     this.getInfo();
   },
@@ -240,6 +243,7 @@ export default {
         return;
       }
       this.addressName = this.listData[index].siteAddress;
+      console.log('addressName', this.addressName, this.listData)
       this.addressId = this.listData[index].id;
       var arrays = [];
       this.listData[index].examUserApplySiteTime.forEach((item) => {
@@ -265,12 +269,13 @@ export default {
           });
         });
       });
+      console.log('arrays', arrays)
       this.activeList = arrays.filter((item, index) => {
         console.log(item);
         // const newTime = parseInt(new Date().getTime() / 1000)
-        console.log(
-          item.dataTime.replace(/-/g, "/") + "" + item.startTime + ":00"
-        );
+        // console.log(
+        //   item.dataTime.replace(/-/g, "/") + "" + item.startTime + ":00"
+        // );
         const liTime = parseInt(
           new Date(
             item.dataTime.replace(/-/g, "/") + "" + item.startTime + ":00"
@@ -303,67 +308,45 @@ export default {
         return;
       }
       this.isUploading = true
-      console.log('commitment_electr_signature', this.commitment_electr_signature)
+
       var self = this;
       if (self.addressId) {
         var ast = self.activeList.some((item) => {
           return item.checked === true;
         });
-        console.log('ast', ast)
+        console.log('ast',this.activeList, ast)
         if (ast) {
-          await this.subCanvas()
-          if (!this.commitment_electr_signature) {
-            uni.showToast({
-              title: "请签名",
-              icon: "none",
-            })
-            return
+          if (this.reportStatus == 1) {
+            await this.subCanvas()
+            if (!this.commitment_electr_signature) {
+              uni.showToast({
+                title: "请签名",
+                icon: "none",
+              })
+              return
+            } else {
+              // await this.submitApi()
+              if (this.commitment_electr_signature) {
+                uni.request({
+                  url: this.commitment_electr_signature, //临时路径
+                  responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
+                  success: res => {
+                    const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
+                    console.log('sfs签名转成base64', base64)
+                    this.baseAddress = base64
+                    this.submits()
+                  },
+                  fail: err => {
+                    console.log(err)
+                  }
+                })
+              }
+            }
           } else {
-            await this.submitApi()
+            this.submits()
           }
           
-          console.log('this.00000', this.commitment_electr_signature)
-          // return
-          var copyData = JSON.parse(JSON.stringify(self.activeList));
-          const index = copyData.findIndex((item) => item.checked);
-          var data = {
-            applyId: self.applyId,
-            goodsId: self.goodsId,
-            studentType: self.applyStatus,
-            applySiteAddress: self.addressName,
-            applySiteExamTime: copyData[index].examTime,
-            applySiteStartTime: copyData[index].startTimeC,
-            applySiteEndTime: copyData[index].endTimeC,
-            orderGoodsId: self.orderGoodsId,
-            siteId: this.siteId, // 考场id
-            reportFile: this.commitment_electr_signature,
-          };
-          console.log('-----data', data)
-          // return
-          if (self.dataId === 1) {
-            self.$store.commit("updateApplyData", data);
-            self.$navTo.togo("/pages2/appointment/kporder", {
-              applyId: self.applyId,
-              applyStatus: self.applyStatus,
-              goodsId: self.goodsId,
-              orderGoodsId: self.orderGoodsId,
-            });
-          }
-          if (self.dataId === 2) {
-            self.$api.addApply(data).then((res) => {
-              if (res.data.code === 200) {
-                uni.reLaunch({
-                  url: `/pages2/appointment/appointment_success?subscribeId=${res.data.data}`,
-                });
-              } else {
-                uni.showToast({
-                  icon: "none",
-                  title: res.data.msg,
-                });
-              }
-            });
-          }
-          this.isUploading = false
+          
         } else {
           uni.showToast({
             title: "请选择考试时间",
@@ -379,6 +362,51 @@ export default {
         this.isUploading = false
       }
     },
+    submits() {
+      var copyData = JSON.parse(JSON.stringify(this.activeList));
+      const index = copyData.findIndex((item) => item.checked);
+      var data = {
+        applyId: this.applyId,
+        goodsId: this.goodsId,
+        studentType: this.applyStatus,
+        applySiteAddress: this.addressName,
+        applySiteExamTime: copyData[index].examTime,
+        applySiteStartTime: copyData[index].startTimeC,
+        applySiteEndTime: copyData[index].endTimeC,
+        orderGoodsId: this.orderGoodsId,
+        siteId: this.siteId, // 考场id
+        
+      };
+      if (this.reportStatus == 1) {
+        data.signImageStr = this.baseAddress
+      }
+      console.log('-----data', data, this.dataId)
+      // return
+      if (this.dataId === 1) {
+        this.$store.commit("updateApplyData", data);
+        this.$navTo.togo("/pages2/appointment/kporder", {
+          applyId: this.applyId,
+          applyStatus: this.applyStatus,
+          goodsId: this.goodsId,
+          orderGoodsId: this.orderGoodsId,
+        });
+      }
+      if (this.dataId === 2) {
+        this.$api.addApply(data).then((res) => {
+          if (res.data.code === 200) {
+            uni.reLaunch({
+              url: `/pages2/appointment/appointment_success?subscribeId=${res.data.data}`,
+            });
+          } else {
+            uni.showToast({
+              icon: "none",
+              title: res.data.msg,
+            });
+          }
+        });
+      }
+      this.isUploading = false
+    },
     backPage() {
       uni.navigateBack({
         delta: 1,
@@ -399,7 +427,7 @@ export default {
     uploadScaleEnd(event) {
       this.handwriting.uploadScaleEnd(event);
     },
-    subCanvas() {
+    async subCanvas() {
       console.log("签名-------");
       return new Promise((resolve, reject) => {
         if (this.commitment_electr_signature) {
@@ -424,31 +452,25 @@ export default {
           this.isUploading = false
       });
     },
-    // async submits() {
-
-    //   if (this.isUploading) {
-    //     return;
-    //   }
-    //   this.isUploading = true;
-    //   var ast = this.listData.some((item) => {
-    //     return item.fieldKey === "commitment_electr_signature";
-    //   });
-    //   if (ast) {
-    //     await this.subCanvas();
-    //   }
-    //   this.openVerify = true;
-    // },
      //提交表单
     async submitApi() {
       if (this.commitment_electr_signature) {
-        this.commitment_electr_signature = await this.$method.uploadFile(
-          this.commitment_electr_signature,
-          0
-        );
-        console.log('----commitment_electr_signature', this.commitment_electr_signature)
+        // this.commitment_electr_signature = await this.$method.uploadFile(
+        //   this.commitment_electr_signature,
+        //   0
+        // );
+         var res = await uni.request({
+          url: this.commitment_electr_signature, //临时路径
+          responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
+          success: res => {
+            const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
+            console.log('sfs签名转成base64', base64)
+            this.baseAddress = base64
+          }
+        })
+        console.log('----commitment_electr_signature',res, this.commitment_electr_signature)
       }
 
-      // this.uploadDatas(data);
     },
   },
 };

+ 18 - 14
pages2/exam/exam_appointment.vue

@@ -20,7 +20,7 @@
 						</view>
 						<view class="item">
 							<view class="left">考试地点</view>
-							<view class="right">{{ item.applySiteAddress }}</view>
+							<view class="right">{{ item.applySiteAddress || '' }}</view>
 						</view>
 						<view class="item">
 							<view class="left">考试时间</view>
@@ -43,18 +43,20 @@
 						<view class="item">
 							<view class="left">准考证号</view>
 							<view class="right">
-								{{ item.examineeCode }}
+								{{ item.examineeCode || '' }}
 							</view>
 						</view>
 						<view class="item">
 							<view class="left">座位号</view>
 							<view class="right">
-								{{ item.seatNumber }}
+								{{ item.seatNumber || '' }}
 							</view>
 						</view>
-						<view class="item" @click="toSign(item)">
+						<!-- applyReportStatus是否需要签署承诺书 1是,0否 -->
+						<view v-if="item.applyReportStatus == 1" class="item" @click="toSign(item)">
 							<view class="left">疫情防控承诺书</view>
-							<view class="right" :class="{unSign: item.reportStatus == 0}">
+							<!-- :class="{unSign: item.reportStatus == 0}" -->
+							<view class="right unSign" >
 								{{ item.reportStatus == 1 ? '已签署' : item.reportStatus == 0 ? '未签署' : '' }}
 							</view>
 						</view>
@@ -97,7 +99,8 @@
 					</view>
 					<view class="item">
 						考试地点:
-						<text class="val">{{ activeList.applySiteAddress }}</text>
+						<!-- fromPlat:1云学堂 2智慧考场 -->
+						<text class="val">{{ activeList.fromPlat == 2 ? (activeList.roomAddress || '') : (activeList.applySiteAddress || '') }}</text>
 					</view>
 					<view class="item">
 						考试时间:
@@ -114,13 +117,13 @@
 					<view class="item">
 						准考证号:
 						<text class="val">
-							{{ activeList.examineeCode }}
+							{{ activeList.examineeCode || '' }}
 						</text>
 					</view>
 					<view class="item">
 						座位号:
 						<text class="val">
-							{{ activeList.seatNumber }}
+							{{ activeList.seatNumber || '' }}
 						</text>
 					</view>
 					<view class="item" v-if="activeList.applySiteAddressTrain">
@@ -148,7 +151,7 @@
 					</view>
 					<view class="item">
 						考试结果:
-						<text class="val">{{ activeList.syncExamResult }}</text>
+						<text class="val">{{ activeList.syncExamResult || '' }}</text>
 					</view>
 				</view>
 				<u-line color="#EEEEEE" />
@@ -241,11 +244,11 @@ export default {
 	methods: {
 		...mapActions(['setSystemTime']),
 		toSign(item) {
-			if (item.reportStatus == 0) {
-				uni.navigateTo({
-					url: 'pages2/exam/signCommit'
-				})
-			}
+			console.log('item', item)
+			uni.navigateTo({
+				url: '/pages2/exam/signCommit?reportStatus=' + item.reportStatus + '&reportFile=' + item.reportFile + '&subscribeId=' + item.subscribeId +
+				'&phone=' + item.telphone
+			})
 		},
 		isShowFun(times) {
 			// var timestamp = parseInt(new Date().getTime() / 1000);
@@ -433,6 +436,7 @@ page {
 }
 .detailsBox {
 	width: 640rpx;
+	height: 1000rpx;
 	background: #ffffff;
 	border-radius: 24rpx;
 	.time {

+ 73 - 43
pages2/exam/signCommit.vue

@@ -19,12 +19,12 @@
       <view class="appointmentItem">
         <view class="title"><text class="star_red">*</text>签名板</view>
         <view class="dis_stys">
-          <text style="color: #999999">请在下方签名区进行签名</text>
-          <text @click="retDraw" mode="">清空</text>
+          <text v-if="reportStatus != 1" style="color: #999999">请在下方签名区进行签名</text>
+          <text v-if="reportStatus != 1" @click="retDraw()" mode="">清空</text>
         </view>
         <view class="handCenter">
-           <!-- v-if="!form[item.fieldKey]" -->
           <canvas
+            v-if="reportStatus != 1"
             class="handWriting"
             disable-scroll="true"
             :catchtouchmove="true"
@@ -33,20 +33,19 @@
             @touchend="uploadScaleEnd"
             canvas-id="handWriting"
           ></canvas>
-          <!-- <view
+          <view
             v-else
             style="width: 100%; height: 100%; position: relative"
           >
-            <view class="ctoples">图片</view>
             <image
               style="width: 100%; height: 100%"
-              :src="$method.splitImgHost(form[item.fieldKey])"
+              :src="$method.splitImgHost(reportFile)"
               mode=""
             ></image>
-          </view> -->
+          </view>
         </view>
       </view>
-      <view class="finish_btn" @click="submits()">
+      <view v-if="reportStatus != 1" class="finish_btn" @click="submits()">
         完成签署
       </view>
     </view>
@@ -58,26 +57,37 @@ export default {
     name: 'sign_commit',
     data() {
         return {
-          handwriting: '',
-          lineColor: "black",
-          slideValue: 50,
-          commitment_electr_signature: '',
-          isUploading: false,
+            handwriting: '',
+            lineColor: "black",
+            slideValue: 30,
+            commitment_electr_signature: '',
+            isUploading: false,
+            reportStatus: 0, // 是否线上签署疫情防控承诺书, 1是,0否
+            baseAddress: '', // 签名转成base64
+            reportFile: '', // 文件路径
+            subscribeId: '',
+            phone: '',
         }
     },
+    onLoad(option) {
+        console.log('option', option)
+        const { reportStatus, reportFile, subscribeId, phone } = option
+        this.reportStatus = reportStatus
+        this.reportFile = reportFile
+        this.subscribeId = subscribeId
+        this.phone = phone
+    },
     onReady(res) {
       this.handwriting = new Handwriting({
         lineColor: this.lineColor,
         slideValue: this.slideValue, // 0, 25, 50, 75, 100
         canvasName: "handWriting",
       });
-      // this.$refs.uForm.setRules(this.rules);
     },
     methods: {
       retDraw() {
         this.handwriting.retDraw()
         this.commitment_electr_signature = ''
-        // this.$set(this.form, "commitment_electr_signature", "");
       },
       uploadScaleStart(event) {
         this.handwriting.uploadScaleStart(event);
@@ -89,7 +99,6 @@ export default {
         this.handwriting.uploadScaleEnd(event);
       },
       subCanvas() {
-        console.log("签名-------");
         return new Promise((resolve, reject) => {
           if (this.commitment_electr_signature) {
             resolve();
@@ -98,19 +107,18 @@ export default {
           this.handwriting.saveCanvas().then((res) => {
               if (this.handwriting.linePrack.length) {
                 console.log('签名-----res', res)
-                // this.$set(this.form, "commitment_electr_signature", res);
                 this.commitment_electr_signature = res
               }
               resolve(res)
             })
             .catch((err) => {
-              uni.showToast({
-                title: "签名上传失败",
-                icon: "error",
-              });
-
+                uni.showToast({
+                    title: "签名上传失败",
+                    icon: "error",
+                });
+                this.isUploading = false
             });
-            this.isUploading = false
+            
         });
       },
       async submits() {
@@ -118,25 +126,45 @@ export default {
           return;
         }
         this.isUploading = true
+
         await this.subCanvas()
-          if (!this.commitment_electr_signature) {
+        if (!this.commitment_electr_signature) {
             uni.showToast({
-              title: "请签名",
-              icon: "none",
+            title: "请签名",
+            icon: "none",
             })
+            this.isUploading = false
             return
-          } else {
-            await this.submitApi()
-          }
-      },
-       //提交表单
-      async submitApi() {
-        if (this.commitment_electr_signature) {
-          this.commitment_electr_signature = await this.$method.uploadFile(
-            this.commitment_electr_signature,
-            0
-          );
-          console.log('----commitment_electr_signature', this.commitment_electr_signature)
+        } else {
+            if (this.commitment_electr_signature) {
+                uni.request({
+                    url: this.commitment_electr_signature, //临时路径
+                    responseType: 'arraybuffer', //设置返回的数据格式为arraybuffer
+                    success: res => {
+                        const base64 = "data:image/png;base64," + uni.arrayBufferToBase64(res.data)
+                        console.log('sfs签名转成base64', base64)
+                        this.baseAddress = base64
+                        // return
+                        this.$http({
+                            url: '/apply/signReport',
+                            method: 'post',
+                            data: {
+                                signImageStr: this.baseAddress,
+                                subscribeId: this.subscribeId,
+                            }
+                        }).then((res) => {
+                            console.log('res', res)
+                            if (res.data.data == 200) {
+                                
+                            }
+                        })
+                    },
+                    fail: err => {
+                        console.log(err)
+                    }
+                })
+                this.isUploading = false
+            }
         }
       },
     },
@@ -190,17 +218,19 @@ export default {
       margin-bottom: 16rpx;
     }
     .handCenter {
-      .handWriting {
         width: 100%;
         height: 400rpx;
-        background: #fff;
-      }
+        .handWriting {
+            width: 100%;
+            height: 100%;
+            background: #fff;
+        }
     }
   }
   .finish_btn {
     // width: 100%;
-    height: 100rpx;
-    line-height: 100rpx;
+    height: 90rpx;
+    line-height: 90rpx;
     text-align: center;
     background-color:#1890ff;
     font-size: 32rpx;

+ 23 - 1
pages5/examList/index.vue

@@ -182,8 +182,29 @@ export default {
 		...mapGetters(['userInfo'])
 	},
 	onLoad(option) {
+		console.log('查看返回的onloaddddd')
 		this.param.mockStatus = option.state || 0
 		
+		// this.endDate = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
+			
+		// this.mockSubscribeListSubscribe();
+		// uni.getSystemInfo({
+		// 	success:(e) => {
+		// 		let info = uni.createSelectorQuery().select(".nav");
+		// 		info.boundingClientRect((navData) => { //data - 各种参数
+				
+		// 			let info = uni.createSelectorQuery().select(".tabs");
+		// 			info.boundingClientRect((tabData) => { //data - 各种参数
+		// 				this.modalTop = navData.height + tabData.height
+		// 				console.log(navData) // 获取元素宽度
+		// 				console.log(tabData) // 获取元素宽度
+		// 			}).exec()
+		// 		}).exec()
+		// 	}
+		// })
+	},
+	onShow() {
+		console.log('查看返回的oonshow')
 		this.endDate = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
 			
 		this.mockSubscribeListSubscribe();
@@ -300,8 +321,9 @@ export default {
 			if(param.startTime) {
 				param.startTime = this.$method.TimeTotimestamp(param.startTime)
 			}
-			
+			// mock/subscribe/listSubscribe
 			this.$api.mockSubscribeListSubscribe(param).then(res => {
+				this.recordList = []
 				this.recordList.push(...res.data.rows)
 				this.total = res.data.total
 			})