|
|
@ -2,7 +2,11 @@
|
|
|
|
<template>
|
|
|
|
<template>
|
|
|
|
<div class="upload-box">
|
|
|
|
<div class="upload-box">
|
|
|
|
<div class="box-lf">
|
|
|
|
<div class="box-lf">
|
|
|
|
<van-uploader accept="*" :disabled="isChecked" v-model="localFileList" @click-preview="handleClickUpload" :before-read="handleFileBeforeRead" :before-delete="handleBeforeDel" :max-count="1" :after-read="handleAfterRead" />
|
|
|
|
<van-uploader accept="*" :disabled="isChecked" v-model="localFileList" @click-preview="handleClickUpload" :before-read="handleFileBeforeRead" :before-delete="handleBeforeDel" :max-count="1" :after-read="handleAfterRead">
|
|
|
|
|
|
|
|
<template #preview-cover="{ file }" v-if="checkFileType(localFileList)">
|
|
|
|
|
|
|
|
<div class="preview-cover">{{handleFilter(localFileList)}}</div>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</van-uploader>
|
|
|
|
<div class="up-tt">支持png、pdf、jpg格式上传</div>
|
|
|
|
<div class="up-tt">支持png、pdf、jpg格式上传</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="box-rt">
|
|
|
|
<div class="box-rt">
|
|
|
@ -57,6 +61,11 @@ export default {
|
|
|
|
handler(list) {
|
|
|
|
handler(list) {
|
|
|
|
// this.localFileList = list
|
|
|
|
// this.localFileList = list
|
|
|
|
this.localFileList = list
|
|
|
|
this.localFileList = list
|
|
|
|
|
|
|
|
// if (Array.isArray(this.localFileList) && this.localFileList.length) {
|
|
|
|
|
|
|
|
// let url = localFileList[0].url
|
|
|
|
|
|
|
|
// if ()
|
|
|
|
|
|
|
|
// console.log('localFileList...', this.localFileList);
|
|
|
|
|
|
|
|
// }
|
|
|
|
this.uploadList = list
|
|
|
|
this.uploadList = list
|
|
|
|
},
|
|
|
|
},
|
|
|
|
deep: true,
|
|
|
|
deep: true,
|
|
|
@ -79,6 +88,24 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
handleFilter(file) {
|
|
|
|
|
|
|
|
let str = ''
|
|
|
|
|
|
|
|
if (file.length) {
|
|
|
|
|
|
|
|
let url = file[0].url
|
|
|
|
|
|
|
|
str = url.split('/baoxiao/')[1]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return str
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
checkFileType(file) {
|
|
|
|
|
|
|
|
let flag = false
|
|
|
|
|
|
|
|
if (file.length) {
|
|
|
|
|
|
|
|
let url = file[0].url
|
|
|
|
|
|
|
|
if (url.indexOf('pdf') > -1) {
|
|
|
|
|
|
|
|
flag = true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return flag
|
|
|
|
|
|
|
|
},
|
|
|
|
handleClickUpload(file) {
|
|
|
|
handleClickUpload(file) {
|
|
|
|
const { url } = file
|
|
|
|
const { url } = file
|
|
|
|
if (url) {
|
|
|
|
if (url) {
|
|
|
@ -203,6 +230,15 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
<style lang='scss' scoped>
|
|
|
|
<style lang='scss' scoped>
|
|
|
|
|
|
|
|
::v-deep .preview-cover {
|
|
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
|
|
background: #fafafa;
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
justify-items: center;
|
|
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
}
|
|
|
|
.upload-box {
|
|
|
|
.upload-box {
|
|
|
|
width: 100%;
|
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|