ThinkCMF电脑微信扫码登陆和公众号授权插件


演示网址:https://www.uihtm.com

使用说明:
1.微信里打开公众号授权登陆

访问地址:/plugin/wxlogin/index/index.html
回调地址:/plugin/wxlogin/index/index.html

thinkcmf5地址:{:cmf_plugin_url('Wxlogin://Index/index')}

代码直接在
/public/plugins/wxlogin/controller/IndexController.php
文件的index函数里面写。

需要写Js的话,写
/var/www/store/public/plugins/wxlogin/view/scripts.html
文件内。


2.PC扫码授权登陆,官方文档:https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html
地址:{:cmf_plugin_url('Wxlogin://Index/scan')}
备注:需要https://open.weixin.qq.com/开放平台建网站应用并付费认证
如须不想跳到微信上扫码,可使用js网站内扫码登陆

<script src="https://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
<script>
   var redirect =  window.location.href;
   var obj = new WxLogin({
       self_redirect:false,//true:手机点击确认登录后可以在 iframe 内跳转到 redirect_uri,false:手机点击确认登录后可以在 top window 跳转到 redirect_uri。默认为 false。
       id:"wx-scan",//显示二维码的容器id
       appid: "xxxxx",
       scope: "snsapi_login",
       redirect_uri: encodeURI('{:cmf_plugin_url("Wxlogin://Index/scan_back","html",true)}'),//重定向地址,需要进行UrlEncode
       state: redirect,
       style: "",//提供"black"、"white"可选,默认为黑色文字描述
       href: ""//自定义样式链接
   });
</script>


ThinkCMF模板插件交流群:550851374 ,领取阿里云1000通用代金券

评论

暂时关闭,稍后恢复~
文档请看10遍以上!有问题可加QQ群!
发布插件

七牛专享优惠码

507670e8

ThinkCMF教程


ThinkCMF 8.0.0发布啦!祝大家节日快乐! 立即体验!