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
65e84309
Commit
65e84309
authored
Mar 15, 2024
by
htc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
横屏适配
parent
0b3f139a
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
7 deletions
+67
-7
HomeLayout.js
src/components/HomeLayout.js
+39
-2
Layout.js
src/components/Layout.js
+20
-1
AuthPage.js
src/pages/AuthPage.js
+8
-4
HomePage.js
src/pages/HomePage.js
+0
-0
No files found.
src/components/HomeLayout.js
View file @
65e84309
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
Image
,
Text
,
View
}
from
'react-native'
;
import
{
Dimensions
,
Image
,
Text
,
View
}
from
'react-native'
;
import
{
appName
}
from
'../utils/config'
;
import
{
appName
}
from
'../utils/config'
;
import
{
setSpText
,
scaleSize
}
from
'../utils/screen'
;
import
{
setSpText
,
scaleSize
}
from
'../utils/screen'
;
...
@@ -24,7 +24,38 @@ class HomeLayout extends Component {
...
@@ -24,7 +24,38 @@ class HomeLayout extends Component {
);
);
}
}
}
}
const
styles
=
{
const
LandscapeStyles
=
{
title
:
{
top
:
0
,
paddingLeft
:
scaleSize
(
50
),
flexDirection
:
'row'
,
height
:
scaleSize
(
110
),
// 修改了这里
width
:
'100%'
,
position
:
'absolute'
,
backgroundColor
:
'white'
,
alignItems
:
'center'
,
elevation
:
10
,
background
:
'#f5f5f5'
,
},
titleImg
:
{
width
:
scaleSize
(
75
),
// 修改了这里
height
:
scaleSize
(
75
),
// 修改了这里
},
titleText
:
{
color
:
'#333'
,
fontSize
:
setSpText
(
60
),
marginLeft
:
30
,
},
container
:
{
flex
:
1
,
backgroundColor
:
'#ffffff'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
},
};
const
portraitStyles
=
{
title
:
{
title
:
{
top
:
0
,
top
:
0
,
paddingLeft
:
scaleSize
(
50
),
paddingLeft
:
scaleSize
(
50
),
...
@@ -54,4 +85,10 @@ const styles = {
...
@@ -54,4 +85,10 @@ const styles = {
},
},
};
};
const
{
width
,
height
}
=
Dimensions
.
get
(
'window'
);
const
isLandscape
=
width
>
height
;
const
styles
=
isLandscape
?
LandscapeStyles
:
portraitStyles
;
export
default
HomeLayout
;
export
default
HomeLayout
;
src/components/Layout.js
View file @
65e84309
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Image
,
PanResponder
,
View
,
Text
}
from
'react-native'
;
import
{
Image
,
PanResponder
,
View
,
Text
,
Dimensions
}
from
'react-native'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
AsyncStorage
from
'@react-native-community/async-storage'
;
import
{
connect
}
from
'react-redux'
;
import
{
connect
}
from
'react-redux'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
...
@@ -9,6 +9,7 @@ import Modal from './Modal';
...
@@ -9,6 +9,7 @@ import Modal from './Modal';
import
Toast
from
'./Toast'
;
import
Toast
from
'./Toast'
;
import
Touch
from
'./Touch'
;
import
Touch
from
'./Touch'
;
import
{
counterInterval
}
from
'../utils/authInterval'
;
import
{
counterInterval
}
from
'../utils/authInterval'
;
import
{
payTitle
}
from
'../utils/config'
;
const
weekdays
=
{
const
weekdays
=
{
0
:
'周日'
,
0
:
'周日'
,
...
@@ -129,6 +130,7 @@ class Layout extends React.Component {
...
@@ -129,6 +130,7 @@ class Layout extends React.Component {
};
};
render
()
{
render
()
{
const
{
width
,
height
}
=
Dimensions
.
get
(
'window'
);
const
{
children
}
=
this
.
props
;
const
{
children
}
=
this
.
props
;
let
{
contact
,
maskVisible
,
dateInfo
,
visibleActive
}
=
this
.
state
;
let
{
contact
,
maskVisible
,
dateInfo
,
visibleActive
}
=
this
.
state
;
contact
=
contact
||
'未授权'
;
contact
=
contact
||
'未授权'
;
...
@@ -138,10 +140,21 @@ class Layout extends React.Component {
...
@@ -138,10 +140,21 @@ class Layout extends React.Component {
style
=
{{
flex
:
1
,
backgroundColor
:
'#333'
}}
>
style
=
{{
flex
:
1
,
backgroundColor
:
'#333'
}}
>
<
View
style
=
{
styles
.
navBar
}
>
<
View
style
=
{
styles
.
navBar
}
>
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
alignItems
:
'center'
}}
>
<
View
style
=
{{
flex
:
1
,
flexDirection
:
'row'
,
alignItems
:
'center'
}}
>
{
width
>
height
?
(
<
Image
source
=
{
require
(
'../assets/logo.png'
)}
style
=
{{
width
:
70
,
height
:
70
,
marginLeft
:
15
,
}}
/
>
)
:
(
<
Image
<
Image
source
=
{
require
(
'../assets/zmgo_icon.png'
)}
source
=
{
require
(
'../assets/zmgo_icon.png'
)}
style
=
{
styles
.
navLogo
}
style
=
{
styles
.
navLogo
}
/
>
/
>
)}
<
View
<
View
style
=
{{
style
=
{{
justifyContent
:
'flex-end'
,
justifyContent
:
'flex-end'
,
...
@@ -162,10 +175,16 @@ class Layout extends React.Component {
...
@@ -162,10 +175,16 @@ class Layout extends React.Component {
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
<
/View
>
{
width
>
height
?
(
<
Text
style
=
{{
color
:
'white'
,
fontSize
:
40
,
fontWeight
:
'700'
}}
>
{
payTitle
}
<
/Text
>
)
:
(
<
Image
<
Image
style
=
{{
width
:
325
,
height
:
36
,
resizeMode
:
'contain'
}}
style
=
{{
width
:
325
,
height
:
36
,
resizeMode
:
'contain'
}}
source
=
{
require
(
'../assets/zmgo_title.png'
)}
source
=
{
require
(
'../assets/zmgo_title.png'
)}
/
>
/
>
)}
<
View
style
=
{
styles
.
navRight
}
>
<
View
style
=
{
styles
.
navRight
}
>
<
Image
<
Image
source
=
{
require
(
'../assets/phone_icon.png'
)}
source
=
{
require
(
'../assets/phone_icon.png'
)}
...
...
src/pages/AuthPage.js
View file @
65e84309
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
{
View
}
from
'react-native'
;
import
{
View
,
Dimensions
}
from
'react-native'
;
import
QRCode
from
'react-native-qrcode-svg'
;
import
QRCode
from
'react-native-qrcode-svg'
;
import
io
from
'socket.io-client'
;
import
io
from
'socket.io-client'
;
import
axios
from
'axios'
;
import
axios
from
'axios'
;
...
@@ -9,9 +9,13 @@ import HomeLayout from '../components/HomeLayout';
...
@@ -9,9 +9,13 @@ import HomeLayout from '../components/HomeLayout';
import
{
setSpText
,
scaleSize
}
from
'../utils/screen'
;
import
{
setSpText
,
scaleSize
}
from
'../utils/screen'
;
class
AuthPage
extends
Component
{
class
AuthPage
extends
Component
{
state
=
{};
state
=
{
isLandscape
:
false
,
};
async
componentDidMount
()
{
async
componentDidMount
()
{
const
{
width
,
height
}
=
Dimensions
.
get
(
'window'
);
this
.
setState
({
isLandscape
:
width
>
height
});
this
.
socket
=
io
(
axios
.
defaults
.
baseURL
);
this
.
socket
=
io
(
axios
.
defaults
.
baseURL
);
this
.
socket
.
on
(
'storeAuth'
,
this
.
handleLogin
);
this
.
socket
.
on
(
'storeAuth'
,
this
.
handleLogin
);
this
.
socket
.
on
(
'connect'
,
()
=>
{
this
.
socket
.
on
(
'connect'
,
()
=>
{
...
@@ -29,12 +33,12 @@ class AuthPage extends Component {
...
@@ -29,12 +33,12 @@ class AuthPage extends Component {
};
};
render
()
{
render
()
{
const
{
socket
}
=
this
.
state
;
const
{
socket
,
isLandscape
}
=
this
.
state
;
return
(
return
(
<
HomeLayout
>
<
HomeLayout
>
<
View
style
=
{
styles
.
qrcode
}
>
<
View
style
=
{
styles
.
qrcode
}
>
<
QRCode
<
QRCode
size
=
{
scaleSize
(
700
)}
size
=
{
isLandscape
?
scaleSize
(
420
)
:
scaleSize
(
700
)}
logo
=
{
require
(
'../assets/logo.png'
)}
logo
=
{
require
(
'../assets/logo.png'
)}
backgroundColor
=
"white"
backgroundColor
=
"white"
value
=
{
`
${
config
.
qrHost
}
/#/store-auth-
${
socket
}
`
}
value
=
{
`
${
config
.
qrHost
}
/#/store-auth-
${
socket
}
`
}
...
...
src/pages/HomePage.js
View file @
65e84309
This diff is collapsed.
Click to expand it.
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