Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
max_android_panel
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Zhang Xin
max_android_panel
Commits
a73f3544
Commit
a73f3544
authored
Jun 03, 2019
by
Zhang Xin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加注释
parent
0eb37bd3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
101 deletions
+34
-101
client/containers/HomePageContainer/HomePageContainer.jsx
+2
-0
client/containers/PageContainer/PageContainer.jsx
+32
-101
No files found.
client/containers/HomePageContainer/HomePageContainer.jsx
View file @
a73f3544
...
...
@@ -45,12 +45,14 @@ export default class HomePageContainer extends React.Component{
},()
=>
{
UTILPATH
.
myLogger
.
info
(
"logout startStopServer "
,
this
.
props
.
startStopServer
);
if
(
this
.
props
.
startStopServer
){
// 断网调用
this
.
props
.
willCloseDoor
().
then
(()
=>
{
this
.
props
.
endCountBack
();
this
.
props
.
tempLogout
()
});
}
else
{
//正常调用
this
.
props
.
willCloseDoor
().
then
(()
=>
{
this
.
props
.
endCountBack
();
let
msg
=
{
type
:
'WILL_CLOSEDOOR'
};
...
...
client/containers/PageContainer/PageContainer.jsx
View file @
a73f3544
...
...
@@ -61,7 +61,7 @@ const defaultPopupInfo = {
popupChild
:
null
,
// 自定义弹窗内部htmls,
popupTitle
:
''
};
const
initPage
=
13
;
const
initPage
=
13
;
// 默认显示页面
const
errorType
=
{
1
:
1
,
//屏幕超时操作
...
...
@@ -73,23 +73,23 @@ class PageContainer extends React.Component {
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
showPage
:
showPage
[
initPage
],
lastPage
:
''
,
page
:
null
,
popupInfo
:
defaultPopupInfo
,
showPage
:
showPage
[
initPage
],
// 当前显示页面
lastPage
:
''
,
// 暂时没用
page
:
null
,
// 暂时没用
popupInfo
:
defaultPopupInfo
,
// 弹窗信息
showClock
:
false
,
//关门页面显示倒计时
headerInfo
:
{},
pageStyle
:
{},
successCloseDoor
:
false
,
headerInfo
:
{},
// 暂时没用
pageStyle
:
{},
// 页面样式
successCloseDoor
:
false
,
//关门成功标识
showClassify
:
false
,
//显示右侧菜单栏,默认不显示,目前没用
isSend
:
false
,
isSend
:
false
,
// 关门之后设置为true,当其为true的时候才会接口 关门的socket消息
area
:
''
,
//区域
maxTime
:
300
,
maxTime
:
300
,
// 超时时间
showAlarm
:
false
,
// 是否已报警,已报警为true,未报警为false
startStopServer
:
false
,
//开启断电断网流程
storeValue
:
""
,
startWork
:
false
,
startCountback
:
false
,
storeValue
:
""
,
// 断网情况下的 门店id
startWork
:
false
,
//断网情况下 开始工作标识(暂未用到)
startCountback
:
false
,
// 开始超时倒计时标识
};
this
.
getPages
=
this
.
getPages
.
bind
(
this
);
//获取当前页面
this
.
showPopup
=
this
.
showPopup
.
bind
(
this
);
//显示弹窗
...
...
@@ -98,7 +98,6 @@ class PageContainer extends React.Component {
this
.
beginCountBack
=
this
.
beginCountBack
.
bind
(
this
);
//开始300s倒计时
this
.
endCountBack
=
this
.
endCountBack
.
bind
(
this
);
//结束300s倒计时
this
.
showAlarm
=
this
.
showAlarm
.
bind
(
this
);
//显示警告弹窗
this
.
beginCloseDoor
=
this
.
beginCloseDoor
.
bind
(
this
);
//开始关门倒计时
this
.
playAlarmMusic
=
this
.
playAlarmMusic
.
bind
(
this
);
//播放警报音乐
this
.
overTimeSolve
=
this
.
overTimeSolve
.
bind
(
this
);
//超时未完成
this
.
failCloseDoor
=
this
.
failCloseDoor
.
bind
(
this
);
//关门倒数未监听到关门成功
...
...
@@ -192,6 +191,7 @@ class PageContainer extends React.Component {
*/
on
(
CONFIG
.
socketType
.
GETSTOREINFO
,
this
,
function
(
data
)
{
//socket接收到门店id
UTILPATH
.
myLogger
.
info
(
CONFIG
.
socketType
.
GETSTOREINFO
,
data
);
dispatch
(
saveCommonInfo
({
ip
:
data
.
ip
}));
if
(
!
this
.
state
.
startStopServer
){
...
...
@@ -218,15 +218,10 @@ class PageContainer extends React.Component {
});
}
}
/**
* 测试数据
* @type {number}
*/
}
});
on
(
CONFIG
.
socketType
.
GETSOCKETMSG
,
this
,
function
(
data
)
{
// 接收到 socket信息
UTILPATH
.
myLogger
.
info
(
CONFIG
.
socketType
.
GETSOCKETMSG
,
data
);
if
(
!
this
.
state
.
startStopServer
){
//非断电断网模式
...
...
@@ -234,6 +229,7 @@ class PageContainer extends React.Component {
}
});
on
(
CONFIG
.
socketType
.
STARTSTOPSERVER
,
this
,()
=>
{
// 接收到断网指令
UTILPATH
.
myLogger
.
info
(
CONFIG
.
socketType
.
STARTSTOPSERVER
);
if
(
!
this
.
state
.
startStopServer
){
this
.
setState
({
...
...
@@ -246,6 +242,7 @@ class PageContainer extends React.Component {
}
});
on
(
CONFIG
.
socketType
.
STOPSTOPSERVER
,
this
,()
=>
{
// 接收到终止断网指令(即联网成功)
UTILPATH
.
myLogger
.
info
(
"componentWillMount "
,
CONFIG
.
socketType
.
STOPSTOPSERVER
);
if
(
this
.
state
.
startStopServer
){
this
.
setState
({
...
...
@@ -263,13 +260,13 @@ class PageContainer extends React.Component {
let
{
dispatch
}
=
this
.
props
;
dispatch
(
logout
());
}
//判断是否向
服务端发起请求
//判断是否向
monitor发起获取货柜门状态请求,点击关门按钮后获取
changeIsSend
(
bool
){
this
.
setState
({
isSend
:
bool
})
}
// 根据socket信息,执行开门关门相关逻辑
getSocketMsg
(
data
){
let
{
dispatch
,
state
}
=
this
.
props
;
let
{
isSend
,
area
}
=
this
.
state
;
...
...
@@ -597,7 +594,7 @@ class PageContainer extends React.Component {
}
}
// 上报错误(目前只有超时在用)
uploadErrs
(){
let
{
dispatch
,
state
}
=
this
.
props
;
let
{
commonInfo
=
{}}
=
state
;
...
...
@@ -632,80 +629,15 @@ class PageContainer extends React.Component {
showAlarm
:
true
,
popupInfo
:
defaultPopupInfo
},()
=>
{
this
.
playAlarmMusic
()
})
/*
let btnWidth = UTILPATH.getRemByPx(260);
let btnMarginLeft = UTILPATH.getRemByPx(30);
let btnBorderRadius = UTILPATH.getRemByPx(10);
let border = "2px solid #e5e5e5"
let btnDom = <Button key={"pagecountBack1"} style={{'width':btnWidth,'border':border}} text={"确定"} option={this.beginCloseDoor}/>
let clockDom = <Clock key={"pagecountBack2"} totalTime={30}
style={{'width':btnWidth,'marginLeft':btnMarginLeft,'borderRadius':btnBorderRadius}}
callback={this.beginCloseDoor}
/>;
let showAlarmDom = this.getPopDom({
popupText : '检测到店铺反常,请站出店铺,关闭店铺门后重新验证您的身份',
popupButtons:[btnDom,clockDom]
});
this.setState({
popupInfo : defaultPopupInfo
},()=>{
this.showPopup({popupChild:showAlarmDom});
this.playAlarmMusic()
})
*/
}
//关门
beginCloseDoor
(){
let
btnWidth
=
UTILPATH
.
getRemByPx
(
260
);
let
btnMarginLeft
=
UTILPATH
.
getRemByPx
(
30
);
let
btnBorderRadius
=
UTILPATH
.
getRemByPx
(
10
);
//老机器
// this.handleCloseDoor();
/*
this.setState({
popupInfo:defaultPopupInfo
},()=>{
let clockDom = <Clock key={"pagecountBack2"} totalTime={30}
style={{'width':btnWidth,'marginLeft':btnMarginLeft,'borderRadius':btnBorderRadius}}
text={"关门中"}
callback={this.judgeDoorStatus}
/>;
let beginCloseDoorDom = this.getPopDom({
popupText : '关门倒数,请尽快站到设备外关闭设备门',
popupButtons:[clockDom]
});
this.showPopup({popupChild:beginCloseDoorDom});
//新机器 todo
// sendMsg(JSON.stringify({type:'WILL_CLOSEDOOR'}));
// this.changeIsSend.bind(this)(true);
this
.
playAlarmMusic
()
//播放音乐,暂未实现
})
*/
}
closeDoor
(){
}
// 关门失败(一期逻辑,现未使用)
failCloseDoor
(){
this
.
playAlarmMusic
();
this
.
uploadErrs
();
}
// 判断关门状态(一期逻辑,现未使用)
judgeDoorStatus
(){
this
.
setState
({
showPage
:
showPage
[
initPage
],
...
...
@@ -758,13 +690,13 @@ class PageContainer extends React.Component {
});
}
//二期临时退出
//二期临时退出
(不考虑现实物理门,直接告诉服务器门已关)
tempLogout
(){
this
.
handleCloseDoor
()
}
/**
* 显示右侧弹出菜单
* 显示右侧弹出菜单
(暂未用)
* @returns {*}
*/
toggleOrders
(
page
=
0
){
...
...
@@ -788,19 +720,19 @@ class PageContainer extends React.Component {
}
// 断网模式,在门店列表页,监听门店切换
handleStoreChange
(
e
){
this
.
setState
({
storeValue
:
e
.
target
.
value
})
}
// 断网模式,监听选择门店,获取门店信息
handleChooseStore
(){
const
{
dispatch
}
=
this
.
props
;
let
storeId
=
this
.
state
.
storeValue
;
dispatch
(
getStoreInfo
(
storeId
));
}
// 断网模式,显示门店列表弹窗
showStoreListPop
(
storeList
){
if
(
storeList
&&
storeList
.
length
>
0
){
let
storeDom
=
storeList
.
map
((
store
,
index
)
=>
{
...
...
@@ -833,7 +765,7 @@ class PageContainer extends React.Component {
});
}
}
// 断网模式,显示扫码弹窗,这个是为让用户通过小程序扫码登录
showQrcodePop
(
storeId
){
if
(
storeId
){
UTILPATH
.
myLogger
.
info
(
"showQrcodePop "
)
...
...
@@ -859,7 +791,6 @@ class PageContainer extends React.Component {
top
:
"50%"
,
transform
:
"translate(-50%,-50%)"
}
let
btnDom
=
<
Button
key=
{
"stopServerStoreListBtn"
}
style=
{
{
'width'
:
btnWidth
,
'border'
:
border
,
'marginLeft'
:
'40%'
,
'marginTop'
:
'12%'
}
}
text=
{
"确定"
}
option=
{
this
.
beginCloseDoor
}
/>
let
dom
=
<
PopModel
popupTitle=
{
"扫码开门二维码"
}
classContainer=
{
"recoveryPopInfo"
}
>
<
div
className=
{
"font36"
}
style=
{
style
}
>
<
ReactQrCode
className=
{
"qrcodeCanvas"
}
value=
{
qrcodeUrl
||
''
}
/>
...
...
@@ -877,7 +808,7 @@ class PageContainer extends React.Component {
}
}
// 点击页面“开始工作”
startWork
(){
const
{
dispatch
,
state
}
=
this
.
props
;
let
{
commonInfo
=
{}}
=
state
;
...
...
@@ -888,7 +819,7 @@ class PageContainer extends React.Component {
});
}
// 回退,菜单栏进入页面的回退按钮,执行这个方法,暂时未用
goBackTask
(){
let
{
state
}
=
this
.
props
;
let
{
commonInfo
=
{}}
=
state
;
...
...
@@ -935,7 +866,7 @@ class PageContainer extends React.Component {
goBackTask
:
this
.
goBackTask
}
}
//得到当前页面
getPages
(){
let
pages
=
null
;
let
{
state
,
dispatch
}
=
this
.
props
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment