Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
banma_credit
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
hik_rn
project
banma_credit
Commits
6f08cd2a
Commit
6f08cd2a
authored
4 years ago
by
leiyongsheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正rn常用设备UI
parent
6647836f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
31 deletions
+82
-31
android
+1
-1
ios
+1
-1
src/config/index.js
+23
-3
src/pages/Equipment/index.js
+14
-10
src/pages/Equipment/style.js
+21
-12
src/router/index.js
+2
-1
src/services/equiment.js
+1
-1
src/utils/request.js
+19
-2
No files found.
android
@
c1da0671
Subproject commit
1587df5e459ddf3c7241bad88cd66613a4347939
Subproject commit
c1da067129625f2a7694bb1ccdf7efcb226b980c
This diff is collapsed.
Click to expand it.
ios
@
068d46e2
Subproject commit
c453457e47c0407d1ab8f1f976258d304d0850d3
Subproject commit
068d46e210861b0b45160b9696df3031527cd46d
This diff is collapsed.
Click to expand it.
src/config/index.js
View file @
6f08cd2a
import
{
NativeModules
}
from
'react-native'
;
const
{
BMCInfo
:
{
getEnvInfo
}
}
=
NativeModules
;
const
dev
=
{
API_ROOT
:
'http://devbmcapp.hikcreate.com'
,
}
const
mock
=
{
API_ROOT
:
'http://yapi.hikcreate.com'
,
}
const
test
=
{
API_ROOT
:
'http://testbmcapp.hikcreate.com'
,
}
const
pre_prod
=
{
API_ROOT
:
'https://prebmcapp.hikcreate.com'
,
}
const
prod
=
{
API_ROOT
:
'https://bmcapp.hikcreate.com'
,
}
const
configs
=
{
const
configs
=
[
dev
,
dev
,
mock
,
test
,
pre_prod
,
prod
,
}
]
let
envInfo
export
default
configs
[
process
.
env
.
buildEnv
||
'dev'
]
export
default
getEnv
=
async
()
=>
{
if
(
!
envInfo
)
{
envInfo
=
await
getEnvInfo
();
}
return
configs
[
envInfo
.
env
];
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/pages/Equipment/index.js
View file @
6f08cd2a
...
...
@@ -15,26 +15,32 @@ const Equipment = () => {
const
[
equimentList
,
setEquimentList
]
=
useState
([]);
useEffect
(()
=>
{
getEquimentList
();
},
[]);
},
[]);
//seEffect Hook 看做 componentDidMount,componentDidUpdate 和 componentWillUnmount 这三个函数的组合,传递一个空数组([])作为第二个参数。
//这就告诉 React 你的 effect 不依赖于 props 或 state 中的任何值,所以它永远都不需要重复执行。即只运行一次的 effect(仅在组件挂载和卸载时执行)
//[count]即仅在 count 更改时更新
const
getEquimentList
=
async
()
=>
{
try
{
const
data
=
await
equimentServices
.
getArticle
List
();
const
data
=
await
equimentServices
.
getBindEquipment
List
();
setEquimentList
(
data
[
0
].
devices
||
[]);
}
catch
(
e
)
{
BMCUI
.
showToast
(
'e'
);
BMCUI
.
showToast
(
e
&&
e
.
message
);
console
.
log
(
"error:"
)
console
.
log
(
e
)
}
};
return
(
<
SafeAreaView
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
main
}
>
<
Text
style
=
{
styles
.
tip
}
>
标题文字点击无反馈,文字超长则隐藏,文字超长则隐藏
<
/Text
>
<
View
style
=
{
styles
.
content
}
>
<
FlatList
style
=
{
styles
.
content
}
data
=
{
equimentList
}
keyExtractor
=
{(
item
,
index
)
=>
item
.
deviceId
+
''
}
ListHeaderComponent
=
{()
=>
{
return
<
Text
style
=
{
styles
.
tip
}
>
列表呈现用户登录的常用设备,以及在常用设备上的最后登录时间
<
/Text
>
}}
renderItem
=
{({
item
})
=>
{
return
<
View
style
=
{
styles
.
ceil
}
>
<
View
style
=
{
styles
.
ceilTitle
}
>
...
...
@@ -45,8 +51,6 @@ const Equipment = () => {
<
/View>
;
}}
/
>
<
/View
>
<
/View
>
<
/SafeAreaView
>
)
};
...
...
This diff is collapsed.
Click to expand it.
src/pages/Equipment/style.js
View file @
6f08cd2a
...
...
@@ -8,20 +8,23 @@ export default StyleSheet.create({
flex
:
1
,
},
tip
:
{
fontSize
:
1
6
,
paddingLeft
:
1
2
,
paddingRight
:
1
2
,
paddingTop
:
20
,
paddingBottom
:
20
,
color
:
'
rgba(182, 182, 182, 1)
'
,
fontSize
:
1
4
,
paddingLeft
:
1
5
,
paddingRight
:
1
5
,
paddingTop
:
15
,
paddingBottom
:
15
,
color
:
'
#C3C3C3
'
,
},
content
:
{
flex
:
1
,
},
ceil
:
{
backgroundColor
:
'#fff'
,
padding
:
12
,
marginBottom
:
12
,
paddingLeft
:
15
,
paddingRight
:
15
,
paddingTop
:
10
,
paddingBottom
:
15
,
marginBottom
:
10
,
},
ceilTitle
:
{
flexDirection
:
'row'
,
...
...
@@ -29,16 +32,22 @@ export default StyleSheet.create({
},
ceilName
:
{
fontSize
:
16
,
color
:
'#
000
'
,
color
:
'#
141414
'
,
},
ceilTag
:
{
marginLeft
:
10
,
backgroundColor
:
'rgba(195, 195, 195, 0.5)'
,
marginLeft
:
5
,
marginRight
:
5
,
fontSize
:
10
,
color
:
'#5A5A5A'
,
backgroundColor
:
'#00000010'
,
padding
:
2
,
borderRadius
:
4
,
borderRadius
:
1
,
borderColor
:
"#979797"
},
ceilInfo
:
{
paddingTop
:
6
,
fontSize
:
12
,
color
:
"#7B7B7B"
},
});
This diff is collapsed.
Click to expand it.
src/router/index.js
View file @
6f08cd2a
...
...
@@ -31,7 +31,8 @@ function AllStack(props) {
headerLeft
:
headerLeft
,
headerTitleStyle
:
{
flex
:
1
,
justifyContent
:
'center'
justifyContent
:
'center'
,
alignItems
:
"center"
},
}}
name
=
"equiment"
component
=
{
Equipment
}
/
>
<
Stack
.
Screen
options
=
{{
...
...
This diff is collapsed.
Click to expand it.
src/services/equiment.js
View file @
6f08cd2a
...
...
@@ -2,7 +2,7 @@ import { $request } from '../utils/request';
export
default
{
get
Article
List
(
params
=
{})
{
get
BindEquipment
List
(
params
=
{})
{
return
$request
.
get
(
'/user/loginDevices'
)
},
}
This diff is collapsed.
Click to expand it.
src/utils/request.js
View file @
6f08cd2a
const
{
BMCUI
}
=
NativeModules
;
import
{
NativeModules
}
from
'react-native'
;
import
appConfig
from
'../config'
import
getEnv
from
'../config'
const
{
BMCInfo
:
{
getLoginInfo
,
getDeviceInfo
}
}
=
NativeModules
;
// 服务器地址
export
const
API_SERVER
=
appConfig
.
API_ROOT
export
let
API_SERVER
=
null
;
// 是否外部的服务器
export
const
isOutServer
=
url
=>
url
.
indexOf
(
'/'
)
!==
0
...
...
@@ -74,6 +74,11 @@ export const $request = {
_requestConfig
:
()
=>
{
return
getRequestInfo
();
},
async
_request
(
url
,
method
,
params
,
config
=
{})
{
const
isOutRequest
=
isOutServer
(
url
)
if
(
!
API_SERVER
)
{
const
serverConfig
=
await
getEnv
();
API_SERVER
=
serverConfig
.
API_ROOT
;
}
console
.
log
(
API_SERVER
)
let
headers
=
config
.
headers
||
{}
let
body
=
{}
let
errorToast
=
config
.
errorToast
||
true
...
...
@@ -109,9 +114,21 @@ export const $request = {
errorProcess
(
res
,
reject
,
errorToast
)
})
.
then
(
json
=>
{
console
.
log
(
`{
${
method
}
request url=
${
url
}
Token=
${
headers
.
Token
}
Pvt-Token=
${
headers
[
'Pvt-Token'
]}
response success:{
${
json
&&
JSON
.
stringify
(
json
)}
}
}`
)
responseProcess
(
json
,
resolve
,
reject
,
isOutRequest
,
errorToast
)
})
.
catch
(
e
=>
{
console
.
log
(
`{
${
method
}
request url=
${
url
}
Token=
${
headers
.
Token
}
Pvt-Token=
${
headers
[
'Pvt-Token'
]}
response error:{
${
e
&&
e
.
toJSONString
()}
}
}`
)
errorProcess
({
data
:
{
message
:
e
.
message
}
},
reject
,
errorToast
)
})
})
...
...
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