|
@@ -22,15 +22,12 @@
|
|
|
</div>
|
|
|
</a-upload>
|
|
|
<a-modal :visible="previewVisible" :footer="null" centered :maskClosable="false" @cancel="handleCancel">
|
|
|
- <div style="height: 30px;">预览</div>
|
|
|
<video v-if="fileType=='video/mp4'" controls="controls" style="width: 100%" :src="previewImage" />
|
|
|
<img v-else alt="example" style="width: 100%" :src="previewImage" />
|
|
|
</a-modal>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-import Sortable from 'sortablejs'
|
|
|
-import { moveElement } from '@/libs/tools'
|
|
|
export default {
|
|
|
name: 'Upload',
|
|
|
props: {
|
|
@@ -104,24 +101,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- created(){
|
|
|
- let _this = this
|
|
|
- this.$nextTick(()=>{
|
|
|
- let el = document.querySelector('.ant-upload-list-picture-card');
|
|
|
- let sortable = Sortable.create(el,{
|
|
|
- onEnd:function(evt){
|
|
|
- console.log(evt.oldIndex,evt.newIndex)
|
|
|
- const a =_this.formatFile()
|
|
|
- console.log(a.split(','))
|
|
|
- const ret = moveElement(a.split(','),evt.oldIndex,evt.newIndex)
|
|
|
- console.log(ret)
|
|
|
-
|
|
|
- _this.$emit('change', ret.join(','))
|
|
|
- _this.$emit('input', ret.join(','))
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
- },
|
|
|
methods: {
|
|
|
setFileList (a) {
|
|
|
const temp = []
|
|
@@ -173,9 +152,9 @@ export default {
|
|
|
this.previewImage = file.url || file.thumbUrl
|
|
|
}
|
|
|
this.previewVisible = true
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
const src = file.response.data
|
|
|
- if(!Array.isArray(src)){
|
|
|
+ if (!Array.isArray(src)) {
|
|
|
this.previewImage = file.url || file.thumbUrl
|
|
|
this.previewVisible = true
|
|
|
}
|
|
@@ -195,7 +174,7 @@ export default {
|
|
|
if (file.status == 'error' || file.status == 'done') {
|
|
|
this.$message.error(file.response.message || '上传失败,请重试!')
|
|
|
this.$emit('remove')
|
|
|
- // return
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
this.fileList = this.validaFile(file, fileList)
|
|
@@ -225,7 +204,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- // console.log(temp)
|
|
|
+ console.log(temp)
|
|
|
obj = JSON.stringify(temp)
|
|
|
}
|
|
|
}
|
|
@@ -237,7 +216,7 @@ export default {
|
|
|
return []
|
|
|
}
|
|
|
// console.log(file, filesList, this.beforeUpload(file, 0))
|
|
|
- if (!this.beforeUpload(file, 0) && file.status != 'removed' || file.status == 'error') {
|
|
|
+ if (!this.beforeUpload(file, 0) && file.status != 'removed') {
|
|
|
const index = filesList.findIndex(item => item.uid == file.uid)
|
|
|
filesList.splice(index, 1)
|
|
|
}
|
|
@@ -327,11 +306,6 @@ export default {
|
|
|
max-height:860px;
|
|
|
text-align:center;
|
|
|
}
|
|
|
-/deep/.ant-modal-close-x{
|
|
|
- height: 35px;
|
|
|
- line-height: 35px;
|
|
|
- width: 35px;
|
|
|
- }
|
|
|
/deep/.ant-modal-body video{
|
|
|
width: 90% !important;
|
|
|
}
|