|
|
|
@ -65,7 +65,7 @@ |
|
|
|
<script> |
|
|
|
import { Scedit,Scdetail } from '@/api/scinfo' |
|
|
|
import * as scproto from '@/utils/scinfo' |
|
|
|
import { unescape } from 'lodash' |
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
@ -80,6 +80,12 @@ export default { |
|
|
|
this.getscdb(id) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 二进制转为base64 |
|
|
|
uint8ArrayToBase64(uint8Array) { |
|
|
|
const decoder = new TextDecoder('utf-8'); |
|
|
|
const binaryString =decoder.decode(uint8Array) |
|
|
|
return btoa(binaryString); |
|
|
|
}, |
|
|
|
// 查询详情 |
|
|
|
getscdb(sid) { |
|
|
|
Scdetail({ |
|
|
|
@ -100,18 +106,26 @@ export default { |
|
|
|
// 提交的status 需要设置为整数 |
|
|
|
status: parseInt(form.status.value) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 将fromdata 转成二进制 |
|
|
|
let binary = scproto.encodeServiceInfo(formData) |
|
|
|
console.log(binary,"binary") |
|
|
|
//二进制转为base64 |
|
|
|
//let base64 = btoa(String.fromCharCode.apply(null, new Uint8Array(binary))) |
|
|
|
let base64 =btoa(unescape(encodeURIComponent(binary))) |
|
|
|
let base64 = btoa(String.fromCharCode.apply(null, new Uint8Array(binary))) |
|
|
|
// let base64 = this.uint8ArrayToBase64(binary) |
|
|
|
console.log(base64) |
|
|
|
// let base64 =btoa(unescape(encodeURIComponent(binary))) |
|
|
|
// arraybuffer转为base64 |
|
|
|
|
|
|
|
// 提交数据 |
|
|
|
Scedit(base64).then(res => { |
|
|
|
console.log(res) |
|
|
|
// console.log(formData,"formData") |
|
|
|
// console.log("save success ") |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|