|
@@ -424,12 +424,16 @@ export default {
|
|
// console.log(buffer);
|
|
// console.log(buffer);
|
|
// var view1 = new Uint8Array(buffer);
|
|
// var view1 = new Uint8Array(buffer);
|
|
// console.log(buffer[0], buffer[1], buffer[429721]);
|
|
// console.log(buffer[0], buffer[1], buffer[429721]);
|
|
- const fileMd5 = MD5(buffer);
|
|
|
|
- console.log(fileMd5);
|
|
|
|
|
|
+ // const fileMd5 = MD5(buffer);
|
|
|
|
+ const fileMd5Base64 = window.btoa(
|
|
|
|
+ String.fromCharCode(...MD5.digest(buffer))
|
|
|
|
+ );
|
|
|
|
+ // console.log(fileMd5);
|
|
|
|
+ // console.log(fileMd5, fileMd5Base64);
|
|
|
|
|
|
const params = new URLSearchParams();
|
|
const params = new URLSearchParams();
|
|
params.append("fileSuffix", "png");
|
|
params.append("fileSuffix", "png");
|
|
- params.append("fileMd5", fileMd5);
|
|
|
|
|
|
+ // params.append("fileMd5", fileMd5);
|
|
const res = await this.$http.get(
|
|
const res = await this.$http.get(
|
|
"/api/ecs_oe_student/examControl/getCapturePhotoYunSign?" + params
|
|
"/api/ecs_oe_student/examControl/getCapturePhotoYunSign?" + params
|
|
);
|
|
);
|
|
@@ -448,15 +452,35 @@ export default {
|
|
myFormData.append(k, v);
|
|
myFormData.append(k, v);
|
|
}
|
|
}
|
|
myFormData.append("file", captureBlob);
|
|
myFormData.append("file", captureBlob);
|
|
|
|
+ // myFormData.toBlob();
|
|
|
|
+ // let myHeaders = new Headers();
|
|
|
|
+ // myHeaders.append("Content-MD5", fileMd5Base64);
|
|
|
|
|
|
try {
|
|
try {
|
|
const res2 = await fetch(res.data.formUrl, {
|
|
const res2 = await fetch(res.data.formUrl, {
|
|
method: "POST",
|
|
method: "POST",
|
|
|
|
+ // headers: myHeaders,
|
|
body: myFormData,
|
|
body: myFormData,
|
|
});
|
|
});
|
|
|
|
+ console.log(res2, {
|
|
|
|
+ "res2.headers": res2.headers,
|
|
|
|
+ 'res2.headers.get("Content-MD5")': res2.headers.get("Content-MD5"),
|
|
|
|
+ 'res2.headers.get("Content-Type")': res2.headers.get(
|
|
|
|
+ "Content-Type"
|
|
|
|
+ ),
|
|
|
|
+ });
|
|
|
|
+ // throw "eee";
|
|
if (!res2.ok) {
|
|
if (!res2.ok) {
|
|
throw res2.status;
|
|
throw res2.status;
|
|
}
|
|
}
|
|
|
|
+ if (res2.headers.get("Content-MD5") != fileMd5Base64) {
|
|
|
|
+ window._hmt.push([
|
|
|
|
+ "_trackEvent",
|
|
|
|
+ "摄像头框",
|
|
|
|
+ "抓拍照片保存失败--alioss content-md5 mismatch",
|
|
|
|
+ ]);
|
|
|
|
+ throw "图片校验失败";
|
|
|
|
+ }
|
|
} catch (error) {
|
|
} catch (error) {
|
|
window._hmt.push([
|
|
window._hmt.push([
|
|
"_trackEvent",
|
|
"_trackEvent",
|