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
e739c04e
Commit
e739c04e
authored
Jul 23, 2018
by
Zhang Xin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善关门逻辑
parent
5148932b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
21 deletions
+98
-21
client/actions/uploadError.js
+25
-12
client/actions/userinfo.js
+12
-2
client/containers/ChooseTaskContainer/ChooseTaskContainer.jsx
+2
-1
client/containers/FinishAskContainer/FinishAskContainer.jsx
+38
-3
client/containers/PageContainer/PageContainer.jsx
+21
-3
No files found.
client/actions/uploadError.js
View file @
e739c04e
...
...
@@ -2,23 +2,36 @@ import fetch from 'isomorphic-fetch'
import
actionType
from
'../actiontype/error'
let
domain
=
ENV
.
domain
;
const
uploadError
=
()
=>
{
var
myHeaders
=
new
Headers
({
'Access-Control-Allow-Origin'
:
'*'
,
// 'Content-Type': 'text/plain;charset=UTF-8',
// 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Content-Type'
:
'application/json; charset=UTF-8'
,
});
const
uploadError
=
(
info
)
=>
{
console
.
log
(
"uploadError "
,
info
)
let
bodyData
=
{
warehouseId
:
info
.
storeId
,
exceptionType
:
info
.
exceptionType
,
taskId
:
info
.
taskId
};
return
(
dispatch
=>
{
// fetch(domain + '/web/pad_warehouse/getMachineData.action
',{
//
credentials : 'include',
//
method : 'POST',
//
mode : 'cors',
// body : {}
//
// }).then((response)=>response.json())
// .then(json=>{
// console.log(json);
// }).catch(e=>{console.error(e)})
console
.
log
(
"uploadError"
)
fetch
(
domain
+
'/machine_pad/flat_warn_record
'
,{
credentials
:
'include'
,
method
:
'POST'
,
mode
:
'cors'
,
headers
:
myHeaders
,
body
:
JSON
.
stringify
(
bodyData
)
}).
then
((
response
)
=>
response
.
json
())
.
then
(
json
=>
{
console
.
log
(
json
);
}).
catch
(
e
=>
{
console
.
error
(
e
)});
})
};
const
addErrorInfo
=
(
errMsg
)
=>
{
console
.
log
(
"errMsg ,"
,
errMsg
)
return
{
type
:
actionType
.
ADDERRORINFO
,
errMsg
...
...
client/actions/userinfo.js
View file @
e739c04e
import
fetch
from
'isomorphic-fetch'
;
import
actionTypes
from
'../actiontype/user'
import
{
saveHeaderInfo
}
from
'./initHeader'
import
{
addErrorInfo
}
from
'./uploadError'
const
domain
=
ENV
.
domain
;
let
json
=
{
...
...
@@ -10,7 +11,7 @@ let json = {
"success"
:
true
},
"data"
:
{
"types"
:
'
Trouble
'
,
"types"
:
'
ER
'
,
"employee"
:{
"id"
:
5
,
"employeeName"
:
"机器库管员"
,
...
...
@@ -50,9 +51,18 @@ const getUserinfo = (info)=>{
}).
then
((
response
)
=>
response
.
json
())
.
then
(
json
=>
{
console
.
log
(
json
);
// if(json.meta.success && json.data){
// dispatch(saveUserinfo(json.data));
// if(!json.data.types){
// dispatch(addErrorInfo('没有任务需要处理'))
// }
// }
}).
catch
(
e
=>
{
console
.
error
(
e
)})
if
(
json
.
meta
.
success
&&
json
.
data
){
dispatch
(
saveUserinfo
(
json
.
data
))
dispatch
(
saveUserinfo
(
json
.
data
));
if
(
!
json
.
data
.
types
){
dispatch
(
addErrorInfo
(
'没有任务需要处理'
))
}
}
}
...
...
client/containers/ChooseTaskContainer/ChooseTaskContainer.jsx
View file @
e739c04e
...
...
@@ -20,7 +20,8 @@ export default class ChooseTaskContainer extends React.Component{
}
closeDoor
(){
console
.
log
(
"closeDoor"
)
console
.
log
(
"closeDoor"
);
this
.
props
.
hidePopup
();
this
.
props
.
showOpenDoorPage
()
}
...
...
client/containers/FinishAskContainer/FinishAskContainer.jsx
View file @
e739c04e
...
...
@@ -12,6 +12,8 @@ export default class FinishAskContainer extends React.Component{
}
this
.
closeDoor
=
this
.
closeDoor
.
bind
(
this
);
this
.
selectTask
=
this
.
selectTask
.
bind
(
this
);
this
.
beginCloseDoor
=
this
.
beginCloseDoor
.
bind
(
this
);
this
.
judgeTask
=
this
.
judgeTask
.
bind
(
this
);
}
componentWillMount
(){
...
...
@@ -28,11 +30,44 @@ export default class FinishAskContainer extends React.Component{
changePages
(
CONFIG
.
showPage
[
9
])
}
c
loseDoor
(){
console
.
log
(
"closeDoor"
)
beginC
loseDoor
(){
this
.
props
.
hidePopup
(
)
this
.
props
.
showOpenDoorPage
();
}
closeDoor
(){
console
.
log
(
"closeDoor"
);
this
.
props
.
hidePopup
();
//任务完成,超时不确定
let
btnDom
=
<
Button
key=
{
"finishcloseDoorBack1"
}
style=
{
{
'width'
:
'260px'
}
}
text=
{
"确定"
}
option=
{
this
.
beginCloseDoor
}
/>
let
clockDom
=
<
Clock
key=
{
"finiscloseDoorhBack2"
}
totalTime=
{
30
}
style=
{
{
'width'
:
'260px'
,
'marginLeft'
:
'30px'
,
'borderRadius'
:
'10px'
}
}
callback=
{
this
.
beginCloseDoor
}
/>;
this
.
props
.
showPopup
({
popupText
:
'检测到店铺反常,请站出店铺,关闭店铺门后重新验证您的身份'
,
popupButtons
:[
btnDom
,
clockDom
]
})
this
.
props
.
uploadErrs
(
2
);
}
judgeTask
(){
console
.
log
(
"judgeTask"
);
this
.
props
.
hidePopup
();
//任务完成,超时不确定
let
btnDom
=
<
Button
key=
{
"finishjudgeTaskBack1"
}
style=
{
{
'width'
:
'260px'
}
}
text=
{
"确定"
}
option=
{
this
.
beginCloseDoor
}
/>
let
clockDom
=
<
Clock
key=
{
"finishjudgeTaskBack2"
}
totalTime=
{
30
}
style=
{
{
'width'
:
'260px'
,
'marginLeft'
:
'30px'
,
'borderRadius'
:
'10px'
}
}
callback=
{
this
.
closeDoor
}
/>;
this
.
props
.
showPopup
({
popupText
:
'您的任务是否已结束'
,
popupButtons
:[
btnDom
,
clockDom
]
});
this
.
props
.
uploadErrs
(
2
);
}
render
(){
let
{
userInfo
,
storeInfo
}
=
this
.
props
;
return
(
...
...
@@ -51,7 +86,7 @@ export default class FinishAskContainer extends React.Component{
<
Button
text=
{
"有"
}
style=
{
{
'marginTop'
:
'120px'
}
}
option=
{
this
.
selectTask
}
/>
<
Button
text=
{
"没有"
}
style=
{
{
'marginTop'
:
'40px'
}
}
option=
{
this
.
closeDoor
}
/>
<
Clock
style=
{
{
'marginTop'
:
'40px'
}
}
totalTime=
{
60
}
callback=
{
this
.
closeDoor
}
/>
callback=
{
this
.
judgeTask
}
/>
</
div
>
</
div
>
</
div
>
...
...
client/containers/PageContainer/PageContainer.jsx
View file @
e739c04e
...
...
@@ -39,6 +39,11 @@ const defaultPopupInfo = {
};
const
initPage
=
showPage
[
7
];
const
errorType
=
{
1
:
1
,
//屏幕超时操作
2
:
2
,
//确认完成任务超时
3
:
3
,
//关门异常
}
class
PageContainer
extends
React
.
Component
{
constructor
(
props
)
{
...
...
@@ -73,6 +78,7 @@ class PageContainer extends React.Component {
this
.
showError
=
this
.
showError
.
bind
(
this
);
//展示错误信息
this
.
hideError
=
this
.
hideError
.
bind
(
this
);
//隐藏错误信息
this
.
getPageStyle
=
this
.
getPageStyle
.
bind
(
this
);
//
this
.
uploadErrs
=
this
.
uploadErrs
.
bind
(
this
);
//
this
.
maxCountBackTime
=
300
;
this
.
count
=
1000
;
...
...
@@ -81,7 +87,7 @@ class PageContainer extends React.Component {
this
.
taskTypeOption
=
{
'
Trouble
'
:
this
.
showTroublePage
'
ER
'
:
this
.
showTroublePage
};
}
...
...
@@ -277,9 +283,18 @@ class PageContainer extends React.Component {
}
}
uploadErrs
(
type
){
let
{
dispatch
,
state
}
=
this
.
props
;
dispatch
(
uploadError
(
Object
.
assign
({},
state
.
headerInfo
,{
exceptionType
:
type
})));
}
//弹出警告弹窗,并报警
showAlarm
(){
console
.
log
(
"showAlarm"
);
//屏幕超过300s无人操作
this
.
uploadErrs
(
errorType
[
1
])
let
btnDom
=
<
Button
key=
{
"pagecountBack1"
}
style=
{
{
'width'
:
'260px'
}
}
text=
{
"确定"
}
option=
{
this
.
beginCloseDoor
}
/>
let
clockDom
=
<
Clock
key=
{
"pagecountBack2"
}
totalTime=
{
30
}
style=
{
{
'width'
:
'260px'
,
'marginLeft'
:
'30px'
,
'borderRadius'
:
'10px'
}
}
...
...
@@ -322,8 +337,7 @@ class PageContainer extends React.Component {
failCloseDoor
(){
this
.
playAlarmMusic
();
let
{
dispatch
}
=
this
.
props
;
dispatch
(
uploadError
());
this
.
uploadErrs
(
errorType
[
3
]);
}
judgeDoorStatus
(){
...
...
@@ -439,6 +453,9 @@ class PageContainer extends React.Component {
endCountBack=
{
this
.
endCountBack
}
changePages=
{
(
data
)
=>
this
.
changePages
(
data
)
}
showOpenDoorPage=
{
()
=>
this
.
showOpenDoorPage
.
bind
(
this
)()
}
showPopup=
{
(
info
)
=>
this
.
showPopup
(
info
)
}
uploadErrs=
{
(
type
)
=>
this
.
uploadErrs
(
type
)
}
hidePopup=
{
()
=>
this
.
hidePopup
()
}
/>
;
break;
case showPage[9]:
...
...
@@ -446,6 +463,7 @@ class PageContainer extends React.Component {
userInfo=
{
state
.
userInfo
}
changePages=
{
(
data
)
=>
this
.
changePages
(
data
)
}
showOpenDoorPage=
{
()
=>
this
.
showOpenDoorPage
.
bind
(
this
)()
}
hidePopup=
{
()
=>
this
.
hidePopup
()
}
/>
;
break;
}
...
...
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