Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
LuzhouLaojiaoSnake_250428
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
LuzhouLaojiaoSnake_250428
Commits
f4fd51e5
Commit
f4fd51e5
authored
May 12, 2025
by
wangzhujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shuru
parent
0a5da262
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
inputinfomodal.tsx
src/components/inputinfomodal/inputinfomodal.tsx
+15
-13
store.ts
src/store/store.ts
+4
-1
No files found.
src/components/inputinfomodal/inputinfomodal.tsx
View file @
f4fd51e5
...
...
@@ -43,23 +43,23 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
// 指定 field 的类型为 InputInfoModalState 的键名
handleChange
=
(
field
:
keyof
InputInfoModalState
,
value
:
string
)
=>
{
// 这里使用类型断言确保类型匹配
this
.
setState
({
[
field
]:
value
}
as
Pick
<
InputInfoModalState
,
typeof
field
>
);
// this.setState({ [field]: value } as Pick<InputInfoModalState, typeof field>);
store
[
field
]
=
value
}
confirm
=
async
()
=>
{
/**判空 */
if
(
!
this
.
state
.
name
||
!
this
.
state
.
phone
||
!
this
.
stat
e
.
detail
||
!
store
.
province
||
!
store
.
city
)
{
if
(
!
store
.
name
||
!
store
.
phone
||
!
stor
e
.
detail
||
!
store
.
province
||
!
store
.
city
)
{
Toast
.
show
(
"请输入完整信息"
)
return
}
/**只判断11位手机号 */
if
(
!
/^1
[
3456789
]\d{9}
$/
.
test
(
this
.
stat
e
.
phone
))
{
if
(
!
/^1
[
3456789
]\d{9}
$/
.
test
(
stor
e
.
phone
))
{
Toast
.
show
(
"请输入正确的手机号"
)
return
}
let
{
name
,
phone
,
detail
}
=
this
.
state
let
{
province
,
city
,
area
}
=
store
let
{
name
,
phone
,
detail
,
province
,
city
,
area
}
=
store
if
(
province
==
'北京市'
||
province
==
'上海市'
||
province
==
'天津市'
||
province
==
'重庆市'
)
{
city
=
province
...
...
@@ -77,12 +77,13 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
if
(
resp
.
success
&&
resp
.
data
)
{
Toast
.
show
(
"领取成功"
)
ModalCtrl
.
closeModal
()
this
.
props
?.
receiveSuc
&&
this
.
props
?.
receiveSuc
()
// this.props?.receiveSuc && this.props?.receiveSuc()
store
.
getPrizeList
()
}
else
{
Toast
.
show
(
"领取失败,请联系客服"
)
ModalCtrl
.
closeModal
()
}
console
.
warn
(
this
.
state
)
//
console.warn(this.state)
}
doSelect
=
({
province
,
city
,
area
})
=>
{
...
...
@@ -97,6 +98,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
store
.
province
=
province
store
.
city
=
city
store
.
area
=
area
// console.info(this.state)
}
...
...
@@ -123,7 +125,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
type=
"text"
className=
"inputinfomodaldetailconplaceholder"
placeholder=
"请输入详细地址"
value=
{
this
.
stat
e
.
detail
}
value=
{
stor
e
.
detail
}
onChange=
{
(
e
)
=>
this
.
handleChange
(
'detail'
,
e
.
target
.
value
)
}
/>
</
div
>
...
...
@@ -133,7 +135,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
type=
"tel"
className=
"inputinfomodalphoneconplaceholder"
placeholder=
"请输入手机号"
value=
{
this
.
stat
e
.
phone
}
value=
{
stor
e
.
phone
}
onChange=
{
(
e
)
=>
this
.
handleChange
(
'phone'
,
e
.
target
.
value
)
}
/>
</
div
>
...
...
@@ -143,7 +145,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
type=
"text"
className=
"inputinfomodalnameconplaceholder"
placeholder=
"请输入姓名"
value=
{
this
.
stat
e
.
name
}
value=
{
stor
e
.
name
}
onChange=
{
(
e
)
=>
this
.
handleChange
(
'name'
,
e
.
target
.
value
)
}
/>
</
div
>
...
...
@@ -154,14 +156,14 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
className=
"inputinfomodalareaprovinceconplaceholder"
placeholder=
"请输入"
value=
{
store
.
province
}
onChange=
{
(
e
)
=>
this
.
handleChange
(
'province'
,
e
.
target
.
value
)
}
//
onChange={(e) => this.handleChange('province', e.target.value)}
/>
<
input
type=
"text"
className=
"inputinfomodalareacityconplaceholder"
placeholder=
"请输入"
value=
{
store
.
city
}
onChange=
{
(
e
)
=>
this
.
handleChange
(
'city'
,
e
.
target
.
value
)
}
//
onChange={(e) => this.handleChange('city', e.target.value)}
/>
<
input
type=
"text"
...
...
@@ -170,7 +172,7 @@ class Inputinfomodal extends React.Component<InputInfoModalProps, InputInfoModal
value=
{
store
.
area
}
onChange=
{
(
e
)
=>
{
console
.
log
(
e
.
target
.
value
)
this
.
handleChange
(
'area'
,
e
.
target
.
value
)
//
this.handleChange('area', e.target.value)
}
}
/>
...
...
src/store/store.ts
View file @
f4fd51e5
...
...
@@ -122,13 +122,16 @@ class Store {
province
:
string
=
''
;
city
:
string
=
''
;
area
:
string
=
''
;
name
:
string
=
''
;
phone
:
string
=
''
;
detail
:
string
=
''
;
goMiniApp
()
{
if
(
isWechatMiniProgram
())
{
// 小程序内跳转
}
else
if
(
isWeiXin
())
{
// 微信内跳转
}
}
...
...
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