Commit 54f8f3f4 by yaxiLiuu

Merge branch 'dev' of git.mjitech.com:zhangxin/max_android_panel into dev

parents 7b38ac04 5697e6c6
...@@ -34,9 +34,54 @@ let json = { ...@@ -34,9 +34,54 @@ let json = {
}, },
{ {
"id": 1, "id": 1,
"errorCode": null, "errorCode": "ER00002",
"type": "OP", "type": "OP",
"files": [ "files": [
{
"id": 17,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 19,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
],
"parentProblemName": "机械故障",
"subProblemName": "其他问题111"
},
{
"id": 1,
"errorCode": "ER00003",
"type": "OP",
"files": [
{
"id": 17,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 19,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 17,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
},
{
"id": 19,
"filePath": "http://static.mjitech.com/static/sku/0/0/427/1471329704482.jpg"
}
], ],
"parentProblemName": "机械故障", "parentProblemName": "机械故障",
"subProblemName": "其他问题111" "subProblemName": "其他问题111"
......
...@@ -42,18 +42,16 @@ export default class ImgToolComponent extends React.Component{ ...@@ -42,18 +42,16 @@ export default class ImgToolComponent extends React.Component{
if(type == "add" && disabled){ if(type == "add" && disabled){
imgSrc = addIconDisabledSrc; imgSrc = addIconDisabledSrc;
} }
if(type == "refresh" && disabled){ if(type === "refresh" && disabled){
imgSrc = refreshIconDisabledSrc; imgSrc = refreshIconDisabledSrc;
} }
return( return(
<div className={"ImgToolComponent"}> <div className={"ImgToolComponent"}>
<div className={"imgItem"}> <img src={imgSrc} data-src={imgSrc} className={"swiper-lazy"} alt="" onClick={props.handleClikImgFunc}/>
<img src={imgSrc} alt="" onClick={props.handleClikImgFunc}/>
{ {
noCloseBtn?"":(<span className={"closeBtn"} onClick={props.handleClikCloseFunc}>×</span>) noCloseBtn?"":(<span className={"closeBtn"} onClick={props.handleClikCloseFunc}>×</span>)
} }
</div> </div>
</div>
) )
} }
......
.ImgToolComponent { .ImgToolComponent {
display: inline-block; display: inline-block;
} /*width: 90px;*/
.ImgToolComponent .imgItem { /*height: 90px;*/
width: 90px; /*box-sizing: border-box;*/
height: 90px;
display: inline-block;
box-sizing: border-box;
margin-right: 25px; margin-right: 25px;
position: relative; position: relative;
} }
.ImgToolComponent .uploadImgRight{ .ImgToolComponent>img{
float: left;
}
.ImgToolComponent .imgItem img{
width: 90px; width: 90px;
height: 90px; height: 90px;
border-radius: 10px; border-radius: 10px;
} }
.ImgToolComponent .imgItem .closeBtn{ .ImgToolComponent .closeBtn{
width: 32px; width: 32px;
height: 32px; height: 32px;
display: inline-block; display: inline-block;
...@@ -41,7 +35,9 @@ ...@@ -41,7 +35,9 @@
height: 732px; height: 732px;
width: 976px; width: 976px;
text-align: center; text-align: center;
line-height: 732px;
} }
.showBigImg>img{ .showBigImg>img{
height: 100%; max-height: 100%;
vertical-align: middle;
} }
\ No newline at end of file
...@@ -28,17 +28,20 @@ export default class SwiperComponent extends React.Component{ ...@@ -28,17 +28,20 @@ export default class SwiperComponent extends React.Component{
} }
componentWillReceiveProps(nextProps){
}
componentDidUpdate(prevProps){ componentDidUpdate(prevProps){
const { swiperCount,swiperContainer,initialSlide,initialSlideTime } = this.props; const { swiperCount,swiperContainer,initialSlide,initialSlideTime } = this.props;
if (prevProps.swiperCount !== swiperCount) { if (prevProps.swiperCount !== swiperCount) {
this.state.swiperList[swiperContainer].init(); this.state.swiperList[swiperContainer].init();
} }
if( // if(
initialSlideTime && // initialSlideTime &&
initialSlide !== prevProps.initialSlide // initialSlide !== prevProps.initialSlide
){ // ){
this.state.swiperList[swiperContainer].slideTo(initialSlide,0); // this.state.swiperList[swiperContainer].slideTo(initialSlide,0);
} // }
} }
componentWillUnmount() { componentWillUnmount() {
......
...@@ -126,14 +126,8 @@ export default class TroubleItemComponent extends React.Component{ ...@@ -126,14 +126,8 @@ export default class TroubleItemComponent extends React.Component{
</div> </div>
<div className={"itemControl rel"}> <div className={"itemControl rel"}>
{/*<div className={"plusImg controlBox "} onClick={()=>props.showQrcode(item.errorCode)}>*/}
{/*<img src={UTILPATH.localImg.plusIcon} alt=""/>*/}
{/*</div>*/}
{/*<div className={"refreshImg controlBox "} onClick={()=>props.getRefreshImg(item.id,item.type)}>*/}
{/*<img src={UTILPATH.localImg.refreshIcon} alt=""/>*/}
{/*</div>*/}
{imgFiles} {imgFiles}
<ImageComponent type={"add"} handleClikImgFunc = {this.addImg} noCloseBtn = {true} /> <ImageComponent disabled={!(item.isExistProblem && parseInt(item.isExistProblem) === 1)} type={"add"} handleClikImgFunc = {this.addImg} noCloseBtn = {true} />
<ImageComponent handleClikImgFunc = {this.reRreshImg} type={"refresh"} noCloseBtn = {true} /> <ImageComponent handleClikImgFunc = {this.reRreshImg} type={"refresh"} noCloseBtn = {true} />
</div> </div>
......
.troubleItemComponent{ .troubleItemComponent{
width: 1396px; width: 1396px;
height: 608px; height: 608px;
border: 1px solid #e5e5e5; border: 3px solid #e5e5e5;
background-color: #ffffff; background-color: #ffffff;
border-radius: 20px; border-radius: 20px;
overflow: hidden; overflow: hidden;
...@@ -91,9 +91,9 @@ ...@@ -91,9 +91,9 @@
right: 46px; right: 46px;
} }
.troubleItemComponent .itemControl{ .troubleItemComponent .itemControl{
display: flex; /*display: flex;*/
flex-direction: row; /*flex-direction: row;*/
flex-wrap: nowrap; /*flex-wrap: nowrap;*/
} }
.troubleItemComponent .itemControl .controlBox{ .troubleItemComponent .itemControl .controlBox{
width: 90px; width: 90px;
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
text-align: center; text-align: center;
width: 178px; width: 178px;
height: 178px; height: 178px;
line-height: 126px; line-height: 106px;
left: -89px; left: -89px;
top: -89px; top: -89px;
transform: rotate(45deg); transform: rotate(45deg);
......
...@@ -37,7 +37,7 @@ const defaultPopupInfo = { ...@@ -37,7 +37,7 @@ const defaultPopupInfo = {
popupButtons : [], // 默认弹窗的按钮 popupButtons : [], // 默认弹窗的按钮
classNames : '' //自定义类名 classNames : '' //自定义类名
}; };
const initPage = showPage[7]; const initPage = 7;
const errorType = { const errorType = {
1 : 1, //屏幕超时操作 1 : 1, //屏幕超时操作
...@@ -49,7 +49,7 @@ class PageContainer extends React.Component { ...@@ -49,7 +49,7 @@ class PageContainer extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
showPage : initPage, showPage : showPage[initPage],
lastPage : '', lastPage : '',
page : null, page : null,
popupInfo : defaultPopupInfo, popupInfo : defaultPopupInfo,
...@@ -402,7 +402,7 @@ class PageContainer extends React.Component { ...@@ -402,7 +402,7 @@ class PageContainer extends React.Component {
refreshImg = {state.refreshImg} refreshImg = {state.refreshImg}
storeInfo={state.storeInfo} storeInfo={state.storeInfo}
userInfo={state.userInfo} userInfo={state.userInfo}
initTroubleList={()=>dispatch(getTroubleList())} initTroubleList={(info)=>dispatch(getTroubleList(info))}
showTextArea={(text)=>this.showTextArea(text)} showTextArea={(text)=>this.showTextArea(text)}
showPopup={(info)=>this.showPopup(info)} showPopup={(info)=>this.showPopup(info)}
hidePopup={()=>this.hidePopup()} hidePopup={()=>this.hidePopup()}
......
...@@ -24,7 +24,9 @@ export default class TroubleContainer extends React.Component{ ...@@ -24,7 +24,9 @@ export default class TroubleContainer extends React.Component{
tmpText : '', tmpText : '',
tmpUrl : '', tmpUrl : '',
showStatus:showDom[1], showStatus:showDom[1],
style : {} style : {},
initialSlide : 0,
tempinitialSlide : 0
}; };
this.setItem = this.setItem.bind(this); this.setItem = this.setItem.bind(this);
this.showText = this.showText.bind(this); this.showText = this.showText.bind(this);
...@@ -37,12 +39,13 @@ export default class TroubleContainer extends React.Component{ ...@@ -37,12 +39,13 @@ export default class TroubleContainer extends React.Component{
this.updateImg = this.updateImg.bind(this); this.updateImg = this.updateImg.bind(this);
this.dealTrouble = this.dealTrouble.bind(this); this.dealTrouble = this.dealTrouble.bind(this);
this.setStyle = this.setStyle.bind(this); this.setStyle = this.setStyle.bind(this);
this.onSlideChangeEnd = this.onSlideChangeEnd.bind(this);
} }
componentWillMount(){ componentWillMount(){
let {troubleList} = this.props; let {troubleList,initTroubleList} = this.props;
// initTroubleList(); // initTroubleList({storeId: 17, employeeId: 5, token: "966D5C0B-3CF2-420D-B9A3-313BA37DE092"});
this.setState({ this.setState({
troubleList : troubleList troubleList : troubleList
}) })
...@@ -71,7 +74,6 @@ export default class TroubleContainer extends React.Component{ ...@@ -71,7 +74,6 @@ export default class TroubleContainer extends React.Component{
this.updateImg(refreshImg); this.updateImg(refreshImg);
} }
} }
updateImg(info){ updateImg(info){
...@@ -90,12 +92,15 @@ export default class TroubleContainer extends React.Component{ ...@@ -90,12 +92,15 @@ export default class TroubleContainer extends React.Component{
let troubleList = this.state.troubleList; let troubleList = this.state.troubleList;
let details = troubleList.details; let details = troubleList.details;
let indexInfo = details.find(d=>d.errorCode === errcode); let indexInfo = details.find(d=>d.errorCode === errcode);
let index = details.findIndex(d=>d.errorCode === errcode);
console.log("showText index ", index)
if(indexInfo && indexInfo.id){ if(indexInfo && indexInfo.id){
let text = indexInfo.explanation; let text = indexInfo.explanation;
this.setState({ this.setState({
currentErrorCode : errcode, currentErrorCode : errcode,
showStatus : showDom[2], showStatus : showDom[2],
tmpText: text, tmpText: text,
tempinitialSlide : index
}) })
} }
} }
...@@ -104,11 +109,14 @@ export default class TroubleContainer extends React.Component{ ...@@ -104,11 +109,14 @@ export default class TroubleContainer extends React.Component{
let troubleList = this.state.troubleList; let troubleList = this.state.troubleList;
let details = troubleList.details; let details = troubleList.details;
let indexInfo = details.find(d=>d.errorCode === errcode); let indexInfo = details.find(d=>d.errorCode === errcode);
let index = details.findIndex(d=>d.errorCode === errcode);
console.log("showQrcode index ", index)
if(indexInfo && indexInfo.id){ if(indexInfo && indexInfo.id){
this.setState({ this.setState({
currentErrorCode : errcode, currentErrorCode : errcode,
showStatus : showDom[3], showStatus : showDom[3],
tmpUrl: `${ENV.uploadImg}/${indexInfo.id}/${indexInfo.type}`, tmpUrl: `${ENV.uploadImg}/${indexInfo.id}/${indexInfo.type}`,
tempinitialSlide : index
}) })
} }
} }
...@@ -133,12 +141,14 @@ export default class TroubleContainer extends React.Component{ ...@@ -133,12 +141,14 @@ export default class TroubleContainer extends React.Component{
} }
goBack(){ goBack(){
console.log("goBack initialSlide ", this.state.initialSlide)
this.setState({ this.setState({
currentErrorCode : 0, currentErrorCode : 0,
showStatus : showDom[1], showStatus : showDom[1],
tmpText: '', tmpText: '',
tmpUrl : '', tmpUrl : '',
style:{} style:{},
initialSlide : this.state.tempinitialSlide
}) })
} }
...@@ -167,6 +177,9 @@ export default class TroubleContainer extends React.Component{ ...@@ -167,6 +177,9 @@ export default class TroubleContainer extends React.Component{
} }
} }
onSlideChangeEnd(swiper){
}
getDefaultDom(){ getDefaultDom(){
let {userInfo,storeInfo,getRefreshImg,deleteImg,changePages,showPopup,hidePopup} = this.props; let {userInfo,storeInfo,getRefreshImg,deleteImg,changePages,showPopup,hidePopup} = this.props;
let troubleList = this.state.troubleList; let troubleList = this.state.troubleList;
...@@ -182,13 +195,32 @@ export default class TroubleContainer extends React.Component{ ...@@ -182,13 +195,32 @@ export default class TroubleContainer extends React.Component{
/>; />;
}); });
let initialSlide = this.state.initialSlide;
let swiperOptions = { let swiperOptions = {
width : 1396, width : 1396,
spaceBetween: 30, spaceBetween: 30,
freeMode:true, // freeMode:true,
// pagination: '.pagination',
// loop:false,
mode: 'horizontal',
touchRatio:0.5,
longSwipesRatio:0.1,
threshold:50,
lazyLoadingInPrevNext:true,
lazyLoading : true,
followFinger:false,
observer: true,//修改swiper自己或子元素时,自动初始化swiper
observeParents: true,//修改swiper的父元素时,自动初始化swiper
lazyLoadingInPrevNextAmount: 1,
onSlideChangeEnd : this.onSlideChangeEnd,
initialSlide : initialSlide
}; };
let swiperContainer = CONFIG.swiperContainers.troubleSwiperContainer; let swiperContainer = CONFIG.swiperContainers.troubleSwiperContainer;
let swiperCount = details.length; let swiperCount = details.length;
console.log("render slide ",this.state.initialSlide)
return( return(
<div className={"toubleContainer " + (showTrouble ? '' : 'hide')}> <div className={"toubleContainer " + (showTrouble ? '' : 'hide')}>
<HeaderComponent <HeaderComponent
...@@ -204,6 +236,7 @@ export default class TroubleContainer extends React.Component{ ...@@ -204,6 +236,7 @@ export default class TroubleContainer extends React.Component{
<div className={"troubleBox"}> <div className={"troubleBox"}>
<SwiperComponent <SwiperComponent
swiperContainer={swiperContainer} swiperOptions={swiperOptions} swiperCount={swiperCount} swiperContainer={swiperContainer} swiperOptions={swiperOptions} swiperCount={swiperCount}
initialSlide={initialSlide}
> >
{dom} {dom}
</SwiperComponent> </SwiperComponent>
......
...@@ -31,5 +31,6 @@ let store = activateVendor(); ...@@ -31,5 +31,6 @@ let store = activateVendor();
// UTILPATH.socket.init(129,17); // UTILPATH.socket.init(129,17);
UTILPATH.socket.testIp(209); UTILPATH.socket.testIp(209);
// UTILPATH.socket.testIp(199);
renderPage(store); renderPage(store);
\ No newline at end of file
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