- 大佬们,关于"__usePrivacyCheck__": true问题?
大佬们,我加入了"__usePrivacyCheck__": true 之后,原来的登录按钮如果为授权进行授权跳转,如果之前授权过就直接进入页面但是现在授权页面不进行跳转了,是因为我用的还是getUserInfo来获取用户信息的关系嘛吗? 现在登录页的代码如下 // pages/mine/mine.js Page({ /** * 页面的初始数据 */ data: { canIUse: wx.canIUse('button.open-type.getUserInfo'), chencked:true, distrue:false, }, checkboxChange: function (e) { var that = this; console.log(e.currentTarget.dataset.index); that.setData({ chencked: !e.currentTarget.dataset.index}); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this; var app = getApp(); var url = app.globalData.url; // 查看是否授权 wx.getSetting({ success: function (res) { if (res.authSetting['scope.userInfo']) { wx.getUserInfo({ success: function (res) { } }); } } }) }, //获取用户信息接口 queryUsreInfo: function () { wx.request({ url: getApp().globalData.urlPath + '', data: { openid: getApp().globalData.openid }, header: { 'content-type': 'application/json' }, success: function (res) { console.log(res.data); getApp().globalData.userInfo = res.data; } }); }, bindGetUserInfo: function (e) { console.log("e",e); var that = this; if (that.data.distrue){ return false; } else { that.setData({distrue:true}) } var app = getApp(); var url = app.globalData.url; var chencked=that.data.chencked; if (chencked==true){ if (e.detail.userInfo) { wx.login({ success: function (res) { var code = res.code console.log("code",code); if (code) { wx.getSetting({ success: function (res) { console.log("res65",res); // res.authSetting['scope.userInfo'] if (true) { wx.getUserInfo({ success: function (res) { console.log("res69",res) var img = res.userInfo.avatarUrl; var name = res.userInfo.nickName; wx.showLoading({ title: '身份验证中...', }) wx.request({ url: url + '/', method: 'POST', data: { code: code, headImg: img, wechatName: name }, success: function (res) { wx.hideLoading(); if (res.data.msg == 'ok') { app.globalData.uid = res.data.uid; var openid = res.data.openid; //授权成功后,跳转进入小程序首页 console.log("认证成功!!!"); // wx.reLaunch({ // url: '../getloction/getloction' // }) //../getphonumber/getphonumber // wx.reLaunch({ // url: '../getphonumber/getphonumber' // }) // 鉴权成功 that.getUserRole(res.data.uid);; } else { console.log("进入了这里跳转") wx.reLaunch({ url: '../getphonumber/getphonumber' }) wx.setStorage({ key: "data", data: res.data }); } } }) } }) } } }); } } }); } else { //用户按了拒绝按钮 wx.showModal({ title: '警告', content: '您点击了拒绝授权,将无法进入小程序,请授权之后再进入!!!', showCancel: false, confirmText: '返回授权', success: function (res) { if (res.confirm) { console.log('用户点击了“返回授权”') } } }) } }else{ wx.showModal({ title: '提示', content: '请勾选同意并阅读以上协议才可授权', success: function (res) { if (res.confirm) { console.log('弹框后点取消') } else { console.log('弹框后点取消') } } }) } }, getUserRole(uid){ // app.globalData.uid = res.data.uid; // wx.setStorageSync('county_txl', res.data.countyId); // console.log("成功",res); // // 判断角色,控制跳转 // that.getUserRole(); // wx.reLaunch({ // url: '../index/index', // }) var that = this; var app = getApp(); var url = app.globalData.url; console.log(uid); wx.request({ method: "post", url: url + '', data: {uid: uid,}, header: { 'content-type': 'application/x-www-form-urlencoded' // 默认值 }, success: (res) => { console.log(res) if (res != null){ var map = res.data; if (map.msg == "success"){ app.globalData.userRole = map.userRole; app.globalData.user = map.user; app.globalData.dept = map.dept; wx.reLaunch({ url: map.path, }) } } } }); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { }, }) wxml如下 <Privacy/> <image class="bgtpsz" src="../../images/background.jpg" mode="aspectFill"></image> <button class="sharemp22" type='primary' open-type="getUserInfo|agreePrivacyAuthorization" lang="zh_CN" bindgetuserinfo="bindGetUserInfo">登 录</button> <!-- id="agree-btn" "Privacy":"../../components/privacy/privacy" -->
2023-09-06 - 隐私协议开发?
这个通知我没看明白是要求全部改成这个样子还是咋回事, [图片] [图片]现在这个样子是不行了还是咋回事,新接触小程序开发的我,是真的没有读懂意思。
2023-09-04 - 求大佬帮忙 小程序输入框联想提示?
大佬们我想做一个小程序输入框联想提示,现在能联想了 但是它提示出来的和我预期的不一样,有啥解决方案吗?目前的样式如下图[图片] 这个是未输入任何字的时候样子 [图片]输入的时候就变成这个样子了 怎么能实现单独弹出联想的一个选择的,就是类似网站搜索的时候 在输入框下面弹出联想的东西 但是还没有改变输入框的大小
2023-07-13 - 求大佬们帮忙?
[图片] 求大佬们帮忙 在服务单位这一栏中他的相关的服务东西是不固定的,如果多的话就会给挤没了,怎么才能在超过4个的时候,让它在重新弄一个一样的放到下面只不过里面的内容是从第五个开始的
2023-07-12 - 在使用picker组件进行省市选择器的时候在模拟器上面点击没有反应 只有手机才有反应?
[图片] 在微信开发者工具模拟器中点击没反应或者电脑登陆微信然后进入小程序点击也是无反应的只有在真机的时候才好用,各位大佬有啥解决办法码?让它在电脑登陆微信进入小程序的时候也是好用的 [图片]
2023-07-10 - 微信小程序服务消息订阅问题?
微信小程序服务消息订阅 我想在登陆页面的时候就提示出要求用户订阅消息 怎么实现 或者在进入某个新的页面的时候就弹出用户订阅消息
2023-06-29 - 如何解决从导航栏进入页面点击左上角的返回按钮直接返回到了首页 首页的按钮什么都没了?
基础库 2.32.0
2023-06-13