Commit 5eb7538c authored by “yiyousong”'s avatar “yiyousong”

fix:修改图片预览

parent a9c8c0a1
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
@click="handleWrite" @click="handleWrite"
> >
<div class="pic-box"> <div class="pic-box">
<img :src="api + v.preViewPath" /> <img class="pic" :src="api + v.preViewPath" />
</div> </div>
<div class="for-short">{{ v.materialName }}</div> <div class="for-short">{{ v.materialName }}</div>
<div class="matterDatumList-name"> <div class="matterDatumList-name">
...@@ -144,6 +144,7 @@ export default { ...@@ -144,6 +144,7 @@ export default {
img { img {
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover;
} }
} }
.for-short { .for-short {
......
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
class="preview-img-box flex aic jcc" class="preview-img-box flex aic jcc"
:style="{ :style="{
width: width * (scale / 100) + 'px', width: width * (scale / 100) + 'px',
height: height * (scale / 100) + 'px', height: v.height * (scale / 100) + 'px',
}" }"
> >
<img <img
:style="{ :style="{
transform: `scale(${scale / 100})`, transform: `scale(${scale / 100})`,
width: width + 'px', width: width + 'px',
height: height + 'px', height: v.height + 'px',
}" }"
class="preview-img" class="preview-img"
:src="api + v.preViewPath" :src="api + v.preViewPath"
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<!-- 侧边内容 --> <!-- 侧边内容 -->
<div class="sidebar-main"> <div class="sidebar-main">
<div class="title flex jcc aic" @click="showSidebar = false"> <div class="title flex jcc aic" @click="showSidebar = false">
<span class="mr30"> 申请表填写进度 </span> <span class="mr30"> 样表展示 </span>
<span class="icon2"> <span class="icon2">
<i class="el-icon-d-arrow-left"></i> <i class="el-icon-d-arrow-left"></i>
</span> </span>
...@@ -63,9 +63,10 @@ ...@@ -63,9 +63,10 @@
{{ matterInfo.matterName }} {{ matterInfo.matterName }}
</div> </div>
<!-- 材料列表 --> <!-- 材料列表 -->
<div class="materails-list">
<div <div
class="materails-item pdl10" class="materails-item pdl10"
v-ellipsis="'340px'" v-ellipsis="'330px'"
:class="{ active: i === active }" :class="{ active: i === active }"
v-for="(v, i) in materailsList" v-for="(v, i) in materailsList"
:key="v.id" :key="v.id"
...@@ -75,6 +76,7 @@ ...@@ -75,6 +76,7 @@
<div class="line"></div> <div class="line"></div>
</div> </div>
</div> </div>
</div>
<!-- 侧边按钮 --> <!-- 侧边按钮 -->
<div <div
...@@ -83,7 +85,7 @@ ...@@ -83,7 +85,7 @@
@click="showSidebar = true" @click="showSidebar = true"
> >
<div class="sidebar-btn-text flex flexc aic"> <div class="sidebar-btn-text flex flexc aic">
<span class="sidebar-btn-title"> 申请表填写记录 </span> <span class="sidebar-btn-title"> 样表展示 </span>
<span class="mt15 mb15"> <span class="mt15 mb15">
{{ active + 1 }}/{{ materailsList.length }} {{ active + 1 }}/{{ materailsList.length }}
</span> </span>
...@@ -116,16 +118,12 @@ export default { ...@@ -116,16 +118,12 @@ export default {
scale: 100, scale: 100,
showSidebar: false, // 切换侧边弹窗显示 showSidebar: false, // 切换侧边弹窗显示
width: 600, width: 600,
height: 800,
}; };
}, },
created() { created() {
this.getMaterialsList(); this.getMaterialsList();
console.log("matterDatumList",this.matterInfo.matterDatumList)
// this.materailsList=this.matterInfo.matterDatumList; // this.materailsList=this.matterInfo.matterDatumList;
}, },
methods: { methods: {
...@@ -141,6 +139,13 @@ export default { ...@@ -141,6 +139,13 @@ export default {
matterId: this.matterInfo.matterId, matterId: this.matterInfo.matterId,
}); });
let { data } = res.data.data; let { data } = res.data.data;
data.forEach((v) => {
let image = new Image();
image.src = this.api + v.preViewPath;
image.onload = function () {
v.height = image.height;
};
});
this.materailsList = data; this.materailsList = data;
}, },
...@@ -178,22 +183,37 @@ export default { ...@@ -178,22 +183,37 @@ export default {
} }
.main { .main {
width: 100%; width: 100%;
height: 1px;
position: relative; position: relative;
overflow: auto; overflow: auto;
.sidebar-box { .sidebar-box {
width: 360px; width: 360px;
min-height: 340px; min-height: 340px;
max-height: 800px;
padding: 10px; padding: 10px;
background: #fff; background: #fff;
box-shadow: 6px -1px 10px 0px rgba(0, 0, 0, 0.11); box-shadow: 6px -1px 10px 0px rgba(0, 0, 0, 0.11);
border-radius: 0px 38px 8px 0px; border-radius: 0px 38px 8px 0px;
position: absolute; position: fixed;
top: 130px; top: 230px;
left: 0px; left: 0px;
z-index: 10; z-index: 10;
transition: all 500ms; transition: all 500ms;
.materails-list {
max-height: 600px;
&::-webkit-scrollbar {
width: 6px;
overflow-y: auto;
}
&::-webkit-scrollbar-thumb {
border-radius: 6px;
background-color: rgba(144, 147, 153, 0.5);
}
&::-webkit-scrollbar-track {
border-radius: 6px;
background: #fff;
}
}
.title { .title {
margin-bottom: 15px; margin-bottom: 15px;
font-size: 22px; font-size: 22px;
...@@ -321,9 +341,8 @@ export default { ...@@ -321,9 +341,8 @@ export default {
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
color: #888888; color: #888888;
} }
.preview-img { // .preview-img {
object-fit: contain; // }
}
// 放大控制 // 放大控制
.control-box { .control-box {
position: fixed; position: fixed;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment