|
@@ -72,7 +72,6 @@
|
|
|
ref="coverUploadRef"
|
|
ref="coverUploadRef"
|
|
|
:action="url"
|
|
:action="url"
|
|
|
:file-list="fileListCover"
|
|
:file-list="fileListCover"
|
|
|
- :limit="1"
|
|
|
|
|
:before-upload="file => beforeUploadHandle(file, 1, [158, 214], 'coverFile')"
|
|
:before-upload="file => beforeUploadHandle(file, 1, [158, 214], 'coverFile')"
|
|
|
list-type="picture-card"
|
|
list-type="picture-card"
|
|
|
:on-success="successHandleCover"
|
|
:on-success="successHandleCover"
|
|
@@ -545,7 +544,12 @@ export default {
|
|
|
initUploadSortable () {
|
|
initUploadSortable () {
|
|
|
const setup = (ref, listKey, onChange) => {
|
|
const setup = (ref, listKey, onChange) => {
|
|
|
const listEl = this.$refs[ref] && this.$refs[ref].$el && this.$refs[ref].$el.querySelector('.el-upload-list--picture-card')
|
|
const listEl = this.$refs[ref] && this.$refs[ref].$el && this.$refs[ref].$el.querySelector('.el-upload-list--picture-card')
|
|
|
- if (!listEl || listEl.__sortable) return
|
|
|
|
|
|
|
+ if (!listEl) return
|
|
|
|
|
+ // 如果之前绑定过,先销毁旧的,避免 element-ui 重渲染后引用陈旧
|
|
|
|
|
+ if (listEl.__sortable) {
|
|
|
|
|
+ listEl.__sortable.destroy()
|
|
|
|
|
+ listEl.__sortable = null
|
|
|
|
|
+ }
|
|
|
listEl.__sortable = Sortable.create(listEl, {
|
|
listEl.__sortable = Sortable.create(listEl, {
|
|
|
animation: 150,
|
|
animation: 150,
|
|
|
onEnd: (evt) => {
|
|
onEnd: (evt) => {
|
|
@@ -571,11 +575,9 @@ export default {
|
|
|
if (res.code !== 0) {
|
|
if (res.code !== 0) {
|
|
|
return this.$message.error(res.msg)
|
|
return this.$message.error(res.msg)
|
|
|
}
|
|
}
|
|
|
- this.fileListCover.unshift({
|
|
|
|
|
- name: '',
|
|
|
|
|
- url: res.data
|
|
|
|
|
- })
|
|
|
|
|
- this.basicForm.coverFile = this.fileListCover[0].url
|
|
|
|
|
|
|
+ // 活动列表图片只保留一张:直接替换而不是 unshift,避免与 el-upload 内部列表不一致导致第二次上传静默失败
|
|
|
|
|
+ this.fileListCover = [{ name: '', url: res.data }]
|
|
|
|
|
+ this.basicForm.coverFile = res.data
|
|
|
},
|
|
},
|
|
|
handleRemoveBanner (file, fileList) {
|
|
handleRemoveBanner (file, fileList) {
|
|
|
this.fileListBanner = fileList.map((item) => item)
|
|
this.fileListBanner = fileList.map((item) => item)
|