Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
uni-starter
提交
f763279a
U
uni-starter
项目概览
DCloud
/
uni-starter
通知
4684
Star
229
Fork
210
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
3
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
uni-starter
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
3
Issue
3
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f763279a
编写于
4月 19, 2021
作者:
L
linju
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
23
上级
c5128ca7
变更
15
显示空白变更内容
内联
并排
Showing
15 changed file
with
426 addition
and
331 deletion
+426
-331
baseapp.config.js
baseapp.config.js
+3
-2
common/appInit.js
common/appInit.js
+32
-32
manifest.json
manifest.json
+3
-3
pages.json
pages.json
+17
-26
pages/ucenter/about/about.vue
pages/ucenter/about/about.vue
+1
-1
pages/ucenter/settings/settings--.nvue
pages/ucenter/settings/settings--.nvue
+14
-8
pages/ucenter/settings/settings.vue
pages/ucenter/settings/settings.vue
+209
-159
store/modules/user.js
store/modules/user.js
+1
-0
uni_modules/uni-list/components/uni-list-item/uni-list-item.vue
...dules/uni-list/components/uni-list-item/uni-list-item.vue
+1
-1
uni_modules/uni-login-page/pages/index/index.vue
uni_modules/uni-login-page/pages/index/index.vue
+44
-38
uni_modules/uni-login-page/pages/phone-code/phone-code.vue
uni_modules/uni-login-page/pages/phone-code/phone-code.vue
+5
-2
uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue
uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue
+3
-7
uni_modules/uni-login-page/static/login/img/smsCode.png
uni_modules/uni-login-page/static/login/img/smsCode.png
+0
-0
uni_modules/uni-login-page/static/login/img/username.png
uni_modules/uni-login-page/static/login/img/username.png
+0
-0
uni_modules/uni-quick-login/components/uni-quick-login/uni-quick-login.vue
...uick-login/components/uni-quick-login/uni-quick-login.vue
+93
-52
未找到文件。
baseapp.config.js
on
→
baseapp.config.js
浏览文件 @
f763279a
{
module
.
exports
=
{
"
router
"
:{
"needLogin"
:[
"
needLogin
"
:[
//配置需要路由拦截的页面地址,在打开这些页面之前会自动检查(不联网)uni_id_token的值是否存在/过期等
"
/pages/ucenter/edit/edit
"
,
"
/pages/ucenter/settings/settings
"
,
"
/uni_modules/uni-login-page/pages/index/pwd-retrieve
"
],
"
login
"
:[
"
univerify
"
,
"
password
"
,
"
weixin
"
,
"
apple
"
,
"
code
"
]
...
...
common/appInit.js
浏览文件 @
f763279a
import
baseappConfig
from
'
@/baseapp.config.js
on
'
;
import
baseappConfig
from
'
@/baseapp.config.js
'
;
// #ifdef APP-PLUS
import
checkUpdate
from
'
@/uni_modules/uni-upgrade-center-app/utils/check-update
'
;
import
callCheckVersion
from
'
@/uni_modules/uni-upgrade-center-app/utils/call-check-version
'
;
...
...
@@ -50,11 +50,11 @@ export default function() {
if
(
url
==
'
/uni_modules/uni-login-page/pages/index/index
'
){
//一键登录(univerify)、密码登陆(password)、快捷登录&验证码登陆(!univerify&password)
if
(
login
[
0
]
==
'
univerify
'
){
console
.
log
(
e
.
url
,
url
);
//
console.log(e.url,url);
if
(
e
.
url
==
url
){
e
.
url
+=
'
?
'
}
e
.
url
+=
"
univerify_first=true
"
}
else
if
(
login
[
0
]
==
'
password
'
){
e
.
url
=
"
/uni_modules/uni-login-page/pages/
index
/pwd-login
"
e
.
url
=
"
/uni_modules/uni-login-page/pages/
pwd-login
/pwd-login
"
}
else
{
//默认即是
}
...
...
@@ -64,8 +64,8 @@ export default function() {
success
(){
// 成功回调拦截
},
fail
(){
// 失败回调拦截
fail
(
err
){
// 失败回调拦截
console
.
log
(
err
);
},
complete
(
e
){
// 完成回调拦截
//console.log(e);
...
...
manifest.json
浏览文件 @
f763279a
...
...
@@ -7,8 +7,8 @@
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
"compatible"
:
{
"ignoreVersion"
:
true
//
true
表示忽略版本检查提示框,HBuilderX
1.9
.
0
及以上版本支持
"compatible"
:
{
"ignoreVersion"
:
true
//
true
表示忽略版本检查提示框,HBuilderX
1.9
.
0
及以上版本支持
},
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
...
...
pages.json
浏览文件 @
f763279a
...
...
@@ -23,17 +23,9 @@
"navigationBarTitleText"
:
""
,
"app-plus"
:
{
"animationType"
:
"none"
,
"popGesture"
:
"none"
,
"navigationStyle"
:
"custom"
,
"backgroundColor"
:
"transparent"
//
"titleNView"
:
{
//
"buttons"
:
[{
//
"text"
:
"帮助"
,
//
"type"
:
"none"
,
//
"fontSize"
:
"16px"
,
//
"width"
:
"60px"
//
}]
//
}
"popGesture"
:
"none"
//
"navigationStyle"
:
"custom"
,
//
"backgroundColor"
:
"transparent"
,
}
}
},
{
...
...
@@ -159,7 +151,6 @@
"navigationBarTitleText"
:
"帮助"
,
"enablePullDownRefresh"
:
false
}
}
,{
"path"
:
"pages/test/test"
,
...
...
@@ -186,20 +177,20 @@
"navigationBarBackgroundColor"
:
"#FFFFFF"
,
"backgroundColor"
:
"#F8F8F8"
},
//
"condition"
:
{
//
"list"
:
[
//
{
//
"path"
:
"uni_modules/uni-login-page/pages/index/index"
//
},
//
{
//
"path"
:
"pages/test/test"
//
},
//
{
//
"path"
:
"pages/ucenter/settings/settings"
//
}
//
],
//
"current"
:
1
//
},
"condition"
:
{
"list"
:
[
{
"path"
:
"uni_modules/uni-login-page/pages/index/index"
},
{
"path"
:
"pages/test/test"
},
{
"path"
:
"pages/ucenter/settings/settings"
}
],
"current"
:
0
},
"tabBar"
:
{
"color"
:
"#7A7E83"
,
"selectedColor"
:
"#007AFF"
,
...
...
pages/ucenter/about/about.vue
浏览文件 @
f763279a
...
...
@@ -16,7 +16,7 @@
</view>
</template>
<
script
>
import
baseappConfig
from
'
@/baseapp.config.js
on
'
;
import
baseappConfig
from
'
@/baseapp.config.js
'
;
export
default
{
onLoad
()
{
// #ifdef APP-PLUS
...
...
pages/ucenter/settings/settings.nvue
→
pages/ucenter/settings/settings
--
.nvue
浏览文件 @
f763279a
<template>
<view class="content">
<!-- 功能列表 -->
<uni-list
class="content"
>
<uni-list>
<uni-list-item v-for="(item,index) in agreeList" :key="index" :title="item.title"
:clickable="true" @click="itemClick(item)" :showSwitch="item.showSwitch" :switchChecked="item.isChecked"
:link="!item.showSwitch"></uni-list-item>
:link="!item.showSwitch"
></uni-list-item>
</uni-list>
<!-- 退出按钮 -->
<view class="bottom-back" @click="clickLogout">
...
...
@@ -71,7 +72,10 @@
},
changePwd(){
uni.navigateTo({
url:'/uni_modules/uni-login-page/pages/index/pwd-retrieve?phoneNumber='+ (this.userInfo?this.userInfo.phone:'') +'&phoneArea=+86'
url:'/uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve?phoneNumber='+ (this.userInfo&&this.userInfo.phone?this.userInfo.phone:'') +'&phoneArea=+86',
fail:err=> {
console.log(err);
}
});
},
checkPush(){
...
...
@@ -198,7 +202,8 @@
}
},
itemClick(item) {
if (!item.to && item.event) {
console.log(item);
if (item.event) {
this[item.event](item);
}
},
...
...
@@ -227,11 +232,12 @@
.content {
/* #ifndef APP-NVUE */
display: flex;
width:
100%
;
height: 100
%
;
width:
750rpx
;
height: 100
vh
;
/* #endif */
flex-direction: column;
flex: 1;
background-color: #E5E5E5;
}
.bottom-back {
...
...
@@ -248,11 +254,11 @@
/* #endif */
border-width: 0;
border-radius: 0;
background-color: #
007AFF;
background-color: #
FFFFFF;
}
.bottom-back-text {
font-size: 40rpx;
color: #
FFFFFF
;
color: #
999999
;
}
</style>
pages/ucenter/settings/settings.vue
浏览文件 @
f763279a
<
template
>
<view
class=
"content"
>
<!-- 功能列表 -->
<uni-list
class=
"conten
t"
>
<uni-list-item
v-for=
"(item,index) in agreeL
ist"
:key=
"index"
:title=
"item.title"
<uni-list
:border=
"false"
class=
"mb10"
v-for=
"(sublist,index) in agreeLis
t"
>
<uni-list-item
:border=
"false"
class=
"mb1"
v-for=
"(item,index) in subl
ist"
:key=
"index"
:title=
"item.title"
:clickable=
"true"
@
click=
"itemClick(item)"
:showSwitch=
"item.showSwitch"
:switchChecked=
"item.isChecked"
:link=
"!item.showSwitch"
></uni-list-item>
</uni-list>
<!-- 退出按钮 -->
<
button
class=
"bottom-back"
@
click=
"clickLogout"
>
<
view
class=
"bottom-back"
@
click=
"clickLogout"
>
<text
class=
"bottom-back-text"
v-if=
"userInfo"
>
退出登录
</text>
<text
class=
"bottom-back-text"
v-else
>
登录
</text>
</
button
>
</
view
>
</view>
</
template
>
<
script
>
import
{
isOn
,
setting
}
from
'
./dc-push/push.js
'
;
import
{
mapMutations
,
mapGetters
}
from
'
vuex
'
;
import
{
isOn
,
setting
}
from
'
./dc-push/push.js
'
;
import
{
mapMutations
,
mapGetters
}
from
'
vuex
'
;
export
default
{
data
()
{
return
{
agreeList
:
[{
agreeList
:
[
[{
title
:
'
个人资料
'
,
event
:
'
toEdit
'
event
:
'
toEdit
'
},
{
title
:
'
修改密码
'
,
event
:
'
changePwd
'
},
// {
// title: '注销用户',
// event: ''
// },
event
:
'
changePwd
'
}
],
[
//#ifdef APP-PLUS
{
title
:
'
推送功能
'
,
...
...
@@ -40,18 +45,18 @@
isChecked
:
false
,
showSwitch
:
true
},
//
{
//
title: '清理缓存',
// event: '
'
//
},
{
title
:
'
清理缓存
'
,
event
:
'
clearTmp
'
},
//#endif
]
]
}
},
computed
:
{
computed
:
{
...
mapGetters
({
'
userInfo
'
:
'
user/info
'
'
userInfo
'
:
'
user/info
'
})
},
onLoad
()
{
...
...
@@ -64,17 +69,21 @@
...
mapMutations
({
logout
:
'
user/logout
'
}),
toEdit
()
{
toEdit
()
{
uni
.
navigateTo
({
url
:
'
/
pages/ucenter/edit/edit
'
url
:
'
/
uni_modules/uni-id-users/pages/uni-id-users/edit
'
});
},
changePwd
()
{
changePwd
()
{
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-login-page/pages/index/pwd-retrieve?phoneNumber=
'
+
(
this
.
userInfo
?
this
.
userInfo
.
phone
:
''
)
+
'
&phoneArea=+86
'
url
:
'
/uni_modules/uni-login-page/pages/pwd-retrieve/pwd-retrieve?phoneNumber=
'
+
(
this
.
userInfo
&&
this
.
userInfo
.
phone
?
this
.
userInfo
.
phone
:
''
)
+
'
&phoneArea=+86
'
,
fail
:
err
=>
{
console
.
log
(
err
);
}
});
},
checkPush
()
{
checkPush
()
{
// 手机端获取推送是否开启
//#ifdef APP-PLUS
let
pushIsOn
=
isOn
();
...
...
@@ -101,7 +110,7 @@
uni
.
checkIsSupportSoterAuthentication
({
success
:
(
res
)
=>
{
res
.
supportMode
.
forEach
(
item
=>
{
this
.
agreeList
.
push
(
checkAuthModeList
.
find
(
mode
=>
mode
.
name
==
item
)
);
this
.
agreeList
.
push
(
[
checkAuthModeList
.
find
(
mode
=>
mode
.
name
==
item
)]
);
})
},
fail
:
(
err
)
=>
{
...
...
@@ -116,14 +125,14 @@
startSoterAuthentication
(
item
)
{
// 检查是否开启认证
this
.
checkIsSoterEnrolledInDevice
(
item
)
.
then
(()
=>
{
.
then
(()
=>
{
// 开始认证
uni
.
startSoterAuthentication
({
requestAuthModes
:
[
item
.
name
],
challenge
:
'
123456
'
,
// 微信端挑战因子
authContent
:
`请用
${
item
.
title
}
`
,
success
:(
res
)
=>
{
if
(
res
.
errCode
==
0
){
success
:
(
res
)
=>
{
if
(
res
.
errCode
==
0
)
{
/**
* 验证成功后开启自己的业务逻辑
*
...
...
@@ -141,21 +150,22 @@
icon
:
'
none
'
});
},
fail
:(
err
)
=>
{
fail
:
(
err
)
=>
{
console
.
log
(
`认证失败:
${
err
.
errCode
}
`
);
uni
.
showToast
({
title
:
`认证失败:
${
err
.
errCode
}
`
,
title
:
`认证失败`
,
icon
:
'
none
'
});
}
})
})
},
checkIsSoterEnrolledInDevice
(
mode
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
checkIsSoterEnrolledInDevice
(
mode
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
uni
.
checkIsSoterEnrolledInDevice
({
checkAuthMode
:
mode
.
name
,
checkAuthMode
:
mode
.
name
,
success
:
(
res
)
=>
{
if
(
res
.
isEnrolled
){
if
(
res
.
isEnrolled
)
{
return
resolve
(
res
);
}
uni
.
showToast
({
...
...
@@ -175,14 +185,14 @@
})
},
clickLogout
()
{
if
(
this
.
userInfo
){
if
(
this
.
userInfo
)
{
uni
.
showModal
({
title
:
'
提示
'
,
content
:
'
是否退出登录
'
,
cancelText
:
'
取消
'
,
confirmText
:
'
确定
'
,
success
:
res
=>
{
if
(
res
.
confirm
){
if
(
res
.
confirm
)
{
this
.
logout
();
uni
.
navigateBack
();
}
...
...
@@ -190,17 +200,42 @@
fail
:
()
=>
{},
complete
:
()
=>
{}
});
}
else
{
}
else
{
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-login-page/pages/index/index
'
});
}
},
itemClick
(
item
)
{
if
(
!
item
.
to
&&
item
.
event
)
{
console
.
log
(
item
);
if
(
item
.
event
)
{
this
[
item
.
event
](
item
);
}
},
clearTmp
()
{
uni
.
showLoading
({
title
:
'
清除中
'
,
mask
:
true
});
uni
.
getSavedFileList
({
success
:
res
=>
{
if
(
res
.
fileList
.
length
>
0
)
{
uni
.
removeSavedFile
({
filePath
:
res
.
fileList
[
0
].
filePath
,
complete
:
res
=>
{
console
.
log
(
res
);
uni
.
hideLoading
()
}
});
}
else
{
uni
.
hideLoading
()
}
},
complete
:
e
=>
{
console
.
log
(
e
);
}
});
},
/**
* 打开设置页面
*/
...
...
@@ -218,24 +253,28 @@
width
:
100%
;
height
:
100%
;
}
uni-button
:after
{
uni-button
:after
{
border
:
none
;
border-radius
:
0
;
}
/* #endif */
.content
{
/* #ifndef APP-NVUE */
display
:
flex
;
width
:
100%
;
height
:
100
%
;
width
:
750
rpx
;
height
:
100
vh
;
/* #endif */
flex-direction
:
column
;
flex
:
1
;
background-color
:
#F9F9F9
;
}
.bottom-back
{
margin-top
:
10px
;
width
:
750
rpx
;
height
:
120
r
px
;
height
:
44
px
;
/* #ifndef APP-NVUE */
display
:
flex
;
/* #endif */
...
...
@@ -247,11 +286,22 @@
/* #endif */
border-width
:
0
;
border-radius
:
0
;
background-color
:
#
007A
FF
;
background-color
:
#
FFFF
FF
;
}
.bottom-back-text
{
font-size
:
40
rpx
;
color
:
#FFFFFF
;
font-size
:
33
rpx
;
}
.mb10
{
margin-bottom
:
10px
;
}
.content
/
deep
/
.uni-list
{
background-color
:
#F9F9F9
;
}
.mb1
{
margin-bottom
:
1px
;
}
</
style
>
store/modules/user.js
浏览文件 @
f763279a
...
...
@@ -28,6 +28,7 @@ let state = {
state
.
info
=
null
;
state
.
hasLogin
=
false
;
uni
.
setStorageSync
(
'
userInfo
'
,
null
);
uni
.
setStorageSync
(
'
uni_id_token
'
,
''
);
}
},
actions
=
{
...
...
uni_modules/uni-list/components/uni-list-item/uni-list-item.vue
浏览文件 @
f763279a
...
...
@@ -370,7 +370,7 @@ $list-item-pd: $uni-spacing-col-lg $uni-spacing-row-lg;
/* #endif */
height
:
$uni-img-size-base
;
width
:
$uni-img-size-base
;
marin-right
:
10px
;
mar
g
in-right
:
10px
;
}
.uni-icon-wrapper
{
...
...
uni_modules/uni-login-page/pages/index/index.vue
浏览文件 @
f763279a
...
...
@@ -27,10 +27,10 @@
<text
class=
"tip-text"
>
未注册的手机号验证通过后将自动注册
</text>
<!-- 其他登录方式 -->
<view
class=
"auth-box"
v-if=
"loginList.includes('password')"
>
<
!-- <
view class="auth-box" v-if="loginList.includes('password')">
<text class="login-text" hover-class="hover" @click="toPwdLogin">密码登录</text>
<
!-- <text class="login-text" hover-class="hover" @click="openLoginList">其他登录方式</text> --
>
</view>
<
text class="login-text" hover-class="hover" @click="openLoginList">其他登录方式</text
>
</view>
-->
</view>
</view>
<!-- 登录按钮弹窗 -->
...
...
@@ -41,7 +41,7 @@
<
script
>
var
univerify_first
,
currentWebview
;
//是否一键登陆优先
import
baseappConfig
from
'
@/baseapp.config.js
on
'
;
import
baseappConfig
from
'
@/baseapp.config.js
'
;
import
mixin
from
'
../../common/loginPage.mixin.js
'
;
var
currentPage
;
export
default
{
...
...
@@ -50,17 +50,19 @@ import baseappConfig from '@/baseapp.config.json';
return
{
phoneArea
:
[
'
+86
'
],
currenPhoneArea
:
'
+86
'
,
loginList
:[]
// loginList:[]
}
},
onLoad
(
e
)
{
this
.
loginList
=
baseappConfig
.
router
.
login
// this.loginList = baseappConfig.router.login
univerify_first
=
e
.
univerify_first
//#ifdef APP-PLUS
if
(
univerify_first
){
const
pages
=
getCurrentPages
();
currentWebview
=
pages
[
pages
.
length
-
1
].
$getAppWebview
();
currentWebview
.
hide
();
currentWebview
.
setStyle
({
"
top
"
:
"
2000px
"
})
}
//#endif
},
...
...
@@ -68,7 +70,9 @@ import baseappConfig from '@/baseapp.config.json';
//#ifdef APP-PLUS
if
(
univerify_first
){
console
.
log
(
'
开始一键登陆
'
);
setTimeout
(()
=>
{
this
.
$refs
.
uniQuickLogin
.
login
(
'
univerify
'
)
},
100
)
setTimeout
(()
=>
{
currentWebview
.
setStyle
({
titleNView
:{
...
...
@@ -76,7 +80,9 @@ import baseappConfig from '@/baseapp.config.json';
backgroundColor
:
"
#FFFFFF
"
}
})
currentWebview
.
show
()
currentWebview
.
setStyle
({
"
top
"
:
"
0
"
})
},
1500
);
}
//#endif
...
...
@@ -112,7 +118,7 @@ import baseappConfig from '@/baseapp.config.json';
*/
toPwdLogin
()
{
uni
.
navigateTo
({
url
:
'
./pwd-login
'
url
:
'
.
./pwd-login
/pwd-login
'
})
},
openLoginList
()
{
...
...
uni_modules/uni-login-page/pages/phone-code/phone-code.vue
浏览文件 @
f763279a
...
...
@@ -8,6 +8,9 @@
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<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=
"请输入手机号码"
>
</uni-easyinput>
-->
<uni-easyinput
type=
"number"
class=
"phone-input-box"
:inputBorder=
"false"
v-model=
"formData.code"
maxlength=
"6"
placeholder=
"请输入验证码"
>
<template
slot=
"right"
>
...
...
@@ -112,6 +115,6 @@
<
style
>
@import
url("../../common/loginPage.css")
;
.phone-input-box
{
margin-top
:
20
r
px
;
margin-top
:
10
px
;
}
</
style
>
uni_modules/uni-login-page/pages/pwd-login/pwd-login.vue
浏览文件 @
f763279a
...
...
@@ -3,13 +3,13 @@
<view
class=
"wrap-content"
>
<view
class=
"content"
>
<!-- 顶部文字 -->
<text
class=
"content-top-title"
>
手机号
密码登录
</text>
<text
class=
"content-top-title"
>
用户名
密码登录
</text>
<login-ikonw
class=
"login-iknow"
:link=
"link"
text=
"登录即表示同意用户协议和隐私政策"
></login-ikonw>
<!-- 登录框 (选择手机号所属国家和地区需要另行实现) -->
<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=
"请输入手机号"
>
v-model=
"formData.phone"
maxlength=
"11"
placeholder=
"请输入手机号
/用户名/邮箱
"
>
<template
slot=
"left"
>
<!-- 当前仅支持中国大陆手机号 -->
<!--
<picker
mode=
"selector"
:range=
"phoneArea"
@
change=
"selectPhoneArea"
>
-->
...
...
@@ -59,9 +59,8 @@
title
:
'
请输入正确的手机号
'
,
icon
:
'
none
'
});
uni
.
navigateTo
({
url
:
'
./pwd-retrieve?phoneNumber=
'
+
this
.
formData
.
phone
+
'
&phoneArea=
'
+
this
.
currenPhoneArea
url
:
'
.
./pwd-retrieve
/pwd-retrieve?phoneNumber=
'
+
this
.
formData
.
phone
+
'
&phoneArea=
'
+
this
.
currenPhoneArea
})
},
/**
...
...
@@ -134,16 +133,13 @@
<
style
>
@import
url("../../common/loginPage.css")
;
.phone-input-box
{
margin-top
:
20
rpx
;
}
.auth-box
{
justify-content
:
flex-start
;
margin-top
:
20
rpx
;
}
.login-text-sub
{
color
:
#8a8f8b
;
}
...
...
uni_modules/uni-login-page/static/login/img/smsCode.png
0 → 100644
浏览文件 @
f763279a
5.6 KB
uni_modules/uni-login-page/static/login/img/username.png
0 → 100644
浏览文件 @
f763279a
6.8 KB
uni_modules/uni-quick-login/components/uni-quick-login/uni-quick-login.vue
浏览文件 @
f763279a
<
template
>
<view
class=
"quick-login-box"
>
<view
class=
"item"
v-for=
"(
{id
},index) in oauthServices" :key="index" @click="login(id)" v-if="config[id].isChecked
">
<image
class=
"logo"
:src=
"
config[id].
logo"
mode=
"widthFix"
></image>
<text
class=
"login-title"
>
{{
config
[
id
].
text
}}
</text>
<view
class=
"item"
v-for=
"(
{id
,logo,text,path},index) in servicesList" :key="index" @click="path?to(path):login(id,false)
">
<image
class=
"logo"
:src=
"logo"
mode=
"widthFix"
></image>
<text
class=
"login-title"
>
{{
text
}}
</text>
</view>
</view>
</
template
>
<
script
>
import
{
mapGetters
,
mapMutations
}
from
'
vuex
'
;
import
{
mapGetters
,
mapMutations
}
from
'
vuex
'
;
//前一个窗口的页面地址。控制点击切换快捷登陆方式是创建还是返回
export
default
{
data
()
{
return
{
...
...
@@ -47,19 +44,43 @@
"
isChecked
"
:
false
//暂未提供该登陆方式的接口示例
}
},
providerList
:
[],
oauthServices
:[],
univerifyStyle
:
{
servicesList
:[
{
"
text
"
:
"
账号登陆
"
,
"
logo
"
:
"
../../static/login/img/username.png
"
,
"
path
"
:
"
/uni_modules/uni-login-page/pages/pwd-login/pwd-login
"
},
{
"
text
"
:
"
短信登陆
"
,
"
logo
"
:
"
../../static/login/img/smsCode.png
"
,
"
path
"
:
"
/uni_modules/uni-login-page/pages/index/index
"
}
],
univerifyStyle
:
{
//一键登陆弹出窗的样式配置参数
"
fullScreen
"
:
true
,
// 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
"
backgroundColor
"
:
"
#ffffff
"
,
// 授权页面背景颜色,默认值:#ffffff
}
}
},
created
()
{
let
servicesList
=
this
.
servicesList
//去掉当前页面对应的登陆选项
for
(
var
i
=
0
;
i
<
servicesList
.
length
;
i
++
)
{
if
(
servicesList
[
i
].
path
==
this
.
getRoute
(
1
)){
servicesList
.
splice
(
i
,
1
)
}
}
},
mounted
()
{
//获取当前环境能用的快捷登陆方式
// #ifdef APP-PLUS
plus
.
oauth
.
getServices
(
oauthServices
=>
{
this
.
oauthServices
=
oauthServices
oauthServices
.
forEach
(({
id
})
=>
{
if
(
this
.
config
[
id
].
isChecked
){
this
.
servicesList
.
push
({...
this
.
config
[
id
],
id
})
}
})
// console.log(oauthServices);
},
err
=>
{
uni
.
hideLoading
()
...
...
@@ -71,27 +92,28 @@
console
.
error
(
'
获取服务供应商失败:
'
+
JSON
.
stringify
(
err
));
})
// #endif
/*
uni.getProvider({
"service": "oauth",
success: res => {
this.providerList = res.provider.map((name) => {
return {...this.config[name],name}
})
this.login('univerify')
},
fail: (err) => {
console.error('获取服务供应商失败:' + JSON.stringify(err));
}
})
*/
},
methods
:
{
...
mapMutations
({
setUserInfo
:
'
user/login
'
}),
login
(
type
)
{
getRoute
(
n
=
0
){
let
pages
=
getCurrentPages
();
console
.
log
(
'
route-pages-length
'
,
pages
.
length
);
if
(
n
>
pages
.
length
){
return
''
}
return
'
/
'
+
pages
[
pages
.
length
-
n
].
route
},
to
(
path
){
console
.
log
(
'
比较
'
,
this
.
getRoute
(
2
),
path
)
if
(
this
.
getRoute
(
2
)
==
path
){
// 控制路由是重新打开还是返回,避免重复打开页面
uni
.
navigateBack
();
}
else
{
uni
.
navigateTo
({
url
:
path
})
}
},
login
(
type
,
navigateBack
=
true
)
{
console
.
log
(
arguments
);
console
.
log
(
'
services
'
,
services
);
let
oauthService
=
this
.
oauthServices
.
find
((
service
)
=>
service
.
id
==
type
)
// #ifdef APP-PLUS
//uni.showLoading({mask: true});
...
...
@@ -122,13 +144,21 @@
fail
:
(
err
)
=>
{
uni
.
hideLoading
()
console
.
log
(
err
);
if
(
type
==
'
univerify
'
){
if
(
err
.
metadata
.
error_data
){
uni
.
showToast
({
title
:
"
一键登陆:
"
+
err
.
metadata
.
error_data
,
icon
:
'
none
'
});
}
switch
(
err
.
errCode
){
case
30002
:
console
.
log
(
'
在一键登陆界面,点击其他登陆方式
'
);
break
;
case
30003
:
console
.
log
(
'
关闭了登陆
'
);
uni
.
navigateBack
()
if
(
navigateBack
){
uni
.
navigateBack
()
}
break
;
case
30006
:
uni
.
showModal
({
...
...
@@ -142,6 +172,7 @@
break
;
}
}
}
})
// #endif
},
...
...
@@ -164,7 +195,18 @@
icon
:
'
none
'
});
uni
.
hideLoading
()
uni
.
navigateBack
()
var
delta
=
0
//判断需要返回几层
let
pages
=
getCurrentPages
();
console
.
log
(
pages
);
pages
.
forEach
((
page
,
index
)
=>
{
console
.
log
(
pages
[
pages
.
length
-
index
-
1
].
route
.
split
(
'
/
'
));
if
(
pages
[
pages
.
length
-
index
-
1
].
route
.
split
(
'
/
'
)[
1
]
==
'
uni-login-page
'
){
delta
++
}
})
console
.
log
(
'
delta:
'
+
delta
);
uni
.
navigateBack
({
delta
})
}
})
},
...
...
@@ -195,7 +237,6 @@
width
:
750
rpx
;
justify-content
:
space-around
;
}
.item
{
flex-direction
:
column
;
justify-content
:
center
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录