上传组件优化

This commit is contained in:
bb_pan 2025-02-26 14:16:44 +08:00
parent d209581d9b
commit ad64f17c1a
6 changed files with 39 additions and 4 deletions

BIN
src/assets/img/pdf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/img/word.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -24,6 +24,41 @@
<slot name="default"></slot>
</div>
<slot name="textContent"></slot>
<template #file="{ file }">
<div>
<img
v-if="file.name.indexOf('.pdf') > -1"
src="@/assets/img/pdf.png"
class="el-upload-list__item-thumbnail"
/>
<img
v-else-if="
file.name.indexOf('.doc') > -1 || file.name.indexOf('.docx') > -1
"
src="@/assets/img/word.png"
class="el-upload-list__item-thumbnail"
/>
<img v-else :src="file.url" class="el-upload-list__item-thumbnail" />
<span class="el-upload-list__item-actions">
<span class="el-upload-list__item-preview" @click="onPreview(file)">
<el-icon><zoom-in /></el-icon>
</span>
<!-- <span
v-if="!disabled"
class="el-upload-list__item-delete"
@click="handleDownload(file)"
>
<el-icon><Download /></el-icon>
</span> -->
<span
class="el-upload-list__item-delete"
@click="removeFile(file, fileList)"
>
<el-icon><Delete /></el-icon>
</span>
</span>
</div>
</template>
</el-upload>
<el-progress v-if="showProcessFlag && processFlag" :percentage="loadProcess"></el-progress>
<el-dialog center width="90%" destroy-on-close v-model="previewDialogVisible">

View File

@ -29,11 +29,11 @@ service.interceptors.request.use(
(config) => {
config.headers['Authorization'] = localStorage.getItem('tokenNew')
// 入参是否加密
config.headers['encryptRequest'] = 'true'
config.headers['encryptRequest'] = 'false'
// 数据完整性校验
config.headers['checkIntegrity'] = 'true'
config.headers['checkIntegrity'] = 'false'
// 回参是否加密
config.headers['encryptResponse'] = 'true'
config.headers['encryptResponse'] = 'false'
// 对请求数据进行加密
if (config.method === 'get' && config.params) {

View File

@ -710,7 +710,7 @@ const onFileChange = (fileList: any) => {
fileUrl = e.url // -
} else {
console.log('走入宏源测试环境----------', e.url)
fileUrl = 'http://sgwpdm.ah.sgcc.com.cn/iws/ahbns/uploads' + e.url // -
fileUrl = 'http://sgwpdm.ah.sgcc.com.cn/iws/ahbns/' + e.url // -
}
console.log('输出fileUrl----------', fileUrl)
return {