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

uni-id-pages(版本号1.0.8)新增 H5端支持微信登录,含:微信公众号内的网页授权登录 和 普通浏览器内网页生成二维码,实现手机微信扫码登录

上级 7b3e1648
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path" : "pages/test/test",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
},
{
"path": "pages/index/index",
"style": {
......
<template>
<view>
<navigator url="/pages/index/index">index</navigator>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>
## 1.0.7(2022-07-19)
- 新增 web移动端,微信内基于公众号登录
- 新增 web电脑端,基于微信开放平台的微信扫码登录
## 1.0.8(2022-08-11)
- 新增 H5端支持微信登录(含微信公众号内的网页授权登录 和 普通浏览器内网页生成二维码,实现手机微信扫码登录)[详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#weixinlogin)
- 新增 登录成功(全局)回调事件:`uni-id-pages-login-success`,支持通过[uni.$on](https://uniapp.dcloud.net.cn/api/window/communication.html#on)监听;
## 1.0.7(2022-07-19)
- 修复 uni-id-co接口 logout时没有删除token的Bug
......
......@@ -307,8 +307,7 @@
// #ifdef H5
if(type == 'weixin'){
console.log('开始微信网页登录');
// console.log('开始微信网页登录');
let redirectUrl = location.protocol +'//'+
document.domain +
(window.location.href.includes('#')?'/#':'') +
......@@ -316,7 +315,7 @@
console.log('redirectUrl----',redirectUrl);
let ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger'){
console.log('在微信公众号内');
// console.log('在微信公众号内');
return window.open(`https://open.weixin.qq.com/connect/oauth2/authorize?
appid=${config.appid.weixin.h5}
&redirect_uri=${encodeURIComponent(redirectUrl)}
......@@ -325,7 +324,7 @@
&state=STATE&connect_redirect=1#wechat_redirect`);
}else{
console.log('非微信公众号内');
// console.log('非微信公众号内');
return location.href = `https://open.weixin.qq.com/connect/qrconnect?appid=${config.appid.weixin.web}
&redirect_uri=${encodeURIComponent(redirectUrl)}
&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect`
......
......@@ -34,12 +34,13 @@ export default {
'register', 'login'
]
},
// 提供各类服务接入(如微信登录服务)的应用id
"appid":{
"weixin":{
// 公众号
"h5":"wx32b2580e30ef8555",
// 网站应用
"web":"wx4dcf96ab6af4c5e8"
// 微信公众号的appid,来源:登录微信公众号(https://mp.weixin.qq.com)-> 设置与开发 -> 基本配置 -> 公众号开发信息 -> AppID
"h5":"xxxxxx",
// 微信开放平台的appid,来源:登录微信开放平台(https://open.weixin.qq.com) -> 管理中心 -> 网站应用 -> 选择对应的应用名称,点击查看 -> AppID
"web":"xxxxxx"
}
}
}
{
"id": "uni-id-pages",
"displayName": "uni-id-pages",
"version": "1.0.7",
"version": "1.0.8",
"description": "云端一体简单、统一、可扩展的用户中心页面模版",
"keywords": [
"用户管理",
"用户中心",
"短信验证码",
"login",
"登录"
],
"用户管理",
"用户中心",
"短信验证码",
"login",
"登录"
],
"repository": "https://gitcode.net/dcloud/hello_uni-id-pages",
"engines": {
"HBuilderX": "^3.4.17"
},
"dcloudext": {
"category": [
"uniCloud",
"云端一体页面模板"
],
"sale": {
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
......@@ -35,7 +31,8 @@
"data": "无",
"permissions": "无"
},
"npmurl": ""
"npmurl": "",
"type": "unicloud-template-page"
},
"uni_modules": {
"dependencies": [
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册