|
@@ -125,10 +125,11 @@ import UploadBtn from '@/components/UploadBtn'
|
|
|
import MDialog from '@/components/Dialog'
|
|
|
import MCard from '@/components/MCard'
|
|
|
import MForm from '@/components/MForm'
|
|
|
+// import { toBase64 } from '@/utils/file'
|
|
|
import {
|
|
|
businessCardParse,
|
|
|
getBusinessCardImage,
|
|
|
- updateBusinessCardStatus
|
|
|
+ updateBusinessCard
|
|
|
} from '@/api/dataOrigin'
|
|
|
export default {
|
|
|
name: 'imageImportEdit',
|
|
@@ -207,10 +208,13 @@ export default {
|
|
|
}
|
|
|
// this.file = item.image_path
|
|
|
try {
|
|
|
- const { data } = await getBusinessCardImage(item.image_path)
|
|
|
- this.file = data
|
|
|
- this.previewUrl = new Blob([data], { type: 'image/jpeg' })
|
|
|
- this.handlePreview(this.file)
|
|
|
+ const { data, name } = await getBusinessCardImage(item.image_path)
|
|
|
+ // const type = item.image_path.split('.').pop()
|
|
|
+ this.file = new File([data], name ?? item.image_path, { type: data.type })
|
|
|
+ // handleReadFile(data, type, files => {
|
|
|
+ // // 返回blob
|
|
|
+ this.previewUrl = URL.createObjectURL(data)
|
|
|
+ // })
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|
|
|
}
|
|
@@ -256,7 +260,7 @@ export default {
|
|
|
}
|
|
|
Object.assign(this.itemData, this.formQuery)
|
|
|
try {
|
|
|
- await updateBusinessCardStatus(this.itemData, this.id)
|
|
|
+ await updateBusinessCard(this.itemData, this.id)
|
|
|
this.$snackbar.success('更新成功')
|
|
|
} catch (error) {
|
|
|
this.$snackbar.error(error)
|