Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bh_face_counter
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄天晨
bh_face_counter
Commits
191e81d3
Commit
191e81d3
authored
Jun 24, 2020
by
修福龙
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
2692704e
f553da2c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
67 additions
and
107 deletions
+67
-107
.gitignore
.gitignore
+2
-0
android
android
+1
-1
package.json
package.json
+1
-1
Layout.js
src/components/Layout.js
+22
-31
Touch.js
src/components/Touch.js
+8
-4
admin.js
src/models/admin.js
+7
-0
AuthPage.js
src/pages/AuthPage.js
+0
-3
CounterMixins.js
src/pages/CounterMixins.js
+2
-2
VerticalPage.js
src/pages/VerticalPage.js
+22
-63
authLogin.js
src/utils/authLogin.js
+2
-2
No files found.
.gitignore
View file @
191e81d3
...
...
@@ -57,3 +57,5 @@ buck-out/
# CocoaPods
/ios/Pods/
*.apk
android
@
a68acacc
Subproject commit
f1af412d416703975a237f1787c7047c62cdafcd
Subproject commit
a68acacc0bd5b01ab34362b4ef09bbab72ded3d5
package.json
View file @
191e81d3
...
...
@@ -7,7 +7,7 @@
"start"
:
"react-native start"
,
"test"
:
"jest"
,
"lint"
:
"eslint --ext .js index.js src"
,
"apk"
:
"cd android && ./gradlew a
ssembleRelease && cp ./app/build/outputs/apk/release/app-release.apk ../release
.apk"
"apk"
:
"cd android && ./gradlew a
pp:assembleRelease && cp ./app/build/outputs/apk/release/app-release.apk ../counter
.apk"
},
"pre-commit"
:
[
"lint"
...
...
src/components/Layout.js
View file @
191e81d3
...
...
@@ -9,7 +9,6 @@ import Modal from './Modal';
import
Toast
from
'./Toast'
;
import
Touch
from
'./Touch'
;
import
{
counterInterval
}
from
'../utils/authInterval'
;
import
{
switchQr
,
switchEnv
}
from
'../utils/switchHost'
;
const
weekdays
=
{
0
:
'周日'
,
...
...
@@ -130,7 +129,7 @@ class Layout extends React.Component {
};
render
()
{
const
{
children
,
app
}
=
this
.
props
;
const
{
children
}
=
this
.
props
;
let
{
contact
,
maskVisible
,
dateInfo
,
visibleActive
}
=
this
.
state
;
contact
=
contact
||
'未授权'
;
return
(
...
...
@@ -163,37 +162,29 @@ class Layout extends React.Component {
<
/View
>
<
/View
>
<
/View
>
<
Touch
onPress
=
{
!
app
.
lock
&&
this
.
showCounterLogin
}
style
=
{{
alignItems
:
'center'
}}
>
<
Image
style
=
{{
width
:
325
,
height
:
36
,
resizeMode
:
'contain'
}}
source
=
{
require
(
'../assets/zmgo_title.png'
)}
/
>
<
View
style
=
{
styles
.
navRight
}
>
<
Image
style
=
{{
width
:
325
,
height
:
36
,
resizeMode
:
'contain'
}}
source
=
{
require
(
'../assets/zmgo_title.png'
)}
source
=
{
require
(
'../assets/phone_icon.png'
)}
style
=
{{
width
:
36
,
height
:
36
,
marginRight
:
5
,
resizeMode
:
'contain'
,
}}
/
>
<
/Touch
>
<
View
style
=
{
styles
.
navRight
}
>
<
Touch
onPress
=
{
!
app
.
lock
&&
switchQr
}
>
<
Image
source
=
{
require
(
'../assets/phone_icon.png'
)}
style
=
{{
width
:
36
,
height
:
36
,
marginRight
:
5
,
resizeMode
:
'contain'
,
}}
/
>
<
/Touch
>
<
Touch
onPress
=
{
!
app
.
lock
&&
switchEnv
}
>
<
Text
style
=
{{
color
:
'#F5AB61'
,
fontSize
:
32
,
fontWeight
:
'bold'
,
marginRight
:
20
,
}}
>
{
contact
}
<
/Text
>
<
/Touch
>
<
Text
style
=
{{
color
:
'#F5AB61'
,
fontSize
:
32
,
fontWeight
:
'bold'
,
marginRight
:
20
,
}}
>
{
contact
}
<
/Text
>
<
/View
>
<
/View
>
{
maskVisible
?
(
...
...
src/components/Touch.js
View file @
191e81d3
...
...
@@ -45,11 +45,12 @@ export default class PlatformTouchable extends React.Component {
foreground
,
background
,
useForeground
,
feddback
,
feedback
,
viewWrap
,
...
props
}
=
this
.
props
;
if
(
fe
d
dback
===
false
)
{
if
(
fe
e
dback
===
false
)
{
TouchableComponent
=
TouchableWithoutFeedback
;
}
props
.
onPress
=
this
.
onPress
;
...
...
@@ -59,6 +60,9 @@ export default class PlatformTouchable extends React.Component {
// the API to be the same for all components so we require
// exactly one direct child for every touchable type.
children
=
React
.
Children
.
only
(
children
);
if
(
viewWrap
!==
false
)
{
children
=
<
View
style
=
{
style
}
>
{
children
}
<
/View>
;
}
if
(
TouchableComponent
===
TouchableNativeFeedback
)
{
useForeground
=
...
...
@@ -76,13 +80,13 @@ export default class PlatformTouchable extends React.Component {
{...
props
}
useForeground
=
{
useForeground
}
background
=
{(
useForeground
&&
foreground
)
||
background
}
>
<
View
style
=
{
style
}
>
{
children
}
<
/View
>
{
children
}
<
/TouchableComponent
>
);
}
else
if
(
TouchableComponent
===
TouchableWithoutFeedback
)
{
return
(
<
TouchableWithoutFeedback
{...
props
}
>
<
View
style
=
{
style
}
>
{
children
}
<
/View
>
{
children
}
<
/TouchableWithoutFeedback
>
);
}
else
{
...
...
src/models/admin.js
View file @
191e81d3
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
*
as
api
from
'../services/admin'
;
import
axios
from
'axios'
;
export
default
{
namespace
:
'admin'
,
...
...
@@ -33,6 +34,9 @@ export default {
let
login
=
action
.
login
;
action
.
device
=
login
;
delete
action
.
login
;
if
(
action
.
host
)
{
axios
.
defaults
.
baseURL
=
action
.
host
;
}
const
{
data
}
=
action
.
key
?
yield
call
(
api
.
token
,
action
)
:
yield
call
(
api
.
refreshToken
);
...
...
@@ -46,6 +50,9 @@ export default {
if
(
action
.
key
)
{
yield
call
(
AsyncStorage
.
setItem
,
'KEY'
,
action
.
key
);
}
if
(
action
.
host
)
{
yield
call
(
AsyncStorage
.
setItem
,
'HOST'
,
action
.
host
);
}
yield
put
({
type
:
'setAuth'
,
id
:
data
.
id
,
auth
:
data
.
data
,
login
});
}
return
data
;
...
...
src/pages/AuthPage.js
View file @
191e81d3
...
...
@@ -22,9 +22,6 @@ class AuthPage extends Component {
handleLogin
=
async
values
=>
{
this
.
setState
({
loading
:
true
});
if
(
!
values
.
host
)
{
values
.
host
=
config
.
host
;
}
values
.
login
=
values
.
device
;
await
counterLogin
(
values
);
};
...
...
src/pages/CounterMixins.js
View file @
191e81d3
...
...
@@ -80,7 +80,8 @@ const CounterMixins = ComposeComponent => {
DeviceEventEmitter
.
addListener
(
'onError'
,
()
=>
(
this
.
busy
=
false
));
const
handleScan
=
this
.
submitBarcode
;
// if you want to react to keyUp
KeyEvent
.
onKeyUpListener
(
async
({
keyCode
})
=>
{
KeyEvent
.
onKeyUpListener
(
async
e
=>
{
const
{
keyCode
}
=
e
;
if
(
keyCode
===
66
)
{
// 回车事件
await
handleScan
();
...
...
@@ -93,7 +94,6 @@ const CounterMixins = ComposeComponent => {
};
componentWillUnmount
=
()
=>
{
clearInterval
(
this
.
preventInter
);
clearInterval
(
this
.
clearListInter
);
clearInterval
(
this
.
payInter
);
clearTimeout
(
this
.
paidTimeout
);
...
...
src/pages/VerticalPage.js
View file @
191e81d3
...
...
@@ -15,7 +15,6 @@ import phone from '../assets/Vertical/phone.png';
import
{
login
}
from
'../utils/config'
;
import
{
colors
}
from
'../utils/common'
;
import
WxFacepay
from
'../utils/WxFacepay'
;
import
{
switchQr
,
switchEnv
}
from
'../utils/switchHost'
;
import
{
width
}
from
'../utils/screen'
;
let
pageSize
=
8
;
// 分页大小
...
...
@@ -189,23 +188,22 @@ class VerticalPage extends Component {
<
/View
>
<
View
style
=
{
styles
.
TdStyle
}
>
{
item
.
numChange
?
(
<
Touch
<
Icon
onPress
=
{()
=>
this
.
props
.
numRemove
(
item
.
num
,
index
+
(
this
.
props
.
current
-
1
)
*
pageSize
,
)
}
>
<
Icon
name
=
"ios-remove-circle"
color
=
{
item
.
num
===
1
?
'#909090'
:
'#00c670'
}
size
=
{
35
}
/
>
<
/Touch
>
}
name
=
"ios-remove-circle"
color
=
{
item
.
num
===
1
?
'#909090'
:
'#00c670'
}
size
=
{
35
}
/
>
)
:
(
<
View
/>
)}
<
Touch
viewWrap
=
{
false
}
onPress
=
{()
=>
item
.
numChange
&&
this
.
props
.
numChange
(
index
+
(
this
.
props
.
current
-
1
)
*
pageSize
)
...
...
@@ -213,15 +211,17 @@ class VerticalPage extends Component {
<
Text
style
=
{
styles
.
TdText
}
>
{
item
.
num
}
<
/Text
>
<
/Touch
>
{
item
.
numChange
?
(
<
Touch
<
Icon
name
=
"ios-add-circle"
color
=
"#00c670"
size
=
{
35
}
onPress
=
{()
=>
this
.
props
.
numAdd
(
item
.
num
,
index
+
(
this
.
props
.
current
-
1
)
*
pageSize
,
)
}
>
<
Icon
name
=
"ios-add-circle"
color
=
"#00c670"
size
=
{
35
}
/
>
<
/Touch
>
}
/
>
)
:
(
<
View
/>
)}
...
...
@@ -236,20 +236,22 @@ class VerticalPage extends Component {
{
NP
.
round
(
item
.
prePrice
*
item
.
num
,
2
).
toFixed
(
2
)}
<
/Text
>
)}
<
Touch
<
Icon
style
=
{{
marginLeft
:
10
}}
name
=
"ios-close-circle"
size
=
{
35
}
color
=
{
colors
.
bg
}
onPress
=
{()
=>
this
.
props
.
removeIndex
(
index
+
(
this
.
props
.
current
-
1
)
*
pageSize
)
}
style
=
{{
marginLeft
:
10
}}
>
<
Icon
name
=
"ios-close-circle"
size
=
{
35
}
color
=
{
colors
.
bg
}
/
>
<
/Touch
>
/
>
<
/View
>
<
/View
>
);
render
()
{
let
{
admin
,
goods
,
goodsArr
,
qrHost
,
current
}
=
this
.
props
;
let
{
contact
,
maskVisible
,
visibleActive
}
=
this
.
state
;
let
{
contact
}
=
this
.
state
;
pageSize
=
goods
&&
goods
.
bags
.
length
>
0
?
7
:
pageSize
;
window
.
pageSize
=
pageSize
;
contact
=
contact
||
'未授权'
;
...
...
@@ -278,53 +280,10 @@ class VerticalPage extends Component {
<
Image
source
=
{
img24h
}
/
>
<
/View
>
<
View
style
=
{
styles
.
right
}
>
<
Touch
onPress
=
{
switchQr
}
>
<
Image
style
=
{
styles
.
phone
}
source
=
{
phone
}
/
>
<
/Touch
>
<
Touch
onPress
=
{
switchEnv
}
>
<
Text
style
=
{
styles
.
number
}
>
{
contact
}
<
/Text
>
<
/Touch
>
<
Image
style
=
{
styles
.
phone
}
source
=
{
phone
}
/
>
<
Text
style
=
{
styles
.
number
}
>
{
contact
}
<
/Text
>
<
/View
>
<
/View
>
{
maskVisible
?
(
<
View
style
=
{
styles
.
navMask
}
>
<
Touch
onPress
=
{()
=>
this
.
stepOne
()}
style
=
{{
width
:
120
,
height
:
80
,
backgroundColor
:
visibleActive
?
colors
.
bg
:
'transparent'
,
}}
>
<
View
/>
<
/Touch
>
<
View
style
=
{{
flex
:
1
,
alignItems
:
'center'
}}
/
>
<
View
style
=
{{
flexDirection
:
'row'
,
alignItems
:
'center'
,
justifyContent
:
'flex-end'
,
}}
>
<
Touch
onPress
=
{()
=>
this
.
stepTwo
()}
style
=
{{
width
:
150
,
height
:
80
}}
>
<
View
/>
<
/Touch
>
<
View
style
=
{{
opacity
:
0
}}
>
<
Text
style
=
{{
color
:
'#F5AB61'
,
fontSize
:
32
,
fontWeight
:
'bold'
,
marginRight
:
20
,
}}
>
{
contact
}
<
/Text
>
<
/View
>
<
/View
>
<
/View
>
)
:
(
<
View
style
=
{{
display
:
'none'
}}
/
>
)}
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{{
flexDirection
:
'row'
,
flex
:
1
}}
>
<
View
style
=
{{
width
:
'90%'
}}
>
...
...
src/utils/authLogin.js
View file @
191e81d3
...
...
@@ -25,7 +25,7 @@ const loginError = async msg => {
Toast
.
fail
(
msg
,
1
);
};
export
const
counterLogin
=
async
({
key
,
secret
,
device
=
'counter'
})
=>
{
export
const
counterLogin
=
async
({
key
,
secret
,
device
=
'counter'
,
host
})
=>
{
if
(
!
key
)
{
await
loginError
(
'请输入门店标识'
);
return
;
...
...
@@ -40,7 +40,7 @@ export const counterLogin = async ({key, secret, device = 'counter'}) => {
return
;
}
await
Toast
.
loading
(
'授权认证中'
);
const
action
=
{
type
:
'admin/auth'
,
key
,
secret
,
login
:
device
};
const
action
=
{
type
:
'admin/auth'
,
key
,
secret
,
login
:
device
,
host
};
// const { dispatch } = this.props;
// const res = await dispatch(action);
const
res
=
await
window
.
dispatch
(
action
);
...
...
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