uniapp做微信登录
2020-06-04 06:47
330 查看
下面展示一些
内联代码片。
// An highlighted block <!-- #ifdef MP-WEIXIN --> <view> <view> <view class='header'> <image src='/static/common/WeChat.png'></image> </view> <view class='content'> <view>申请获取以下权限</view> <text>获得你的公开信息(昵称,头像、地区等)</text> </view> <button class='bottom' type='primary' open-type="getUserInfo" withCredentials="true" lang="zh_CN" @getuserinfo="wxLogin"> 授权登录 </button> </view> </view> <!-- #endif -->
// An highlighted block <!-- #ifdef MP-WEIXIN --> <view> <view> <view class='header'> <image src='/static/common/WeChat.png'></image> </view> <view class='content'> <view>申请获取以下权限</view> <text>获得你的公开信息(昵称,头像、地区等)</text> </view> <button class='bottom' type='primary' open-type="getUserInfo" withCredentials="true" lang="zh_CN" @getuserinfo="wxLogin"> 授权登录 </button> </view> </view> <!-- #endif -->
// An highlighted block wxLogin(e) { let _this = this; if (e.detail.userInfo) { uni.login({ provider: "weixin", success(res) { //获得微信授权码 var code = res.code _this.$LoadingMsg("登录中") uni.request({ url: _this.$api.getAccessToken, data: { code: code, }, method: 'GET', header: { 'content-type': 'application/x-www-form-urlencoded' }, success(res) { if (res.data.code == 0) { uni.hideLoading() if(res.data.data.code){ uni.navigateTo({ url:"/pages/login/sms?openId="+res.data.data.openId }) }else{ } } } }) } }) } else { console.log("拒绝") } }
相关文章推荐
- 使用微信登录APP
- Android App 接入微信登录套路导航
- 谈谈第三方App接入微信登录 解读
- 关于使用微信登录第三方APP的实现(Android版)
- 【原创】基于phpGrace+uniApp开发之:5.登录界面增加图片验证码
- uni-app开发微信小程序引入UI组件库(Vant-weapp)步骤
- 第三方App接入微信登录 解读
- App接入微信登录 步骤
- 微信小程序自定义tabBar在uni-app的适配详解
- uni-app微信小程序模拟器运行到某一页面调试操作
- Android 微信第三方App登录
- 微信授权登录第三方app遇到的问题
- Android实现使用微信登录第三方APP的方法
- 2019最新独家二开五级分销千月影视VIP视频解析微信QQ登录在线视频APP安卓IOS苹果双端
- uniapp踩坑(二):canvas合成背景图和二维码,并分享给微信好友或微信朋友圈
- 关于微信第三方登录 AppId 和AppSecret 忘记修改无法登录问题
- APP带第三方微博、微信、QQ等登录注册的登录注册流程分解
- Android App实现第三方微信登录
- 在IonicApp中调用微信进行登录