|
|
|
@ -9,22 +9,37 @@ |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="上传录音" label-width="118px" :class="{ 'form-item': source === 'visiual' }"> |
|
|
|
<el-upload :headers="$getElUploadHeaders()" class="avatar-uploader" :action="uploadUlr" accept=".mp3" |
|
|
|
:data="{ customerId: customerId }" :show-file-list="true" :on-success="handleAudioSuccess" |
|
|
|
:on-remove="handleAudioRemove" :before-upload="beforeAudioUpload" :file-list="audioList"> |
|
|
|
<el-button type="primary" :disabled="pageType === 'check'">上传音频<i |
|
|
|
class="el-icon-upload el-icon--right"></i></el-button> |
|
|
|
</el-upload> |
|
|
|
<el-form-item label="上传录音" label-width="118px" :class="{ 'form-item': source === 'visiual' }" prop="luyin"> |
|
|
|
<el-upload v-if="audioList.length < 3" :headers="$getElUploadHeaders()" |
|
|
|
:action="uploadUlr" :data="{ customerId: customerId }" :show-file-list="false" |
|
|
|
:on-success="handleAudioSuccess" :before-upload="beforeAudioUpload" |
|
|
|
accept=".mp3" > |
|
|
|
<el-button type="primary" :disabled="pageType === 'check'">上传录音<i |
|
|
|
class="el-icon-upload el-icon--right"></i></el-button> |
|
|
|
</el-upload> |
|
|
|
<section class="uploadList"> |
|
|
|
<div v-for="file in audioList" :key="file.attachmentUrl" :file="file" |
|
|
|
:style="{cursor:pageType === 'check'? 'no-drop':'pointer'}" > |
|
|
|
<span>{{ file.attachmentName }}</span> |
|
|
|
<span type="text" @click="handleAudioRemove(file)" class="el-icon-close"> </span> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="上传图片" label-width="118px" :class="{ 'form-item': source === 'visiual' }" prop="files"> |
|
|
|
<el-upload :headers="$getElUploadHeaders()" class="avatar-uploader" :action="uploadUlr" |
|
|
|
accept=".jpg,.png,.jpeg" |
|
|
|
:data="{ customerId: customerId }" :show-file-list="true" :on-success="handleImgSuccess" |
|
|
|
:on-remove="handleImgRemove" :before-upload="beforeImgUpload" :file-list="imgList"> |
|
|
|
<el-button type="primary" :disabled="pageType === 'check'">上传图片<i |
|
|
|
class="el-icon-upload el-icon--right"></i></el-button> |
|
|
|
</el-upload> |
|
|
|
<el-form-item label="上传图片" label-width="118px" :class="{ 'form-item': source === 'visiual' }" prop="luyin"> |
|
|
|
<el-upload v-if="audioList.length < 3" :headers="$getElUploadHeaders()" |
|
|
|
:action="uploadUlr" :data="{ customerId: customerId }" :show-file-list="false" |
|
|
|
:on-success="handleImgSuccess" :before-upload="beforeImgUpload" |
|
|
|
accept=".jpg,.png,.jpeg"> |
|
|
|
<el-button type="primary" :disabled="pageType === 'check'">上传图片<i |
|
|
|
class="el-icon-upload el-icon--right"></i></el-button> |
|
|
|
</el-upload> |
|
|
|
<section class="uploadList"> |
|
|
|
<div v-for="file in imgList" :key="file.attachmentUrl" :file="file" |
|
|
|
:style="{cursor:pageType === 'check'? 'no-drop':'pointer'}"> |
|
|
|
<span>{{ file.attachmentName }}</span> |
|
|
|
<span type="text" @click="handleImgRemove(file)" class="el-icon-close"> </span> |
|
|
|
</div> |
|
|
|
</section> |
|
|
|
</el-form-item> |
|
|
|
<el-divider></el-divider> |
|
|
|
<div class="flex"> |
|
|
|
@ -355,8 +370,8 @@ export default { |
|
|
|
this.formData = newVal; |
|
|
|
console.log(this.formData); |
|
|
|
if(this.formData.internalFile){ |
|
|
|
this.imgList = this.formData.internalFile.filter(item=>item.type==='image') |
|
|
|
this.audioList = this.formData.internalFile.filter(item=>item.type==='voice') |
|
|
|
this.imgList = this.formData.internalFile.filter(item=>item.attachmentType==='image') |
|
|
|
this.audioList = this.formData.internalFile.filter(item=>item.attachmentType==='voice') |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
@ -390,11 +405,11 @@ export default { |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
console.log("res.data.url", res.data.url); |
|
|
|
this.audioList.push({ |
|
|
|
format: file.name.split(".").pop(), |
|
|
|
name: file.name, |
|
|
|
attachmentFormat: file.name.split(".").pop(), |
|
|
|
attachmentName: file.name, |
|
|
|
size: file.size, |
|
|
|
type: file.raw.type, |
|
|
|
url: res.data.url, |
|
|
|
attachmentType: file.raw.type, |
|
|
|
attachmentUrl: res.data.url, |
|
|
|
}); |
|
|
|
console.log(this.formData.files); |
|
|
|
} else { |
|
|
|
@ -403,8 +418,9 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
handleAudioRemove(file) { |
|
|
|
if(this.pageType === 'check')return |
|
|
|
let index = this.audioList.findIndex( |
|
|
|
(item) => item.url == file.response.data.url |
|
|
|
(item) => item.attachmentUrl == file.attachmentUrl |
|
|
|
); |
|
|
|
this.audioList.splice(index, 1); |
|
|
|
console.log(this.audioList); |
|
|
|
@ -422,11 +438,11 @@ export default { |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
console.log("res.data.url", res.data.url); |
|
|
|
this.imgList.push({ |
|
|
|
format: file.name.split(".").pop(), |
|
|
|
name: file.name, |
|
|
|
attachmentFormat: file.name.split(".").pop(), |
|
|
|
attachmentName: file.name, |
|
|
|
size: file.size, |
|
|
|
type: file.raw.type, |
|
|
|
url: res.data.url, |
|
|
|
attachmentType: file.raw.type, |
|
|
|
attachmentUrl: res.data.url, |
|
|
|
}); |
|
|
|
console.log(this.formData.files); |
|
|
|
} else { |
|
|
|
@ -447,11 +463,11 @@ export default { |
|
|
|
if (res.code === 0 && res.msg === "success") { |
|
|
|
console.log("res.data.url", res.data.url); |
|
|
|
this.examineImgList.push({ |
|
|
|
format: file.name.split(".").pop(), |
|
|
|
name: file.name, |
|
|
|
attachmentFormat: file.name.split(".").pop(), |
|
|
|
attachmentName: file.name, |
|
|
|
size: file.size, |
|
|
|
type: file.raw.type, |
|
|
|
url: res.data.url, |
|
|
|
attachmentType: file.raw.type, |
|
|
|
attachmentUrl: res.data.url, |
|
|
|
}); |
|
|
|
console.log(this.formData.files); |
|
|
|
} else { |
|
|
|
@ -460,8 +476,9 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
handleImgRemove(file) { |
|
|
|
let index = this.imgList.findIndex( |
|
|
|
(item) => item.url == file.response.data.url |
|
|
|
if(this.pageType === 'check')return |
|
|
|
let index = this.audioList.findIndex( |
|
|
|
(item) => item.attachmentUrl == file.attachmentUrl |
|
|
|
); |
|
|
|
this.imgList.splice(index, 1); |
|
|
|
console.log(this.imgList); |
|
|
|
|