Commit eac263a1 by wujiabao

fix 冲突

parents 7b24e00c fac20f45
......@@ -61,7 +61,7 @@ export default class HeaderComponent extends React.Component {
}
})
if (this.isShowVersionAndPort() && this.props.changePages) {
this.props.changePages(CONFIG.showPage[8888])
this.props.changePages(CONFIG.showPage['DevPage'])
}
}
......
import { getQuery } from '../util/common';
// {}
const requestInfo = {
domainPort : '7788',
domainIp : '192.168.10.'
domainIp : process.env.NODE_ENV !== 'production' ? '192.168.10.' : '192.168.8.',
exactDomainIp: getQuery('isDev') ? '127.0.0.1' : ''
}
module.exports = requestInfo;
\ No newline at end of file
......@@ -2,6 +2,6 @@ import swiperContainers from './swiperContainer'
import showPage from './showPage'
import socketType from './socketType'
import taskErrorType from './taskErrorType'
import machineInfo from './machineInfo'
import config from './config'
module.exports = {swiperContainers,...showPage,socketType,taskErrorType , machineInfo }
\ No newline at end of file
module.exports = {swiperContainers,...showPage,socketType,taskErrorType , config }
\ No newline at end of file
......@@ -18,7 +18,7 @@ const showPage = {
14 : 'Question', //二期问题反馈页面
141 : 'Question1', //二期问题反馈页面
15 : 'BoxRecoverySkus', //二期回收箱回收
8888 : 'MachineInfo'
'DevPage' : 'DevPage'
};
const taskSchedule = { //任务进度序列号,后台给
1: showPage[5],
......
......@@ -2,7 +2,7 @@ import React from 'react';
import HeaderComponent from '../../components/CommonComponent/HeaderComponent/HeaderComponent'
import Button from '../../components/CommonComponent/ButtonComponent/ButtonComponent';
export default class MachineInfo extends React.Component {
export default class DevPage extends React.Component {
constructor(props){
super(props);
this.state = {
......@@ -19,7 +19,7 @@ export default class MachineInfo extends React.Component {
/>
<div className="machineInfo" style={{textAlign:'center', marginTop:'3rem'}}>
<p>当前版本号 {CURVERSION}</p>
<p>当前端口号 {CONFIG.machineInfo.domainPort} </p>
<p>当前端口号 {CONFIG.config.domainPort} </p>
<Button text={'首页'} btnContainer={'colfff font30'} style={{background:'#ff7860',marginLeft:'50%',transform:' translate(-50%)',marginTop:'.5rem'}} option={()=>changePages(CONFIG.showPage[13])} />
</div>
</div>
......
......@@ -43,8 +43,8 @@ import {willCloseDoor,closeDoorSuccess} from '../../actions/chooseTaskContainer'
import {sendMsg} from '../../util/socket'
import PopModel from '../../components/CommonComponent/PopupComponent/PopupChildComponent'
import MachineInfo from '../MachineInfo/MachineInfo'
import WeChatUtil from '../../util/WeChatUtil'
import DevPage from '../DevPage/DevPage'
/*二期引用 end*/
import {on,remove} from '../../util/event';
......@@ -1100,8 +1100,8 @@ class PageContainer extends React.Component {
willCloseDoor={async ()=>{return await dispatch(willCloseDoor(commonInfo,true))}}
/>;
break;
case showPage[8888] :
pages = <MachineInfo
case showPage['DevPage'] :
pages = <DevPage
headerInfo = {commonInfo}
changePages={(data)=>this.changePages(data)}
/>
......
......@@ -2,6 +2,6 @@
* Created by ruibing on 16/11/2.
*/
module.exports = {
domain: 'https://test.mjitech.com/web/',
domain: 'https://www.mjitech.com/web/',
uploadImg : 'https://preprod.mjitech.com/static/uploadTrouble'
}
\ No newline at end of file
......@@ -2,6 +2,6 @@
* Created by ruibing on 16/11/2.
*/
module.exports = {
domain: 'https://test.mjitech.com/web/',
domain: 'https://www.mjitech.com/web/',
uploadImg : "https://preprod.mjitech.com/static/uploadTrouble"
}
\ No newline at end of file
......@@ -2,6 +2,6 @@
* Created by ruibing on 16/11/2.
*/
module.exports = {
domain: 'https://preprod.mjitech.com/web/',
domain: 'https://www.mjitech.com/web/',
uploadImg : 'https://preprod.mjitech.com/static/uploadTrouble'
}
\ No newline at end of file
export const getQuery = (key) => {
let searchInfo = location.search.substr(1).split("&");
let searchObj = {};
searchInfo.forEach(i=>{
let obj = i.split("=");
searchObj[obj[0]] = obj[1];
});
return searchObj[key];
}
\ No newline at end of file
import fetch from 'isomorphic-fetch';
let domain = "http://192.168.10.63:7780";
let domain = "";
const domainPort = CONFIG.machineInfo.domainPort;
const domainPort = CONFIG.config.domainPort;
const myHeaders = new Headers({
// 'Access-Control-Allow-Origin': '*',
// 'Content-Type': 'text/plain;charset=UTF-8',
......
import {emit, on , remove} from './event'
import {emit, on , remove} from './event';
import { exactDomainIp } from '../config/config';
import myLogger from './logger'
let domainIp = CONFIG.machineInfo.domainIp;
let domainIp = CONFIG.config.domainIp;
const domainPort = CONFIG.machineInfo.domainPort;
const domainPort = CONFIG.config.domainPort;
const socket = {};
......@@ -60,7 +61,11 @@ socket.getIp1 = ()=>{
if(!getIpING) {
getIpING = true;
for(let j = 0; j< 255 ; j ++){
let wsUrl = `ws://${domainIp}${j}:${domainPort}/notify?from=plant`;
let connectIp = `${domainIp}${j}`;
if (exactDomainIp) {
connectIp = exactDomainIp;
}
let wsUrl = `ws://${connectIp}:${domainPort}/notify?from=plant`;
let ws1 = new WebSocket(wsUrl);
ws1.onopen = function()
{
......@@ -79,6 +84,7 @@ socket.getIp1 = ()=>{
ws1.close();
if(!startStopServer){
//非断电断网情况就连接
console.log('=====>', info);
init(currentIpIndex,info.data,true);
}
}
......@@ -94,41 +100,15 @@ socket.getIp1 = ()=>{
socket.getIp1();
}
}
}
}
}
socket.getTestIp = (ip) => {
let wsUrl = `ws://${domainIp}${ip}:${domainPort}/notify?from=plant`;
let ws1 = new WebSocket(wsUrl);
ws1.onopen = function()
{
if(currentIpIndex === 255){
currentIpIndex = ip;
// ws1.close();
}else{
ws1.close();
}
};
ws1.onmessage = (evt)=>{
if(currentIpIndex !== 255){
let info = JSON.parse(evt.data);
if(info.type === 'GET_STORE_ID' && info.data){
ws1.close();
if(!startStopServer){
init(currentIpIndex,info.data,true);
}
if (exactDomainIp) {
break;
}
}
}
};
}
const getError = ()=>{
getClose();
}
......@@ -142,9 +122,10 @@ const getClose = ()=>{
const init = (ip,storeid,from = false)=>{
let wsUrl = `ws://${domainIp}${ip}:${domainPort}/notify?from=plant&storeId=${storeid}`;
if("WebSocket" in window && !ws && ip && storeid && (currentIpIndex === 255 || from)){
let theIp = exactDomainIp || `${domainIp}${ip}`;
let wsUrl = `ws://${theIp}:${domainPort}/notify?from=plant&storeId=${storeid}`;
if("WebSocket" in window && !ws && storeid &&
(exactDomainIp || (ip && storeid && (currentIpIndex === 255 || from))) ){
ws = new WebSocket(wsUrl);
ws.onopen = function()
......@@ -154,7 +135,7 @@ const init = (ip,storeid,from = false)=>{
currentIpIndex = ip;
storeId = storeid;
getIpING = false;
myLogger.saveDomain(domainIp+ip);
myLogger.saveDomain(exactDomainIp || (domainIp + ip));
if(stopTimer){
//重连成功后,终止倒计时
clearTimeout(stopTimer);
......@@ -162,7 +143,7 @@ const init = (ip,storeid,from = false)=>{
startStopServer = false;
myLogger.info("连接成功,停止stopTimer倒计时");
}
emit(CONFIG.socketType.GETSTOREINFO,{ip:domainIp+ip,storeId:storeid})
emit(CONFIG.socketType.GETSTOREINFO,{ip:(exactDomainIp || (domainIp + ip)),storeId:storeid})
};
ws.onmessage = function (evt)
......
......@@ -65,7 +65,6 @@ let baseConfig = {
function getEnv(){
const args = require('minimist')(process.argv.slice(2));
let env;
console.log("===================== args ",args);
if(args._.length > 0 && args._.indexOf('start') !== -1){
env = 'test';
}else if(args.env){
......@@ -77,7 +76,6 @@ function getEnv(){
}
let env = getEnv();
console.log("===================== env ",env);
function getVersion(){
const args = require('minimist')(process.argv.slice(2));
......@@ -90,8 +88,6 @@ function getVersion(){
let curversion = getVersion();
console.log("===================== version ",curversion,typeof curversion);
let envConfig = {
'build':{
output:{
......
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