Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
一个会的不多的人
uni-starter
提交
3de4d89e
U
uni-starter
项目概览
一个会的不多的人
/
uni-starter
与 Fork 源项目一致
Fork自
DCloud / uni-starter
通知
1
Star
1
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3de4d89e
编写于
4月 10, 2021
作者:
L
linju
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
123
上级
3f548d5c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
190 addition
and
149 deletion
+190
-149
uni_modules/uni-login-page/pages/index/index.vue
uni_modules/uni-login-page/pages/index/index.vue
+27
-27
uni_modules/uni-login-page/pages/index/pwd-login.vue
uni_modules/uni-login-page/pages/index/pwd-login.vue
+100
-100
uni_modules/uni-login-page/pages/index/pwd-retrieve.vue
uni_modules/uni-login-page/pages/index/pwd-retrieve.vue
+53
-19
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/index.js
...-quick-login/uniCloud/cloudfunctions/user-center/index.js
+10
-3
未找到文件。
uni_modules/uni-login-page/pages/index/index.vue
浏览文件 @
3de4d89e
...
...
@@ -10,7 +10,7 @@
<uni-forms-item
name=
"phone"
>
<uni-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号"
>
<template
slot=
"left"
>
<template
slot=
"left"
>
<!-- 当前仅支持中国大陆手机号 -->
<!--
<picker
mode=
"selector"
:range=
"phoneArea"
@
change=
"selectPhoneArea"
>
-->
<text
class=
"phone-area"
@
click=
"selectPhoneArea"
>
{{
currenPhoneArea
}}
</text>
...
...
@@ -38,10 +38,10 @@
</view>
</template>
<
script
>
import
mixin
from
'
../../common/loginPage.mixin.js
'
;
<
script
>
import
mixin
from
'
../../common/loginPage.mixin.js
'
;
var
currentPage
;
export
default
{
export
default
{
mixins
:[
mixin
],
data
()
{
return
{
...
...
@@ -56,7 +56,7 @@
currenPhoneArea
:
'
+86
'
,
formData
:
{
phone
:
'
177
77777777
'
phone
:
'
177
69516081
'
},
rules
:
{
// 对phone字段进行必填验证
...
...
@@ -79,16 +79,16 @@
currentPage
=
pages
[
pages
.
length
-
1
];
currentPage
.
$getAppWebview
().
setStyle
({
top
:
"
1000px
"
})
},
onReady
()
{
this
.
$refs
.
uniQuickLogin
.
login
(
'
univerify
'
)
setTimeout
(()
=>
{
currentPage
.
$getAppWebview
().
setStyle
({
top
:
"
0
"
})
},
1500
);
},
})
},
onReady
()
{
this
.
$refs
.
uniQuickLogin
.
login
(
'
univerify
'
)
setTimeout
(()
=>
{
currentPage
.
$getAppWebview
().
setStyle
({
top
:
"
0
"
})
},
1500
);
},
computed
:
{
canGetShortMsg
()
{
...
...
@@ -105,10 +105,10 @@
console
.
log
(
'
表单错误信息:
'
,
err
);
})
},
selectPhoneArea
(
event
)
{
uni
.
showToast
({
title
:
'
当前仅支持中国大陆手机号
'
,
icon
:
'
none
'
selectPhoneArea
(
event
)
{
uni
.
showToast
({
title
:
'
当前仅支持中国大陆手机号
'
,
icon
:
'
none
'
});
// this.currenPhoneArea = this.phoneArea[event.detail.value];
},
...
...
@@ -118,13 +118,13 @@
* 发送验证吗
*/
uni
.
showLoading
();
uni
.
navigateTo
({
url
:
'
./phone-code?phoneNumber=
'
+
this
.
formData
.
phone
+
'
&phoneArea=
'
+
this
.
currenPhoneArea
,
success
:
res
=>
{},
fail
:
()
=>
{},
complete
:
()
=>
{}
});
uni
.
navigateTo
({
url
:
'
./phone-code?phoneNumber=
'
+
this
.
formData
.
phone
+
'
&phoneArea=
'
+
this
.
currenPhoneArea
,
success
:
res
=>
{},
fail
:
()
=>
{},
complete
:
()
=>
{}
});
},
/**
* 去密码登录页
...
...
@@ -164,4 +164,4 @@
border-right
:
1
rpx
solid
#d7d9d8
;
/* #endif */
}
</
style
>
</
style
>
uni_modules/uni-login-page/pages/index/pwd-login.vue
浏览文件 @
3de4d89e
...
...
@@ -8,14 +8,14 @@
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<uni-forms
ref=
"form"
:value=
"formData"
:rules=
"rules"
>
<uni-forms-item
name=
"phone"
>
<uni-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号"
>
<template
slot=
"left"
>
<!-- 当前仅支持中国大陆手机号 -->
<!--
<picker
mode=
"selector"
:range=
"phoneArea"
@
change=
"selectPhoneArea"
>
-->
<text
class=
"phone-area"
@
click=
"selectPhoneArea"
>
{{
currenPhoneArea
}}
</text>
<!--
</picker>
-->
</
template
>
<uni-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号"
>
<template
slot=
"left"
>
<!-- 当前仅支持中国大陆手机号 -->
<!--
<picker
mode=
"selector"
:range=
"phoneArea"
@
change=
"selectPhoneArea"
>
-->
<text
class=
"phone-area"
@
click=
"selectPhoneArea"
>
{{
currenPhoneArea
}}
</text>
<!--
</picker>
-->
</
template
>
</uni-easyinput>
<uni-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.pwd"
placeholder=
"请输入密码"
></uni-easyinput>
...
...
@@ -34,49 +34,49 @@
</view>
</template>
<
script
>
<
script
>
import
mixin
from
'
../../common/loginPage.mixin.js
'
;
export
default
{
export
default
{
mixins
:[
mixin
],
data
()
{
return
{
link
:
[{
text
:
'
用户协议
'
,
to
:
'
/pages/ucenter/agree-list/service/service
'
},
{
text
:
'
隐私政策
'
,
to
:
'
/pages/ucenter/agree-list/privacy/privacy
'
link
:
[{
text
:
'
用户协议
'
,
to
:
'
/pages/ucenter/agree-list/service/service
'
},
{
text
:
'
隐私政策
'
,
to
:
'
/pages/ucenter/agree-list/privacy/privacy
'
}],
phoneArea
:
[
'
+86
'
],
currenPhoneArea
:
'
+86
'
,
formData
:
{
phone
:
'
177
77777777
'
,
pwd
:
'
123456
'
},
rules
:
{
phone
:
{
rules
:
[{
required
:
true
,
errorMessage
:
'
请输入手机号
'
,
},
{
pattern
:
/^1
\d{10}
$/
,
errorMessage
:
'
手机号格式不正确
'
,
}
]
},
pwd
:{
rules
:
[{
required
:
true
,
errorMessage
:
'
请输入密码
'
,
},
{
pattern
:
/^.
{6,20}
$/
,
errorMessage
:
'
密码应为6到20位
'
,
}
]
}
currenPhoneArea
:
'
+86
'
,
formData
:
{
phone
:
'
177
69516081
'
,
pwd
:
'
123456
'
},
rules
:
{
phone
:
{
rules
:
[{
required
:
true
,
errorMessage
:
'
请输入手机号
'
,
},
{
pattern
:
/^1
\d{10}
$/
,
errorMessage
:
'
手机号格式不正确
'
,
}
]
},
pwd
:{
rules
:
[{
required
:
true
,
errorMessage
:
'
请输入密码
'
,
},
{
pattern
:
/^.
{6,20}
$/
,
errorMessage
:
'
密码应为6到20位
'
,
}
]
}
}
}
},
...
...
@@ -111,61 +111,61 @@
*/
pwdLogin
()
{
if
(
!
this
.
canLogin
)
return
;
// 下边是可以登录
uniCloud
.
callFunction
({
name
:
"
user-center
"
,
"
data
"
:{
"
action
"
:
"
login
"
,
"
params
"
:{
"
username
"
:
this
.
formData
.
phone
,
"
password
"
:
this
.
formData
.
pwd
}
},
success
:
async
(
e
)
=>
{
uni
.
hideLoading
()
console
.
log
(
e
.
result
);
if
(
e
.
result
.
code
===
0
){
uni
.
setStorageSync
(
'
uni_id_uid
'
,
e
.
result
.
uid
)
uni
.
setStorageSync
(
'
uni_id_token
'
,
e
.
result
.
token
)
uni
.
setStorageSync
(
'
uni_id_token_expired
'
,
e
.
result
.
tokenExpired
)
// console.log('66666=',e.result.uid,e.result.token,e.result.tokenExpired);
delete
e
.
result
.
userInfo
.
token
this
.
setUserInfo
(
e
.
result
.
userInfo
)
uni
.
showToast
({
title
:
'
登陆成功
'
,
icon
:
'
none
'
});
uni
.
navigateBack
()
}
else
{
uni
.
showModal
({
title
:
'
错误
'
,
content
:
e
.
result
.
msg
,
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
}
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
uni
.
showModal
({
title
:
'
错误
'
,
content
:
JSON
.
stringify
(
err
),
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
if
(
err
.
errCode
===
30002
){
}
},
complete
:
()
=>
{
uni
.
hideLoading
()
}
// 下边是可以登录
uniCloud
.
callFunction
({
name
:
"
user-center
"
,
"
data
"
:{
"
action
"
:
"
login
"
,
"
params
"
:{
"
username
"
:
this
.
formData
.
phone
,
"
password
"
:
this
.
formData
.
pwd
}
},
success
:
async
(
e
)
=>
{
uni
.
hideLoading
()
console
.
log
(
e
.
result
);
if
(
e
.
result
.
code
===
0
){
uni
.
setStorageSync
(
'
uni_id_uid
'
,
e
.
result
.
uid
)
uni
.
setStorageSync
(
'
uni_id_token
'
,
e
.
result
.
token
)
uni
.
setStorageSync
(
'
uni_id_token_expired
'
,
e
.
result
.
tokenExpired
)
// console.log('66666=',e.result.uid,e.result.token,e.result.tokenExpired);
delete
e
.
result
.
userInfo
.
token
this
.
setUserInfo
(
e
.
result
.
userInfo
)
uni
.
showToast
({
title
:
'
登陆成功
'
,
icon
:
'
none
'
});
uni
.
navigateBack
()
}
else
{
uni
.
showModal
({
title
:
'
错误
'
,
content
:
e
.
result
.
msg
,
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
}
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
uni
.
showModal
({
title
:
'
错误
'
,
content
:
JSON
.
stringify
(
err
),
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
if
(
err
.
errCode
===
30002
){
}
},
complete
:
()
=>
{
uni
.
hideLoading
()
}
})
},
selectPhoneArea
(
event
)
{
uni
.
showToast
({
title
:
'
当前仅支持中国大陆手机号
'
,
icon
:
'
none
'
selectPhoneArea
(
event
)
{
uni
.
showToast
({
title
:
'
当前仅支持中国大陆手机号
'
,
icon
:
'
none
'
});
// this.currenPhoneArea = this.phoneArea[event.detail.value];
},
...
...
@@ -181,11 +181,11 @@
}
.auth-box
{
justify-content
:
flex-start
;
justify-content
:
flex-start
;
margin-top
:
20
rpx
;
}
.login-text-sub
{
color
:
#8a8f8b
;
}
</
style
>
</
style
>
uni_modules/uni-login-page/pages/index/pwd-retrieve.vue
浏览文件 @
3de4d89e
...
...
@@ -18,7 +18,7 @@
v-model=
"formData.pwd"
placeholder=
"请输入新密码"
></uni-easyinput>
</uni-forms-item>
<button
class=
"send-btn-box"
:disabled=
"!canSubmit"
:type=
"canSubmit?'primary':'default'"
@
click=
"
submit
"
>
完成
</button>
@
click=
"
checkCode(submit)
"
>
完成
</button>
</uni-forms>
</view>
</view>
...
...
@@ -130,17 +130,14 @@ import mixin from '../../common/loginPage.mixin.js';
}
})
},
/**
* 完成并提交
*/
submit
(){
uniCloud
.
callFunction
({
name
:
"
user-center
"
,
"
data
"
:{
"
action
"
:
"
login
"
,
checkCode
(
callback
){
uniCloud
.
callFunction
({
//联网验证登陆
"
name
"
:
"
user-center
"
,
"
data
"
:
{
"
action
"
:
"
loginBySms
"
,
"
params
"
:{
"
username
"
:
this
.
formData
.
phone
,
"
password
"
:
this
.
formData
.
pwd
"
mobile
"
:
this
.
phoneNumber
,
"
code
"
:
this
.
formData
.
code
}
},
success
:
async
(
e
)
=>
{
...
...
@@ -150,14 +147,11 @@ import mixin from '../../common/loginPage.mixin.js';
uni
.
setStorageSync
(
'
uni_id_uid
'
,
e
.
result
.
uid
)
uni
.
setStorageSync
(
'
uni_id_token
'
,
e
.
result
.
token
)
uni
.
setStorageSync
(
'
uni_id_token_expired
'
,
e
.
result
.
tokenExpired
)
// console.log('66666=',e.result.uid,e.result.token,e.result.tokenExpired);
delete
e
.
result
.
userInfo
.
token
this
.
setUserInfo
(
e
.
result
.
userInfo
)
uni
.
showToast
({
title
:
'
登陆成功
'
,
icon
:
'
none
'
});
uni
.
navigateBack
()
// uni.showToast({
// title: '登陆成功',
// icon: 'none'
// });
callback
()
}
else
{
uni
.
showModal
({
title
:
'
错误
'
,
...
...
@@ -183,6 +177,46 @@ import mixin from '../../common/loginPage.mixin.js';
uni
.
hideLoading
()
}
})
},
/**
* 完成并提交
*/
submit
(){
uniCloud
.
callFunction
({
name
:
"
user-center
"
,
"
data
"
:{
"
action
"
:
"
resetPwd
"
,
"
params
"
:{
"
password
"
:
this
.
formData
.
pwd
}
},
success
:
async
(
e
)
=>
{
uni
.
hideLoading
()
console
.
log
(
e
.
result
);
uni
.
showToast
({
title
:
e
.
result
.
msg
,
icon
:
'
none
'
});
if
(
e
.
result
.
code
===
0
){
uni
.
navigateBack
()
}
},
fail
:
(
err
)
=>
{
console
.
log
(
err
);
uni
.
showModal
({
title
:
'
错误
'
,
content
:
JSON
.
stringify
(
err
),
showCancel
:
false
,
confirmText
:
'
知道了
'
,
});
if
(
err
.
errCode
===
30002
){
}
},
complete
:
()
=>
{
uni
.
hideLoading
()
}
})
}
}
}
...
...
uni_modules/uni-quick-login/uniCloud/cloudfunctions/user-center/index.js
浏览文件 @
3de4d89e
...
...
@@ -32,6 +32,7 @@ exports.main = async (event, context) => {
'
createCaptcha
'
,
'
verifyCaptcha
'
,
'
refreshCaptcha
'
,
'
inviteLogin
'
,
'
login_by_weixin
'
,
'
login_by_univerify
'
,
'
login_by_apple
'
,
'
loginBySms
'
]
let
payload
;
console
.
log
(
event
.
action
);
if
(
!
noCheckAction
.
includes
(
event
.
action
))
{
if
(
!
event
.
uniIdToken
)
{
...
...
@@ -40,7 +41,7 @@ exports.main = async (event, context) => {
msg
:
'
缺少token
'
}
}
let
payload
=
await
uniID
.
checkToken
(
event
.
uniIdToken
)
payload
=
await
uniID
.
checkToken
(
event
.
uniIdToken
)
if
(
payload
.
code
&&
payload
.
code
>
0
)
{
return
payload
}
...
...
@@ -88,7 +89,10 @@ exports.main = async (event, context) => {
}
if
(
!
needCaptcha
||
passed
)
{
res
=
await
uniID
.
login
({...
params
,
"
queryField
"
:[
'
username
'
,
'
email
'
,
'
mobile
'
]});
res
=
await
uniID
.
login
({
...
params
,
queryField
:
[
'
username
'
,
'
email
'
,
'
mobile
'
]
});
await
loginLog
(
res
);
needCaptcha
=
await
getNeedCaptcha
();
}
...
...
@@ -124,7 +128,7 @@ exports.main = async (event, context) => {
msg
:
'
请求过于频繁
'
}
}
const
templateId
=
''
// 替换为自己申请的模板id
const
templateId
=
'
11753
'
// 替换为自己申请的模板id
if
(
!
templateId
)
{
return
{
code
:
500
,
...
...
@@ -192,6 +196,9 @@ exports.main = async (event, context) => {
break
;
case
'
refreshCaptcha
'
:
res
=
await
uniCaptcha
.
refresh
(
params
)
break
;
case
'
resetPwd
'
:
res
=
await
uniID
.
resetPwd
({...
params
,
"
uid
"
:
payload
.
uid
})
break
;
default
:
res
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录