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

微信公众号、pc扫码登录完成

上级 e230c642
......@@ -134,7 +134,15 @@
"vueVersion" : "2",
"h5" : {
"unipush" : {
"enable" : true
"enable" : false
},
"devServer" : {
"port" : -11,
"disableHostCheck" : true,
"https" : false
},
"router" : {
"mode" : "history"
}
},
"_spaceID" : "9f641af8-e860-44e5-b18f-f68dd8fe3fe4",
......
## 1.0.13(2022-07-21)
- 修复 创建token时未传角色权限信息生成的token不正确的bug
## 1.0.12(2022-07-15)
- 提升与旧版本uni-id的兼容性(补充读取配置文件时回退平台app-plus、h5),但是仍推荐使用新平台名进行配置(app、web)
## 1.0.11(2022-07-14)
......
{
"id": "uni-id-common",
"displayName": "uni-id-common",
"version": "1.0.12",
"version": "1.0.13",
"description": "包含uni-id token生成、校验、刷新功能的云函数公共模块",
"keywords": [
"uni-id-common",
......
{
"name": "uni-id-common",
"version": "1.0.12",
"version": "1.0.13",
"description": "uni-id token生成、校验、刷新",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id-common.html",
......
## 1.0.7(2022-07-19)
- 新增 web移动端,微信内基于公众号登录
- 新增 web电脑端,基于微信开放平台的微信扫码登录
- 未安装
## 1.0.7(2022-07-19)
- 修复 uni-id-co接口 logout时没有删除token的Bug
## 1.0.6(2022-07-13)
......
......@@ -48,6 +48,6 @@ let mixin = {
loginSuccess(e) {
loginSuccess(e)
}
}
}
}
export default mixin
......@@ -15,15 +15,15 @@ export default function(e = {}) {
if (autoBack) {
let delta = 0; //判断需要返回几层
let pages = getCurrentPages();
// console.log(pages);
console.log(pages);
pages.forEach((page, index) => {
if (pages[pages.length - index - 1].route.split('/')[3] == 'login') {
delta++
}
})
console.log('判断需要返回几层:', delta);
uni.navigateBack({
delta
})
// uni.navigateBack({
// delta
// })
}
}
......@@ -15,7 +15,8 @@
<script>
import config from '@/uni_modules/uni-id-pages/config.js'
//前一个窗口的页面地址。控制点击切换快捷登录方式是创建还是返回
import loginSuccess from '../../common/loginSuccess.js';
import loginSuccess from '../../common/loginSuccess.js';
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
let allServicesList = []
......@@ -186,6 +187,9 @@
})
//console.log('servicesList', servicesList, this.servicesList);
},
async mounted() {
},
methods: {
setUserInfo(e) {
console.log('setUserInfo', e);
......@@ -221,7 +225,23 @@
}
},
async login_before(type, navigateBack = true) {
console.log(type);
console.log(type);
// #ifdef H5
if(type == 'weixin'){
console.log('开始微信网页登录');
location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=wx4dcf96ab6af4c5e8
&redirect_uri=${encodeURIComponent('http://test.0577app.com/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin_redirect')}
&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`
/*location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?
appid=wx32b2580e30ef8555
&redirect_uri=${encodeURIComponent('http://test.0577app.com/uni_modules/uni-id-pages/pages/login/login-withoutpwd?type=weixin_redirect')}
&response_type=code
&scope=snsapi_userinfo
&state=STATE&connect_redirect=1#wechat_redirect`;*/
}
// #endif
//提示空实现
if (["qq",
......@@ -232,10 +252,6 @@
"google",
"alipay",
"douyin",
//H5端没有支持微信登录
// #ifdef H5
"weixin"
// #endif
].includes(type)) {
return uni.showToast({
title: '该登录方式暂未实现,欢迎提交pr',
......@@ -383,7 +399,8 @@
}
})
},
login(params, type) { //联网验证登录
login(params, type) { //联网验证登录
console.log('执行登录开始----');
console.log({
params,
type
......
......@@ -18,9 +18,7 @@ export default {
// #ifdef APP
"univerify",
// #endif
// #ifndef H5
"weixin",
// #endif
"username",
// #ifdef APP
"apple",
......@@ -32,6 +30,8 @@ export default {
"serviceUrl": "https://xxx", //用户服务协议链接
"privacyUrl": "https://xxx", //隐私政策条款链接
// 哪些场景下显示,1.注册(包括登录并注册,如:微信登录、苹果登录、短信验证码登录)、2.登录(如:用户名密码登录)
"scope": ['register', 'login']
"scope": [
// 'register', 'login'
]
}
}
......@@ -95,5 +95,12 @@ export default async function() {
})
}
})
}
//5.未启用uni统计,但使用uni-id-pages+uni-push2.0,onLaunch时上报device_id至服务端
if(uni.report == undefined){
if (uni.getPushClientId) {
}
}
}
......@@ -4,12 +4,12 @@
"version": "1.0.7",
"description": "云端一体简单、统一、可扩展的用户中心页面模版",
"keywords": [
"用户管理",
"用户中心",
"短信验证码",
"login",
"登录"
],
"用户管理",
"用户中心",
"短信验证码",
"login",
"登录"
],
"repository": "https://gitcode.net/dcloud/hello_uni-id-pages",
"engines": {
"HBuilderX": "^3.4.17"
......@@ -42,11 +42,11 @@
"uni-captcha",
"uni-config-center",
"uni-data-checkbox",
"uni-easyinput",
"uni-easyinput",
"uni-forms",
"uni-icons",
"uni-id-common",
"uni-list",
"uni-list",
"uni-load-more",
"uni-popup",
"uni-scss",
......@@ -89,7 +89,7 @@
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
"京东": "u"
},
"快应用": {
"华为": "u",
......@@ -97,5 +97,8 @@
}
}
}
},
"dependencies": {
"jweixin-module": "^1.6.0"
}
}
}
......@@ -53,13 +53,20 @@
async onLoad(e) {
console.log(e);
let type = e.type
if(type == 'weixin_redirect'){
this.$nextTick(n=>{
console.log(this.$refs.uniFabLogin);
this.$refs.uniFabLogin.login({code:e.code},'weixin')
})
}
// console.log({type});
this.type = type
if(type != 'univerify'){
this.focusPhone = true
}
this.$nextTick(() => {
//关闭重复显示的登录快捷方式
if (['weixin', 'apple'].includes(type)) {
......@@ -67,7 +74,6 @@
item.id != type)
}
})
uni.$on('uni-id-pages-set-login-type', type => {
this.type = type
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册