Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
traceSourceMb
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yanyanhong
traceSourceMb
Commits
e7fcab4f
Commit
e7fcab4f
authored
Aug 05, 2020
by
yyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设置密码和设置手机号流程
parent
bbef1970
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
index.ts
src/store/index.ts
+3
-0
SetPasswd.vue
src/views/userCenter/SetPasswd.vue
+3
-4
SetPhone.vue
src/views/userCenter/SetPhone.vue
+11
-4
No files found.
src/store/index.ts
View file @
e7fcab4f
...
...
@@ -18,6 +18,9 @@ export default new Vuex.Store({
isPhone
(
{
userInfo
})
{
return
userInfo
.
phone
;
},
isPhoneStr
(
{
userInfo
})
{
return
userInfo
.
phone
?
'手机号'
:
'邮箱'
;
},
userIcon
(
{
userInfo
}
)
{
if
(
userInfo
.
icon
)
{
return
userInfo
.
icon
;
...
...
src/views/userCenter/SetPasswd.vue
View file @
e7fcab4f
...
...
@@ -2,7 +2,7 @@
<div
class=
"set-passwd"
>
<section
v-if=
"step == '1'"
>
<div
class=
"title"
>
设置密码
</div>
<van-field
:value=
"userInfo.phone || userInfo.email"
label=
""
readonly
placeholder=
"请输入你的手机号
"
class=
"margin-top30"
></van-field>
<van-field
:value=
"userInfo.phone || userInfo.email"
label=
""
readonly
:placeholder=
"`请输入你的$
{isPhoneStr}`
" class="margin-top30">
</van-field>
<van-button
block
style=
"margin-top: 60px;"
type=
"info"
@
click=
"step = '2'"
>
获取验证码
</van-button>
</section>
<code-input
v-if=
"step == '2'"
:code
.
sync=
"code"
:codeTo=
"userInfo.phone || userInfo.email"
@
send-code=
"sendCode"
@
next=
"showPassWordInputHandler"
></code-input>
...
...
@@ -40,13 +40,12 @@ import CodeInput from './components/CodeInput.vue';
})
export
default
class
SetPasswd
extends
Vue
{
@
State
(
'userInfo'
)
private
userInfo
!
:
any
;
@
Getter
(
'isPhone'
)
private
isPhone
!
:
boolean
;
@
Getter
(
'isPhoneStr'
)
private
isPhoneStr
!
:
string
;
@
Action
(
'getUserInfo'
)
private
getUserInfo
!
:
()
=>
void
;
private
code
:
string
=
''
;
private
pwd
:
string
=
''
;
private
step
:
string
=
'1'
;
get
isPhone
()
{
return
this
.
userInfo
.
phone
;
}
get
codeType
()
{
return
this
.
isPhone
?
0
:
1
;
}
...
...
src/views/userCenter/SetPhone.vue
View file @
e7fcab4f
...
...
@@ -16,7 +16,7 @@
<section
v-if=
"step === '3'"
>
<div
class=
"title"
>
输入新
{{
isPhoneStr
}}
</div>
<van-field
v-model=
"newPhone"
label=
""
:placeholder=
"`请输入新$
{isPhoneStr}`" class="margin-top30">
</van-field>
<van-button
block
type=
"info"
class=
"margin-top30"
@
click=
"
step='4';sendCode(newPhone)();
"
>
确定
</van-button>
<van-button
block
type=
"info"
class=
"margin-top30"
@
click=
"
inputNewPhone
"
>
确定
</van-button>
</section>
<code-input
v-if=
"step === '4'"
...
...
@@ -48,6 +48,7 @@ import CodeInput from './components/CodeInput.vue';
export
default
class
SetPhone
extends
Vue
{
@
State
(
'userInfo'
)
private
userInfo
!
:
any
;
@
Getter
(
'isPhone'
)
private
isPhone
!
:
boolean
;
@
Getter
(
'isPhoneStr'
)
private
isPhoneStr
!
:
string
;
@
Action
(
'getUserInfo'
)
private
getUserInfo
!
:
()
=>
Promise
<
any
>
;
private
code
:
string
=
''
;
private
randomToken
:
string
=
''
;
...
...
@@ -56,9 +57,6 @@ export default class SetPhone extends Vue {
get
codeType
()
{
return
this
.
isPhone
?
0
:
1
;
}
get
isPhoneStr
()
{
return
this
.
isPhone
?
'手机号'
:
'邮箱'
;
}
private
sendSms
(
account
:
string
=
''
)
{
return
this
.
$api
.
user
.
sendSms
(
account
||
this
.
userInfo
.
phone
,
3
);
// 1 修改密码
}
...
...
@@ -87,6 +85,15 @@ export default class SetPhone extends Vue {
this
.
step
=
'3'
;
this
.
code
=
''
;
}
private
inputNewPhone
()
{
const
{
isPhone
,
newPhone
,
isPhoneStr
}
=
this
;
if
(
!
/1
\d{10}
/
.
test
(
newPhone
)
||
!
/^
[
A-Za-z0-9
\u
4e00-
\u
9fa5
]
+@
[
a-zA-Z0-9_-
]
+
(\.[
a-zA-Z0-9_-
]
+
)
+$/
.
test
(
newPhone
))
{
this
.
$toast
(
`请输入正确的
${
isPhoneStr
}
`
);
return
;
}
this
.
step
=
'4'
;
this
.
sendCode
(
newPhone
)();
}
private
async
setPhone
()
{
const
{
code
,
newPhone
,
randomToken
}
=
this
;
await
this
.
$api
.
user
.
setPhone
(
code
,
newPhone
,
randomToken
);
...
...
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