提交 79d75cf3 authored 作者: 蔡元龙's avatar 蔡元龙

图片上传组件修改

上级 851924f4
...@@ -86,20 +86,25 @@ export default class UploadCom extends React.Component { ...@@ -86,20 +86,25 @@ export default class UploadCom extends React.Component {
{(files || []).map((f) => { {(files || []).map((f) => {
if ((f.path && f.path.indexOf('.png') !== -1) || f.path.indexOf('.jpg') !== -1) { if ((f.path && f.path.indexOf('.png') !== -1) || f.path.indexOf('.jpg') !== -1) {
return ( return (
<li key={f.path} className={styles.preview_img} style={{ position: 'relative' }}> <li key={f.path} className={styles.preview_img}>
<div className={styles.preview_div}>
<img <img
style={{ width: 100, height: 100 }} style={{ width: '100%', height: 100 }}
className={styles.img} className={styles.img}
src={queryApiActionPath() + f.path} src={queryApiActionPath() + f.path}
/>
<div
className={styles.mask}
onClick={() => { onClick={() => {
// window.open(queryApiActionPath() + f.path); // window.open(queryApiActionPath() + f.path);
this.setState({ this.setState({
previewVisible: true, previewVisible: true,
previewImage: queryApiActionPath() + f.path, previewImage: queryApiActionPath() + f.path,
}); });
}} }}>
/> <Icon type="eye" className={styles.icon_eye} />
<Icon type="eye" className={styles.icon_eye} style={{}} /> </div>
</div>
{!disabled && ( {!disabled && (
<Icon <Icon
style={{ marginLeft: 10 }} style={{ marginLeft: 10 }}
......
...@@ -239,18 +239,32 @@ ...@@ -239,18 +239,32 @@
} }
.preview_img { .preview_img {
display: flex;
align-items: center;
.preview_div {
position: relative; position: relative;
.img { width: 100px;
&:hover + .icon_eye { height: 100px;
&:hover {
.mask {
display: block; display: block;
} }
} }
.mask {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, .5);
position: absolute;
top: 0;
left: 0;
display: none;
.icon_eye { .icon_eye {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
color: #fff; color: #fff;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
display: none; }
}
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论