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
6125ac60
Commit
6125ac60
authored
Jul 19, 2018
by
Zhang Xin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
连接socket的后续功能
parent
b0614921
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
123 additions
and
44 deletions
+123
-44
client/actions/getStore.js
+13
-11
client/actions/getTroubles.js
+8
-4
client/actions/initHeader.js
+28
-0
client/actiontype/initHeader.js
+6
-0
client/components/CommonComponent/HeaderComponent/HeaderComponent.jsx
+13
-10
client/components/CommonComponent/HeaderComponent/index.css
+1
-1
client/containers/HomeContainer/HomeContainer.jsx
+22
-12
client/containers/PageContainer/PageContainer.jsx
+8
-2
client/containers/TroubleContainer/TroubleContainer.jsx
+5
-2
client/reducers/index.js
+3
-1
client/reducers/initHeader.js
+15
-0
client/util/socket.js
+1
-1
No files found.
client/actions/getStore.js
View file @
6125ac60
import
fetch
from
'isomorphic-fetch'
;
import
actionTypes
from
'../actiontype/store'
import
{
saveHeaderInfo
}
from
'./initHeader'
const
domain
=
ENV
.
domain
;
let
json
=
{
...
...
@@ -27,18 +28,19 @@ const saveStoreInfo = (data)=>{
const
getStoreInfo
=
(
storeId
)
=>
{
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)})
dispatch
(
saveHeaderInfo
({
storeId
}));
fetch
(
domain
+
'/web/pad_warehouse/getMachineData.action'
,{
credentials
:
'include'
,
method
:
'POST'
,
mode
:
'cors'
,
body
:
Object
.
assign
({},{
storeId
})
}).
then
((
response
)
=>
response
.
json
())
.
then
(
json
=>
{
console
.
log
(
json
);
}).
catch
(
e
=>
{
console
.
error
(
e
)})
if
(
json
.
meta
.
success
&&
json
.
data
.
warehouse
){
dispatch
(
saveStoreInfo
(
json
.
data
.
warehouse
))
dispatch
(
saveStoreInfo
(
Object
.
assign
({},
json
.
data
.
warehouse
,{
id
:
storeId
})
))
}
else
{
}
...
...
client/actions/getTroubles.js
View file @
6125ac60
import
fetch
from
'isomorphic-fetch'
;
import
actionTypes
from
'../actiontype/trouble'
import
userActionTypes
from
"../actiontype/user"
;
import
{
saveHeaderInfo
}
from
'./initHeader'
const
domain
=
ENV
.
domain
;
let
json
=
{
...
...
@@ -46,9 +47,8 @@ let json = {
"employeeName"
:
"机器库管员"
,
"headImageUrl"
:
"http://www.mjitech.com/static/coupon/gounian/banner_hongbaotupian-3-14.jpg"
},
"taskIds"
:
[
155
]
"taskIds"
:
155
}
}
...
...
@@ -68,8 +68,11 @@ const saveUserInfo = (data)=>{
}
const
getTroubleList
=
()
=>
{
const
getTroubleList
=
(
info
)
=>
{
console
.
log
(
info
);
return
(
dispatch
)
=>
{
dispatch
(
saveHeaderInfo
(
info
));
// fetch(domain + '/web/pad_warehouse/getMachineData.action',{
// credentials : 'include',
// method : 'POST',
...
...
@@ -81,6 +84,7 @@ const getTroubleList = ()=>{
// console.log(json);
// }).catch(e=>{console.error(e)})
if
(
json
.
meta
.
success
&&
json
.
data
){
dispatch
(
saveHeaderInfo
({
taskId
:
json
.
data
.
taskIds
}))
if
(
json
.
data
.
employee
){
//存储用户信息
dispatch
(
saveUserInfo
(
json
.
data
.
employee
));
...
...
client/actions/initHeader.js
0 → 100644
View file @
6125ac60
import
actionTypes
from
'../actiontype/initHeader'
const
domain
=
ENV
.
domain
;
let
json
=
{
"meta"
:
{
"code"
:
"200"
,
"message"
:
"成功"
,
"success"
:
true
},
"data"
:
{
"warehouse"
:
{
"id"
:
13
,
"name"
:
"华贸商业街"
,
"image"
:
"http://static.mjitech.com/static/tmp/2018-05-25/1527243213701.jpg"
,
"address"
:
"华贸商业街(新光天地与利兹卡尔顿酒店之间广场)"
}
}
};
const
saveHeaderInfo
=
(
data
)
=>
{
return
{
type
:
actionTypes
.
INITHEADERS
,
data
}
};
export
{
saveHeaderInfo
}
client/actiontype/initHeader.js
0 → 100644
View file @
6125ac60
const
actionTypes
=
{
INITHEADERS
:
'INITHEADERS'
}
export
default
actionTypes
;
\ No newline at end of file
client/components/CommonComponent/HeaderComponent/HeaderComponent.jsx
View file @
6125ac60
...
...
@@ -34,22 +34,25 @@ export default class HeaderComponent extends React.Component{
return
(
<
div
className=
{
"homeHeader clearfix"
}
>
{
storeInfo
?
<
div
className=
{
"headerContent leftContent fl"
}
>
<
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
{
storeInfo
&&
storeInfo
.
id
?
<
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 :
{
storeInfo
.
id
}
</
p
>
</
div
>
</
div
>
:
null
}
</
div
>
}
{
userinfo
?
<
div
className=
{
"headerContent rightContent fr "
+
(
userinfo
.
id
?
''
:
'hide'
)
}
>
userinfo
&&
userinfo
.
id
?
<
div
className=
{
"headerContent rightContent fr "
}
>
<
img
className=
{
"userheadImg"
}
src=
{
userinfo
.
headImageUrl
||
UTILPATH
.
localImg
.
defaultImg
}
alt=
""
/>
<
div
className=
{
"userinfo font24 colfff"
}
>
<
p
>
{
userinfo
.
employeeName
||
''
}
</
p
>
...
...
client/components/CommonComponent/HeaderComponent/index.css
View file @
6125ac60
...
...
@@ -52,7 +52,7 @@
}
.headerComponent
.homeHeader
.locationInfo
.local
{
display
:
inline-block
;
line-height
:
3
4
px
;
line-height
:
3
6
px
;
vertical-align
:
middle
;
}
.headerComponent
.homeHeader
.rightContent
{
...
...
client/containers/HomeContainer/HomeContainer.jsx
View file @
6125ac60
import
React
from
'react'
;
import
Clock
from
'../../components/CommonComponent/ClockComponent/ClockComponent'
import
HeaderComponent
from
'../../components/CommonComponent/HeaderComponent/HeaderComponent'
require
(
'./index.css'
);
export
default
class
HomeContainer
extends
React
.
Component
{
...
...
@@ -21,20 +22,29 @@ export default class HomeContainer extends React.Component{
render
(){
let
props
=
this
.
props
;
let
{
userInfo
,
storeInfo
}
=
props
;
return
(
<
div
className=
{
"homeContainer"
}
>
<
img
className=
{
"homeIcon"
}
src=
{
UTILPATH
.
localImg
.
defaultImg
}
alt=
""
/>
<
div
className=
{
"homeText font40"
}
>
感谢您辛勤工作,祝您今天顺利!
</
div
>
{
props
.
showClock
?
<
div
className=
{
"closeDoorContent "
}
>
<
div
className=
{
"closeDoorText font32 colf00"
}
>
<
p
>
关门倒数,请尽快离开店铺
</
p
>
<
p
>
请在离开前再次确保没有遗留个人物品在设备内
</
p
>
</
div
>
<
Clock
totalTime=
{
60
}
/>
</
div
>
:
null
}
<
div
>
<
HeaderComponent
showHeader=
{
CONFIG
.
headerStatus
[
1
]
}
userinfo=
{
userInfo
}
storeInfo=
{
storeInfo
}
/>
<
div
className=
{
"homeContainer"
}
>
<
img
className=
{
"homeIcon"
}
src=
{
UTILPATH
.
localImg
.
defaultImg
}
alt=
""
/>
<
div
className=
{
"homeText font40"
}
>
感谢您辛勤工作,祝您今天顺利!
</
div
>
{
props
.
showClock
?
<
div
className=
{
"closeDoorContent "
}
>
<
div
className=
{
"closeDoorText font32 colf00"
}
>
<
p
>
关门倒数,请尽快离开店铺
</
p
>
<
p
>
请在离开前再次确保没有遗留个人物品在设备内
</
p
>
</
div
>
<
Clock
totalTime=
{
60
}
/>
</
div
>
:
null
}
</
div
>
</
div
>
)
}
}
...
...
client/containers/PageContainer/PageContainer.jsx
View file @
6125ac60
...
...
@@ -79,9 +79,10 @@ class PageContainer extends React.Component {
componentWillMount
()
{
let
that
=
this
;
let
{
dispatch
}
=
this
.
props
;
on
(
CONFIG
.
socketType
.
GETSTOREINFO
,
this
,
function
(
data
)
{
console
.
log
(
"==GETSTOREINFO==="
)
console
.
log
(
data
)
console
.
log
(
data
)
;
dispatch
(
getStoreInfo
(
data
.
storeId
));
})
on
(
CONFIG
.
socketType
.
GETSOCKETMSG
,
this
,
function
(
data
)
{
...
...
@@ -94,9 +95,13 @@ class PageContainer extends React.Component {
}
getSocketMsg
(
data
){
let
{
dispatch
}
=
this
.
props
;
switch
(
data
.
type
){
case
'SUCCESS_OPENDOOR'
:
//执行开门
let
info
=
JSON
.
parse
(
data
.
info
);
console
.
log
(
"SUCCESS_OPENDOOR "
,
info
);
dispatch
(
getTroubleList
(
info
));
this
.
setState
({
showPage
:
showPage
[
1
]
},()
=>
{
...
...
@@ -327,7 +332,8 @@ class PageContainer extends React.Component {
/
>
;
break;
case showPage[7]:
pages =
<
HomeContainer
showClock=
{
this
.
state
.
showClock
}
/>
;
pages =
<
HomeContainer
showClock=
{
this
.
state
.
showClock
}
storeInfo=
{
state
.
storeInfo
}
userInfo=
{
state
.
userInfo
}
/>
;
break;
case showPage[8]:
pages =
<
FinishAskContainer
/>
;
...
...
client/containers/TroubleContainer/TroubleContainer.jsx
View file @
6125ac60
...
...
@@ -39,8 +39,11 @@ export default class TroubleContainer extends React.Component{
componentWillMount
(){
let
{
initTroubleList
}
=
this
.
props
;
initTroubleList
();
let
{
troubleList
}
=
this
.
props
;
// initTroubleList();
this
.
setState
({
troubleList
:
troubleList
})
}
componentWillReceiveProps
(
nextProps
){
...
...
client/reducers/index.js
View file @
6125ac60
...
...
@@ -5,6 +5,7 @@ import scanBarCodeContainer from './scanBarCodeContainer'
import
otherQuestion
from
'./otherQuestion'
import
userInfo
from
'./user'
import
refreshImg
from
'./refreshImg'
import
headerInfo
from
'./initHeader'
export
default
combineReducers
({
troubleList
,
...
...
@@ -12,7 +13,8 @@ export default combineReducers({
scanBarCodeContainer
,
otherQuestion
,
userInfo
,
refreshImg
refreshImg
,
headerInfo
})
...
...
client/reducers/initHeader.js
0 → 100644
View file @
6125ac60
import
actionTypes
from
'../actiontype/initHeader'
;
const
saveHeaders
=
(
content
,
data
)
=>
{
return
Object
.
assign
({},
content
,
data
);
}
export
default
function
(
state
=
{},
action
)
{
switch
(
action
.
type
)
{
case
actionTypes
.
INITHEADERS
:
return
saveHeaders
(
state
,
action
.
data
)
default
:
return
state
;
}
}
\ No newline at end of file
client/util/socket.js
View file @
6125ac60
...
...
@@ -2,7 +2,7 @@ import fetch from 'isomorphic-fetch';
import
{
emit
}
from
'./event'
let
domainIp
=
'192.168.1
99
.'
;
let
domainIp
=
'192.168.1
0
.'
;
let
initIndex
=
1
;
let
totalIndex
=
255
/
5
;
...
...
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