Commit ebf65e40 by Zhang Xin

完善代码

parent 11500a4f
...@@ -412,6 +412,7 @@ class PageContainer extends React.Component { ...@@ -412,6 +412,7 @@ class PageContainer extends React.Component {
this.countBackTime = -1; this.countBackTime = -1;
clearTimeout(this.countbackTimer); clearTimeout(this.countbackTimer);
this.countbackTimer = null; this.countbackTimer = null;
UTILPATH.myLogger.info("endCountBack countBackTime ",this.countBackTime);
} }
overTimeSolve(){ overTimeSolve(){
...@@ -424,6 +425,7 @@ class PageContainer extends React.Component { ...@@ -424,6 +425,7 @@ class PageContainer extends React.Component {
} }
countBack(){ countBack(){
UTILPATH.myLogger.info("countBack countBackTime ",this.countBackTime);
if(!this.countbackTimer && this.countBackTime >= 0){ if(!this.countbackTimer && this.countBackTime >= 0){
this.countBackTime--; this.countBackTime--;
this.countbackTimer = window.setTimeout(()=>{ this.countbackTimer = window.setTimeout(()=>{
......
...@@ -21,6 +21,8 @@ const saveCommonInfo = (newState,data)=>{ ...@@ -21,6 +21,8 @@ const saveCommonInfo = (newState,data)=>{
}; };
const emptyCommInfo = (state,data)=>{ const emptyCommInfo = (state,data)=>{
UTILPATH.myLogger.info("emptyCommInfo data ",data);
UTILPATH.myLogger.info("emptyCommInfo ",Object.assign({},state,data));
return Object.assign({},state,data) return Object.assign({},state,data)
} }
......
import fetch from 'isomorphic-fetch'; import fetch from 'isomorphic-fetch';
let domain = ""; let domain = "";
const domainPort = "7788";
const myHeaders = new Headers({ const myHeaders = new Headers({
// 'Access-Control-Allow-Origin': '*', // 'Access-Control-Allow-Origin': '*',
// 'Content-Type': 'text/plain;charset=UTF-8', // 'Content-Type': 'text/plain;charset=UTF-8',
...@@ -12,7 +12,7 @@ const myHeaders = new Headers({ ...@@ -12,7 +12,7 @@ const myHeaders = new Headers({
const myLogger = {}; const myLogger = {};
myLogger.saveDomain = (ip)=>{ myLogger.saveDomain = (ip)=>{
domain = `http://${ip}:7788`; domain = `http://${ip}:${domainPort}`;
}; };
myLogger.info = function () { myLogger.info = function () {
...@@ -31,8 +31,6 @@ myLogger.info = function () { ...@@ -31,8 +31,6 @@ myLogger.info = function () {
.then((json)=>{ .then((json)=>{
}).catch(e=>{ }).catch(e=>{
}) })
}else{
} }
}; };
...@@ -52,8 +50,6 @@ myLogger.error = function () { ...@@ -52,8 +50,6 @@ myLogger.error = function () {
.then((json)=>{ .then((json)=>{
}).catch(e=>{ }).catch(e=>{
}) })
}else{
} }
}; };
......
...@@ -3,6 +3,8 @@ import myLogger from './logger' ...@@ -3,6 +3,8 @@ import myLogger from './logger'
let domainIp = '192.168.10.'; let domainIp = '192.168.10.';
const domainPort = "7788";
const socket = {}; const socket = {};
let totalCount = 0; let totalCount = 0;
...@@ -15,7 +17,7 @@ socket.getIp1 = ()=>{ ...@@ -15,7 +17,7 @@ socket.getIp1 = ()=>{
if(!getIpING) { if(!getIpING) {
getIpING = true; getIpING = true;
for(let j = 0; j< 255 ; j ++){ for(let j = 0; j< 255 ; j ++){
let wsUrl = 'ws://' + domainIp + j + ':7788/notify?from=plant'; let wsUrl = `ws://${domainIp}${j}:${domainPort}/notify?from=plant`;
let ws1 = new WebSocket(wsUrl); let ws1 = new WebSocket(wsUrl);
ws1.onopen = function() ws1.onopen = function()
{ {
...@@ -53,7 +55,7 @@ socket.getIp1 = ()=>{ ...@@ -53,7 +55,7 @@ socket.getIp1 = ()=>{
socket.getTestIp = (ip) => { socket.getTestIp = (ip) => {
let wsUrl = 'ws://' + domainIp + ip + ':7788/notify?from=plant'; let wsUrl = `ws://${domainIp}${ip}:${domainPort}/notify?from=plant`;
let ws1 = new WebSocket(wsUrl); let ws1 = new WebSocket(wsUrl);
ws1.onopen = function() ws1.onopen = function()
{ {
...@@ -97,7 +99,7 @@ const getClose = ()=>{ ...@@ -97,7 +99,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}:${domainPort}/notify?from=plant&storeId=${storeid}`;
if("WebSocket" in window && !ws && ip && storeid && (currentIpIndex === 255 || from)){ if("WebSocket" in window && !ws && ip && storeid && (currentIpIndex === 255 || from)){
ws = new WebSocket(wsUrl); ws = new WebSocket(wsUrl);
......
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