From 03a4f65e9dca2ba2777e0ea42ed972c5f4f7544f Mon Sep 17 00:00:00 2001
From: zhanghua <314079846@qq.com>
Date: 星期一, 28 十一月 2022 11:33:25 +0800
Subject: [PATCH] 点位管理bug修改
---
src/components/myUpload/index.vue | 114 ++++++++++++++++++++++++++++++++++-----------------------
1 files changed, 68 insertions(+), 46 deletions(-)
diff --git a/src/components/myUpload/index.vue b/src/components/myUpload/index.vue
index a7f4acb..95d078f 100644
--- a/src/components/myUpload/index.vue
+++ b/src/components/myUpload/index.vue
@@ -1,6 +1,12 @@
<template>
<div class="my-upload">
- <el-upload
+ <div v-if="pictureList.length > 0" class="image-box">
+ <div v-for="image in pictureList" class="image-box-item">
+ <i @click="handleDeletePicture(image)" class="el-icon-delete image-delete-icon"></i>
+ <el-image :key="image" class="image-content" :src="image" ></el-image>
+ </div>
+ </div>
+ <el-upload
:file-list="fileList"
action="/sccg/file/medias"
:multiple="multiple"
@@ -12,10 +18,10 @@
:list-type="listType"
:on-remove="handleRemove"
:headers="getToken()">
- <div class="upload-btn">
- <i class="el-icon-plus"></i>
- <span>涓婁紶鍥剧墖</span>
- </div>
+ <div class="upload-btn">
+ <i class="el-icon-plus"></i>
+ <span>涓婁紶鍥剧墖</span>
+ </div>
</el-upload>
</div>
</template>
@@ -26,7 +32,7 @@
// 鏂囦欢鍒楄〃
fileList: [],
// 鏄惁鏄剧ず鏂囦欢鍒楄〃
- flag: true,
+ flag: false,
// 澶氶��
multiple: false,
// 闄愬埗
@@ -80,18 +86,13 @@
// 绉婚櫎鏂囦欢
handleRemove(file, fileList){
this.$emit('delPictureUrl',{url:file.response.data.url1});
+ },
+
+ handleDeletePicture(imageUrl) {
+ this.$emit('delPictureUrl', { url: imageUrl });
}
},
props: {
- // 杩斿洖涓婁紶鎴愬姛鍥剧墖鍦板潃
- setPictureUrl:{
- type:Function,
- default:()=>{}
- },
- delPictureUrl:{
- type:Function,
- default:()=>{}
- },
pictureList: {
type: Array,
default: () => []
@@ -101,6 +102,58 @@
</script>
<style lang="scss" scoped>
.my-upload {
+ display: flex;
+ flex-wrap: nowrap;
+ justify-content: flex-start;
+ margin-right: 5px;
+
+ .upload-btn {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ border-radius: 4px;
+ width: 100px;
+ height: 100px;
+
+ &:hover i{
+ color: #409eff;
+ }
+
+ i {
+ font-size: 30px;
+ font-weight: 650;
+ }
+
+ span {
+ line-height: 22px;
+ }
+ }
+ .image-box {
+ display: flex;
+ height: 100px;
+ margin: 0 10px;
+
+ .image-content {
+ width: 100px;
+ height: 100px;
+ }
+ .image-delete-icon {
+ position: relative;
+ bottom: calc(100% - 50px);
+ left: calc(100% - 50px);
+ opacity: 0;
+ }
+
+ .image-box-item:hover {
+ color: #ffffff;
+ opacity: .5;
+ .image-delete-icon {
+ z-index: 2;
+ opacity: 1;
+ }
+ }
+ }
:deep(.el-upload--picture-card) {
width: 100px;
@@ -109,37 +162,6 @@
:deep(.el-upload-list__item){
width: 100px;
height: 100px;
- }
- //.file-list {
- // display: flex;
- // flex-wrap: nowrap;
- //}
- .upload-btn {
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- border-radius: 4px;
- width: 100px;
- height: 100px;
-
- &:hover i{
- color: #409eff;
- }
-
- i {
- font-size: 30px;
- font-weight: 650;
- }
-
- span {
- line-height: 22px;
- }
- }
- .uploaded-image {
- width: 0;
- height: 100px;
- display: flex;
}
}
</style>
\ No newline at end of file
--
Gitblit v1.8.0