|
@@ -1,27 +1,37 @@
|
|
|
<template>
|
|
|
- <div>
|
|
|
- <div class="detail-enclosure-img">
|
|
|
- <div>
|
|
|
- <div class="img-box" v-for="(image,ind) in distinctFile(souseArr)" :key="ind">
|
|
|
- <zoom-image
|
|
|
- :url="`/image-service/common/image_get?systemId=saas&secret=46f869eea8b31d14&key=${image}`"
|
|
|
- ></zoom-image>
|
|
|
- <i class="el-icon-delete" @click="handleRemove(image,ind)"></i>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div v-if="loading" class="img-bg">
|
|
|
- <i class="el-icon-loading"></i>
|
|
|
+ <div class="detail-enclosure-img">
|
|
|
+ <!-- 图片-->
|
|
|
+ <div class="img-box" v-for="(image,ind) in distinctFile(souseArr)" :key="ind">
|
|
|
+ <zoom-image
|
|
|
+ :url="`/image-service/common/image_get?systemId=saas&secret=46f869eea8b31d14&key=${image}`"
|
|
|
+ ></zoom-image>
|
|
|
+ <i class="deleteImg" @click="handleRemove(image,ind)"></i>
|
|
|
+ </div>
|
|
|
+ <!-- 上传中 -->
|
|
|
+ <div class="Uploading" v-if="Uploading">
|
|
|
+ <span>上传中</span>
|
|
|
+ <div class="progress-box">
|
|
|
+ <!-- <div id="progressId" class="progress"></div> -->
|
|
|
+ <el-progress :text-inside="true" :stroke-width="4" :percentage="percentage"></el-progress>
|
|
|
</div>
|
|
|
- <el-upload
|
|
|
- :on-change="getImage"
|
|
|
- action="string"
|
|
|
- list-type="picture-card"
|
|
|
- accept="image/*"
|
|
|
- capture="camera"
|
|
|
- >
|
|
|
- <img src="../assets/addimg.png" alt />
|
|
|
- </el-upload>
|
|
|
+ <i class="deleteImg2" @click="handleRemove(image,ind)"></i>
|
|
|
</div>
|
|
|
+ <!-- 上传图片失败 -->
|
|
|
+ <div class="failImg" v-if="failImg">
|
|
|
+ <img src="../assets/bj.png" alt />
|
|
|
+ <span>上传图片失败</span>
|
|
|
+ </div>
|
|
|
+ <!-- 点击上传 -->
|
|
|
+ <el-upload
|
|
|
+ :on-change="getImage"
|
|
|
+ action="string"
|
|
|
+ list-type="picture-card"
|
|
|
+ accept="image/*"
|
|
|
+ capture="camera"
|
|
|
+ >
|
|
|
+ <div class="add"></div>
|
|
|
+ <span>添加图片</span>
|
|
|
+ </el-upload>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
@@ -31,8 +41,10 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
showTrue: true,
|
|
|
- loading: false,
|
|
|
- tempArr: []
|
|
|
+ tempArr: [],
|
|
|
+ percentage: 30,
|
|
|
+ Uploading: false, //上传中
|
|
|
+ failImg: false //上传失败
|
|
|
};
|
|
|
},
|
|
|
components: { zoomImage },
|
|
@@ -43,12 +55,12 @@ export default {
|
|
|
return Array.from(new Set(a));
|
|
|
},
|
|
|
getImage(event) {
|
|
|
- this.loading = true;
|
|
|
+ this.Uploading = true;
|
|
|
this.fileName = new Date().getTime() + "_" + event.name;
|
|
|
let url =
|
|
|
"/image-service/common/image_upload?systemId=saas&secret=46f869eea8b31d14&key=" +
|
|
|
this.fileName;
|
|
|
- let _this = this;
|
|
|
+ let that = this;
|
|
|
let reader = new FileReader();
|
|
|
reader.readAsArrayBuffer(event.raw);
|
|
|
reader.onload = function(e) {
|
|
@@ -58,12 +70,11 @@ export default {
|
|
|
xhr.onreadystatechange = function() {
|
|
|
if (xhr.readyState == 4) {
|
|
|
if (xhr.status == 200) {
|
|
|
- let src = _this.getPreviewSrc(event.raw);
|
|
|
- _this.tempArr.push(_this.fileName);
|
|
|
- _this.souseArr.push(_this.fileName);
|
|
|
- _this.$emit("setPic", this.souseArr);
|
|
|
- _this.loading = false;
|
|
|
- _this.showTrue = true;
|
|
|
+ let src = that.getPreviewSrc(event.raw);
|
|
|
+ that.tempArr.push(that.fileName);
|
|
|
+ that.souseArr.push(that.fileName);
|
|
|
+ that.$emit("setPic", that.souseArr);
|
|
|
+ that.Uploading = false;
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -118,46 +129,112 @@ export default {
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.detail-enclosure-img {
|
|
|
- width: 112px;
|
|
|
- height: 112px;
|
|
|
display: flex;
|
|
|
flex-wrap: wrap;
|
|
|
.img-box {
|
|
|
- width: 112px;
|
|
|
- height: 112px;
|
|
|
display: inline-block;
|
|
|
- margin-right: 15px;
|
|
|
- margin-bottom: 15px;
|
|
|
- border-radius: 12px;
|
|
|
+ margin-right: 8px;
|
|
|
+ margin-bottom: 8px;
|
|
|
position: relative;
|
|
|
- .bigImg {
|
|
|
- width: 112px;
|
|
|
- height: 112px;
|
|
|
- }
|
|
|
- i {
|
|
|
- border-radius: 3px;
|
|
|
+ .deleteImg {
|
|
|
+ position: absolute;
|
|
|
+ top: 9px;
|
|
|
+ right: 9px;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
cursor: pointer;
|
|
|
+ background: url("../assets/delete.png");
|
|
|
+ background-size: 100% 100%;
|
|
|
+ display: none;
|
|
|
}
|
|
|
- .el-icon-delete {
|
|
|
- font-size: 20px;
|
|
|
+ }
|
|
|
+ .img-box:hover .deleteImg {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+ .Uploading {
|
|
|
+ width: 112px;
|
|
|
+ height: 112px;
|
|
|
+ margin-right: 8px;
|
|
|
+ background: rgba(248, 249, 250, 1);
|
|
|
+ border-radius: 4px;
|
|
|
+ border: 1px dashed rgba(195, 199, 203, 1);
|
|
|
+ position: relative;
|
|
|
+ .deleteImg2 {
|
|
|
position: absolute;
|
|
|
- top: 0;
|
|
|
- right: 0;
|
|
|
- background: #ffffff;
|
|
|
+ top: 9px;
|
|
|
+ right: 9px;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ cursor: pointer;
|
|
|
+ background: url("../assets/delete1.png");
|
|
|
+ background-size: 100% 100%;
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ text-align: center;
|
|
|
+ display: block;
|
|
|
+ margin-top: 35px;
|
|
|
+ height: 22px;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: rgba(141, 147, 153, 1);
|
|
|
+ line-height: 22px;
|
|
|
+ }
|
|
|
+ .progress-box {
|
|
|
+ width: 94px;
|
|
|
+ height: 4px;
|
|
|
+ background: rgba(233, 233, 233, 1);
|
|
|
+ border-radius: 2px;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 8px;
|
|
|
+ position: relative;
|
|
|
+ .progress {
|
|
|
+ width: 0px;
|
|
|
+ height: 4px;
|
|
|
+ background: rgba(0, 145, 255, 1);
|
|
|
+ border-radius: 2px;
|
|
|
+ position: absolute;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ transition: all 2s;
|
|
|
+ -moz-transition: all 2s;
|
|
|
+ -webkit-transition: all 2s;
|
|
|
+ -o-transition: all 2s;
|
|
|
+ }
|
|
|
+ .progressHover {
|
|
|
+ width: 94px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- .img-bg {
|
|
|
+ .Uploading:hover .deleteImg2 {
|
|
|
+ display: block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .failImg {
|
|
|
width: 112px;
|
|
|
height: 112px;
|
|
|
- line-height: 112px;
|
|
|
- text-align: center;
|
|
|
- display: inline-block;
|
|
|
- i {
|
|
|
- font-size: 40px;
|
|
|
+ background: rgba(248, 249, 250, 1);
|
|
|
+ border-radius: 4px;
|
|
|
+ border: 1px solid rgba(209, 212, 215, 1);
|
|
|
+ margin-right: 8px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ img {
|
|
|
+ width: 40px;
|
|
|
+ height: 40px;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 25px;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ height: 22px;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: rgba(141, 147, 153, 1);
|
|
|
+ line-height: 22px;
|
|
|
+ text-align: center;
|
|
|
}
|
|
|
- }
|
|
|
- div {
|
|
|
- display: inline-block;
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
@@ -175,9 +252,45 @@ export default {
|
|
|
top: 112px;
|
|
|
left: 112px;
|
|
|
}
|
|
|
- img {
|
|
|
- width: 112px;
|
|
|
- height: 112px;
|
|
|
+ .add {
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ color: #8d9399;
|
|
|
+ transition: color 0.25s;
|
|
|
+ position: relative;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 32px;
|
|
|
+ }
|
|
|
+ .add::before {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 50%;
|
|
|
+ width: 18px;
|
|
|
+ margin-left: -9px;
|
|
|
+ margin-top: -1px;
|
|
|
+ border-top: 2px solid;
|
|
|
+ }
|
|
|
+ .add::after {
|
|
|
+ content: "";
|
|
|
+ position: absolute;
|
|
|
+ left: 50%;
|
|
|
+ top: 50%;
|
|
|
+ height: 18px;
|
|
|
+ margin-left: -1px;
|
|
|
+ margin-top: -9px;
|
|
|
+ border-left: 2px solid;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ position: absolute;
|
|
|
+ right: 28px;
|
|
|
+ bottom: 30px;
|
|
|
+ height: 22px;
|
|
|
+ font-size: 14px;
|
|
|
+ font-family: PingFangSC-Regular, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ color: rgba(31, 36, 41, 1);
|
|
|
+ line-height: 22px;
|
|
|
}
|
|
|
}
|
|
|
.is-uploading {
|