refactor: 背景图片直接存储在服务器

refactor: 背景图片直接存储在服务器
This commit is contained in:
王嘉豪
2022-04-25 12:13:05 +08:00
committed by GitHub
parent dbb8a7a76d
commit f55749417d
11 changed files with 270 additions and 27 deletions

View File

@@ -64,7 +64,6 @@
:on-remove="handleRemove"
:http-request="upload"
:file-list="fileList"
:on-change="onChange"
>
<i class="el-icon-plus" />
</el-upload>
@@ -108,9 +107,9 @@
import { queryBackground } from '@/api/background/background'
import BackgroundItem from '@/views/background/BackgroundItem'
import { mapState } from 'vuex'
import eventBus from '@/components/canvas/utils/eventBus'
import { deepCopy } from '@/components/canvas/utils/utils'
import { COLOR_PANEL } from '@/views/chart/chart/chart'
import { uploadFileResult } from '@/api/staticResource/staticResource'
export default {
name: 'Background',
@@ -179,7 +178,7 @@ export default {
},
handleRemove(file, fileList) {
this.uploadDisabled = false
this.panel.imageUrl = null
this.curComponent.commonBackground.outerImage = null
this.fileList = []
this.commitStyle()
},
@@ -187,16 +186,11 @@ export default {
this.dialogImageUrl = file.url
this.dialogVisible = true
},
onChange(file, fileList) {
var _this = this
_this.uploadDisabled = true
const reader = new FileReader()
reader.onload = function() {
_this.curComponent.commonBackground.outerImage = reader.result
}
reader.readAsDataURL(file.raw)
},
upload(file) {
const _this = this
uploadFileResult(file, (fileUrl) => {
_this.curComponent.commonBackground.outerImage = fileUrl
})
// console.log('this is upload')
}