|
@@ -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);
|
|
|
},
|
|
|
},
|
|
|
};
|