Commit 717b81d3 by Zhang Xin

修改临时关门 & delete console.log

parent f7d3039d
...@@ -23,7 +23,6 @@ const checkProductQuantity = (data)=>{ ...@@ -23,7 +23,6 @@ const checkProductQuantity = (data)=>{
}).then(response=>response.json()) }).then(response=>response.json())
.then((json)=>{ .then((json)=>{
if(json.data===1){ if(json.data===1){
console.log("执行了 json.data===1 的拉取工单的操作")
dispatch(getTaskList(commonInfo)) dispatch(getTaskList(commonInfo))
} }
dispatch(checkQuantity({type:json.data})) dispatch(checkQuantity({type:json.data}))
......
...@@ -30,7 +30,6 @@ const submitBreakageProduct = (data)=>{ ...@@ -30,7 +30,6 @@ const submitBreakageProduct = (data)=>{
body:JSON.stringify(bodyData) body:JSON.stringify(bodyData)
}).then((response)=>response.json()) }).then((response)=>response.json())
.then((json)=>{ .then((json)=>{
console.log(json,'breakageContainerjs')
dispatch(getSubmitStatus(json.meta)) dispatch(getSubmitStatus(json.meta))
}) })
} }
...@@ -40,7 +39,6 @@ const submitBreakageProduct = (data)=>{ ...@@ -40,7 +39,6 @@ const submitBreakageProduct = (data)=>{
//test 没有散落货品 //test 没有散落货品
const hasNoSku = (commonInfo)=>{ const hasNoSku = (commonInfo)=>{
let {storeInfo={},userInfo={},taskInfo={}} = commonInfo; let {storeInfo={},userInfo={},taskInfo={}} = commonInfo;
console.log("执行了没有散落商品的接口")
return (dispatch)=>{ return (dispatch)=>{
let url = `${domain}machine_pad/work/lr/status/${taskInfo.taskId}/${taskInfo.area}/${taskInfo.currentTaskType}`; let url = `${domain}machine_pad/work/lr/status/${taskInfo.taskId}/${taskInfo.area}/${taskInfo.currentTaskType}`;
fetch(url,{ fetch(url,{
......
import fetch from 'isomorphic-fetch' import fetch from 'isomorphic-fetch'
import {logout} from "./common";
let domain = ENV.domain; let domain = ENV.domain;
// let domain1='http://192.168.10.184:8080/maxbox/web/' // let domain1='http://192.168.10.184:8080/maxbox/web/'
const willCloseDoor=(data)=>{ const willCloseDoor=(data)=>{
let url=domain+`machine_pad/finish_task.action` let url=domain+`machine_pad/finish_task.action`
let {userInfo,taskInfo,storeInfo}=data; let {userInfo,taskInfo,storeInfo}=data;
console.log(data,'ahsdjhjaskhdjkhasjkd')
let userId=userInfo.employeeId; let userId=userInfo.employeeId;
let machineId=storeInfo.id; let machineId=storeInfo.id;
let {taskId,area,currentTaskType}=taskInfo; let {taskId,area,currentTaskType}=taskInfo;
...@@ -21,8 +21,7 @@ const willCloseDoor=(data)=>{ ...@@ -21,8 +21,7 @@ const willCloseDoor=(data)=>{
body:JSON.stringify(bodyData) body:JSON.stringify(bodyData)
}).then((response)=>response.json()) }).then((response)=>response.json())
.then((json)=>{ .then((json)=>{
// console.log(json,'breakageContainerjs') dispatch(closeDoorSuccess(data));
// dispatch(getSubmitStatus(json.meta))
}) })
} }
} }
...@@ -47,6 +46,7 @@ const closeDoorSuccess=(data)=>{ ...@@ -47,6 +46,7 @@ const closeDoorSuccess=(data)=>{
body:JSON.stringify(bodyData) body:JSON.stringify(bodyData)
}).then((response)=>response.json()) }).then((response)=>response.json())
.then((json)=>{ .then((json)=>{
dispatch(logout())
// console.log(json,'breakageContainerjs') // console.log(json,'breakageContainerjs')
// dispatch(getSubmitStatus(json.meta)) // dispatch(getSubmitStatus(json.meta))
}) })
......
...@@ -19,8 +19,6 @@ const saveIp = (data)=>{ ...@@ -19,8 +19,6 @@ const saveIp = (data)=>{
}; };
const checkStatus = (response)=>{ const checkStatus = (response)=>{
console.log("===========")
console.log(response);
if (response.status >= 200 && response.status < 300) { if (response.status >= 200 && response.status < 300) {
return response; return response;
} }
...@@ -50,7 +48,6 @@ const getIp = ()=>{ ...@@ -50,7 +48,6 @@ const getIp = ()=>{
}).then(checkStatus) }).then(checkStatus)
.then(parseJson) .then(parseJson)
.then((data) => { .then((data) => {
console.log("data :",data);
dispatch(saveIp(domainIp + i + ':7788')) dispatch(saveIp(domainIp + i + ':7788'))
}) })
.catch((err) =>{ .catch((err) =>{
......
...@@ -180,7 +180,6 @@ const updateTroubleList = (info, headerInfo) => { ...@@ -180,7 +180,6 @@ const updateTroubleList = (info, headerInfo) => {
let {taskInfo={},userInfo={},storeInfo={}} = headerInfo; let {taskInfo={},userInfo={},storeInfo={}} = headerInfo;
let bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:userInfo.employeeId,storeId:storeInfo.id}); let bodyData = Object.assign({}, {details: info}, {taskId:taskInfo.taskId,employeeId:userInfo.employeeId,storeId:storeInfo.id});
console.log("updateTroubleList ",bodyData);
//todo 更新故障处理,并且获取新的工单 //todo 更新故障处理,并且获取新的工单
return (dispatch) => { return (dispatch) => {
fetch(domain + 'machine_pad/save_all_error.action', { fetch(domain + 'machine_pad/save_all_error.action', {
......
...@@ -5,7 +5,6 @@ const domain = ENV.domain; ...@@ -5,7 +5,6 @@ const domain = ENV.domain;
export function initGetOtherProblem(postData) { export function initGetOtherProblem(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'machine_pad/list_other_fault.action'); let url = String(domain+'machine_pad/list_other_fault.action');
console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -32,7 +31,6 @@ export function initGetOtherProblem(postData) { ...@@ -32,7 +31,6 @@ export function initGetOtherProblem(postData) {
export function addNewProbem(postData) { export function addNewProbem(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'machine_pad/insert_problem.action'); let url = String(domain+'machine_pad/insert_problem.action');
console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -93,7 +91,6 @@ export function deleteProblem(postData) { ...@@ -93,7 +91,6 @@ export function deleteProblem(postData) {
export function submitProblemList(postData) { export function submitProblemList(postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'machine_pad/add_feed_problem.action'); let url = String(domain+'machine_pad/add_feed_problem.action');
console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
......
...@@ -5,7 +5,6 @@ let domain = ENV.domain; ...@@ -5,7 +5,6 @@ let domain = ENV.domain;
export function getReportDamageList (postData) { export function getReportDamageList (postData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'machine_pad/list_all_dealed_invetory_loss/'+postData.taskId+'/'+postData.storeId); let url = String(domain+'machine_pad/list_all_dealed_invetory_loss/'+postData.taskId+'/'+postData.storeId);
console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'GET', method : 'GET',
...@@ -29,7 +28,6 @@ export function getReportDamageList (postData) { ...@@ -29,7 +28,6 @@ export function getReportDamageList (postData) {
export function deleteDamageItem(postaData) { export function deleteDamageItem(postaData) {
return (dispatch) => { return (dispatch) => {
let url = String(domain+'machine_pad/delete_invetory_loss_by_saas'); let url = String(domain+'machine_pad/delete_invetory_loss_by_saas');
console.log(url)
fetch(url,{ fetch(url,{
credentials : 'include', credentials : 'include',
method : 'POST', method : 'POST',
...@@ -57,7 +55,6 @@ export function deleteDamageItem(postaData) { ...@@ -57,7 +55,6 @@ export function deleteDamageItem(postaData) {
} }
function getReportDamageListSuccess(data) { function getReportDamageListSuccess(data) {
console.log("========================")
return{ return{
type:actionTypes.INIT_GETDAMGELIST_SUCCESS, type:actionTypes.INIT_GETDAMGELIST_SUCCESS,
data data
...@@ -65,7 +62,6 @@ function getReportDamageListSuccess(data) { ...@@ -65,7 +62,6 @@ function getReportDamageListSuccess(data) {
} }
function deleteDamageListSuccess(data) { function deleteDamageListSuccess(data) {
console.log("=======================delete===========")
return{ return{
type:actionTypes.DELET_DAMAGEITEM_SUCCESS, type:actionTypes.DELET_DAMAGEITEM_SUCCESS,
data data
......
...@@ -47,7 +47,6 @@ const uploadError = (info,exceptionType,getTask=true)=>{ ...@@ -47,7 +47,6 @@ const uploadError = (info,exceptionType,getTask=true)=>{
taskType : taskInfo.currentTaskType || '', taskType : taskInfo.currentTaskType || '',
area : taskInfo.area || '' area : taskInfo.area || ''
}); });
console.log("exception_skupass_sku ",bodyData)
return (dispatch =>{ return (dispatch =>{
fetch(domain + 'machine_pad/exception_skupass_sku.action',{ fetch(domain + 'machine_pad/exception_skupass_sku.action',{
credentials : 'include', credentials : 'include',
......
...@@ -33,7 +33,6 @@ class BarcodeComponent extends React.Component{ ...@@ -33,7 +33,6 @@ class BarcodeComponent extends React.Component{
let {barcode}=this.state; let {barcode}=this.state;
let props=this.props; let props=this.props;
//验证输入的条形码是否为空 //验证输入的条形码是否为空
console.log(barcode,'sakldjklasjkdljasjdajskdjksajl')
if(barcode){ if(barcode){
props.getBarCodeProductInfo(barcode); props.getBarCodeProductInfo(barcode);
// props.changePage&&props.changePage(2) // props.changePage&&props.changePage(2)
......
...@@ -13,7 +13,6 @@ export default class ClockComponent extends React.Component{ ...@@ -13,7 +13,6 @@ export default class ClockComponent extends React.Component{
} }
componentWillMount(){ componentWillMount(){
console.log("clock componentWillMount")
let {totalTime} = this.props; let {totalTime} = this.props;
if(totalTime && totalTime > 0){ if(totalTime && totalTime > 0){
this.setState({ this.setState({
...@@ -26,11 +25,9 @@ export default class ClockComponent extends React.Component{ ...@@ -26,11 +25,9 @@ export default class ClockComponent extends React.Component{
} }
componentWillReceiveProps(){ componentWillReceiveProps(){
console.log("clock componentWillReceiveProps")
} }
componentWillUnmount(){ componentWillUnmount(){
console.log("clock componentWillUnmount")
window.clearTimeout(this.state.timer); window.clearTimeout(this.state.timer);
this.setState({ this.setState({
timer : null, timer : null,
...@@ -41,10 +38,8 @@ export default class ClockComponent extends React.Component{ ...@@ -41,10 +38,8 @@ export default class ClockComponent extends React.Component{
beginCountBack(){ beginCountBack(){
let {callback} = this.props; let {callback} = this.props;
let that = this; let that = this;
console.log("timer ",this.state.timer);
if(!this.state.timer && this.state.count >= 0){ if(!this.state.timer && this.state.count >= 0){
let count = this.state.count - 1; let count = this.state.count - 1;
console.log("count ",count," ",this.state.count);
this.state.timer = window.setTimeout(()=>{ this.state.timer = window.setTimeout(()=>{
if(count >= 0){ if(count >= 0){
window.clearTimeout(that.state.timer); window.clearTimeout(that.state.timer);
...@@ -60,7 +55,6 @@ export default class ClockComponent extends React.Component{ ...@@ -60,7 +55,6 @@ export default class ClockComponent extends React.Component{
that.setState({ that.setState({
timer : null timer : null
},()=>{ },()=>{
console.log("倒计时结束");
callback(); callback();
}) })
......
...@@ -33,7 +33,6 @@ export default class EditProblemItem extends React.Component{ ...@@ -33,7 +33,6 @@ export default class EditProblemItem extends React.Component{
let showRemark = baseInfo.remark; let showRemark = baseInfo.remark;
if(currentRemarkLength>200){ if(currentRemarkLength>200){
showRemark = String(showRemark).substring(0,199) showRemark = String(showRemark).substring(0,199)
console.log(showRemark.length)
} }
this.setState({ this.setState({
problemList:Problems_format, problemList:Problems_format,
...@@ -68,7 +67,6 @@ export default class EditProblemItem extends React.Component{ ...@@ -68,7 +67,6 @@ export default class EditProblemItem extends React.Component{
if(value == "showDetailElement"){ if(value == "showDetailElement"){
//点击了 小分类 检查如果大分类未选择则进行提示 //点击了 小分类 检查如果大分类未选择则进行提示
if(!this.state.currentBigId){ if(!this.state.currentBigId){
console.log("请先选择大分类")
return; return;
} }
} }
...@@ -137,7 +135,6 @@ export default class EditProblemItem extends React.Component{ ...@@ -137,7 +135,6 @@ export default class EditProblemItem extends React.Component{
editProblemItem(data) editProblemItem(data)
} }
handleClickEditRemark(){ handleClickEditRemark(){
console.log("点击编辑跳转到文本框")
} }
showImg(imgSrc){ showImg(imgSrc){
let {showPopup,hidePopup} = this.props; let {showPopup,hidePopup} = this.props;
......
...@@ -38,17 +38,13 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -38,17 +38,13 @@ export default class ReplenishScanPage extends React.Component{
} }
componentWillUnmount(){ componentWillUnmount(){
console.log("ReplenishScanPage componentWillUnmount")
this.setState({ this.setState({
btnClock : false btnClock : false
}) })
console.log("willUmmount");
this.props.emptyBarcodeInfo() this.props.emptyBarcodeInfo()
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
console.log("ReplenishScanPage componentWillReceiveProps ",nextProps);
let props = this.props; let props = this.props;
let {replenishInfo,barcodeInfo} = props; let {replenishInfo,barcodeInfo} = props;
...@@ -78,7 +74,6 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -78,7 +74,6 @@ export default class ReplenishScanPage extends React.Component{
} }
}else{ }else{
//没有错误类型的错误 //没有错误类型的错误
console.log("ReplenishScanPage ",nextProps.replenishInfo.errorInfo.errorMessage)
this.showErrorInfo(nextProps.replenishInfo.errorInfo.errorMessage); this.showErrorInfo(nextProps.replenishInfo.errorInfo.errorMessage);
} }
} }
...@@ -154,7 +149,6 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -154,7 +149,6 @@ export default class ReplenishScanPage extends React.Component{
} }
handleScanOver(){ handleScanOver(){
console.log("扫描结束");
//货道商品不符 //货道商品不符
let {showPopup,hidePopup} = this.props; let {showPopup,hidePopup} = this.props;
let btnDom1 = <Button btnContainer={"replenishHandleScanOverBtn1 font32 bordere5e5e5"} key={"replenishHandleScanOverBtn1"} text={"继续扫描"} option={this.handleScanContinue}/> let btnDom1 = <Button btnContainer={"replenishHandleScanOverBtn1 font32 bordere5e5e5"} key={"replenishHandleScanOverBtn1"} text={"继续扫描"} option={this.handleScanContinue}/>
...@@ -360,7 +354,6 @@ export default class ReplenishScanPage extends React.Component{ ...@@ -360,7 +354,6 @@ export default class ReplenishScanPage extends React.Component{
if(barcodeText){ if(barcodeText){
barcodeText = barcodeText.trim(); barcodeText = barcodeText.trim();
if(this.checkNumber(barcodeText)){ if(this.checkNumber(barcodeText)){
console.log("submitBarcode ",barcodeText);
//获取条形码信息 //获取条形码信息
getBarCodeProductInfo(barcodeText); getBarCodeProductInfo(barcodeText);
}else{ }else{
......
...@@ -58,7 +58,6 @@ export default class ReplenishSkuPage extends React.Component{ ...@@ -58,7 +58,6 @@ export default class ReplenishSkuPage extends React.Component{
componentWillUnmount(){ componentWillUnmount(){
console.log("ReplenishSkuPage componentWillUnmount");
this.setState({ this.setState({
btnClock : false btnClock : false
}) })
...@@ -85,7 +84,6 @@ export default class ReplenishSkuPage extends React.Component{ ...@@ -85,7 +84,6 @@ export default class ReplenishSkuPage extends React.Component{
} }
handleScanOver(){ handleScanOver(){
console.log("扫描结束")
//货道商品不符 //货道商品不符
let {showPopup,hidePopup} = this.props; let {showPopup,hidePopup} = this.props;
let btnDom1 = <Button btnContainer={"replenishHandleScanOverBtn1 font32 bordere5e5e5"} key={"replenishHandleScanOverBtn1"} text={"继续扫描"} option={hidePopup}/> let btnDom1 = <Button btnContainer={"replenishHandleScanOverBtn1 font32 bordere5e5e5"} key={"replenishHandleScanOverBtn1"} text={"继续扫描"} option={hidePopup}/>
......
...@@ -25,7 +25,6 @@ export default class DamageItem extends React.Component{ ...@@ -25,7 +25,6 @@ export default class DamageItem extends React.Component{
productContent+=newText; productContent+=newText;
}) })
let imgListUi = fileModelList.map((item,index)=>{ let imgListUi = fileModelList.map((item,index)=>{
console.log(item.filePath)
return <ImgToolComponent return <ImgToolComponent
key={index+"image"} key={index+"image"}
noCloseBtn={true} noCloseBtn={true}
......
...@@ -9,15 +9,12 @@ export default class FinishTroubleComponent extends React.Component{ ...@@ -9,15 +9,12 @@ export default class FinishTroubleComponent extends React.Component{
haveNext(){ haveNext(){
console.log("有");
let props = this.props; let props = this.props;
props.changePages(CONFIG.showPage[2]) props.changePages(CONFIG.showPage[2])
} }
haveNoNext(){ haveNoNext(){
console.log("没有");
let props = this.props; let props = this.props;
console.log(CONFIG.showPage[4]);
props.changePages(CONFIG.showPage[4]) props.changePages(CONFIG.showPage[4])
} }
......
...@@ -50,7 +50,6 @@ export default class ChooseTaskContainer extends React.Component{ ...@@ -50,7 +50,6 @@ export default class ChooseTaskContainer extends React.Component{
} }
closeDoor(){ closeDoor(){
console.log("closeDoor");
this.props.hidePopup(); this.props.hidePopup();
this.props.showOpenDoorPage() this.props.showOpenDoorPage()
} }
......
...@@ -26,7 +26,6 @@ export default class FinishAskContainer extends React.Component{ ...@@ -26,7 +26,6 @@ export default class FinishAskContainer extends React.Component{
} }
selectTask(){ selectTask(){
console.log("selectTask")
let {changePages} = this.props; let {changePages} = this.props;
changePages(CONFIG.showPage[9]) changePages(CONFIG.showPage[9])
} }
...@@ -37,7 +36,6 @@ export default class FinishAskContainer extends React.Component{ ...@@ -37,7 +36,6 @@ export default class FinishAskContainer extends React.Component{
} }
closeDoor(){ closeDoor(){
console.log("closeDoor");
this.props.hidePopup(); this.props.hidePopup();
//任务完成,超时不确定 //任务完成,超时不确定
let btnDom = <Button btnContainer={"btne5"} key={"finishcloseDoorBack1"} style={{'width':UTILPATH.getRemByPx(260)}} text={"确定"} option={this.beginCloseDoor}/> let btnDom = <Button btnContainer={"btne5"} key={"finishcloseDoorBack1"} style={{'width':UTILPATH.getRemByPx(260)}} text={"确定"} option={this.beginCloseDoor}/>
...@@ -52,7 +50,6 @@ export default class FinishAskContainer extends React.Component{ ...@@ -52,7 +50,6 @@ export default class FinishAskContainer extends React.Component{
judgeTask(){ judgeTask(){
console.log("judgeTask");
this.props.hidePopup(); this.props.hidePopup();
//任务完成,超时不确定 //任务完成,超时不确定
let btnDom = <Button btnContainer={"btne5"} key={"finishjudgeTaskBack1"} style={{'width':UTILPATH.getRemByPx(260)}} text={"确定"} option={this.beginCloseDoor}/> let btnDom = <Button btnContainer={"btne5"} key={"finishjudgeTaskBack1"} style={{'width':UTILPATH.getRemByPx(260)}} text={"确定"} option={this.beginCloseDoor}/>
......
...@@ -38,9 +38,10 @@ export default class HomePageContainer extends React.Component{ ...@@ -38,9 +38,10 @@ export default class HomePageContainer extends React.Component{
} }
logout(){ logout(){
this.props.willCloseDoor(); // this.props.willCloseDoor();
let msg={type:'WILL_CLOSEDOOR'} // let msg={type:'WILL_CLOSEDOOR'}
sendMsg(JSON.stringify(msg)) // sendMsg(JSON.stringify(msg))
this.props.tempLogout()
} }
showLogoutPopup(){ showLogoutPopup(){
...@@ -108,7 +109,6 @@ export default class HomePageContainer extends React.Component{ ...@@ -108,7 +109,6 @@ export default class HomePageContainer extends React.Component{
) )
} }
start(){ start(){
console.log('执行 开始工作了')
let props=this.props; let props=this.props;
props.getTaskList(); props.getTaskList();
} }
......
...@@ -208,10 +208,7 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -208,10 +208,7 @@ export default class OtherQuestionContainer extends React.Component{
"showQr":true, "showQr":true,
"qrUrl":tmpUrl "qrUrl":tmpUrl
},()=>{ },()=>{
console.log("=======================设置的二维码===========")
console.log(this.state.qrUrl)
}) })
console.log("添加照片")
} }
...@@ -299,7 +296,6 @@ export default class OtherQuestionContainer extends React.Component{ ...@@ -299,7 +296,6 @@ export default class OtherQuestionContainer extends React.Component{
let swiperContainer = CONFIG.swiperContainers.editProblemSwiperContainer; let swiperContainer = CONFIG.swiperContainers.editProblemSwiperContainer;
//控制Ui显示 //控制Ui显示
let elementUI = ''; let elementUI = '';
console.log("render ",this.state.showTextArea , this.state.showPop)
if(this.state.showTextArea){ if(this.state.showTextArea){
elementUI = <div> elementUI = <div>
......
...@@ -145,8 +145,6 @@ class PageContainer extends React.Component { ...@@ -145,8 +145,6 @@ class PageContainer extends React.Component {
let that = this; let that = this;
let {dispatch} = this.props; let {dispatch} = this.props;
on(CONFIG.socketType.GETSTOREINFO,this,function (data) { on(CONFIG.socketType.GETSTOREINFO,this,function (data) {
console.log("==GETSTOREINFO===")
console.log(data);
dispatch(saveCommonInfo({ip:data.ip})); dispatch(saveCommonInfo({ip:data.ip}));
dispatch(getStoreInfo(data.storeId)); dispatch(getStoreInfo(data.storeId));
...@@ -155,12 +153,8 @@ class PageContainer extends React.Component { ...@@ -155,12 +153,8 @@ class PageContainer extends React.Component {
// dispatch(saveCommonInfo({userInfo:{employeeId:9}})); // dispatch(saveCommonInfo({userInfo:{employeeId:9}}));
// dispatch(getUserinfo(9,13)) // dispatch(getUserinfo(9,13))
// dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:'A'}}))) // dispatch(saveCommonInfo(Object.assign({},{taskInfo:{area:'A'}})))
// dispatch(saveCommonInfo({userInfo:{employeeId:20}}));
// dispatch(getUserinfo(20,data.storeId));
}); });
on(CONFIG.socketType.GETSOCKETMSG,this,function (data) { on(CONFIG.socketType.GETSOCKETMSG,this,function (data) {
console.log("==GETSTOREINFO===")
console.log(data)
that.getSocketMsg(data) that.getSocketMsg(data)
}); });
// on(CONFIG.socketType.SOCKETERROR,this,()=>{ // on(CONFIG.socketType.SOCKETERROR,this,()=>{
...@@ -185,19 +179,14 @@ class PageContainer extends React.Component { ...@@ -185,19 +179,14 @@ class PageContainer extends React.Component {
let {dispatch,state} = this.props; let {dispatch,state} = this.props;
let {isSend , area} = this.state; let {isSend , area} = this.state;
data.isSend = isSend; data.isSend = isSend;
this.showError(JSON.stringify(data));
console.log(data,'kldasjdkljaskljdklsjakldjkla')
switch (data.type){ switch (data.type){
case 'SUCCESS_OPENDOOR': case 'SUCCESS_OPENDOOR':
this.showError(JSON.stringify(data));
//执行开门 //执行开门
let info = data.info; let info = data.info;
let commonInfo = state.commonInfo; let commonInfo = state.commonInfo;
console.log("SUCCESS_OPENDOOR " ,info);
let {userinfo} = info; let {userinfo} = info;
let datas = info.data; let datas = info.data;
let {storeInfo} = commonInfo; let {storeInfo} = commonInfo;
console.log("========= ",userinfo,storeInfo)
if(storeInfo && userinfo && if(storeInfo && userinfo &&
storeInfo.id && userinfo.employeeId storeInfo.id && userinfo.employeeId
){ ){
...@@ -216,22 +205,7 @@ class PageContainer extends React.Component { ...@@ -216,22 +205,7 @@ class PageContainer extends React.Component {
break; break;
case 'SUCCESS_CLOSEDOOR': case 'SUCCESS_CLOSEDOOR':
if(isSend){ if(isSend){
// if(area==="A"){ //this.handleCloseDoor()
// if(data.info.left_tread===1){
// //关门成功
// this.handleCloseDoor()
// }else{
// sendMsg(JSON.stringify({type:'WILL_CLOSEDOOR'}))
// }
// }else if(area==="B"){
// if(data.info.right_tread===1){
// //关门成功
// this.handleCloseDoor()
// }else{
// sendMsg(JSON.stringify({type:'WILL_CLOSEDOOR'}))
// }
// }
this.handleCloseDoor()
} }
break; break;
...@@ -239,9 +213,9 @@ class PageContainer extends React.Component { ...@@ -239,9 +213,9 @@ class PageContainer extends React.Component {
} }
handleCloseDoor(){ handleCloseDoor(){
let {dispatch,state} = this.props; let {dispatch,state} = this.props;
console.log("closedoor");
dispatch(logout()); dispatch(logout());
// this.endCountBack(); // this.endCountBack();
// remove(CONFIG.socketType.GETSTOREINFO,this) // remove(CONFIG.socketType.GETSTOREINFO,this)
...@@ -263,7 +237,6 @@ class PageContainer extends React.Component { ...@@ -263,7 +237,6 @@ class PageContainer extends React.Component {
componentDidUpdate() { componentDidUpdate() {
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
console.log("componentWillReceiveProps")
let {state,dispatch} = nextProps; let {state,dispatch} = nextProps;
let nextCommonInfo = state.commonInfo; let nextCommonInfo = state.commonInfo;
let nextUserInfo = nextCommonInfo.userInfo || {}; let nextUserInfo = nextCommonInfo.userInfo || {};
...@@ -275,7 +248,6 @@ class PageContainer extends React.Component { ...@@ -275,7 +248,6 @@ class PageContainer extends React.Component {
) || ( ) || (
userInfo.taskType !== nextUserInfo.taskType userInfo.taskType !== nextUserInfo.taskType
)){ )){
console.log("componentWillReceiveProps in ",nextUserInfo);
//如果不是同一个用户或者不是同一个任务,会再次进入 //如果不是同一个用户或者不是同一个任务,会再次进入
this.dealPageByType(nextUserInfo.taskType); this.dealPageByType(nextUserInfo.taskType);
} }
...@@ -289,7 +261,6 @@ class PageContainer extends React.Component { ...@@ -289,7 +261,6 @@ class PageContainer extends React.Component {
if(nextUserInfo.taskType === "SECOND" && nextTaskInfo && nextTaskInfo.currentTaskType && if(nextUserInfo.taskType === "SECOND" && nextTaskInfo && nextTaskInfo.currentTaskType &&
nextTaskInfo.currentTaskType !== lastCurrentType nextTaskInfo.currentTaskType !== lastCurrentType
){ ){
console.log("SECOND")
switch (nextTaskInfo.currentTaskType) { switch (nextTaskInfo.currentTaskType) {
case 'LR' : case 'LR' :
this.changePages(CONFIG.showPage[5]); this.changePages(CONFIG.showPage[5]);
...@@ -337,7 +308,6 @@ class PageContainer extends React.Component { ...@@ -337,7 +308,6 @@ class PageContainer extends React.Component {
} }
hideError(){ hideError(){
console.log("hideError");
let {dispatch} = this.props; let {dispatch} = this.props;
dispatch(addErrorInfo("")); dispatch(addErrorInfo(""));
this.hidePopup(); this.hidePopup();
...@@ -352,7 +322,6 @@ class PageContainer extends React.Component { ...@@ -352,7 +322,6 @@ class PageContainer extends React.Component {
} }
showTroublePage(info){ showTroublePage(info){
console.log("showTroublePage ",info)
let {dispatch} = this.props; let {dispatch} = this.props;
dispatch(getTroubleList(info)) dispatch(getTroubleList(info))
this.setState({ this.setState({
...@@ -368,7 +337,6 @@ class PageContainer extends React.Component { ...@@ -368,7 +337,6 @@ class PageContainer extends React.Component {
}) })
} }
changePages(page){ changePages(page){
console.log("changePages : ",page);
this.setState({ this.setState({
showPage : page, showPage : page,
popupInfo : defaultPopupInfo popupInfo : defaultPopupInfo
...@@ -385,7 +353,6 @@ class PageContainer extends React.Component { ...@@ -385,7 +353,6 @@ class PageContainer extends React.Component {
} }
endCountBack(){ endCountBack(){
console.log("endCountBack")
this.countBackTime = -1; this.countBackTime = -1;
clearTimeout(this.countbackTimer); clearTimeout(this.countbackTimer);
this.countbackTimer = null; this.countbackTimer = null;
...@@ -455,8 +422,6 @@ class PageContainer extends React.Component { ...@@ -455,8 +422,6 @@ class PageContainer extends React.Component {
//弹出警告弹窗,并报警 //弹出警告弹窗,并报警
showAlarm(){ showAlarm(){
console.log("showAlarm");
//屏幕超过300s无人操作 //屏幕超过300s无人操作
this.uploadErrs(errorType[1]) this.uploadErrs(errorType[1])
let btnWidth = UTILPATH.getRemByPx(260); let btnWidth = UTILPATH.getRemByPx(260);
...@@ -482,7 +447,6 @@ class PageContainer extends React.Component { ...@@ -482,7 +447,6 @@ class PageContainer extends React.Component {
//关门 //关门
beginCloseDoor(){ beginCloseDoor(){
console.log("beginCloseDoor");
let btnWidth = UTILPATH.getRemByPx(260); let btnWidth = UTILPATH.getRemByPx(260);
let btnMarginLeft = UTILPATH.getRemByPx(30); let btnMarginLeft = UTILPATH.getRemByPx(30);
let btnBorderRadius = UTILPATH.getRemByPx(10); let btnBorderRadius = UTILPATH.getRemByPx(10);
...@@ -528,7 +492,6 @@ class PageContainer extends React.Component { ...@@ -528,7 +492,6 @@ class PageContainer extends React.Component {
playAlarmMusic(){ playAlarmMusic(){
//播放警报音乐 //播放警报音乐
console.log("playMusic");
let music = this.refs.audioplay; let music = this.refs.audioplay;
if(music){ if(music){
music.play(); music.play();
...@@ -555,7 +518,6 @@ class PageContainer extends React.Component { ...@@ -555,7 +518,6 @@ class PageContainer extends React.Component {
showOpenDoorPage(){ showOpenDoorPage(){
console.log("showOpenDoorPage")
this.setState({ this.setState({
showPage : showPage[7], showPage : showPage[7],
showClock : true showClock : true
...@@ -570,8 +532,9 @@ class PageContainer extends React.Component { ...@@ -570,8 +532,9 @@ class PageContainer extends React.Component {
//二期临时退出 //二期临时退出
tempLogout(){ tempLogout(){
let {dispatch} = this.props; let {dispatch,state} = this.props;
dispatch(logout()); let {commonInfo={}} = state;
dispatch(willCloseDoor(commonInfo));
this.hidePopup(); this.hidePopup();
this.setState({ this.setState({
showPage : showPage[initPage], showPage : showPage[initPage],
...@@ -722,7 +685,7 @@ class PageContainer extends React.Component { ...@@ -722,7 +685,7 @@ class PageContainer extends React.Component {
showOpenDoorPage={()=>this.showOpenDoorPage.bind(this)()} showOpenDoorPage={()=>this.showOpenDoorPage.bind(this)()}
showPopup={(info)=>this.showPopup(info)} showPopup={(info)=>this.showPopup(info)}
hidePopup={()=>this.hidePopup()} hidePopup={()=>this.hidePopup()}
// tempLogout={()=>this.tempLogout.bind(this)()} tempLogout={()=>this.tempLogout.bind(this)()}
willCloseDoor={()=>{dispatch(willCloseDoor(commonInfo))}} willCloseDoor={()=>{dispatch(willCloseDoor(commonInfo))}}
changeIsSend ={this.changeIsSend.bind(this)} changeIsSend ={this.changeIsSend.bind(this)}
/>; />;
...@@ -752,6 +715,7 @@ class PageContainer extends React.Component { ...@@ -752,6 +715,7 @@ class PageContainer extends React.Component {
hidePopup={()=>this.hidePopup()} hidePopup={()=>this.hidePopup()}
willCloseDoor={()=>{dispatch(willCloseDoor(commonInfo))}} willCloseDoor={()=>{dispatch(willCloseDoor(commonInfo))}}
closeDoor={true} closeDoor={true}
tempLogout={()=>this.tempLogout.bind(this)()}
/>; />;
break; break;
case showPage[6]: case showPage[6]:
...@@ -837,7 +801,6 @@ class PageContainer extends React.Component { ...@@ -837,7 +801,6 @@ class PageContainer extends React.Component {
handleTouch(){ handleTouch(){
console.log("handleTouch");
this.countBackTime = this.maxCountBackTime; this.countBackTime = this.maxCountBackTime;
} }
......
...@@ -23,8 +23,6 @@ export default class QuestionContainer extends React.Component{ ...@@ -23,8 +23,6 @@ export default class QuestionContainer extends React.Component{
handleNoQuestion(){ handleNoQuestion(){
console.log("handleNoQuestion ",this.props);
console.log(CONFIG.showPage[131])
let {menuType = '',changePages} = this.props; let {menuType = '',changePages} = this.props;
if(menuType){ if(menuType){
this.context.goBackTask() this.context.goBackTask()
...@@ -36,7 +34,6 @@ export default class QuestionContainer extends React.Component{ ...@@ -36,7 +34,6 @@ export default class QuestionContainer extends React.Component{
render(){ render(){
let props = this.props; let props = this.props;
console.log(props)
let {headerInfo,menuType="",changePages} = props; let {headerInfo,menuType="",changePages} = props;
return( return(
......
...@@ -28,11 +28,9 @@ export default class RecoveryContainer extends React.Component{ ...@@ -28,11 +28,9 @@ export default class RecoveryContainer extends React.Component{
componentWillMount() { componentWillMount() {
let props = this.props; let props = this.props;
console.log("props ",this.props);
let {headerInfo = {}} = props; let {headerInfo = {}} = props;
let {taskList = {}} = headerInfo; let {taskList = {}} = headerInfo;
if(taskList && !taskList.whetherType){ if(taskList && !taskList.whetherType){
console.log("没有回收箱物品")
//没有回收箱物品 //没有回收箱物品
this.setState({ this.setState({
showPage : 2 showPage : 2
...@@ -43,8 +41,6 @@ export default class RecoveryContainer extends React.Component{ ...@@ -43,8 +41,6 @@ export default class RecoveryContainer extends React.Component{
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
let {hidePopup,headerInfo} = nextProps; let {hidePopup,headerInfo} = nextProps;
console.log("nextProps ",nextProps)
console.log("props ",this.props)
if(this.props.headerInfo && this.props.headerInfo.taskList && headerInfo && headerInfo.taskList){ if(this.props.headerInfo && this.props.headerInfo.taskList && headerInfo && headerInfo.taskList){
let oldTaskList = this.props.headerInfo.taskList; let oldTaskList = this.props.headerInfo.taskList;
let taskList = headerInfo.taskList; let taskList = headerInfo.taskList;
......
...@@ -31,11 +31,9 @@ export default class ReplenishContainer extends React.Component{ ...@@ -31,11 +31,9 @@ export default class ReplenishContainer extends React.Component{
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
console.log("componentWillReceiveProps ",nextProps);
} }
getPage(type){ getPage(type){
console.log("type ",type)
return (props)=>this[replenishPageIndex[type]](props) return (props)=>this[replenishPageIndex[type]](props)
} }
...@@ -75,7 +73,6 @@ export default class ReplenishContainer extends React.Component{ ...@@ -75,7 +73,6 @@ export default class ReplenishContainer extends React.Component{
render(){ render(){
console.log("render ",this.state.pageType,this.state.showScanQrcode);
let props = this.props; let props = this.props;
return ( return (
<div className={"replenishContainer page"}> <div className={"replenishContainer page"}>
......
...@@ -152,22 +152,17 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -152,22 +152,17 @@ export default class ScanBarCodeContainer extends React.Component{
"showQr":true, "showQr":true,
"qrUrl":tmpUrl "qrUrl":tmpUrl
},()=>{ },()=>{
console.log(this.state.qrUrl)
}) })
console.log("添加照片")
} }
handleDeleteImg(id){ handleDeleteImg(id){
console.log(id)
let {deleteImg,state} = this.props; let {deleteImg,state} = this.props;
let {scanBarCode} = state; let {scanBarCode} = state;
console.log(this.state.taskTy)
deleteImg(scanBarCode.inventorylossId,this.state.taskTy,id); deleteImg(scanBarCode.inventorylossId,this.state.taskTy,id);
} }
handleRefreshImg(data){ handleRefreshImg(data){
let {getRefreshImg,state} = this.props; let {getRefreshImg,state} = this.props;
let {scanBarCode} = state; let {scanBarCode} = state;
getRefreshImg(scanBarCode.inventorylossId,this.state.taskTy); getRefreshImg(scanBarCode.inventorylossId,this.state.taskTy);
console.log("刷新照片")
} }
//点击编辑报损的商品的提交按钮 //点击编辑报损的商品的提交按钮
handleSubmitProductInfo(data){ handleSubmitProductInfo(data){
...@@ -182,9 +177,7 @@ export default class ScanBarCodeContainer extends React.Component{ ...@@ -182,9 +177,7 @@ export default class ScanBarCodeContainer extends React.Component{
render() { render() {
let {state,headerInfo} = this.props; let {state,headerInfo} = this.props;
let productInfo = state.scanBarCode; let productInfo = state.scanBarCode;
console.log("popupInfo ",this.state.popupInfo);
let {popupText="",popupButtons=[],popupChild=null,showPopup=false} = this.state.popupInfo; let {popupText="",popupButtons=[],popupChild=null,showPopup=false} = this.state.popupInfo;
console.log("showPopup ",showPopup)
return ( return (
<div className={"scanBarCodeContainer"}> <div className={"scanBarCodeContainer"}>
{this.state.showQr?( {this.state.showQr?(
......
...@@ -100,9 +100,7 @@ class TakeStokeContaniner extends React.Component { ...@@ -100,9 +100,7 @@ class TakeStokeContaniner extends React.Component {
//核对产品数量 //核对产品数量
checkProductNum(){ checkProductNum(){
let {initNum}=this.state; let {initNum}=this.state;
console.log(initNum)
if(initNum!=='-'){ if(initNum!=='-'){
console.log(212)
let {workListId,skuPassId}=this.props.tokeTaskProduct; let {workListId,skuPassId}=this.props.tokeTaskProduct;
let tokeProductInfo={workListId,skuPassId,quantity:initNum} let tokeProductInfo={workListId,skuPassId,quantity:initNum}
this.props.checkProductQuantity(tokeProductInfo) this.props.checkProductQuantity(tokeProductInfo)
......
...@@ -60,7 +60,6 @@ export default class TroubleContainer extends React.Component{ ...@@ -60,7 +60,6 @@ export default class TroubleContainer extends React.Component{
} }
componentWillReceiveProps(nextProps){ componentWillReceiveProps(nextProps){
console.log("componentWillReceiveProps ",nextProps)
let {headerInfo} = this.props; let {headerInfo} = this.props;
let {taskList={}} = headerInfo; let {taskList={}} = headerInfo;
let nextHeaderInfo = nextProps.headerInfo; let nextHeaderInfo = nextProps.headerInfo;
......
...@@ -245,7 +245,6 @@ export default class TroubleContainer extends React.Component{ ...@@ -245,7 +245,6 @@ export default class TroubleContainer extends React.Component{
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 : [];
console.log(details);
let imgLength = details.map(d=>Array.isArray(d.files) ? d.files.length : 0).reduce((pre,next)=>{return pre + next},0); let imgLength = details.map(d=>Array.isArray(d.files) ? d.files.length : 0).reduce((pre,next)=>{return pre + next},0);
let dom = details.map((i,k)=>{ let dom = details.map((i,k)=>{
return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem} return <TroubleItem key={k} item={i} num={k+1} setItem={this.setItem}
......
...@@ -28,8 +28,7 @@ function renderPage(store) { ...@@ -28,8 +28,7 @@ function renderPage(store) {
} }
let store = activateVendor(); let store = activateVendor();
// UTILPATH.socket.init(129,17);
UTILPATH.socket.getIp1(); UTILPATH.socket.getIp1();
// UTILPATH.socket.getIp(); // UTILPATH.socket.getTestIp(182);
renderPage(store); renderPage(store);
\ No newline at end of file
...@@ -131,7 +131,6 @@ const NumChangeWord = (currentTaskType,childTaskNum)=>{ ...@@ -131,7 +131,6 @@ const NumChangeWord = (currentTaskType,childTaskNum)=>{
}; };
const getTaskName = (content,data)=>{ const getTaskName = (content,data)=>{
console.log(data,'这是打印改变任务名字的reducer')
let {currentTaskType,childTaskNum} = data; let {currentTaskType,childTaskNum} = data;
let taskName = NumChangeWord(currentTaskType,childTaskNum); let taskName = NumChangeWord(currentTaskType,childTaskNum);
let taskInfo = Object.assign({},{taskName}); let taskInfo = Object.assign({},{taskName});
......
...@@ -32,7 +32,6 @@ function initSuccess(state,data) { ...@@ -32,7 +32,6 @@ function initSuccess(state,data) {
return newInfo; return newInfo;
} }
function addNewProblem(state,data) { function addNewProblem(state,data) {
console.log(data);
let feed = data.feed; let feed = data.feed;
let temObj = {}; let temObj = {};
temObj.id = feed.id; temObj.id = feed.id;
...@@ -49,8 +48,6 @@ function addNewProblem(state,data) { ...@@ -49,8 +48,6 @@ function addNewProblem(state,data) {
return newInfo; return newInfo;
} }
function deleteProblemItem(state,data) { function deleteProblemItem(state,data) {
console.log('==================data===========');
console.log(data);
let feedId = data.feedIds; let feedId = data.feedIds;
if(feedId){ if(feedId){
delete allFeeds[feedId] delete allFeeds[feedId]
...@@ -62,8 +59,6 @@ function deleteProblemItem(state,data) { ...@@ -62,8 +59,6 @@ function deleteProblemItem(state,data) {
return newInfo; return newInfo;
} }
function submitProblemList(state,data) { function submitProblemList(state,data) {
console.log("=================reducers==============")
console.log(data)
let newInfo = Object.assign({},state,data); let newInfo = Object.assign({},state,data);
return newInfo; return newInfo;
} }
...@@ -72,10 +67,7 @@ function submitProblemList(state,data) { ...@@ -72,10 +67,7 @@ function submitProblemList(state,data) {
function editProblem(state,data) { function editProblem(state,data) {
console.log(data);
let problemId = data.troubelId; let problemId = data.troubelId;
console.log("=====================problemId");
console.log(problemId)
let type = data.type; let type = data.type;
let currentProblemObj = allFeeds[problemId]; let currentProblemObj = allFeeds[problemId];
if(type == "remark"){ if(type == "remark"){
...@@ -97,10 +89,8 @@ function editProblem(state,data) { ...@@ -97,10 +89,8 @@ function editProblem(state,data) {
return state; return state;
} }
function setProblem(state,data) { function setProblem(state,data) {
console.log(data);
} }
function setRemark(state,data) { function setRemark(state,data) {
console.log(data)
} }
export default function(state={}, action) { export default function(state={}, action) {
switch (action.type) { switch (action.type) {
......
import * as actionTypes from '../actiontype/reportDamage'; import * as actionTypes from '../actiontype/reportDamage';
function initDamgeListSuccess(state,data) { function initDamgeListSuccess(state,data) {
console.log("reportDamageList=============")
console.log(state);
let newInfo = Object.assign([],data); let newInfo = Object.assign([],data);
return newInfo; return newInfo;
} }
......
...@@ -2,9 +2,7 @@ let events = {}; ...@@ -2,9 +2,7 @@ let events = {};
const on = (name,self,callback)=>{ const on = (name,self,callback)=>{
let tuple = [self,callback]; let tuple = [self,callback];
console.log("on ",name,tuple)
let cb = events[name]; let cb = events[name];
console.log("on__",events,cb)
if(Array.isArray(cb)){ if(Array.isArray(cb)){
cb.push(tuple); cb.push(tuple);
}else { }else {
...@@ -14,10 +12,8 @@ const on = (name,self,callback)=>{ ...@@ -14,10 +12,8 @@ const on = (name,self,callback)=>{
const emit = (name,data)=>{ const emit = (name,data)=>{
let callbacks = events[name]; let callbacks = events[name];
console.log("emit ",name,callbacks)
if(Array.isArray(callbacks)){ if(Array.isArray(callbacks)){
callbacks.map((tuple)=>{ callbacks.map((tuple)=>{
console.log("tuple ",tuple);
let self = tuple[0]; let self = tuple[0];
let callback = tuple[1]; let callback = tuple[1];
callback.call(self,data); callback.call(self,data);
......
...@@ -12,56 +12,6 @@ let currentIpIndex = 255; ...@@ -12,56 +12,6 @@ let currentIpIndex = 255;
let ws = null; let ws = null;
let storeId = 0 let storeId = 0
const checkStatus = (response)=>{
if (response.status >= 200 && response.status < 300) {
return response;
}
const error = new Error(response.statusText);
error.response = response;
throw error;
};
const parseJson = (response)=>{
console.log("socket response ",response);
return response.json();
};
// socket.getIp = ()=>{
// console.log("getIp ",getIpING,currentIpIndex);
// if(!getIpING){
// getIpING = true;
// for(let i = 0; i < 255 ; i ++){
// let url = 'http://' + domainIp + i + ':9999/getmyid';
// if(currentIpIndex === 255 && getIpING){
// fetch( url ,{
// // credentials : 'include',
// method : 'GET',
// mode : 'cors',
// }).then(checkStatus)
// .then(parseJson)
// .then((data) => {
// console.error("data :",data,currentIpIndex,i);
// if(data.storeId && currentIpIndex === 255){
// init(i,data.storeId);
// }
// })
// .catch((err) =>{
// console.error("Err:",err);
// totalCount++;
// if(totalCount >= 255){
// totalCount = 0;
// currentIpIndex = 255;
// getIpING = false;
// socket.getIp();
// }
//
// });
// }
//
// }
// }
//
// };
socket.getIp1 = ()=>{ socket.getIp1 = ()=>{
if(!getIpING) { if(!getIpING) {
getIpING = true; getIpING = true;
...@@ -70,9 +20,7 @@ socket.getIp1 = ()=>{ ...@@ -70,9 +20,7 @@ socket.getIp1 = ()=>{
let ws1 = new WebSocket(wsUrl); let ws1 = new WebSocket(wsUrl);
ws1.onopen = function() ws1.onopen = function()
{ {
console.log("ok ")
if(currentIpIndex === 255){ if(currentIpIndex === 255){
console.log("ip ",j);
currentIpIndex = j; currentIpIndex = j;
// ws1.close(); // ws1.close();
}else{ }else{
...@@ -82,7 +30,6 @@ socket.getIp1 = ()=>{ ...@@ -82,7 +30,6 @@ socket.getIp1 = ()=>{
}; };
ws1.onmessage = (evt)=>{ ws1.onmessage = (evt)=>{
if(currentIpIndex !== 255){ if(currentIpIndex !== 255){
console.log('onmessage ',currentIpIndex,evt.data);
let info = JSON.parse(evt.data); let info = JSON.parse(evt.data);
if(info.type === 'GET_STORE_ID' && info.data){ if(info.type === 'GET_STORE_ID' && info.data){
ws1.close(); ws1.close();
...@@ -93,9 +40,7 @@ socket.getIp1 = ()=>{ ...@@ -93,9 +40,7 @@ socket.getIp1 = ()=>{
}; };
ws1.onerror = function (err) { ws1.onerror = function (err) {
totalCount++; totalCount++;
console.log("totalCount ",totalCount)
if(totalCount >= 255){ if(totalCount >= 255){
console.log("totalCount inin")
totalCount = 0; totalCount = 0;
currentIpIndex = 255; currentIpIndex = 255;
getIpING = false; getIpING = false;
...@@ -107,30 +52,31 @@ socket.getIp1 = ()=>{ ...@@ -107,30 +52,31 @@ socket.getIp1 = ()=>{
} }
// socket.getStoreIdByIp = (ip) => {
// let url = 'http://' + domainIp + ip + ':9999/getmyid'; socket.getTestIp = (ip) => {
// fetch( url ,{ let wsUrl = 'ws://' + domainIp + ip + ':7788/notify?from=plant';
// // credentials : 'include', let ws1 = new WebSocket(wsUrl);
// method : 'GET', ws1.onopen = function()
// mode : 'cors', {
// }).then(checkStatus) if(currentIpIndex === 255){
// .then(parseJson) currentIpIndex = ip;
// .then((data) => { // ws1.close();
// console.log("socket data ",data); }else{
// if(data.storeId){ ws1.close();
// init(ip,data.storeId,true); }
// }
// }) };
// .catch((err) =>{ ws1.onmessage = (evt)=>{
// console.error("Err:",err); if(currentIpIndex !== 255){
// if(!getIpING){ let info = JSON.parse(evt.data);
// console.log("getStoreIdByIp=======") if(info.type === 'GET_STORE_ID' && info.data){
// currentIpIndex = 255; ws1.close();
// totalCount = 0; init(currentIpIndex,info.data,true);
// socket.getIp1(); }
// } }
// });
// } };
}
const getError = ()=>{ const getError = ()=>{
...@@ -143,7 +89,6 @@ const getClose = ()=>{ ...@@ -143,7 +89,6 @@ const getClose = ()=>{
//如果有currentIp就没有必要再次循环 //如果有currentIp就没有必要再次循环
ws = null; ws = null;
if(!getIpING){ if(!getIpING){
console.log("socket close========");
currentIpIndex = 255; currentIpIndex = 255;
totalCount = 0; totalCount = 0;
storeId = 0; storeId = 0;
...@@ -156,10 +101,7 @@ const getClose = ()=>{ ...@@ -156,10 +101,7 @@ const getClose = ()=>{
const init = (ip,storeid,from = false)=>{ const init = (ip,storeid,from = false)=>{
let wsUrl = 'ws://' + domainIp + ip + ':7788/notify?from=plant&storeId=' + storeid; let wsUrl = 'ws://' + domainIp + ip + ':7788/notify?from=plant&storeId=' + storeid;
console.log("init :" ,wsUrl);
console.log("========= ","WebSocket" in window,ws,ip,storeid,currentIpIndex,from)
if("WebSocket" in window && !ws && ip && storeid && (currentIpIndex === 255 || from)){ if("WebSocket" in window && !ws && ip && storeid && (currentIpIndex === 255 || from)){
console.log("in websocket");
ws = new WebSocket(wsUrl); ws = new WebSocket(wsUrl);
ws.onopen = function() ws.onopen = function()
...@@ -169,21 +111,18 @@ const init = (ip,storeid,from = false)=>{ ...@@ -169,21 +111,18 @@ const init = (ip,storeid,from = false)=>{
currentIpIndex = ip; currentIpIndex = ip;
storeId = storeid; storeId = storeid;
getIpING = false; getIpING = false;
console.log("open");
emit(CONFIG.socketType.GETSTOREINFO,{ip:domainIp+ip,storeId:storeid}) emit(CONFIG.socketType.GETSTOREINFO,{ip:domainIp+ip,storeId:storeid})
}; };
ws.onmessage = function (evt) ws.onmessage = function (evt)
{ {
var received_msg = JSON.parse(evt.data); //String var received_msg = JSON.parse(evt.data); //String
console.log("数据已接收...");
emit(CONFIG.socketType.GETSOCKETMSG,received_msg); emit(CONFIG.socketType.GETSOCKETMSG,received_msg);
}; };
ws.onclose = function(err) ws.onclose = function(err)
{ {
// 关闭 websocket // 关闭 websocket
console.log("close : ",err);
emit(CONFIG.socketType.SOCKETERROR,""); emit(CONFIG.socketType.SOCKETERROR,"");
getClose(); getClose();
}; };
......
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