|
@@ -523,6 +523,7 @@ let cropperType = ref('before')
|
|
|
let customPosterInfo = ref({})
|
|
|
let customPosterData = ref({})
|
|
|
let customShowNewImage = ref(false)
|
|
|
+let refCropper = ref('')
|
|
|
|
|
|
// 当前展示组件内容 default(表单) preview(预览) topUp(充值)
|
|
|
let showComType = ref("default");
|
|
@@ -1747,41 +1748,44 @@ const selectImage = (option) => {
|
|
|
const confirmImage = () => {
|
|
|
let contentType = 'image/png';
|
|
|
cropperLoading.value = true;
|
|
|
- currentInstance.ctx.$refs.refCropper.getCropBlob(imgData => {
|
|
|
- uploadSignature({
|
|
|
- params: {
|
|
|
- bizType: 1,
|
|
|
- fileType: 1,
|
|
|
- contentType: contentType,
|
|
|
- fileSuffix: 'png',
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- let { code, data } = res;
|
|
|
- if (code === 0) {
|
|
|
- let reader = new FileReader()
|
|
|
- reader.readAsArrayBuffer(imgData)
|
|
|
- reader.onload = function(e) {
|
|
|
- let execFile = e.target.result;
|
|
|
- uploadFile({
|
|
|
- url: data.url,
|
|
|
- data: new Blob([execFile]),
|
|
|
- headers: {
|
|
|
- 'Authorization': data.authorization,
|
|
|
- 'x-amz-date': data.date,
|
|
|
- 'Content-Type': contentType
|
|
|
- }
|
|
|
- }).then(res => {
|
|
|
- let { status } = res
|
|
|
- if (status == 200) {
|
|
|
- successImage(data)
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- cropperLoading.value = false;
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ if (refCropper.value) {
|
|
|
+ refCropper.value.getCropBlob(imgData => {
|
|
|
+ uploadSignature({
|
|
|
+ params: {
|
|
|
+ bizType: 1,
|
|
|
+ fileType: 1,
|
|
|
+ contentType: contentType,
|
|
|
+ fileSuffix: 'png',
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ let { code, data } = res;
|
|
|
+ if (code === 0) {
|
|
|
+ let reader = new FileReader()
|
|
|
+ reader.readAsArrayBuffer(imgData)
|
|
|
+ reader.onload = function(e) {
|
|
|
+ let execFile = e.target.result;
|
|
|
+ uploadFile({
|
|
|
+ url: data.url,
|
|
|
+ data: new Blob([execFile]),
|
|
|
+ headers: {
|
|
|
+ 'Authorization': data.authorization,
|
|
|
+ 'x-amz-date': data.date,
|
|
|
+ 'Content-Type': contentType
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ let { status } = res
|
|
|
+ if (status == 200) {
|
|
|
+ successImage(data)
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ cropperLoading.value = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
+ }
|
|
|
}
|
|
|
const successImage = (data) => {
|
|
|
hiddenDialog()
|