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
cfe0d05b
Commit
cfe0d05b
authored
Sep 13, 2018
by
Zhang Xin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add commonInfo
parent
98f22d1a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
234 additions
and
48 deletions
+234
-48
client/actions/common.js
+119
-0
client/actions/index.js
+2
-2
client/actiontype/common.js
+8
-0
client/components/CommonComponent/HeaderComponent/HeaderComponent.jsx
+25
-25
client/containers/PageContainer/PageContainer.jsx
+31
-17
client/containers/RecoveryContainer/RecoveryContainer.jsx
+6
-1
client/env/test.js
+2
-1
client/index.js
+2
-1
client/reducers/common.js
+36
-0
client/reducers/index.js
+3
-1
No files found.
client/actions/common.js
0 → 100644
View file @
cfe0d05b
import
fetch
from
'isomorphic-fetch'
;
import
actionType
from
'../actiontype/common'
import
{
saveHeaderInfo
}
from
"./initHeader"
;
import
actionTypes
from
"../actiontype/user"
;
const
domain
=
ENV
.
domain
;
//获取工单
const
getTaskInfo
=
(
data
)
=>
{
let
{
employeeId
,
storeId
}
=
data
;
return
(
dispatch
)
=>
{
}
};
//获取店铺信息
const
getStoreInfo
=
(
storeId
)
=>
{
return
(
dispatch
)
=>
{
let
bodyData
=
{
storeId
};
fetch
(
domain
+
'pad_warehouse/getMachineData.action'
,{
credentials
:
'include'
,
method
:
'POST'
,
mode
:
'cors'
,
headers
:
{
'Content-Type'
:
'application/json'
},
body
:
JSON
.
stringify
(
bodyData
)
}).
then
((
response
)
=>
response
.
json
())
.
then
(
json
=>
{
let
storeInfo
=
Object
.
assign
({},{
id
:
storeId
});
if
(
json
.
meta
.
success
&&
json
.
data
.
warehouse
){
storeInfo
=
Object
.
assign
({},
storeInfo
,
json
.
data
.
warehouse
)
}
dispatch
(
saveCommonInfo
(
Object
.
assign
({},{
storeInfo
})))
}).
catch
(
e
=>
{
console
.
error
(
e
)})
}
};
//获取条形码信息
const
getInfoByBarcode
=
(
data
)
=>
{
let
{
storeId
,
barcode
}
=
data
;
let
url
=
`flat/barcode/
${
storeId
}
/
${
barcode
}
`
return
(
dispatch
)
=>
{
// dispatch(clearBarcodeInfo()); //清空barcode信息
fetch
(
domain
+
url
,{
credentials
:
'include'
,
method
:
'GET'
,
mode
:
'cors'
,
headers
:
{
'Content-Type'
:
'application/json'
},
}).
then
(
response
=>
response
.
json
())
.
then
(
json
=>
{
console
.
log
(
json
);
if
(
json
.
meta
.
success
){
//扫码成功
}
else
{
//扫码失败
}
})
}
};
//获取用户信息
const
getUserinfo
=
(
employeeId
,
storeId
)
=>
{
let
bodyData
=
Object
.
assign
({},{
employeeId
,
storeId
})
return
(
dispatch
)
=>
{
dispatch
(
saveHeaderInfo
(
info
));
fetch
(
domain
+
'machine_pad/get_alowed_task.action'
,{
credentials
:
'include'
,
method
:
'POST'
,
mode
:
'cors'
,
headers
:
myHeaders
,
body
:
JSON
.
stringify
(
bodyData
)
}).
then
((
response
)
=>
response
.
json
())
.
then
(
json
=>
{
let
userInfo
=
Object
.
assign
({},{
id
:
employeeId
})
if
(
json
.
meta
.
success
&&
json
.
data
){
if
(
json
.
data
.
employee
){
userInfo
=
Object
.
assign
({},
userInfo
,
json
.
data
.
employee
)
}
if
(
json
.
data
.
type
){
userInfo
=
Object
.
assign
({},
userInfo
,{
taskType
:
json
.
data
.
type
});
}
else
{
dispatch
(
addErrorInfo
(
'没有任务需要处理'
))
}
dispatch
(
saveCommonInfo
(
Object
.
assign
({},{
userInfo
})));
}
}).
catch
(
e
=>
{
console
.
error
(
e
)})
}
}
const
setBarcodeInfo
=
(
data
)
=>
{
return
{
type
:
actionType
.
SETBARCODEINFO
,
data
}
};
const
clearBarcodeInfo
=
(
data
)
=>
{
return
{
type
:
actionType
.
EMPTYBARCODEINFO
,
data
}
};
const
saveCommonInfo
=
(
data
)
=>
{
return
{
type
:
actionType
.
SAVECOMMONINFO
,
data
}
};
const
logout
=
()
=>
{
let
data
=
Object
.
assign
({},{
userInfo
:{},
taskInfo
:{}});
return
{
type
:
actionTypes
.
EMPTYCOMMONINFO
,
data
}
}
export
{
getStoreInfo
,
getTaskInfo
,
getInfoByBarcode
,
saveCommonInfo
,
getUserinfo
,
logout
}
client/actions/index.js
View file @
cfe0d05b
...
...
@@ -9,10 +9,10 @@ const initStart = () => {
data
:
mock
}
}
const
s
etPickedCategory
=
(
data
)
=>
{
const
s
tartTask
=
(
data
)
=>
{
return
{
type
:
actiontypes
.
SETPICKEDCATEGORY
,
data
}
}
export
{
initStart
,
setPickedCategory
}
export
{
initStart
}
client/actiontype/common.js
0 → 100644
View file @
cfe0d05b
const
actionTypes
=
{
SETBARCODEINFO
:
'SETBARCODEINFO'
,
EMPTYBARCODEINFO
:
'EMPTYBARCODEINFO'
,
SAVECOMMONINFO
:
'SAVECOMMONINFO'
,
EMPTYCOMMONINFO
:
'EMPTYCOMMONINFO'
,
}
export
default
actionTypes
\ No newline at end of file
client/components/CommonComponent/HeaderComponent/HeaderComponent.jsx
View file @
cfe0d05b
...
...
@@ -40,23 +40,14 @@ export default class HeaderComponent extends React.Component{
}
getHomeHeader
(){
let
{
storeInfo
,
userinfo
,
taskInfo
}
=
this
.
props
;
storeInfo
=
{
name
:
'华贸商业街'
,
id
:
20
};
userinfo
=
{
headImageUrl
:
""
,
employeeName
:
"你说呢"
,
id
:
"00001"
};
taskInfo
=
{
totalTaskNum
:
5
,
currentTaskNum
:
2
};
let
style
=
{
'width'
:
(
parseInt
(
taskInfo
.
currentTaskNum
)
/
parseInt
(
taskInfo
.
totalTaskNum
)
*
100
)
+
'%'
let
headerInfo
=
this
.
props
.
headerInfo
;
let
{
storeInfo
,
userInfo
,
taskInfo
}
=
headerInfo
;
if
(
taskInfo
&&
taskInfo
.
currentTaskNum
&&
taskInfo
.
totalTaskNum
){
let
style
=
{
'width'
:
(
parseInt
(
taskInfo
.
currentTaskNum
)
/
parseInt
(
taskInfo
.
totalTaskNum
)
*
100
)
+
'%'
}
}
return
(
<
div
className=
{
"homeHeader clearfix"
}
>
{
...
...
@@ -75,21 +66,24 @@ export default class HeaderComponent extends React.Component{
</
div
>
:
null
}
<
div
className=
{
"taskProgress"
}
>
<
div
className=
{
"currentTask"
}
style=
{
style
}
></
div
>
<
div
className=
{
"progressText col333 font26"
}
>
任务进度
{
taskInfo
.
currentTaskNum
}
/
{
taskInfo
.
totalTaskNum
}
</
div
>
</
div
>
{
taskInfo
&&
taskInfo
.
currentTaskNum
&&
taskInfo
.
totalTaskNum
?
<
div
className=
{
"taskProgress"
}
>
<
div
className=
{
"currentTask"
}
style=
{
style
}
></
div
>
<
div
className=
{
"progressText col333 font26"
}
>
任务进度
{
taskInfo
.
currentTaskNum
}
/
{
taskInfo
.
totalTaskNum
}
</
div
>
</
div
>
:
null
}
</
div
>
}
<
div
className=
{
"headerContent rightContent fr "
}
>
{
user
info
&&
useri
nfo
.
id
?
<
div
className=
{
"userinfos"
}
>
<
img
className=
{
"userheadImg"
}
src=
{
user
i
nfo
.
headImageUrl
||
UTILPATH
.
localImg
.
defaultImg
}
alt=
""
/>
user
Info
&&
userI
nfo
.
id
?
<
div
className=
{
"userinfos"
}
>
<
img
className=
{
"userheadImg"
}
src=
{
user
I
nfo
.
headImageUrl
||
UTILPATH
.
localImg
.
defaultImg
}
alt=
""
/>
<
div
className=
{
"userinfo font24 colfff"
}
>
<
p
>
{
user
i
nfo
.
employeeName
||
''
}
</
p
>
<
p
>
ID:
{
user
i
nfo
.
id
||
0
}
</
p
>
<
p
>
{
user
I
nfo
.
employeeName
||
''
}
</
p
>
<
p
>
ID:
{
user
I
nfo
.
id
||
0
}
</
p
>
</
div
>
</
div
>
:
null
}
...
...
@@ -137,7 +131,13 @@ export default class HeaderComponent extends React.Component{
render
(){
let
pages
=
this
.
getHeader
.
bind
(
this
)();
let
props
=
this
.
props
;
let
pages
=
null
;
console
.
log
(
"props "
,
props
);
console
.
log
(
"props "
,
props
.
headerInfo
);
if
(
props
&&
props
.
headerInfo
&&
props
.
headerInfo
.
storeInfo
){
pages
=
this
.
getHeader
.
bind
(
this
)();
}
return
<
div
className=
{
"headerComponent"
}
>
{
pages
}
</
div
>
...
...
client/containers/PageContainer/PageContainer.jsx
View file @
cfe0d05b
...
...
@@ -2,14 +2,13 @@
import
React
from
'react'
import
{
connect
}
from
'react-redux'
;
import
{
getStoreInfo
}
from
"../../actions/getStore
"
;
import
{
getStoreInfo
,
saveCommonInfo
,
getUserinfo
,
logout
}
from
"../../actions/common
"
;
import
{
getTroubleList
,
updateTroubleList
}
from
"../../actions/getTroubles"
;
import
{
initGetOtherProblem
,
addNewProbem
,
deleteProblem
,
editProblemItem
,
submitProblemList
}
from
"../../actions/otherQuestion"
import
{
scanBarCodeGetProductInfo
,
submitProductInfo
,
saveEditProductInfo
,
submitProductSuccess
,
clearProductSuccess
}
from
"../../actions/ScanBarCode"
import
{
getReportDamageList
,
deleteDamageItem
}
from
'../../actions/reportDamageList'
import
{
getRefreshImg
,
deleteImg
,
emptyImg
}
from
"../../actions/refreshImg"
import
{
uploadError
,
addErrorInfo
}
from
'../../actions/uploadError'
import
{
getUserinfo
,
logoutUser
}
from
'../../actions/userinfo'
import
PopupComponent
from
'../../components/CommonComponent/PopupComponent/PopupComponent'
import
TroubleContainer
from
'../TroubleContainer/TroubleContainer'
import
ScanBarCodeContainer
from
'../ScanBarCodeContainer/ScanBarCodeContaienr'
...
...
@@ -22,7 +21,7 @@ import Button from '../../components/CommonComponent/ButtonComponent/ButtonCompo
import
Clock
from
'../../components/CommonComponent/ClockComponent/ClockComponent'
;
/*二期引用 start*/
import
HomePage
from
'../Home
Container/Hom
eContainer'
import
HomePage
from
'../Home
PageContainer/HomePag
eContainer'
import
TakeStokeContainer
from
'../TakeStokeContainer/TakeStokeContainer'
import
BreakageContainer
from
'../BreakageContainer/BreakageConatiner'
import
RecoveryPage
from
'../RecoveryContainer/RecoveryContainer'
...
...
@@ -67,7 +66,7 @@ class PageContainer extends React.Component {
headerInfo
:
{},
pageStyle
:
{},
successCloseDoor
:
false
,
showClassify
:
false
//显示右侧菜单栏,默认不显示
showClassify
:
false
//显示右侧菜单栏,默认不显示
,目前没用
};
this
.
getPages
=
this
.
getPages
.
bind
(
this
);
//获取当前页面
this
.
showPopup
=
this
.
showPopup
.
bind
(
this
);
//显示弹窗
...
...
@@ -132,12 +131,12 @@ class PageContainer extends React.Component {
on
(
CONFIG
.
socketType
.
GETSTOREINFO
,
this
,
function
(
data
)
{
console
.
log
(
"==GETSTOREINFO==="
)
console
.
log
(
data
);
dispatch
(
getStoreInfo
(
data
));
dispatch
(
saveCommonInfo
({
ip
:
data
.
ip
}));
dispatch
(
getStoreInfo
(
data
.
storeId
));
});
on
(
CONFIG
.
socketType
.
GETSOCKETMSG
,
this
,
function
(
data
)
{
console
.
log
(
"==GETSTOREINFO==="
)
console
.
log
(
data
)
console
.
log
(
this
);
that
.
getSocketMsg
(
data
)
})
...
...
@@ -146,7 +145,7 @@ class PageContainer extends React.Component {
emptyUser
(){
let
{
dispatch
}
=
this
.
props
;
dispatch
(
logout
User
());
dispatch
(
logout
());
}
getSocketMsg
(
data
){
...
...
@@ -155,9 +154,21 @@ class PageContainer extends React.Component {
case
'SUCCESS_OPENDOOR'
:
//执行开门
let
info
=
data
.
info
;
let
headerInfo
=
state
.
header
Info
;
let
commonInfo
=
state
.
common
Info
;
console
.
log
(
"SUCCESS_OPENDOOR "
,
info
);
dispatch
(
getUserinfo
(
info
,
headerInfo
));
let
{
userinfo
}
=
info
;
let
datas
=
info
.
data
;
let
{
storeInfo
}
=
commonInfo
;
if
(
storeInfo
&&
userinfo
&&
storeInfo
.
id
&&
userinfo
.
employeeId
){
dispatch
(
getUserinfo
(
userinfo
.
employeeId
,
storeInfo
.
id
))
}
if
(
datas
.
area
){
//区域信息
dispatch
(
saveCommonInfo
(
Object
.
assign
({},{
taskInfo
:{
area
:
datas
.
area
}})))
}
this
.
setState
({
successCloseDoor
:
false
});
...
...
@@ -165,7 +176,7 @@ class PageContainer extends React.Component {
case
'SUCCESS_CLOSEDOOR'
:
//关门成功
console
.
log
(
"closedoor"
);
dispatch
(
logout
User
());
dispatch
(
logout
());
this
.
endCountBack
();
// remove(CONFIG.socketType.GETSTOREINFO,this)
// remove(CONFIG.socketType.GETSOCKETMSG,this)
...
...
@@ -198,6 +209,7 @@ class PageContainer extends React.Component {
this
.
dealPageByType
(
userinfo
.
type
);
}
if
(
state
.
errMsg
.
errMsg
){
//有错误信息,弹出错误信息弹窗
this
.
showError
(
state
.
errMsg
.
errMsg
)
}
}
...
...
@@ -225,8 +237,8 @@ class PageContainer extends React.Component {
dealPageByType
(
type
){
let
{
dispatch
,
state
}
=
this
.
props
;
if
(
this
.
taskTypeOption
[
type
]
&&
state
.
header
Info
){
this
.
taskTypeOption
[
type
](
state
.
header
Info
);
if
(
this
.
taskTypeOption
[
type
]
&&
state
.
common
Info
){
this
.
taskTypeOption
[
type
](
state
.
common
Info
);
}
}
...
...
@@ -307,7 +319,7 @@ class PageContainer extends React.Component {
uploadErrs
(
type
){
let
{
dispatch
,
state
}
=
this
.
props
;
dispatch
(
uploadError
(
Object
.
assign
({},
state
.
header
Info
,{
exceptionType
:
type
})));
dispatch
(
uploadError
(
Object
.
assign
({},
state
.
common
Info
,{
exceptionType
:
type
})));
}
//弹出警告弹窗,并报警
showAlarm
(){
...
...
@@ -455,7 +467,7 @@ class PageContainer extends React.Component {
break
;
case
showPage
[
2
]:
pages
=
<
ScanBarCodeContainer
headerInfo
=
{
state
.
header
Info
}
headerInfo
=
{
state
.
common
Info
}
storeInfo=
{
state
.
storeInfo
}
userInfo=
{
state
.
userInfo
}
getProductInfo
=
{(
postData
)=
>
dispatch(scanBarCodeGetProductInfo(postData))}
...
...
@@ -474,7 +486,7 @@ class PageContainer extends React.Component {
getReportDamageList
=
{(
postData
)=
>
dispatch(getReportDamageList(postData))}
deleteDamageItem =
{
(
postData
)
=>
{
dispatch
(
deleteDamageItem
(
postData
))}
}
changePages=
{
(
data
)
=>
this
.
changePages
(
data
)
}
headerInfo =
{
state
.
header
Info
}
headerInfo =
{
state
.
common
Info
}
storeInfo=
{
state
.
storeInfo
}
userInfo=
{
state
.
userInfo
}
state =
{
state
}
...
...
@@ -492,7 +504,7 @@ class PageContainer extends React.Component {
getRefreshImg=
{
(
errorId
,
type
)
=>
dispatch
(
getRefreshImg
(
errorId
,
type
))
}
deleteImg=
{
(
errorId
,
type
,
fileId
)
=>
dispatch
(
deleteImg
(
errorId
,
type
,
fileId
))
}
changePages=
{
(
data
)
=>
this
.
changePages
(
data
)
}
headerInfo =
{
state
.
header
Info
}
headerInfo =
{
state
.
common
Info
}
storeInfo=
{
state
.
storeInfo
}
userInfo=
{
state
.
userInfo
}
state =
{
state
}
...
...
@@ -538,6 +550,7 @@ class PageContainer extends React.Component {
break;
case showPage[10]:
pages =
<
RecoveryPage
headerInfo
=
{
state
.
commonInfo
}
showPopup=
{
(
info
)
=>
this
.
showPopup
(
info
)
}
hidePopup=
{
()
=>
this
.
hidePopup
()
}
/>
;
...
...
@@ -553,8 +566,9 @@ class PageContainer extends React.Component {
}
render()
{
console
.
log
(
"render "
);
let
{
state
}
=
this
.
props
;
let
headerInfo
=
state
.
header
Info
;
let
headerInfo
=
state
.
common
Info
;
let
ip
=
headerInfo
?
headerInfo
.
ip
:
''
;
let
mp3Url
=
ip
?
`http://${ip}:7788/defaultMedia/back.mp3`
:
''
;
return
(
...
...
client/containers/RecoveryContainer/RecoveryContainer.jsx
View file @
cfe0d05b
...
...
@@ -65,9 +65,14 @@ export default class RecoveryContainer extends React.Component{
render
(){
let
dom
=
this
.
getFirstPage
();
let
props
=
this
.
props
;
return
(
<
div
className=
{
"recoveryContainer page"
}
>
<
Header
/>
{
props
.
headerInfo
&&
props
.
headerInfo
.
storeInfo
?
<
Header
headerInfo=
{
props
.
headerInfo
}
/>
:
null
}
<
LeftContainer
/>
<
RightContainer
>
{
...
...
client/env/test.js
View file @
cfe0d05b
...
...
@@ -2,6 +2,6 @@
* Created by ruibing on 16/11/2.
*/
module
.
exports
=
{
domain
:
'http://test.mjitech.com'
,
domain
:
'http://test.mjitech.com
/web/
'
,
uploadImg
:
'https://preprod.mjitech.com/static/uploadTrouble'
}
\ No newline at end of file
client/index.js
View file @
cfe0d05b
...
...
@@ -30,6 +30,6 @@ function renderPage(store) {
let
store
=
activateVendor
();
// UTILPATH.socket.init(129,17);
// UTILPATH.socket.testIp(209);
// UTILPATH.socket.testIp(17
9);
UTILPATH
.
socket
.
testIp
(
16
9
);
renderPage
(
store
);
\ No newline at end of file
client/reducers/common.js
0 → 100644
View file @
cfe0d05b
import
actionTypes
from
'../actiontype/common'
;
const
saveCommonInfo
=
(
state
,
data
)
=>
{
let
keys
=
Object
.
keys
(
data
);
keys
.
forEach
(
k
=>
{
if
(
state
[
k
]){
if
(
typeof
data
[
k
]
===
'string'
){
state
[
k
]
=
data
[
k
]
}
else
{
state
[
k
]
=
Object
.
assign
({},
state
[
k
],
data
[
k
]);
}
}
else
{
state
[
k
]
=
data
[
k
]
}
});
return
Object
.
assign
({},
state
);
};
const
emptyCommInfo
=
(
state
,
data
)
=>
{
return
Object
.
assign
({},
state
,
data
)
}
export
default
function
(
state
=
{},
action
)
{
switch
(
action
.
type
)
{
case
actionTypes
.
SAVECOMMONINFO
:
return
saveCommonInfo
(
state
,
action
.
data
);
case
actionTypes
.
EMPTYCOMMONINFO
:
return
emptyCommInfo
(
state
);
default
:
return
state
;
}
}
\ No newline at end of file
client/reducers/index.js
View file @
cfe0d05b
...
...
@@ -8,6 +8,7 @@ import refreshImg from './refreshImg' //刷新图片
import
headerInfo
from
'./initHeader'
//获取头部信息
import
reportDamageList
from
'./reportDamge'
//一期商铺报损
import
errMsg
from
'./error'
//上报异常
import
commonInfo
from
'./common'
//上报异常
export
default
combineReducers
({
troubleList
,
...
...
@@ -18,7 +19,8 @@ export default combineReducers({
refreshImg
,
headerInfo
,
reportDamageList
,
errMsg
errMsg
,
commonInfo
})
...
...
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