Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
zhangzhonghua
/
BoneHouse_Business_APP
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c3fdfd57
authored
Aug 17, 2022
by
peii
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'develop' into product
parents
4052ca0a
5a762f7c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
213 additions
and
227 deletions
app/containers/login/module/FillDomainModel.js
app/containers/login/module/FillDomainModel.js
View file @
c3fdfd57
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
import
{
ActionSheet
}
from
'@ant-design/react-native'
import
{
View
,
Text
,
Modal
,
SafeAreaView
,
TextInput
,
StyleSheet
,
TouchableOpacity
}
from
'react-native'
import
{
View
,
Text
,
Modal
,
SafeAreaView
,
TextInput
,
StyleSheet
,
TouchableOpacity
}
from
'react-native'
;
import
{
safe_view
,
placehold_text_color
,
Width
,
pxHeight
,
foundation_color
,
promary_text_color
,
font_family_semibold
,
font_family_regular
,
first_text_color
,
btn_sub_color
,
second_text_size
,
title_text_color
,
pxSize
}
from
'../../../base/BaseStyle'
;
import
{
show
}
from
'../../../utils/Utils'
;
safe_view
,
placehold_text_color
,
Width
,
pxHeight
,
foundation_color
,
promary_text_color
,
font_family_semibold
,
font_family_regular
,
first_text_color
,
btn_sub_color
,
second_text_size
,
title_text_color
,
pxSize
,
scale
,
}
from
'../../../base/BaseStyle'
import
{
show
}
from
'../../../utils/Utils'
class
FillDomainModel
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
isVisible
:
false
,
defaDomainHead
:
'https://'
,
domainValue
:
''
,
isNull
:
false
}
constructor
(
props
)
{
super
(
props
)
this
.
state
=
{
isVisible
:
false
,
defaDomainHead
:
'http(s)://'
,
domainValue
:
''
,
isNull
:
false
,
}
}
componentWillReceiveProps
(
nextProps
)
{
if
(
this
.
state
.
isVisible
!=
nextProps
.
show
)
{
this
.
setState
({
isVisible
:
nextProps
.
show
});
}
if
(
this
.
state
.
domainValue
!=
nextProps
.
domainValue
)
{
let
tempDomain
=
nextProps
.
domainValue
let
{
isVisible
}
=
this
.
state
if
(
tempDomain
.
includes
(
"obs.uat.guke.tech"
))
{
// tempDomain = ''
isVisible
=
true
}
this
.
setState
({
domainValue
:
tempDomain
,
isVisible
})
}
componentWillReceiveProps
(
nextProps
)
{
if
(
this
.
state
.
isVisible
!=
nextProps
.
show
)
{
this
.
setState
({
isVisible
:
nextProps
.
show
,
})
}
closeModal
()
{
this
.
setState
({
isVisible
:
false
})
this
.
props
.
closeModal
(
false
)
if
(
this
.
state
.
domainValue
!=
nextProps
.
domainValue
)
{
let
tempDomain
=
nextProps
.
domainValue
let
{
isVisible
}
=
this
.
state
if
(
tempDomain
.
includes
(
'obs.uat.guke.tech'
))
{
// tempDomain = ''
isVisible
=
true
}
this
.
setState
({
domainValue
:
tempDomain
,
isVisible
,
})
}
}
// 域名 输入
handleDomainInput
(
text
)
{
let
isNull
=
false
if
(
!
text
)
{
isNull
=
true
}
this
.
setState
({
domainValue
:
text
,
isNull
})
}
closeModal
()
{
this
.
setState
({
isVisible
:
false
,
})
this
.
props
.
closeModal
(
false
)
}
// 确定
handleSubClick
()
{
let
{
defaDomainHead
,
domainValue
}
=
this
.
state
if
(
!
domainValue
)
{
this
.
setState
({
isNull
:
true
})
return
}
// 存储值 !!!
let
tempDomain
=
defaDomainHead
+
domainValue
this
.
closeModal
()
this
.
props
.
callback
(
tempDomain
)
// 域名 输入
handleDomainInput
(
text
)
{
let
isNull
=
false
if
(
!
text
)
{
isNull
=
true
}
this
.
setState
({
domainValue
:
text
,
isNull
,
})
}
renderDialog
()
{
let
{
domainValue
,
defaDomainHead
,
isNull
}
=
this
.
state
return
(
<
View
style
=
{
styles
.
cont_mian
}
>
<
View
style
=
{
styles
.
cont_inner
}
>
<
View
style
=
{
styles
.
cont_tit_box
}
>
<
Text
style
=
{
styles
.
cont_tit
}
>
配置域名
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
cont_cell
}
>
<
Text
style
=
{
styles
.
input_head
}
>
{
defaDomainHead
}
<
/Text
>
<
TextInput
autoCapitalize
=
'none'
style
=
{
styles
.
cell_inp_txt
}
placeholderTextColor
=
{
placehold_text_color
}
returnKeyType
=
"done"
defaultValue
=
{
domainValue
}
placeholder
=
{
'请输入域名'
}
keyboardType
=
"email-address"
onChangeText
=
{(
text
)
=>
this
.
handleDomainInput
(
text
)}
/
>
<
/View
>
{
isNull
?
<
View
style
=
{
styles
.
err_input_box
}
>
<
Text
style
=
{
styles
.
err_input
}
>
请输入域名
<
/Text
>
<
/View> : nul
l
}
<
View
style
=
{
styles
.
cont_footer
}
>
<
TouchableOpacity
activeOpacity
=
{.
8
}
style
=
{
styles
.
sub_btn_box
}
onPress
=
{()
=>
this
.
handleSubClick
()}
>
<
Text
style
=
{
styles
.
sub_tit
}
>
确定
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
)
// 确定
handleSubClick
()
{
let
{
domainValue
}
=
this
.
state
if
(
!
domainValue
)
{
this
.
setState
({
isNull
:
true
,
})
return
}
// 存储值 !!!
let
host
=
'https://'
+
domainValue
const
exp
=
/^
((\d
|
[
1-9
]\d
|1
\d\d
|2
[
0-4
]\d
|25
[
0-5
])\.){3}(\d
|
[
1-9
]\d
|1
\d\d
|2
[
0-4
]\d
|25
[
0-5
])
/g
if
(
exp
.
test
(
domainValue
))
{
host
=
'http://'
+
domainValue
}
this
.
closeModal
()
this
.
props
.
callback
(
host
)
}
render
()
{
return
(
<
View
style
=
{
styles
.
dia_container
}
>
<
Modal
transparent
=
{
true
}
visible
=
{
this
.
state
.
isVisible
}
animationType
=
{
'fade'
}
>
<
SafeAreaView
style
=
{
safe_view
}
>
<
View
style
=
{
styles
.
container
}
>
{
this
.
renderDialog
()}
<
/View
>
<
/SafeAreaView
>
<
/Modal
>
renderDialog
()
{
let
{
domainValue
,
defaDomainHead
,
isNull
}
=
this
.
state
return
(
<
View
style
=
{
styles
.
cont_mian
}
>
<
View
style
=
{
styles
.
cont_inner
}
>
<
View
style
=
{
styles
.
cont_tit_box
}
>
<
Text
style
=
{
styles
.
cont_tit
}
>
配置域名
<
/Text
>
<
/View
>
<
View
style
=
{
styles
.
cont_cell
}
>
<
Text
style
=
{
styles
.
input_head
}
>
{
defaDomainHead
}
<
/Text
>
<
TextInput
autoCapitalize
=
"none"
style
=
{
styles
.
cell_inp_txt
}
placeholderTextColor
=
{
placehold_text_color
}
returnKeyType
=
"done"
defaultValue
=
{
domainValue
}
placeholder
=
{
'请输入域名'
}
keyboardType
=
"email-address"
onChangeText
=
{
text
=>
this
.
handleDomainInput
(
text
)}
/
>
<
/View
>
{
isNull
?
(
<
View
style
=
{
styles
.
err_input_box
}
>
<
Text
style
=
{
styles
.
err_input
}
>
请输入域名
<
/Text
>
<
/View
>
);
}
)
:
null
}
<
View
style
=
{
styles
.
cont_footer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.8
}
style
=
{
styles
.
sub_btn_box
}
onPress
=
{()
=>
this
.
handleSubClick
()}
>
<
Text
style
=
{
styles
.
sub_tit
}
>
确定
<
/Text
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
<
/View
>
)
}
render
()
{
return
(
<
View
style
=
{
styles
.
dia_container
}
>
<
Modal
transparent
=
{
true
}
visible
=
{
this
.
state
.
isVisible
}
animationType
=
{
'fade'
}
>
<
SafeAreaView
style
=
{
safe_view
}
>
<
View
style
=
{
styles
.
container
}
>
{
this
.
renderDialog
()}
<
/View
>
<
/SafeAreaView
>
<
/Modal
>
<
/View
>
)
}
}
const
styles
=
StyleSheet
.
create
({
dia_container
:
{
flex
:
1
},
container
:
{
flex
:
1
,
backgroundColor
:
'rgba(0, 0, 0, 0.5)'
},
cont_mian
:
{
flex
:
1
,
justifyContent
:
'center'
,
position
:
'relative'
},
cont_inner
:
{
position
:
'absolute'
,
left
:
0
,
top
:
pxHeight
(
196
),
width
:
Width
()
-
60
,
flex
:
1
,
flexDirection
:
'column'
,
backgroundColor
:
foundation_color
,
height
:
pxSize
(
360
),
borderRadius
:
10
,
marginHorizontal
:
30
,
marginVertical
:
20
,
paddingTop
:
30
,
paddingBottom
:
60
,
paddingHorizontal
:
20
dia_container
:
{
flex
:
1
,
},
container
:
{
flex
:
1
,
backgroundColor
:
'rgba(0, 0, 0, 0.5)'
,
},
cont_mian
:
{
flex
:
1
,
justifyContent
:
'center'
,
position
:
'relative'
,
},
cont_inner
:
{
position
:
'absolute'
,
left
:
0
,
top
:
scale
(
196
),
width
:
Width
()
-
60
,
flex
:
1
,
flexDirection
:
'column'
,
backgroundColor
:
foundation_color
,
height
:
scale
(
360
),
borderRadius
:
10
,
marginHorizontal
:
30
,
marginVertical
:
20
,
paddingTop
:
30
,
paddingBottom
:
60
,
paddingHorizontal
:
20
,
},
cont_tit_box
:
{},
cont_tit
:
{
color
:
promary_text_color
,
fontSize
:
20
,
lineHeight
:
28
,
fontFamily
:
font_family_semibold
,
},
cont_cell
:
{
height
:
45
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
borderRadius
:
100
,
paddingHorizontal
:
12
,
backgroundColor
:
'#EFEFEF'
,
marginTop
:
30
,
},
input_head
:
{
fontSize
:
14
,
fontFamily
:
font_family_semibold
,
color
:
promary_text_color
,
},
cell_inp_txt
:
{
paddingLeft
:
4
,
fontFamily
:
font_family_regular
,
fontSize
:
14
,
color
:
first_text_color
,
width
:
'80%'
,
},
err_input_box
:
{
paddingLeft
:
10
,
paddingTop
:
4
,
},
err_input
:
{
fontSize
:
14
,
fontFamily
:
font_family_regular
,
color
:
'#FF0000'
,
},
cont_footer
:
{
flex
:
1
,
justifyContent
:
'flex-end'
,
},
sub_btn_box
:
{
width
:
'100%'
,
height
:
38
,
backgroundColor
:
btn_sub_color
,
borderRadius
:
20
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
shadowColor
:
btn_sub_color
,
shadowOffset
:
{
width
:
1
,
height
:
2
,
},
cont_tit_box
:
{},
cont_tit
:
{
color
:
promary_text_color
,
fontSize
:
20
,
lineHeight
:
28
,
fontFamily
:
font_family_semibold
},
cont_cell
:
{
height
:
45
,
flexDirection
:
'row'
,
alignItems
:
'center'
,
borderRadius
:
100
,
paddingHorizontal
:
12
,
backgroundColor
:
'#EFEFEF'
,
marginTop
:
30
},
input_head
:
{
fontSize
:
14
,
fontFamily
:
font_family_semibold
,
color
:
promary_text_color
},
cell_inp_txt
:
{
paddingLeft
:
4
,
fontFamily
:
font_family_regular
,
fontSize
:
14
,
color
:
first_text_color
,
width
:
'80%'
},
err_input_box
:
{
paddingLeft
:
10
,
paddingTop
:
4
},
err_input
:{
fontSize
:
14
,
fontFamily
:
font_family_regular
,
color
:
'#FF0000'
},
cont_footer
:
{
flex
:
1
,
justifyContent
:
'flex-end'
},
sub_btn_box
:
{
width
:
'100%'
,
height
:
38
,
backgroundColor
:
btn_sub_color
,
borderRadius
:
20
,
display
:
'flex'
,
justifyContent
:
'center'
,
alignItems
:
'center'
,
shadowColor
:
btn_sub_color
,
shadowOffset
:
{
width
:
1
,
height
:
2
},
shadowOpacity
:
1
,
elevation
:
2
,
borderWidth
:
0
},
sub_tit
:
{
color
:
title_text_color
,
fontSize
:
second_text_size
}
shadowOpacity
:
1
,
elevation
:
2
,
borderWidth
:
0
,
},
sub_tit
:
{
color
:
title_text_color
,
fontSize
:
second_text_size
,
},
})
export
default
FillDomainModel
;
\ No newline at end of file
export
default
FillDomainModel
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