Commit 5148932b by Zhang Xin

图片æ”点击放大,删除提示

parent 119ada55
......@@ -34,3 +34,15 @@
top: -16px;
right: -16px
}
.showBigImg{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
height: 732px;
width: 976px;
text-align: center;
}
.showBigImg>img{
height: 100%;
}
\ No newline at end of file
import React from 'react';
import ImageComponent from '../../CommonComponent/ImgToolComponent/CommonSmalContainer';
import Button from '../../CommonComponent/ButtonComponent/ButtonComponent'
require('./index.css')
export default class TroubleItemComponent extends React.Component{
constructor(props){
super(props)
this.state = {
text: ''
text: '',
imgStyle:{
'height':'100%',
}
}
this.reRreshImg = this.reRreshImg.bind(this)
this.deleteImgById = this.deleteImgById.bind(this)
this.confirmDeleteImg = this.confirmDeleteImg.bind(this)
this.addImg = this.addImg.bind(this)
this.showImg = this.showImg.bind(this)
}
getDes(item){
......@@ -38,16 +44,38 @@ export default class TroubleItemComponent extends React.Component{
}
deleteImgById(fileId){
console.log("deleteImgById :",fileId)
console.log("deleteImgById :",fileId);
let {hidePopup} = this.props;
let props = this.props;
let {deleteImg} = props;
let item = props.item;
let errorId = item.id;
let type = item.type;
console.log(errorId,type,fileId)
console.log(errorId,type,fileId);
hidePopup()
deleteImg(errorId,type,fileId)
}
confirmDeleteImg(fileId){
let {showPopup,hidePopup} = this.props;
let btnDom1 = <Button key={"confirmDeleteTroubleImg1"} style={{'width':'260px'}} text={"取消"} option={hidePopup}/>
let btnDom2 = <Button key={"confirmDeleteTroubleImg2"} style={{'width':'260px','marginLeft':' 30px'}} text={"确定"} option={()=>this.deleteImgById(fileId)}/>
showPopup({
popupText:'确定删除此照片吗',
popupButtons:[btnDom1,btnDom2]
})
}
showImg(imgSrc){
let {showPopup,hidePopup} = this.props;
let showImgDom = <div onClick={()=>hidePopup()} className={"showBigImg"}>
<img src={imgSrc} alt=""/>
</div>;
showPopup({
popupChild : showImgDom
});
}
render(){
let props = this.props;
......@@ -56,10 +84,11 @@ export default class TroubleItemComponent extends React.Component{
let imgFiles = Array.isArray(item.files) ? item.files.map((f,k)=>{
return <ImageComponent key={"troubleItemImg"+k}
noCloseBtn={false}
handleClikCloseFunc = {()=>this.deleteImgById(f.id)}
handleClikImgFunc = {()=>{}}
handleClikCloseFunc = {()=>this.confirmDeleteImg(f.id)}
handleClikImgFunc = {()=>{this.showImg(f.filePath)}}
type={"custom"}
imgSrc = {f.filePath}/>
}) : null;
return (
......
......@@ -44,7 +44,7 @@ class PageContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
showPage : showPage[3],
showPage : initPage,
lastPage : '',
page : null,
popupInfo : defaultPopupInfo,
......@@ -144,6 +144,8 @@ class PageContainer extends React.Component {
console.log("closedoor");
dispatch(logoutUser());
this.endCountBack();
// remove(CONFIG.socketType.GETSTOREINFO,this)
// remove(CONFIG.socketType.GETSOCKETMSG,this)
this.setState({
showPage : showPage[7],
showClock : false,
......@@ -168,13 +170,9 @@ class PageContainer extends React.Component {
(!nowUserInfo || !nowUserInfo.employee || (nowUserInfo.employee.id !== userinfo.employee.id));
let isNotOneTask = userinfo.types && userinfo.types !== nowUserInfo.types;
console.log(isNotOneTask);
console.log(isNotOneUser)
if(isNotOneUser && isNotOneTask){
this.dealPageByType(userinfo.types);
}
console.log(state.errMsg);
if(state.errMsg.errMsg){
this.showError(state.errMsg.errMsg)
}
......
......@@ -168,7 +168,7 @@ export default class TroubleContainer extends React.Component{
}
getDefaultDom(){
let {userInfo,storeInfo,getRefreshImg,deleteImg,changePages} = this.props;
let {userInfo,storeInfo,getRefreshImg,deleteImg,changePages,showPopup,hidePopup} = this.props;
let troubleList = this.state.troubleList;
let showTrouble = Array.isArray(troubleList.details) && troubleList.details.length > 0;
let details = Array.isArray(troubleList.details) ? troubleList.details : [];
......@@ -177,6 +177,9 @@ export default class TroubleContainer extends React.Component{
showText={this.showText} showQrcode={this.showQrcode}
getRefreshImg={getRefreshImg}
deleteImg={deleteImg}
showPopup={showPopup}
hidePopup={hidePopup}
/>;
});
let swiperOptions = {
......
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