Commit 77528d08 by Zhang Xin

找回代码

parent 3a2942b8
......@@ -36,18 +36,6 @@ let json = {
"errorCode": null,
"type": "OP",
"files": [
{
"id": 16,
"filePath": "/tmp/2016-08-16/1471329685902.jpg"
},
{
"id": 17,
"filePath": "/sku/0/0/427/1471329704482.jpg"
},
{
"id": 18,
"filePath": "/sku/0/0/426/1471330380712.jpg"
}
],
"parentProblemName": "机械故障",
"subProblemName": "其他问题111"
......
......@@ -41,7 +41,7 @@ export default class TroubleItemComponent extends React.Component{
<span className={"colff7860 font32 star"}>*</span>
<span>是否有此问题</span>
<div className={"questionBox border_e5 "+(item.isExistProblem && parseInt(item.isExistProblem) === 1 ? 'active':'')}
onClick={()=>props.setItem(item.errorCode,"isExistProblem",1)}
onClick={()=>props.setItem(item.errorCode,"isExistProblem",1)}
></div>
<div className={"questionBox border_e5 "+(item.isExistProblem && parseInt(item.isExistProblem) === 2 ? 'active':'')}
onClick={()=>props.setItem(item.errorCode,"isExistProblem",2)}
......@@ -63,14 +63,14 @@ export default class TroubleItemComponent extends React.Component{
</div>
<div className={"itemControl rel"}>
<div className={"plusImg controlBox "}>
<div className={"plusImg controlBox "} onClick={()=>props.showQrcode(item.errorCode)}>
<img src={UTILPATH.localImg.plusIcon} alt=""/>
</div>
<div className={"refreshImg controlBox "}>
<div className={"refreshImg controlBox "} onClick={()=>props.getRefreshImg(item.id,item.type)}>
<img src={UTILPATH.localImg.refreshIcon} alt=""/>
</div>
</div>
</div>
)
}
}
\ No newline at end of file
}
.editUploadItem .newTroubleContent .problemCategory{
.troubleItemComponent{
width: 1396px;
height: 608px;
border: 1px solid #e5e5e5;
background-color: #ffffff;
border-radius: 20px;
overflow: hidden;
padding: 42px 45px 0 45px;
position: relative;
}
.troubleItemComponent .border_e5{
border: 2px solid #e5e5e5;
border-radius: 10px;
}
.troubleItemComponent .border_dashed_e5{
border: 2px dashed #e5e5e5;
border-radius: 10px;
}
.troubleItemComponent .rel{
position: relative;
padding-left: 44px;
}
.troubleItemComponent .itemText{
font-weight: bold;
}
.troubleItemComponent .itemWrongInfo{
height: 86px;
position: relative;
}
.troubleItemComponent .itemWrongInfo>p{
line-height: 32px;
top: 50%;
transform: translateY(-50%);
position: absolute;
}
.troubleItemComponent .star{
display: inline-block;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 0;
}
.troubleItemComponent .jugdeQuestion{
height: 61px;
line-height: 61px;
margin-bottom: 30px;
}
.troubleItemComponent .jugdeQuestion .questionBox{
height: 100%;
width: 161px;
text-align: center;
display: inline-block;
margin-left: 30px;
}
.editUploadItem .newTroubleContent .DetailProblem{}
.editUploadItem .newTroubleRemark{
margin-top: 4px;
.troubleItemComponent .jugdeQuestion .questionBox.active{
border-color: #26ce61;
}
.editUploadItem .newTroubleRemark .startIcon{
float: left;
.troubleItemComponent .itemTextArea{
height: 198px;
margin-bottom: 29px;
}
.editUploadItem .newTroubleRemark .remarkContent{
float: left;
.troubleItemComponent .itemTextAreaBox{
width: 1250px;
height: 100%;
display: inline-block;
background-color: #f2f2f2;
padding: 20px;
overflow: hidden;
}
.itemTextAreaBoxs{
background-color: #f2f2f2;
border: none;
resize: none;
width: 100%;
height: 100%;
line-height: 40px;
text-align: justify;
}
.editUploadItem .newTroubleRemark .remarkContent .editIcon{
.troubleItemComponent .itemTextArea .itemPlayceHolder{
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.troubleItemComponent .itemTextArea .itemTextEdit{
text-align: right;
padding: 13px 10px;
font-size: 24px;
color: #ff7860;
position: absolute;
line-height: 57px;
top: -57px;
right: 46px;
}
.troubleItemComponent .itemControl .controlBox{
width: 90px;
height: 90px;
position: relative;
display: inline-block;
margin-right: 30px;
}
.troubleItemComponent .itemControl .controlBox>img{
position: absolute;
width: 90px;
height: 90px;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.troubleItemComponent .finishBox{
display: none;
position: absolute;
top: 0;
right: 0;
width: 0;
height: 0;
border-top: 63px solid #26ce61;
border-bottom: 63px solid transparent;
border-left: 63px solid transparent;
border-right: 63px solid #26ce61;
}
.editUploadItem .newTroubleRemark .remarkContent .remarkText{
height: 198px;
border: 1px solid #e5e5e5;
border-radius: 10px;
background-color: #f2f2f2;
line-height: 198px;
.troubleItemComponent .finishBox .finishText{
position: absolute;
text-align: center;
font-size: 24px;
color: #999999;
width: 178px;
height: 178px;
line-height: 126px;
left: -89px;
top: -89px;
transform: rotate(45deg);
}
.troubleItemComponent.finish{
border: 3px solid #26ce61;
}
.editUploadItem .damageImgs .uploadImgRight{
float: left;
.troubleItemComponent.finish .finishBox{
display: block;
}
.editUploadItem .damageImgs .operationLeft{
float: left;
}
\ No newline at end of file
......@@ -37,7 +37,7 @@ class PageContainer extends React.Component {
super(props);
// UTILPATH.socket.getIp();
this.state = {
showPage : showPage[4],
showPage : showPage[1],
lastPage : '',
page : null,
popupInfo : defaultPopupInfo,
......
import React from 'react';
import ReactQrCode from 'qrcode.react'
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
require('./index.css');
export default class Qrcode extends React.Component{
constructor(props){
super(props);
this.state = {
url : 'http://www.baidu.com'
}
this.getOtherHeader = this.getOtherHeader.bind(this);
}
getOtherHeader(){
let {goBack} = this.props;
return <div className={"otherHeader font32 clearfix"}>
<div className={"fl colfff"} onClick={()=>goBack()}>
<i className={"iconfont middle icon font58 icon-circle-left circleIcon"}></i>
<span className={"middle"}>添加照片</span>
</div>
</div>
}
render(){
return(
<div className="qrCodeContainer">
<div className={"qrcode"}>
<ReactQrCode value={this.state.url} size={312}/>
</div>
<div className={"qrcodeText font32"}>
请用手机微信扫一扫上方二维码
<div>
<HeaderComponent
showHeader={CONFIG.headerStatus[2]}
>
{this.getOtherHeader()}
</HeaderComponent>
<div className="qrCodeContainer">
<div className={"qrcode"}>
<ReactQrCode value={this.props.url || ''} size={312}/>
</div>
<div className={"qrcodeText font32"}>
请用手机微信“扫一扫”上方二维码进行图片上传
</div>
</div>
</div>
)
}
}
\ No newline at end of file
}
import React from 'react';
import SwiperComponent from '../../components/CommonComponent/SwiperComponent/SwiperComponent'
import TroubleItem from '../../components/TroubleComponent/TroubleItemComponent/TroubleItemComponent'
import Button from '../../components/CommonComponent/ButtonComponent/ButtonComponent'
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import TextArea from "../TextAreaContainer/TextAreaContainer";
import Qrcode from '../Qrcode/Qrcode'
import FinishTrouble from '../../components/TroubleComponent/FinishTroubleComponent/FinishTroubleComponent'
import Button from '../../components/CommonComponent/ButtonComponent/ButtonComponent'
require('./index.css')
const showDom={
1:'default',
2:'textArea',
3:'qrcode'
};
export default class TroubleContainer extends React.Component{
constructor(props){
super(props);
......@@ -15,11 +21,13 @@ export default class TroubleContainer extends React.Component{
showTrouble : true,
troubleList : {},
currentErrorCode : 0,
showTextArea : false,
tmpText : ''
tmpText : '',
tmpUrl : '',
showStatus:showDom[1]
};
this.setItem = this.setItem.bind(this);
this.showText = this.showText.bind(this);
this.showQrcode = this.showQrcode.bind(this);
this.goBack = this.goBack.bind(this);
this.saveText = this.saveText.bind(this);
this.getDefaultDom = this.getDefaultDom.bind(this);
......@@ -29,31 +37,6 @@ export default class TroubleContainer extends React.Component{
this.dealTrouble = this.dealTrouble.bind(this);
}
dealTrouble(){
let {showPopup,hidePopup} = this.props;
let troubleList = this.state.troubleList;
let details = troubleList.details;
let arr = details.filter(d=>{
return !d.isExistProblem || ( d.isExistProblem === 1 && ! d.explanation)
});
let btnDom = <Button key={"dealTrouble1"} style={{'width':'260px'}} text={"关闭"} option={hidePopup}/>
if(arr && arr.length > 0){
showPopup({
popupText:'请完成所有需要处理的故障的必填项',
popupButtons:[btnDom]
})
}else{
details.forEach((d)=>{
d.imagesFileId = d.files.map(f=>f.id).join(',');
});
console.log(details);
this.setState({
showTrouble : false
})
}
}
componentWillMount(){
let {initTroubleList} = this.props;
......@@ -63,9 +46,9 @@ export default class TroubleContainer extends React.Component{
componentWillReceiveProps(nextProps){
let troubleList = nextProps.troubleList;
let nowTroubleList = this.state.troubleList;
let troubleErrorCodeList = Array.isArray(troubleList.details) ? troubleList.details.map(i=>i.errorCode) : []
let nowtroubleErrorCodeList = Array.isArray(nowTroubleList.details) ? nowTroubleList.details.map(i=>i.errorCode) : []
let troubleErrorCodeList = Array.isArray(troubleList.details) ? troubleList.details.map(i=>i.errorCode) : [];
let nowtroubleErrorCodeList = Array.isArray(nowTroubleList.details) ? nowTroubleList.details.map(i=>i.errorCode) : [];
//上一次和这一次不一样
let troubleErrorCodeListStr = troubleErrorCodeList.join(",");
let nowtroubleErrorCodeListStr = nowtroubleErrorCodeList.join(",");
......@@ -78,43 +61,52 @@ export default class TroubleContainer extends React.Component{
})
}
let refreshImg = nextProps.refreshImg;
let nowRefreshImg = this.state.refreshImg;
if(refreshImg && refreshImg.errorId && refreshImg.type && refreshImg.files){
this.updateImg(refreshImg);
}
}
haveNext(){
console.log("有")
}
haveNoNext(){
console.log("没有")
updateImg(info){
let id = info.errorId;
let type = info.type;
let files = info.files;
let troubleList = this.state.troubleList;
let details = troubleList.details;
let indexInfo = details.find(d=>d.id === id && d.type === type);
if(indexInfo && indexInfo.id){
this.setItem(indexInfo.errorCode,"files",files);
}
}
showText(errcode){
console.log("errcode ",errcode)
let troubleList = this.state.troubleList;
let details = troubleList.details;
let index = details.findIndex(d=>d.errorCode === errcode);
if(index > -1){
let text = details[index]['explanation'];
console.log("text ",text);
let indexInfo = details.find(d=>d.errorCode === errcode);
if(indexInfo && indexInfo.id){
let text = indexInfo.explanation;
this.setState({
currentErrorCode : errcode,
showTextArea : true,
showStatus : showDom[2],
tmpText: text
})
}
}
showQrcode(errcode){
let troubleList = this.state.troubleList;
let details = troubleList.details;
let indexInfo = details.find(d=>d.errorCode === errcode);
if(indexInfo && indexInfo.id){
this.setState({
currentErrorCode : errcode,
showStatus : showDom[3],
tmpUrl: `${ENV.uploadImg}/${indexInfo.id}/${indexInfo.type}`
})
}
}
setItem(errcode,option,info){
......@@ -130,78 +122,127 @@ export default class TroubleContainer extends React.Component{
this.goBack()
})
}
saveText(text){
let errcode = this.state.currentErrorCode;
this.setItem(errcode,'explanation',text);
}
goBack(){
this.setState({
currentErrorCode : 0,
showTextArea : false,
tmpText: ''
showStatus : showDom[1],
tmpText: '',
tmpUrl : ''
})
}
dealTrouble(){
let {showPopup,hidePopup} = this.props;
let troubleList = this.state.troubleList;
let details = troubleList.details;
let arr = details.filter(d=>{
return !d.isExistProblem || ( d.isExistProblem === 1 && ! d.explanation)
});
render(){
let {userInfo,storeInfo} = this.props;
let btnDom = <Button key={"dealTrouble1"} style={{'width':'260px'}} text={"关闭"} option={hidePopup}/>
if(arr && arr.length > 0){
showPopup({
popupText:'请完成所有需要处理的故障的必填项',
popupButtons:[btnDom]
})
}else{
details.forEach((d)=>{
d.imagesFileId = d.files.map(f=>f.id).join(',');
});
console.log(details);
this.setState({
showTrouble : false
})
}
}
getDefaultDom(){
let {userInfo,storeInfo,getRefreshImg} = 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 : [];
let dom = details.map((i,k)=>{
return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem} showText={this.showText}/>;
return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem}
showText={this.showText} showQrcode={this.showQrcode}
getRefreshImg={getRefreshImg}
/>;
});
let swiperOptions = {
width : 1396,
spaceBetween: 30,
freeMode:true,
};
let swiperContainer = CONFIG.swiperContainers.troubleSwiperContainer;
let swiperCount = details.length;
return (
<div>
{
this.state.showTextArea ? <TextArea
text={this.state.tmpText}
goBack={this.goBack}
saveText={this.saveText}
></TextArea> :
<div className={"toubleContainers " + (showTrouble ? '' : 'hide')}>
<HeaderComponent
showHeader={CONFIG.headerStatus[1]}
userinfo={userInfo}
storeInfo={storeInfo}
/>
<div className={"troubleContainer " + ( this.state.showTrouble ? '' : 'hide')}>
<div className={"troubleText font32"}><span className={"colff7860"}>* </span>必填项</div>
<div className={"troubleBox"}>
<SwiperComponent
swiperContainer={swiperContainer} swiperOptions={swiperOptions} swiperCount={swiperCount}
>
{dom}
</SwiperComponent>
</div>
<div className={"troubleBtnBox"}>
<div className={"troubleBtn colfff font32"} onClick={()=>this.dealTrouble.bind(this)()}>
处理完毕
</div>
</div>
return(
<div className={"toubleContainer " + (showTrouble ? '' : 'hide')}>
<HeaderComponent
showHeader={CONFIG.headerStatus[1]}
userinfo={userInfo}
storeInfo={storeInfo}
/>
{
this.state.showTrouble ?
<div className={"troubleContent " + ( this.state.showTrouble ? '' : 'hide')}>
<div className={"troubleText font32"}><span className={"colff7860"}>* </span>必填项</div>
<div className={"troubleBox"}>
<SwiperComponent
swiperContainer={swiperContainer} swiperOptions={swiperOptions} swiperCount={swiperCount}
>
{dom}
</SwiperComponent>
</div>
<div className={"selectContainer " + ( this.state.showTrouble ? 'hide' : '')}>
<div className={"selectText font40 col333"} style={{"marginTop":"230px"}}>出货板传送区、机械手平台、轨道是否有未出货遗留的货品</div>
<div className={"selectButtons"}>
<Button text={"有"} option={this.haveNext} style={{"marginTop":"128px"}}/>
<Button text={"没有"} option={this.haveNoNext} style={{"marginTop":"49px"}}/>
<div className={"troubleBtnBox"}>
<div className={"troubleBtn colfff font32"} onClick={()=>this.dealTrouble.bind(this)()}>
处理完毕
</div>
</div>
</div>
</div> : <FinishTrouble />
}
</div>
)
}
getTextAreaDom(){
return <TextArea
text={this.state.tmpText}
goBack={this.goBack}
saveText={this.saveText}/>
}
getQrcodeDom(){
return <Qrcode goBack={this.goBack} url={this.state.tmpUrl}/>
}
getDom(){
switch (this.state.showStatus){
case showDom[1]:
return this.getDefaultDom();
case showDom[2]:
return this.getTextAreaDom();
case showDom[3]:
return this.getQrcodeDom();
default :
return null;
}
}
render(){
return (
<div className={"troubleContainers "+(this.state.showStatus === showDom[2] ? 'backfff' : '')}>
{
this.getDom()
}
</div>
)
}
}
\ No newline at end of file
}
.troubleContainer{
.troubleContainers{
width: 100%;
height: 100%;
}
.troubleContainers.backfff{
background-color: #ffffff;
}
.troubleContent{
padding-left: 30px;
}
.troubleContainer .troubleText{
.troubleContent .troubleText{
height: 100px;
display: table-cell;
vertical-align: bottom;
}
.troubleContainer .troubleBox{
.troubleContent .troubleBox{
margin: 20px 0;
}
.troubleContainer .troubleBtnBox{
.troubleContent .troubleBtnBox{
height: 80px;
width: 100%;
text-align: right;
padding-right: 30px;
}
.troubleContainer .troubleBtn{
.troubleContent .troubleBtn{
width: 413px;
height: 100%;
display: inline-block;
......@@ -24,12 +31,3 @@
background-color: #ff7860;
border-radius: 10px;
}
.selectContainer{
text-align: center;
}
.selectButtons{
display: flex;
flex-direction: column;
align-items:center;
}
\ No newline at end of file
......@@ -4,13 +4,16 @@ import storeInfo from './store'
import scanBarCodeContainer from './scanBarCodeContainer'
import otherQuestion from './otherQuestion'
import userInfo from './user'
import refreshImg from './refreshImg'
export default combineReducers({
troubleList,
storeInfo,
scanBarCodeContainer,
otherQuestion,
userInfo
userInfo,
refreshImg
})
......@@ -4,6 +4,7 @@ import addIcon from '../image/addIcon.png';
import refreshIcon from '../image/refresh.png';
import plusIcon from '../image/plusIcon.png';
import clockIcon from '../image/clock.png';
import breakImg from '../image/breakImg.png';
const localHost = 'http://localhost:7788';
const devHost = 'http://test.mjitech.com';
......@@ -77,6 +78,6 @@ const handleImgLoad = (ref)=>{
return style;
}
const localImg = {headlogo,defaultImg,addIcon,refreshIcon,plusIcon,clockIcon}
const localImg = {headlogo,defaultImg,addIcon,refreshIcon,plusIcon,clockIcon,breakImg}
module.exports = {localHost,devHost,masterHost,getPic,handleImgError,handleImgLoad,localImg};
\ 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