Commit de45c121 by Zhang Xin

填添加首é¡故障离åˆ列表»辑

parent 144150e6
......@@ -2,7 +2,7 @@ import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/store'
const domain = ENV.domain;
let mock = {
let json = {
"meta": {
"code": "200",
"message": "成功",
......@@ -37,7 +37,12 @@ const getStoreInfo = ()=>{
// .then(json=>{
// console.log(json);
// }).catch(e=>{console.error(e)})
dispatch(saveStoreInfo(mock.data))
if(json.meta.success && json.data.warehouse){
dispatch(saveStoreInfo(json.data.warehouse))
}else{
}
}
}
......
import fetch from 'isomorphic-fetch';
import actionTypes from '../actiontype/trouble'
import userActionTypes from "../actiontype/user";
const domain = ENV.domain;
let mock = {
let json = {
"meta": {
"code": "200",
"message": "成功",
......@@ -55,7 +56,7 @@ let mock = {
"employee": {
"id": 5,
"employeeName": "机器库管员",
"headImageUrl": "/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
"headImageUrl": "http://www.mjitech.com/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
},
"taskIds": [
155
......@@ -70,6 +71,15 @@ const saveTroubleList = (data)=>{
}
};
const saveUserInfo = (data)=>{
return{
type : userActionTypes.SAVEUSERINFO,
data
}
}
const getTroubleList = ()=>{
return(dispatch)=>{
// fetch(domain + '/web/pad_warehouse/getMachineData.action',{
......@@ -82,7 +92,14 @@ const getTroubleList = ()=>{
// .then(json=>{
// console.log(json);
// }).catch(e=>{console.error(e)})
dispatch(saveTroubleList(mock.data))
if(json.meta.success && json.data){
if(json.data.employee){
//存储用户信息
dispatch(saveUserInfo(json.data.employee));
}
dispatch(saveTroubleList(json.data))
}
}
}
......
const actionTypes = {
SAVEUSERINFO : 'SAVEUSERINFO',
}
export default actionTypes
\ No newline at end of file
import React from 'react';
require('./index.css')
const headerStatus = {
1 : 'home',
2 : 'other'
}
const headerStatus = CONFIG.headerStatus;
export default class HeaderComponent extends React.Component{
constructor(props){
super(props);
this.getHomeHeader = this.getHomeHeader.bind(this);
this.getOtherHeader = this.getOtherHeader.bind(this);
this.state = {
showHeader : headerStatus[2]
showHeader : headerStatus[1]
}
}
componentWillReceiveProps(nextProps){
}
getHeader(){
let pages = null;
switch (this.state.showHeader){
let {showHeader} = this.props;
switch (showHeader){
case headerStatus[1]:
pages = this.getHomeHeader();
break;
case headerStatus[2]:
pages = this.getOtherHeader();
pages = this.props.children;
break;
}
......@@ -29,40 +30,66 @@ export default class HeaderComponent extends React.Component{
}
getHomeHeader(){
return <div className={"homeHeader clearfix"}>
<div className={"headerContent leftContent fl"}>
<div className={"headerlogo"}>
<img className={"logoImg"} src={UTILPATH.localImg.headlogo} alt=""/>
</div>
<div className={"locationInfo"}>
<img className={"addIcon"} src={UTILPATH.localImg.addIcon} alt=""/>
<div className={"local colfff"}>
<p className={"font30"}>华贸商业街</p>
<p className={"font24"}>ID : 001</p>
</div>
</div>
</div>
let {storeInfo,userinfo} = this.props;
return (
<div className={"homeHeader clearfix"}>
{
storeInfo ? <div className={"headerContent leftContent fl"}>
<div className={"headerlogo"}>
<img className={"logoImg"} src={UTILPATH.localImg.headlogo} alt=""/>
</div>
<div className={"locationInfo"}>
<img className={"addIcon"} src={UTILPATH.localImg.addIcon} alt=""/>
<div className={"local colfff"}>
<p className={"font30"}>{storeInfo.name}</p>
<p className={"font24"}>ID : 001</p>
</div>
</div>
</div> : null
}
<div className={"headerContent rightContent fr"}>
<img className={"userheadImg"} src={UTILPATH.localImg.defaultImg} alt=""/>
<div className={"userinfo font24 colfff"}>
<p>李大仁</p>
<p>ID:001</p>
</div>
{
userinfo ? <div className={"headerContent rightContent fr " + (userinfo.id ? '' : 'hide')}>
<img className={"userheadImg"} src={ userinfo.headImageUrl || UTILPATH.localImg.defaultImg} alt=""/>
<div className={"userinfo font24 colfff"}>
<p>{userinfo.employeeName || ''}</p>
<p>ID:{userinfo.id || 0}</p>
</div>
</div> : null
}
</div>
</div>
)
}
getOtherHeader(){
let {headerIconList} = this.props;
return <div className={"otherHeader font32 clearfix"}>
<div className={"fl colfff"}>
<i className={"iconfont middle icon font58 icon-circle-left circleIcon"}></i>
<span className={"middle"}>检查编辑结果</span>
</div>
<div className={"fr col999"}>
<i className={"iconfont middle icon font60 icon-save saveIcon"}></i>
<span className={"middle"}>保存</span>
</div>
{
headerIconList ? headerIconList.map((info,index)=>{
let dom = null;
if(index === 0){
dom = (
<div className={"fl colfff"} onClick={()=>info.option()}>
<i className={"iconfont middle icon font58 icon-circle-left circleIcon"}></i>
<span className={"middle"}>{info.text || ''}</span>
</div>
)
}else if(index ===1){
dom = (
<div className={"fr "+(info.active ? 'colff7860':'col999')} onClick={()=>info.option()}>
<i className={"iconfont middle icon font60 icon-save saveIcon"}></i>
<span className={"middle"}>{info.text || ''}</span>
</div>
)
}
return dom;
}) : null
}
</div>
}
......
......@@ -38,7 +38,7 @@
.headerComponent .homeHeader .headerlogo .logoImg{
position: absolute;
top: 50%;
left: 40%;
left: 44%;
transform: translate(-50%,-50%);
}
.headerComponent .homeHeader .locationInfo{
......
......@@ -19,7 +19,7 @@ export default class PopupComponent extends React.Component{
return (
<div className={"defaultPopup col333"}>
<div className={"defaultPopupText font30"}>
{this.props.text}
{popupInfo.popupText}
</div>
<div className={"defaultPopupButtons font32"}>
{dom}
......
......@@ -8,31 +8,54 @@ export default class TroubleItemComponent extends React.Component{
}
}
getDes(item){
let des = "";
switch (item.type){
case 'KN':
des = item.description || '';
break;
case 'OP':
des = `${item.parentProblemName || ''} ${item.subProblemName || ''}`;
break;
}
return des;
}
render(){
let props = this.props;
let item = props.item ? props.item : {};
let description = this.getDes(item);
return (
<div className={"troubleItemComponent"}>
<div className={"finishBox"}>
<div className={"finishText colfff font24"}>已处理</div>
</div>
<div className={"itemText font32"}>故障问题1:故障ID-00001</div>
<div className={"itemText font32"}>故障问题{props.num || 0}:故障ID-{item.errorCode || ''}</div>
<div className={"itemWrongInfo font24 col999"}>
<p>2:3 左侧动作故障,取货动作出错</p>
<p>{description}</p>
</div>
<div className={"jugdeQuestion font32 rel"}>
<span className={"colff7860 font32 star"}>*</span>
<span>是否有此问题</span>
<div className={"questionBox border_e5"}></div>
<div className={"questionBox border_e5"}></div>
<div className={"questionBox border_e5 "+(item.isExistProblem && parseInt(item.isExistProblem) === 1 ? 'active':'')}
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)}
></div>
</div>
<div className={"itemTextArea rel font24"}>
<div className={"itemTextEdit font24 colff7860"}>
<div className={"itemTextEdit font24 colff7860"} onClick={()=>props.showText(item.errorCode)}>
<span className={"iconfont font24 icon icon-editor-line colff7860"}></span>
<span> 编辑</span>
</div>
<span className={"colff7860 font32 star"}>*</span>
<div className={"itemTextAreaBox col999 border_e5"}>
<div className={"itemTextAreaBox col999 border_e5"} onClick={()=>props.showText(item.errorCode)}>
{
this.state.text ? <textarea readOnly className={"itemTextAreaBoxs col999"} value={this.state.text}></textarea> :
item.explanation ? <textarea readOnly className={"itemTextAreaBoxs col999"} value={item.explanation}></textarea> :
<span className={"itemPlayceHolder"}>编辑检查结果</span>
}
......
import swiperContainers from './swiperContainer'
import showPage from './showPage'
module.exports = {swiperContainers}
\ No newline at end of file
module.exports = {swiperContainers,...showPage}
\ No newline at end of file
const showPage = {
1 : 'Trouble',
2 : 'Scan',
3 : 'DamageProductList',
4 : 'OtherQuestionUpload',
5 : 'TextArea',
6 : 'Qrcode',
7 : 'Home',
8 : 'FinishAsk',
9 : 'ChooseTask'
};
const headerStatus = {
1 : 'home',
2 : 'other'
}
module.exports = {showPage,headerStatus};
\ No newline at end of file
......@@ -5,7 +5,6 @@ import { connect } from 'react-redux';
import {getStoreInfo} from "../../actions/getStore";
import {getTroubleList} from "../../actions/getTroubles";
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import PopupComponent from '../../components/CommonComponent/PopupComponent/PopupComponent'
import TroubleContainer from '../TroubleContainer/TroubleContainer'
import TextAreaContainer from '../TextAreaContainer/TextAreaContainer'
......@@ -19,17 +18,8 @@ import Qrcode from '../Qrcode/Qrcode'
require('./index.css')
const showPage = {
1 : 'Trouble',
2 : 'Scan',
3 : 'DamageProductList',
4 : 'OtherQuestionUpload',
5 : 'TextArea',
6 : 'Qrcode',
7 : 'Home',
8 : 'FinishAsk',
9 : 'ChooseTask'
}
const showPage = CONFIG.showPage;
const headerStatus = CONFIG.headerStatus;
const defaultPopupInfo = {
......@@ -46,20 +36,27 @@ class PageContainer extends React.Component {
// UTILPATH.socket.getIp();
this.state = {
showPage : showPage[1],
lastPage : '',
page : null,
popupInfo : defaultPopupInfo,
pageStyle : {
// 'backgroundColor' : '#ffffff'
}
},
lastPageStyle:{
},
};
this.getPages = this.getPages.bind(this);
this.showPopup = this.showPopup.bind(this);
this.hidePopup = this.hidePopup.bind(this);
this.showQrCode = this.showQrCode.bind(this);
this.saveLastPage = this.saveLastPage.bind(this);
this.goBack = this.goBack.bind(this);
}
componentWillMount() {
let {dispatch} = this.props;
dispatch(getStoreInfo());
dispatch(getTroubleList());
let pages = this.getPages();
this.setState({
page : pages
......@@ -96,11 +93,48 @@ class PageContainer extends React.Component {
})
}
showQrCode(url){
this.setState({
showPage: showPage[5],
tempInfo : {
text : text,
url : url
}
})
}
saveLastPage(page,pageStyle){
this.setState({
lastPage : page,
lastPageStyle : pageStyle
})
}
goBack(){
console.log("goback")
let lastPage = this.state.lastPage;
let pageStyle = this.state.lastPageStyle;
this.setState({
showPage: lastPage,
pageStyle : pageStyle
})
}
getPages(){
let pages = null;
let {state,dispatch} = this.props;
switch (this.state.showPage){
case showPage[1]:
pages = <TroubleContainer />;
pages = <TroubleContainer
troubleList={state.troubleList}
storeInfo={state.storeInfo}
userInfo={state.userInfo}
initTroubleList={()=>dispatch(getTroubleList())}
showTextArea={(text)=>this.showTextArea(text)}
/>;
break;
case showPage[2]:
pages = <ScanBarCodeContainer />;
......@@ -111,9 +145,6 @@ class PageContainer extends React.Component {
case showPage[4]:
pages = <OtherQuestionContainer />;
break;
case showPage[5]:
pages = <TextAreaContainer />;
break;
case showPage[6]:
pages = <Qrcode />;
break;
......@@ -131,11 +162,12 @@ class PageContainer extends React.Component {
}
render() {
let {state} = this.props;
return (
<div className={"pageContainer "} style={this.state.pageStyle}>
<HeaderComponent />
<PopupComponent popupInfo={this.state.popupInfo} />
{this.state.page}
{this.getPages()}
</div>
)
}
......
.pageContainer{
position: relative;
height: 956px;
height: 945px;
width: 1920px;
}
.pageContainer.backColfff{
......
import React from 'react';
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
require('./index.css');
export default class TextAreaContainer extends React.Component{
......@@ -7,24 +8,57 @@ export default class TextAreaContainer extends React.Component{
this.state = {
text : ''
}
this.getOtherHeader = this.getOtherHeader.bind(this);
this.saveText = this.saveText.bind(this);
}
componentWillReceiveProps(nextProps){
let text = nextProps.text ? nextProps.text : ''
componentWillMount() {
let {text} = this.props;
this.setState({
text : text
})
}
handleChange(e){
let value = e.target.value
let value = e.target.value;
this.setState({text: value});
}
saveText(){
if(this.state.text){
this.props.saveText(this.state.text)
}
}
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 className={"fr "+(this.state.text ? 'colff7860':'col999')} onClick={()=>this.saveText()}>
<i className={"iconfont middle icon font60 icon-save saveIcon"}></i>
<span className={"middle"}>保存</span>
</div>
</div>
}
render(){
return (
<div className={"textAreaContainer"}>
<div className={"textAreaDiv font30 col999"} >
<textarea className={"textAreaBox font30 col999"} name="" id="" cols="30" rows="10" onChange={this.handleChange.bind(this)} value={this.state.text} placeholder={"点击输入"}></textarea>
<div>
<HeaderComponent
showHeader={CONFIG.headerStatus[2]}
>
{this.getOtherHeader()}
</HeaderComponent>
<div className={"textAreaContainer"}>
<div className={"textAreaDiv font30 col999"} >
<textarea className={"textAreaBox font30 col999"} name="" id="" cols="30" rows="10" onChange={this.handleChange.bind(this)} value={this.state.text} placeholder={"点击输入"}></textarea>
</div>
</div>
</div>
)
}
}
......@@ -2,21 +2,66 @@ 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";
require('./index.css')
export default class TroubleContainer extends React.Component{
export default class TroubleContainer extends React.Component{
constructor(props){
super(props);
this.state = {
showTrouble : false
}
showTrouble : true,
troubleList : {},
currentErrorCode : 0,
showTextArea : false,
tmpText : ''
};
this.setItem = this.setItem.bind(this);
this.showText = this.showText.bind(this);
this.goBack = this.goBack.bind(this);
this.saveText = this.saveText.bind(this);
}
dealTrouble(){
let troubleList = this.state.troubleList;
let details = troubleList.details;
let arr = details.filter(d=>{
})
this.setState({
showTrouble : false
})
}
componentWillMount(){
let {initTroubleList} = this.props;
initTroubleList();
}
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 troubleErrorCodeListStr = troubleErrorCodeList.join(",");
let nowtroubleErrorCodeListStr = nowtroubleErrorCodeList.join(",");
if(
troubleErrorCodeListStr !== nowtroubleErrorCodeListStr
){
this.setState({
troubleList : troubleList
})
}
}
haveNext(){
console.log("有")
}
......@@ -25,44 +70,109 @@ export default class TroubleContainer extends React.Component{
console.log("没有")
}
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)
this.setState({
currentErrorCode : errcode,
showTextArea : true,
tmpText: text
})
}
}
setItem(errcode,option,info){
let troubleList = this.state.troubleList;
let details = troubleList.details;
let index = details.findIndex(d=>d.errorCode === errcode);
if(index > -1){
details[index][option] = info;
}
this.setState({
troubleList : troubleList,
},()=>{
this.goBack()
})
}
saveText(text){
let errcode = this.state.currentErrorCode;
this.setItem(errcode,'explanation',text);
}
goBack(){
this.setState({
currentErrorCode : 0,
showTextArea : false,
tmpText: ''
})
}
render(){
let arr = [1,2,3,4];
let dom = arr.map((i,k)=>{
return <TroubleItem key={k}/>;
let {userInfo,storeInfo} = 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}/>;
});
let swiperOptions = {
width : 1396,
spaceBetween: 30,
freeMode:true,
// slidesPerView: 2.6,
};
let swiperContainer = CONFIG.swiperContainers.troubleSwiperContainer;
let swiperCount = arr.length;
let swiperCount = details.length;
return (
<div className={"toubleContainers"}>
<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>
{
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>
</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>
</div>
</div>
</div>
</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>
</div>
}
</div>
)
}
......
......@@ -28,4 +28,6 @@ function renderPage(store) {
}
let store = activateVendor();
renderPage(store);
\ No newline at end of file
import { combineReducers } from 'redux'
import trouble from './trouble'
import troubleList from './trouble'
import storeInfo from './store'
import scanBarCodeContainer from './scanBarCodeContainer'
import userInfo from './user'
export default combineReducers({
trouble,
troubleList,
storeInfo,
userInfo,
scanBarCodeContainer
})
import actionTypes from '../actiontype/trouble';
const saveStore = (content,data)=>{
return Object.assign({},content,data);
let data = {
"details": [
{
"id": 1634,
"errorCode": "ER00001",
"type": "KN",
"description": "2:左侧动作故障,4:机械手移动到放货位置出错()",
"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"
}
],
},
{
"id": 1,
"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"
}
],
"employee": {
"id": 5,
"employeeName": "机器库管员",
"headImageUrl": "/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
},
"taskIds": [
155
]
}
const dealTroubleList = (data)=>{
let defaultInfo = {
details: [],
taskIds: []
};
let defaultDetailItem = {
isExistProblem : 0,
imagesFileId : "",
explanation : ""
};
let info = Object.assign({},defaultInfo,data);
info.details = info.details.map((i)=>{
return Object.assign({},i,defaultDetailItem);
});
return info;
};
const saveTroubles = (content,data)=>{
let newData = dealTroubleList(data);
return Object.assign({},content,newData);
};
export default function(state={}, action) {
switch (action.type) {
case actionTypes.SAVETROUBLELIST:
return saveStore(state,action.data)
return saveTroubles(state,action.data);
default:
return state;
}
......
import actionTypes from '../actiontype/user';
const saveUser = (content,data)=>{
return Object.assign({},content,data);
}
export default function(state={}, action) {
switch (action.type) {
case actionTypes.SAVEUSERINFO:
return saveUser(state,action.data)
default:
return state;
}
}
\ No newline at end of file
......@@ -28,7 +28,7 @@ const parseJson = (response)=>{
return response.json();
};
const getIp = ()=>{
const getIp = (cb)=>{
console.log("getIp : ",initIndex)
for(let i = initIndex; i < (totalIndex + initIndex) ; i++){
let url = 'http://' + domainIp + i + ':9999/getmyid';
......@@ -44,7 +44,7 @@ const getIp = ()=>{
if(data.storeId){
let wsUrl = 'ws://' + domainIp + i + ':7788/notify?from=plant&storeId='+data.storeId;
currentIpIndex = i;
init(wsUrl);
init(wsUrl,cb);
}
})
......@@ -85,9 +85,11 @@ const testIp = (ip) => {
.then(parseJson)
.then((data) => {
if(data.storeId){
window.storeId = data.storeId;
window.localIp = domainIp + i;
let wsUrl = 'ws://' + domainIp + i + ':7788/notify?from=plant&storeId='+data.storeId;
currentIpIndex = i;
init(wsUrl);
init(wsUrl,cb);
}
})
.catch((err) =>{
......@@ -102,7 +104,7 @@ const testIp = (ip) => {
}
const init = (url)=>{
const init = (url,cb)=>{
console.log("init :" ,url);
if("WebSocket" in window && !ws && url){
ws = new WebSocket(url);
......@@ -117,7 +119,7 @@ const init = (url)=>{
inteval = null;
initIndex = 1;
failTotal = 1;
cb();
console.log("open");
isFalse = false;
......@@ -188,4 +190,4 @@ const closeSocket = ()=>{
}
}
module.exports = {getIp,sendMsg}
\ No newline at end of file
module.exports = {getIp,sendMsg};
\ 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