Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
m0_60613409
vue2-elm
提交
853f2363
V
vue2-elm
项目概览
m0_60613409
/
vue2-elm
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue2-elm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
853f2363
编写于
2月 16, 2017
作者:
M
maguohua
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reset
上级
9b657473
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
93 addition
and
72 deletion
+93
-72
src/page/forget/forget.vue
src/page/forget/forget.vue
+69
-66
src/page/login/login.vue
src/page/login/login.vue
+16
-1
src/service/getData.js
src/service/getData.js
+8
-5
未找到文件。
src/page/forget/forget.vue
浏览文件 @
853f2363
...
...
@@ -2,11 +2,10 @@
<div
class=
"restContainer"
>
<head-top
head-title=
"重置密码"
goBack=
"true"
></head-top>
<form
class=
"restForm"
>
<section
class=
"input_container"
>
<input
type=
"text"
placeholder=
"手机号/邮箱"
v-model=
"userAccount"
>
</section>
<section
class=
"input_container"
>
<input
type=
"text"
placeholder=
"请输入旧密码"
name=
"oldPassWord"
v-model=
"oldPassWord"
>
<section
class=
"input_container phone_number"
>
<input
type=
"text"
placeholder=
"手机号"
name=
"phone"
maxlength=
"11"
v-model=
"phoneNumber"
@
input=
"inputPhone"
>
<button
@
click.prevent=
"getVerifyCode"
:class=
"
{right_phone_number:rightPhoneNumber}" v-show="!computedTime">获取验证码
</button>
<button
@
click.prevent
v-show=
"computedTime"
>
已发送(
{{
computedTime
}}
s)
</button>
</section>
<section
class=
"input_container"
>
<input
type=
"text"
placeholder=
"请输入新密码"
name=
"newPassWord"
v-model=
"newPassWord"
>
...
...
@@ -14,15 +13,8 @@
<section
class=
"input_container"
>
<input
type=
"text"
placeholder=
"请确认密码"
name=
"confirmPassWord"
v-model=
"confirmPassWord"
>
</section>
<section
class=
"input_container captcha_code_container"
>
<input
type=
"text"
placeholder=
"验证码"
maxlength=
"4"
v-model=
"codeNumber"
>
<div
class=
"img_change_img"
>
<img
v-show=
"captchaCodeImg"
:src=
"captchaCodeImg"
>
<div
class=
"change_img"
@
click=
"getCaptchaCode"
>
<p>
看不清
</p>
<p>
换一张
</p>
</div>
</div>
<section
class=
"input_container"
>
<input
type=
"text"
placeholder=
"验证码"
name=
"mobileCode"
maxlength=
"6"
v-model=
"mobileCode"
>
</section>
</form>
<div
class=
"login_container"
@
click=
"resetButton"
>
确认修改
</div>
...
...
@@ -33,46 +25,67 @@
<
script
>
import
headTop
from
'
../../components/header/head
'
import
alertTip
from
'
../../components/common/alertTip
'
import
{
mapState
,
mapMutations
}
from
'
vuex
'
import
{
getcaptchas
,
checkExsis
,
sendMobile
}
from
'
../../service/getData
'
import
{
mobileCode
,
checkExsis
,
sendMobile
}
from
'
../../service/getData
'
export
default
{
data
(){
return
{
userAccount
:
null
,
//帐号
oldPassWord
:
null
,
//旧密码
phoneNumber
:
null
,
//电话号码
newPassWord
:
null
,
//新密码
rightPhoneNumber
:
false
,
//输入的手机号码是否符合要求
confirmPassWord
:
null
,
//确认密码
captchaCodeImg
:
null
,
//验证码地址
codeNumber
:
null
,
//验证码
mobileCode
:
null
,
//短信验证码
computedTime
:
0
,
//倒数记时
showAlert
:
false
,
//显示提示组件
alertText
:
null
,
//提示的内容
accountType
:
null
,
//注册方式
accountType
:
'
mobile
'
,
//注册方式
}
},
created
(){
this
.
getCaptchaCode
();
},
components
:
{
headTop
,
alertTip
,
},
methods
:
{
...
mapMutations
([
'
RECORD_USERINFO
'
,
]),
async
getCaptchaCode
(){
let
res
=
await
getcaptchas
();
this
.
captchaCodeImg
=
'
https://mainsite-restapi.ele.me/v1/captchas/
'
+
res
.
code
;
inputPhone
(){
if
(
/^1
\d{10}
$/gi
.
test
(
this
.
phoneNumber
)){
this
.
rightPhoneNumber
=
true
;
}
else
{
this
.
rightPhoneNumber
=
false
;
}
},
async
getVerifyCode
(){
if
(
this
.
rightPhoneNumber
)
{
this
.
computedTime
=
30
;
this
.
timer
=
setInterval
(()
=>
{
this
.
computedTime
--
;
if
(
this
.
computedTime
==
0
)
{
clearInterval
(
this
.
timer
)
}
},
1000
)
let
res
=
await
checkExsis
(
this
.
phoneNumber
,
this
.
accountType
);
if
(
res
.
message
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
res
.
message
;
return
}
else
if
(
!
res
.
is_exists
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
'
您输入的手机号尚未绑定
'
;
return
}
let
getCode
=
await
mobileCode
(
this
.
phoneNumber
);
if
(
getCode
.
message
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
getCode
.
message
;
return
}
this
.
validate_token
=
getCode
.
validate_token
;
}
},
async
resetButton
(){
if
(
!
this
.
userAccount
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
'
请输入您的帐号
'
;
return
}
else
if
(
!
this
.
oldPassWord
){
if
(
!
this
.
rightPhoneNumber
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
'
请输入
旧密码
'
;
this
.
alertText
=
'
请输入
正确的手机号
'
;
return
}
else
if
(
!
this
.
newPassWord
){
this
.
showAlert
=
true
;
...
...
@@ -82,44 +95,23 @@
this
.
showAlert
=
true
;
this
.
alertText
=
'
请输确认密码
'
;
return
}
else
if
(
!
this
.
codeNumber
){
}
else
if
(
this
.
newPassWord
!==
this
.
confirmPassWord
){
this
.
showAlert
=
true
;
this
.
alertText
=
'
请输验证码
'
;
this
.
alertText
=
'
两次输入的密码不一致
'
;
return
}
else
if
(
/^1
\d{10}
$/gi
.
test
(
this
.
userAccount
)){
this
.
accountType
=
'
mobile
'
;
let
res
=
await
checkExsis
(
this
.
userAccount
,
this
.
accountType
);
if
(
res
.
message
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
res
.
message
;
return
}
else
if
(
!
res
.
is_exists
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
'
您输入的手机号尚未绑定
'
;
return
}
}
else
if
(
/@/gi
.
test
(
this
.
userAccount
)){
this
.
accountType
=
'
email
'
;
let
res
=
await
checkExsis
(
this
.
userAccount
,
this
.
accountType
);
if
(
res
.
message
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
res
.
message
;
return
}
else
if
(
!
res
.
is_exists
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
'
您输入的邮箱尚未绑定
'
;
return
}
}
else
{
}
else
if
(
!
this
.
mobileCode
){
this
.
showAlert
=
true
;
this
.
alertText
=
'
请输
入正确的手机号/邮箱
'
;
this
.
alertText
=
'
请输
验证码
'
;
return
}
let
res
=
await
sendMobile
(
this
.
userAccount
,
this
.
codeNumber
,
this
.
accountType
);
let
res
=
await
sendMobile
(
this
.
phoneNumber
,
this
.
mobileCode
,
this
.
accountType
,
this
.
newPassWord
);
if
(
res
.
message
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
res
.
message
;
return
}
else
{
this
.
showAlert
=
true
;
this
.
alertText
=
'
密码修改成功
'
;
}
},
closeTip
(){
...
...
@@ -146,9 +138,20 @@
border-bottom
:
1px
solid
#f1f1f1
;
input
{
@include
sc
(
.7rem
,
#666
);
flex
:
1
;
}
button
{
@include
sc
(
.65rem
,
#fff
);
font-family
:
Helvetica
Neue
,
Tahoma
,
Arial
;
padding
:
.28rem
.4rem
;
border
:
1px
;
border-radius
:
0
.15rem
;
}
.right_phone_number
{
background-color
:
#4cd964
;
}
}
.phone_number
{
padding
:
.3rem
.8rem
;
}
.captcha_code_container
{
height
:
2
.2rem
;
...
...
src/page/login/login.vue
浏览文件 @
853f2363
...
...
@@ -51,7 +51,7 @@
import
headTop
from
'
../../components/header/head
'
import
alertTip
from
'
../../components/common/alertTip
'
import
{
mapState
,
mapMutations
}
from
'
vuex
'
import
{
mobileCode
,
sendLogin
,
getcaptchas
,
accountLogin
}
from
'
../../service/getData
'
import
{
mobileCode
,
checkExsis
,
sendLogin
,
getcaptchas
,
accountLogin
}
from
'
../../service/getData
'
export
default
{
data
(){
...
...
@@ -109,7 +109,22 @@
clearInterval
(
this
.
timer
)
}
},
1000
)
let
exsis
=
await
checkExsis
(
this
.
phoneNumber
,
this
.
accountType
);
if
(
exsis
.
message
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
exsis
.
message
;
return
}
else
if
(
!
exsis
.
is_exists
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
'
您输入的手机号尚未绑定
'
;
return
}
let
res
=
await
mobileCode
(
this
.
phoneNumber
);
if
(
res
.
message
)
{
this
.
showAlert
=
true
;
this
.
alertText
=
res
.
message
;
return
}
this
.
validate_token
=
res
.
validate_token
;
}
},
...
...
src/service/getData.js
浏览文件 @
853f2363
...
...
@@ -150,7 +150,11 @@ export const ratingTags = shopid => fetch('GET', '/ugc/v2/restaurants/' + shopid
/**
* 获取短信验证码
*/
//export const mobileCode = phone => fetch('POST', '/v4/mobile/verify_code/send', {mobile:phone, scene: 'login', type: 'sms'});
export
const
mobileCode
=
phone
=>
fetch
(
'
POST
'
,
'
/v4/mobile/verify_code/send
'
,
{
mobile
:
phone
,
scene
:
'
login
'
,
type
:
'
sms
'
});
/**
* 手机号登陆
*/
...
...
@@ -170,17 +174,16 @@ export const checkExsis = (checkNumber, type) => fetch('GET', '/v1/users/exists'
[
type
]:
checkNumber
,
type
});
/**
* 发送帐号
*/
export
const
sendMobile
=
(
sendData
,
captcha_code
,
type
)
=>
fetch
(
'
POST
'
,
'
/v1/mobile/verify_code/send
'
,
{
export
const
sendMobile
=
(
sendData
,
captcha_code
,
type
,
password
)
=>
fetch
(
'
POST
'
,
'
/v1/mobile/verify_code/send
'
,
{
action
:
"
send
"
,
captcha_code
,
[
type
]:
sendData
,
type
:
"
sms
"
,
way
:
type
,
password
,
});
...
...
@@ -211,6 +214,6 @@ const setpromise = data => {
// export const getRatingList = (offset, tag_name = '') => setpromise(shop.ratingList);
// export const ratingScores = shopid => setpromise(shop.scores);
// export const ratingTags = shopid => setpromise(shop.tage);
export
const
mobileCode
=
phone
=>
setpromise
(
login
.
validate_token
);
//
export const mobileCode = phone => setpromise(login.validate_token);
export
const
sendLogin
=
(
code
,
mobile
,
validate_token
)
=>
setpromise
(
login
.
userInfo
);
export
const
accountLogin
=
(
username
,
password
,
captcha_code
)
=>
setpromise
(
login
.
userInfo
);
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录