提交 2ea33f18 编写于 作者: DCloud_JSON's avatar DCloud_JSON

修复因为uniVerify驼峰法与plus.oauth.getServices获取到的名称不保持一致导致的登陆项配置无效

上级 349ccbc1
...@@ -46,8 +46,8 @@ export default function() { ...@@ -46,8 +46,8 @@ export default function() {
} }
//控制登陆优先级 //控制登陆优先级
if (url == '/pages/ucenter/login-page/index/index') { if (url == '/pages/ucenter/login-page/index/index') {
//一键登录(uniVerify)、账号(username)、验证码登陆(短信smsCode) //一键登录(univerify)、账号(username)、验证码登陆(短信smsCode)
if (login[0] == 'uniVerify') { if (login[0] == 'univerify') {
// console.log(e.url,url); // console.log(e.url,url);
if (e.url == url) { if (e.url == url) {
e.url += '?' e.url += '?'
......
...@@ -38,12 +38,12 @@ ...@@ -38,12 +38,12 @@
oauthServices: [] oauthServices: []
} }
}, },
props: { props: {
agree:{ agree:{
type:Boolean, type:Boolean,
default(){ default(){
return false return false
} }
}, },
config: { config: {
type: Object, type: Object,
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
//去掉配置项中不存在的项 //去掉配置项中不存在的项
for (var i = 0; i < servicesList.length; i++) { for (var i = 0; i < servicesList.length; i++) {
if (!this.loginConfig.includes(servicesList[i].id)) { if (!this.loginConfig.includes(servicesList[i].id)) {
console.log(servicesList[i].id); console.log('去掉配置项中不存在的项',servicesList[i].id);
servicesList.splice(i, 1) servicesList.splice(i, 1)
} }
} }
...@@ -119,7 +119,8 @@ ...@@ -119,7 +119,8 @@
oauthServices.forEach(({ oauthServices.forEach(({
id id
}) => { }) => {
if (this.config[id].isChecked) { console.log(9527,id);
if (this.config[id].isChecked&&this.loginConfig.includes(id)) {
this.servicesList.push({ this.servicesList.push({
...this.config[id], ...this.config[id],
id id
...@@ -137,7 +138,7 @@ ...@@ -137,7 +138,7 @@
console.error('获取服务供应商失败:' + JSON.stringify(err)); console.error('获取服务供应商失败:' + JSON.stringify(err));
}) })
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
let id = 'weixin' let id = 'weixin'
if (this.loginConfig.includes(id)) { if (this.loginConfig.includes(id)) {
this.servicesList.push({ this.servicesList.push({
...@@ -169,13 +170,13 @@ ...@@ -169,13 +170,13 @@
}) })
} }
}, },
login_before(type, navigateBack = true) { login_before(type, navigateBack = true) {
if(!this.agree){ if(!this.agree){
return uni.showToast({ return uni.showToast({
title: '你未同意隐私政策协议', title: '你未同意隐私政策协议',
icon: 'none' icon: 'none'
}); });
} }
console.log(arguments); console.log(arguments);
let oauthService = this.oauthServices.find((service) => service.id == type) let oauthService = this.oauthServices.find((service) => service.id == type)
...@@ -325,4 +326,4 @@ ...@@ -325,4 +326,4 @@
margin-top: 4px; margin-top: 4px;
font-size: 26rpx; font-size: 26rpx;
} }
</style> </style>
{ {
"name" : "uni-starter", "name" : "uni-starter",
"appid" : "__UNI__E5373F7", "appid" : "__UNI__03B096E",
"description" : "集成了商用项目开发常见功能的项目模板", "description" : "集成了商用项目开发常见功能的项目模板",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
...@@ -32,7 +32,8 @@ ...@@ -32,7 +32,8 @@
"modules" : { "modules" : {
"Fingerprint" : {}, "Fingerprint" : {},
"Share" : {}, "Share" : {},
"Push" : {} "Push" : {},
"OAuth" : {}
}, },
/* 应用发布信息 */ /* 应用发布信息 */
"distribute" : { "distribute" : {
......
...@@ -25,7 +25,7 @@ module.exports = { ...@@ -25,7 +25,7 @@ module.exports = {
"/uni_modules/uni-news-favorite/pages/uni-news-favorite/list", "/uni_modules/uni-news-favorite/pages/uni-news-favorite/list",
"/pages/ucenter/userinfo/uploadCutImageToUnicloud" "/pages/ucenter/userinfo/uploadCutImageToUnicloud"
], ],
"login": ["smsCode","uniVerify", "username", "weixin", "apple"], "login": ["smsCode","univerify", "username", "weixin", "apple"],
/* /*
根据数组的第0项,决定登陆方式的第一优先级。 根据数组的第0项,决定登陆方式的第一优先级。
未列举到的,或设备环境不支持的选项,将被隐藏。 未列举到的,或设备环境不支持的选项,将被隐藏。
......
...@@ -124,10 +124,10 @@ exports.main = async (event, context) => { ...@@ -124,10 +124,10 @@ exports.main = async (event, context) => {
mobile: params.mobile, mobile: params.mobile,
code: params.code code: params.code
}); });
res = await uniID.bindMobile({ res = await uniID.bindMobile({
uid: params.uid, uid: params.uid,
mobile: params.mobile, mobile: params.mobile,
code: params.code code: params.code
}) })
console.log(res); console.log(res);
break; break;
...@@ -186,7 +186,7 @@ exports.main = async (event, context) => { ...@@ -186,7 +186,7 @@ exports.main = async (event, context) => {
await loginLog(res) await loginLog(res)
break; break;
case 'login_by_univerify': case 'login_by_univerify':
res = await uniID.loginByUniverify(params) res = await uniID.loginByuniverify(params)
await loginLog(res) await loginLog(res)
break; break;
case 'login_by_apple': case 'login_by_apple':
...@@ -199,14 +199,14 @@ exports.main = async (event, context) => { ...@@ -199,14 +199,14 @@ exports.main = async (event, context) => {
case 'logout': case 'logout':
res = await uniID.logout(event.uniIdToken) res = await uniID.logout(event.uniIdToken)
break; break;
case 'sendSmsCode': case 'sendSmsCode':
return uniID.setVerifyCode({ return uniID.setVerifyCode({
mobile: params.mobile, mobile: params.mobile,
code:'123456', code:'123456',
type: params.type type: params.type
}) })
// 简单限制一下客户端调用频率 // 简单限制一下客户端调用频率
const ipLimit = await db.collection('uni-verify').where({ const ipLimit = await db.collection('uni-verify').where({
...@@ -323,4 +323,4 @@ exports.main = async (event, context) => { ...@@ -323,4 +323,4 @@ exports.main = async (event, context) => {
//返回数据给客户端 //返回数据给客户端
return res return res
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册