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