Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
言程序plus
uni-starter
提交
525b710b
U
uni-starter
项目概览
言程序plus
/
uni-starter
与 Fork 源项目一致
Fork自
DCloud / uni-starter
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
525b710b
编写于
4月 25, 2021
作者:
DCloud_JSON
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复mixin引用错误的问题
上级
c6950357
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
129 addition
and
68 deletion
+129
-68
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
+129
-68
未找到文件。
pages/ucenter/login-page/pwd-retrieve/pwd-retrieve.vue
浏览文件 @
525b710b
<
template
>
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"title"
>
重置密码
</text>
<login-ikonw
v-show=
"isPhone"
class=
"login-iknow"
:text=
"tipText"
></login-ikonw>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-forms
ref=
"form"
:value=
"formData"
:rules=
"rules"
>
<uni-forms-item
name=
"phone"
>
<!-- focus规则如果上一页携带来“手机号码”数据就focus验证码输入框,否则focus手机号码输入框 -->
<uni-easyinput
:focus=
"!formData.phone.length"
type=
"number"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"code"
>
<uni-easyinput
:focus=
"formData.phone.length!=0"
type=
"number"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<send-sms-code
ref=
"shortCode"
:phone=
"formData.phone"
></send-sms-code>
</
template
>
</uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"pwd"
>
<uni-easyinput
type=
"password"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.pwd"
placeholder=
"请输入新密码"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"pwd2"
>
<uni-easyinput
type=
"password"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.pwd2"
placeholder=
"请确认新密码"
></uni-easyinput>
</uni-forms-item>
<button
class=
"send-btn-box"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"submit"
>
完成
</button>
</uni-forms>
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"title"
>
重置密码
</text>
<login-ikonw
v-show=
"isPhone"
class=
"login-iknow"
:text=
"tipText"
></login-ikonw>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-forms
ref=
"form"
:value=
"formData"
:rules=
"rules"
>
<uni-forms-item
name=
"phone"
>
<!-- focus规则如果上一页携带来“手机号码”数据就focus验证码输入框,否则focus手机号码输入框 -->
<uni-easyinput
:focus=
"!formData.phone.length"
type=
"number"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"code"
>
<uni-easyinput
:focus=
"formData.phone.length!=0"
type=
"number"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
<send-sms-code
ref=
"shortCode"
:phone=
"formData.phone"
></send-sms-code>
</
template
>
</uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"pwd"
>
<uni-easyinput
type=
"password"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.pwd"
placeholder=
"请输入新密码"
></uni-easyinput>
</uni-forms-item>
<uni-forms-item
name=
"pwd2"
>
<uni-easyinput
type=
"password"
class=
"easyinput"
:inputBorder=
"false"
v-model=
"formData.pwd2"
placeholder=
"请确认新密码"
></uni-easyinput>
</uni-forms-item>
<button
class=
"send-btn-box"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"submit"
>
完成
</button>
</uni-forms>
</view>
</template>
<
script
>
import
mixin
from
'
../common/loginP
age.mixin.js
'
;
import
mixin
from
'
../common/login-p
age.mixin.js
'
;
export
default
{
mixins
:[
mixin
],
mixins
:
[
mixin
],
data
()
{
return
{
formData
:
{
"
phone
"
:
""
,
'
pwd
'
:
''
,
'
pwd2
'
:
''
},
rules
:
{
phone
:
{
rules
:
[{
required
:
true
,
errorMessage
:
'
请输入手机号
'
,
},
{
pattern
:
/^1
\d{10}
$/
,
errorMessage
:
'
手机号格式不正确
'
,
}
]
},
code
:
{
rules
:
[{
required
:
true
,
errorMessage
:
'
请输入验证码
'
,
},
{
pattern
:
/^.
{6}
$/
,
errorMessage
:
'
请输入6位验证码
'
,
}
]
},
pwd
:
{
rules
:
[{
required
:
true
,
errorMessage
:
'
请输入密码
'
,
},
{
pattern
:
/^.
{6,20}
$/
,
errorMessage
:
'
密码应为6到20位
'
,
}
]
},
pwd2
:
{
rules
:
[{
required
:
true
,
errorMessage
:
'
请确认密码
'
,
},
{
pattern
:
/^.
{6,20}
$/
,
errorMessage
:
'
密码应为6到20位
'
,
},
{
validateFunction
:
function
(
rule
,
value
,
data
,
callback
)
{
console
.
log
(
value
);
if
(
value
!=
data
.
pwd
)
{
callback
(
'
两次输入密码不一致
'
)
};
return
true
}
}
]
}
}
}
},
computed
:
{
...
...
@@ -46,21 +106,21 @@ import mixin from '../common/loginPage.mixin.js';
},
canSubmit
()
{
return
this
.
isPhone
&&
this
.
isPwd
&&
this
.
isCode
;
},
isPhone
()
{
let
reg_phone
=
/^1
\d{10}
$/
;
let
isPhone
=
reg_phone
.
test
(
this
.
formData
.
phone
);
return
isPhone
;
},
isPwd
()
{
let
reg_pwd
=
/^.
{6,20}
$/
;
let
isPwd
=
reg_pwd
.
test
(
this
.
formData
.
pwd
);
return
isPwd
;
},
isCode
()
{
let
reg_code
=
/^
\d{6}
$/
;
let
isCode
=
reg_code
.
test
(
this
.
formData
.
code
);
return
isCode
;
},
isPhone
()
{
let
reg_phone
=
/^1
\d{10}
$/
;
let
isPhone
=
reg_phone
.
test
(
this
.
formData
.
phone
);
return
isPhone
;
},
isPwd
()
{
let
reg_pwd
=
/^.
{6,20}
$/
;
let
isPwd
=
reg_pwd
.
test
(
this
.
formData
.
pwd
);
return
isPwd
;
},
isCode
()
{
let
reg_code
=
/^
\d{6}
$/
;
let
isCode
=
reg_code
.
test
(
this
.
formData
.
code
);
return
isCode
;
}
},
onLoad
(
event
)
{
...
...
@@ -69,7 +129,7 @@ import mixin from '../common/loginPage.mixin.js';
}
},
onReady
()
{
if
(
this
.
formData
.
phone
)
{
if
(
this
.
formData
.
phone
)
{
this
.
$refs
.
shortCode
.
start
();
}
},
...
...
@@ -77,32 +137,33 @@ import mixin from '../common/loginPage.mixin.js';
/**
* 完成并提交
*/
submit
(){
submit
()
{
this
.
$refs
.
form
.
submit
()
.
then
(
res
=>
{
this
.
request
(
'
user-center/resetPwdBySmsCode
'
,{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
,
"
password
"
:
this
.
formData
.
pwd
},
result
=>
{
console
.
log
(
result
);
uni
.
showToast
({
title
:
result
.
msg
,
icon
:
'
none
'
});
if
(
result
.
code
===
0
){
uni
.
navigateBack
()
}
.
then
(
res
=>
{
this
.
request
(
'
user-center/resetPwdBySmsCode
'
,
{
"
mobile
"
:
this
.
formData
.
phone
,
"
code
"
:
this
.
formData
.
code
,
"
password
"
:
this
.
formData
.
pwd
},
result
=>
{
console
.
log
(
result
);
uni
.
showToast
({
title
:
result
.
msg
,
icon
:
'
none
'
});
if
(
result
.
code
===
0
)
{
uni
.
navigateBack
()
}
})
})
})
}
}
}
</
script
>
<
style
>
@import
url("../common/login-page.css")
;
.content-top-title
{
margin-bottom
:
6px
;
@import
url("../common/login-page.css")
;
.content-top-title
{
margin-bottom
:
6px
;
}
</
style
>
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录