|
@@ -31,7 +31,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import { VueCropper } from 'vue-cropper'
|
|
|
-import { uploadFileWithBase64 } from '@/api/appTenant'
|
|
|
+import { uploadFileWithBase64, uploadFile } from '@/api/appTenant'
|
|
|
export default {
|
|
|
name: 'CropperModal',
|
|
|
components: {
|
|
@@ -89,11 +89,17 @@ export default {
|
|
|
this.$refs.cropper.getCropData(async (data) => {
|
|
|
const name = (this.options.name ? this.options.name.split('.')[0] : +new Date()) + '.png'
|
|
|
let form = new FormData()
|
|
|
- form.append('base64Str', data)
|
|
|
- form.append('fileName', name)
|
|
|
- form.append('extName', 'png')
|
|
|
+ form.append('file', this.blobToFile(data), name)
|
|
|
+ // form.append('base64Str', data)
|
|
|
+ // form.append('fileName', name)
|
|
|
+ // form.append('extName', 'png')
|
|
|
try {
|
|
|
- const res = await uploadFileWithBase64(form)
|
|
|
+ const res = await uploadFile(form)
|
|
|
+ // form.append('base64Str', data)
|
|
|
+ // form.append('fileName', name)
|
|
|
+ // form.append('extName', 'png')
|
|
|
+ // try {
|
|
|
+ // const res = await uploadFileWithBase64(form)
|
|
|
that.$emit('cropper-ok', res)
|
|
|
} catch(err) {
|
|
|
that.$message.error(err)
|