Commit 5148932b by Zhang Xin

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

parent 119ada55
...@@ -34,3 +34,15 @@ ...@@ -34,3 +34,15 @@
top: -16px; top: -16px;
right: -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 React from 'react';
import ImageComponent from '../../CommonComponent/ImgToolComponent/CommonSmalContainer'; import ImageComponent from '../../CommonComponent/ImgToolComponent/CommonSmalContainer';
import Button from '../../CommonComponent/ButtonComponent/ButtonComponent'
require('./index.css') require('./index.css')
export default class TroubleItemComponent extends React.Component{ export default class TroubleItemComponent extends React.Component{
constructor(props){ constructor(props){
super(props) super(props)
this.state = { this.state = {
text: '' text: '',
imgStyle:{
'height':'100%',
}
} }
this.reRreshImg = this.reRreshImg.bind(this) this.reRreshImg = this.reRreshImg.bind(this)
this.deleteImgById = this.deleteImgById.bind(this) this.deleteImgById = this.deleteImgById.bind(this)
this.confirmDeleteImg = this.confirmDeleteImg.bind(this)
this.addImg = this.addImg.bind(this) this.addImg = this.addImg.bind(this)
this.showImg = this.showImg.bind(this)
} }
getDes(item){ getDes(item){
...@@ -38,16 +44,38 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -38,16 +44,38 @@ export default class TroubleItemComponent extends React.Component{
} }
deleteImgById(fileId){ deleteImgById(fileId){
console.log("deleteImgById :",fileId) console.log("deleteImgById :",fileId);
let {hidePopup} = this.props;
let props = this.props; let props = this.props;
let {deleteImg} = props; let {deleteImg} = props;
let item = props.item; let item = props.item;
let errorId = item.id; let errorId = item.id;
let type = item.type; let type = item.type;
console.log(errorId,type,fileId) console.log(errorId,type,fileId);
hidePopup()
deleteImg(errorId,type,fileId) 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(){ render(){
let props = this.props; let props = this.props;
...@@ -56,10 +84,11 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -56,10 +84,11 @@ export default class TroubleItemComponent extends React.Component{
let imgFiles = Array.isArray(item.files) ? item.files.map((f,k)=>{ let imgFiles = Array.isArray(item.files) ? item.files.map((f,k)=>{
return <ImageComponent key={"troubleItemImg"+k} return <ImageComponent key={"troubleItemImg"+k}
noCloseBtn={false} noCloseBtn={false}
handleClikCloseFunc = {()=>this.deleteImgById(f.id)} handleClikCloseFunc = {()=>this.confirmDeleteImg(f.id)}
handleClikImgFunc = {()=>{}} handleClikImgFunc = {()=>{this.showImg(f.filePath)}}
type={"custom"} type={"custom"}
imgSrc = {f.filePath}/> imgSrc = {f.filePath}/>
}) : null; }) : null;
return ( return (
......
...@@ -44,7 +44,7 @@ class PageContainer extends React.Component { ...@@ -44,7 +44,7 @@ class PageContainer extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
showPage : showPage[3], showPage : initPage,
lastPage : '', lastPage : '',
page : null, page : null,
popupInfo : defaultPopupInfo, popupInfo : defaultPopupInfo,
...@@ -144,6 +144,8 @@ class PageContainer extends React.Component { ...@@ -144,6 +144,8 @@ class PageContainer extends React.Component {
console.log("closedoor"); console.log("closedoor");
dispatch(logoutUser()); dispatch(logoutUser());
this.endCountBack(); this.endCountBack();
// remove(CONFIG.socketType.GETSTOREINFO,this)
// remove(CONFIG.socketType.GETSOCKETMSG,this)
this.setState({ this.setState({
showPage : showPage[7], showPage : showPage[7],
showClock : false, showClock : false,
...@@ -168,13 +170,9 @@ class PageContainer extends React.Component { ...@@ -168,13 +170,9 @@ class PageContainer extends React.Component {
(!nowUserInfo || !nowUserInfo.employee || (nowUserInfo.employee.id !== userinfo.employee.id)); (!nowUserInfo || !nowUserInfo.employee || (nowUserInfo.employee.id !== userinfo.employee.id));
let isNotOneTask = userinfo.types && userinfo.types !== nowUserInfo.types; let isNotOneTask = userinfo.types && userinfo.types !== nowUserInfo.types;
console.log(isNotOneTask);
console.log(isNotOneUser)
if(isNotOneUser && isNotOneTask){ if(isNotOneUser && isNotOneTask){
this.dealPageByType(userinfo.types); this.dealPageByType(userinfo.types);
} }
console.log(state.errMsg);
if(state.errMsg.errMsg){ if(state.errMsg.errMsg){
this.showError(state.errMsg.errMsg) this.showError(state.errMsg.errMsg)
} }
......
...@@ -168,7 +168,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -168,7 +168,7 @@ export default class TroubleContainer extends React.Component{
} }
getDefaultDom(){ 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 troubleList = this.state.troubleList;
let showTrouble = Array.isArray(troubleList.details) && troubleList.details.length > 0; let showTrouble = Array.isArray(troubleList.details) && troubleList.details.length > 0;
let details = Array.isArray(troubleList.details) ? troubleList.details : []; let details = Array.isArray(troubleList.details) ? troubleList.details : [];
...@@ -177,6 +177,9 @@ export default class TroubleContainer extends React.Component{ ...@@ -177,6 +177,9 @@ export default class TroubleContainer extends React.Component{
showText={this.showText} showQrcode={this.showQrcode} showText={this.showText} showQrcode={this.showQrcode}
getRefreshImg={getRefreshImg} getRefreshImg={getRefreshImg}
deleteImg={deleteImg} deleteImg={deleteImg}
showPopup={showPopup}
hidePopup={hidePopup}
/>; />;
}); });
let swiperOptions = { 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