| | |
| | | |
| | | <div class="detail-images" v-if="detailImages.length"> |
| | | <div class="detail-images-title">发货图片</div> |
| | | <el-image |
| | | v-for="img in detailImages" |
| | | :key="img.url" |
| | | :src="img.url" |
| | | :preview-src-list="detailImages.map(i => i.url)" |
| | | fit="cover" |
| | | <ImagePreview |
| | | :src="detailImages.map(i => i.url).join(',')" |
| | | width="120px" |
| | | height="120px" |
| | | class="detail-image" |
| | | /> |
| | | </div> |
| | |
| | | |
| | | const normalizeFileUrl = (rawUrl = '') => { |
| | | let fileUrl = rawUrl || ''; |
| | | // Windows 路径转 URL |
| | | |
| | | if (fileUrl && fileUrl.indexOf('\\') > -1) { |
| | | const uploadsIndex = fileUrl.toLowerCase().indexOf('uploads'); |
| | | if (uploadsIndex > -1) { |
| | | const relativePath = fileUrl.substring(uploadsIndex).replace(/\\/g, '/'); |
| | | fileUrl = '/' + relativePath; |
| | | const lowerPath = fileUrl.toLowerCase(); |
| | | const uploadPathIndex = lowerPath.indexOf('uploadpath'); |
| | | |
| | | if (uploadPathIndex > -1) { |
| | | fileUrl = fileUrl |
| | | .substring(uploadPathIndex) |
| | | .replace(/\\/g, '/'); |
| | | } else { |
| | | const parts = fileUrl.split('\\'); |
| | | const fileName = parts[parts.length - 1]; |
| | | fileUrl = '/uploads/' + fileName; |
| | | fileUrl = fileUrl.replace(/\\/g, '/'); |
| | | } |
| | | } |
| | | if (fileUrl && !fileUrl.startsWith('http')) { |
| | | fileUrl = fileUrl.replace(/^\/?uploadPath/, '/profile'); |
| | | |
| | | if (!fileUrl.startsWith('http')) { |
| | | if (!fileUrl.startsWith('/')) fileUrl = '/' + fileUrl; |
| | | fileUrl = javaApi + fileUrl; |
| | | } |
| | | |
| | | return fileUrl; |
| | | }; |
| | | |
| | | // 上传配置 |
| | | const upload = reactive({ |
| | | // 上传的地址 |