|
@@ -451,7 +451,7 @@
|
|
|
<el-upload
|
|
|
ref="upload"
|
|
|
class="upload-demo"
|
|
|
- action="https://jsonplaceholder.typicode.com/posts/"
|
|
|
+ action="http://star.xiaojukeji.com/upload/img.node"
|
|
|
:before-upload="beforeUpload"
|
|
|
:before-remove="beforeRemove"
|
|
|
:on-remove="handleRemove"
|
|
@@ -951,12 +951,24 @@ export default {
|
|
|
})
|
|
|
this.bugUpdate(this.bug, 'accessory')
|
|
|
},
|
|
|
- async handleDownload(file) { // 下载图片
|
|
|
- await axios({
|
|
|
- url: file.url,
|
|
|
- method: 'get',
|
|
|
- responseType: 'blob'
|
|
|
- })
|
|
|
+ handleDownload(file) { // 下载图片
|
|
|
+ const xhr = new XMLHttpRequest()
|
|
|
+ xhr.open('get', file.url, true)
|
|
|
+ xhr.responseType = 'blob'
|
|
|
+ xhr.onload = () => {
|
|
|
+ if (xhr.status === 200) {
|
|
|
+ this.saveAs(xhr.response, file.name)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ xhr.send()
|
|
|
+ },
|
|
|
+ saveAs(data, name) { // 保存图片
|
|
|
+ const urlObject = window.URL || window.webkitURL || window
|
|
|
+ const file = new Blob([data])
|
|
|
+ const a = document.createElement('a')
|
|
|
+ a.href = urlObject.createObjectURL(file)
|
|
|
+ a.download = name
|
|
|
+ a.click()
|
|
|
},
|
|
|
getCommentList() {
|
|
|
getCommentList({ type: 2, joinId: this.id }).then(res => {
|
|
@@ -1367,7 +1379,7 @@ export default {
|
|
|
const res = await this.updateFile(window.uploadFiles[0])
|
|
|
const data = res.data
|
|
|
const item = {
|
|
|
- name: this.imageName.name || '',
|
|
|
+ name: `${this.imageName.name}.png` || `${this.generateMixed(10)}.png`,
|
|
|
status: 'success',
|
|
|
url: 'http:' + data.url
|
|
|
}
|