- 小程序微信手机号授权成功后页面卡死?
小程序微信授权成功后,执行任何操作页面都会卡死;小程序没有发布正式版,用户隐私保护指引配置了没有生效,页面卡死和用户隐私指引有关嘛?还是页面逻辑的问题? <template> <view class="contain-box"> <view class="item-png"> <image src="@/static/logo.png" class="logo-img"></image> </view> <view class="item-text"> 欢迎来到xxxxxxx </view> <view class="item-text"> 报障小程序 </view> <view class="wxLogin-box" @click="wxLogin"> <view class=""> <image src="@/static/whitWxLogin.png" class="wxLogin-png" mode=""></image> </view> <view class="wx-login">微信快捷登录</view> </view> </view> <!-- <xc-wxLogin ref="childrenIsShowPopup" @savevalue="saveValue"> </xc-wxLogin> --> <!-- 授权弹框 --> <u-popup v-model="isShowPopup" mode="bottom" border-radius="10" :mask-close-able="false" :closeable="false" z-index="99999"> <view class="prop-top"> <view> <image src="@/static/logo.png" class="logo-img"></image> </view> <view class="prop-bank"> xxxxx报障小程序 申请获取以下权限: </view> </view> <view class="prop-center"> <span class="circle"></span>申请获取并验证你的手机号 </view> <view class="prop-bottom"> <button class="delete-login" @click="deleteLogin">拒绝</button> <view @click="allowBtn"> <button class="allow-btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" :phone-number-no-quota-toast="false"> 允许 </button> </view> </view> </u-popup> <!-- 用户隐私保护指引 --> <xc-privacyPopup ref="privacyComponent" position="center" @allowPrivacy="allowPrivacy"></xc-privacyPopup> <!-- 引用loding --> <xc-loading v-if="this.$store.getters.loding"></xc-loading> <!-- 引用弹框组件 --> <xc-confirmPopup v-if="confirmPopup" @cancelBtn="cancelBtn" :content="popupcontent"></xc-confirmPopup> </template> <script> import { formatMobilePhone, formatLoginName } from '@/utils/util.js'; import localStorage from '@/utils/localStorage.js' export default { data() { return { confirmPopup: false, // 弹框默认隐藏 popupcontent: '', // 弹框内容 isShowPopup: false, Code: '', }; }, onShow() { uni.hideHomeButton({ success: function() {} }); // 查询隐私协议 if (wx.getPrivacySetting) { wx.getPrivacySetting({ success: res => { if (!res.needAuthorization) { this.$refs.privacyComponent.closePrivacy(); // 查询授权 this.queryAuthLogin(); } }, fail: () => {}, complete: () => {} }) } else { this.queryAuthLogin(); } }, methods: { //微信授权登录 wxLogin() { // this.$refs.childrenIsShowPopup.openPropup(); this.isShowPopup = true; this.getCode(); }, // 拒绝授权 deleteLogin() { this.isShowPopup = false; }, // 允许授权 allowBtn() { this.isShowPopup = false; }, // 获取Code getCode() { let that = this; uni.login({ timeout: 10000, provider: 'weixin', success: function(data) { //获取临时登录凭证code that.Code = data.code; }, fail: function(err) { // console.log("loginerr", err); } }) }, // 允许授权 getPhoneNumber: function(e) { console.log('授权打印', e) let that = this; if (!e.detail.code) { uni.showToast({ title: '获取手机号失败', icon: 'none' }) return; } if (e.detail.errno == '1400001') { that.confirmPopup = true; that.popupcontent = '微信授权次数已用尽,请联系工作人员'; } else { if (e.detail.errMsg == 'getPhoneNumber:ok') { that.encryptedData = e.detail.encryptedData; that.iv = e.detail.iv; const parmas = { code: that.Code, encryptedData: that.encryptedData, iv: that.iv, operate: '1', channelId: 'ssvb_minip' } console.log('授权上送字段', parmas) that.$api.wxAuth(parmas).then(async (res) => { console.log('申请授权', res) if (res.code == 'BSC00000') { console.log('授权处理成功') const weixinLogin = { phoneNumber: res.data.user_name, phoneNumberFormat: formatMobilePhone(res.data .user_name), address: res.data.address, user_name: res.data.nickName, roleId: res.data.roleId, user_id: res.data.user_id, token: res.data.value, tokenType: res.data.tokenType, sm2_pubkey: res.data.sm2_pubkey } // 存储数据 // localStorage.set('weixinLogin', weixinLogin) await that.$store.commit('SET_WEIXINLOGIN', weixinLogin); if (res.data.roleId == 0) { that.toReport(); } else if (res.data.roleId == 1) { that.tohandle(); } } else { that.wamingPopup = true; that.popupcontent = res.msg; } }).catch(error => { that.confirmPopup = true; that.popupcontent = error.errMsg; }); } } }, // 工单上报 toReport() { console.log('跳转工单上报页') // setTimeout(() => { // uni.redirectTo({ // url: '/reportObstacles/report/index' // }) // }, 20000); uni.redirectTo({ url: '/reportObstacles/report/index' }) }, // 工单处理 tohandle() { uni.redirectTo({ url: '/reportObstacles/handle/index' }) }, // 同意隐私协议 allowPrivacy() { // 查询授权 this.queryAuthLogin(); }, // 微信授权保存数据 // saveValue(roleId) { // if (roleId == 0) { // this.toReport(); // } else if (roleId == 1) { // this.tohandle(); // } // }, // 查询授权 queryAuthLogin() { let that = this; uni.login({ timeout: 10000, provider: 'weixin', success: function(data) { console.log('data', data) //获取临时登录凭证codC that.Code = data.code; const parmas = { code: that.Code, operate: '0', channelId: 'ssvb_minip' } that.$api.wxAuth(parmas).then(async (res) => { if (res.code == 'BSC00000') { console.log('查询授权', res) if (res.data.user_id != null && res.data.user_id != '' && res.data .user_id != undefined) { that.phoneNumber = res.data.user_name; that.phoneNumberFormat = formatMobilePhone(res.data.user_name); const weixinLogin = { phoneNumber: res.data.user_name, phoneNumberFormat: formatMobilePhone(res.data .user_name), address: res.data.address, user_name: res.data.nickName, roleId: res.data.roleId, user_id: res.data.user_id, token: res.data.tokenType + " " + res.data.value, tokenType: res.data.tokenType, sm2_prvkey: res.data.sm2_prvkey } // 存储数据 // localStorage.set('weixinLogin', weixinLogin) await that.$store.commit('SET_WEIXINLOGIN', weixinLogin); if (res.data.roleId == 0) { that.toReport(); } else if (res.data.roleId == 1) { that.tohandle(); } } } else if (res.code == 'MINIP_00010') { console.log(res.msg) } else { that.confirmPopup = true; that.popupcontent = res.msg; } }).catch(error => { that.confirmPopup = true; that.popupcontent = error.errMsg; }); }, fail: function(err) { // console.log("loginerr", err); } }) }, // 弹框隐藏 cancelBtn() { this.confirmPopup = false; }, } } </script> 上面是授权页面的标签和js代码
07-11 - 微信授权获取手机号成功后,跳转功能页面,页面卡死,所有按钮无法点击;重新进入小程序正常,是什么原因?
微信小程序使用微信授权获取手机号成功后,跳转页面,初始化页面调接口时卡死;点小程序右上角三个点再次进入小程序,不走微信授权进入小程序的同一个页面,接口初始化正常,页面渲染正常,这个是啥原因? // 1、子组件 // 微信授权方法 getPhoneNumber: function(e) { if (!e.detail.code) { uni.showToast({ title: '获取手机号失败', icon: 'none' }) return; } if (e.detail.errno == '1400001') { if (this.jumpPage == 'pages/my/my') { uni.hideTabBar(); } this.confirmPopup = true; showModal('温馨提示', '微信授权次数已用尽,请联系工作人员'); // clearInterval(this.timer); // this.messageShow = true; // this.messageCode = ''; } else { if (e.detail.errMsg == 'getPhoneNumber:ok') { this.encryptedData = e.detail.encryptedData; this.iv = e.detail.iv; const parmas = { code: this.Code, encryptedData: this.encryptedData, iv: this.iv, operate: '1', channelId: 'ssvb_minip' } console.log('授权上送字段', parmas) this.$api.wxAuth(parmas).then((res) => { console.log('申请授权',res) if (res.code == 'BSC00000') { const weixinLogin = { phoneNumber: res.data.user_name, phoneNumberFormat: formatMobilePhone(res.data .user_name), address: res.data.address, user_name: res.data.nickName, roleId: res.data.roleId, user_id: res.data.user_id, token: res.data.value, tokenType: res.data.tokenType, sm2_pubkey: res.data.sm2_pubkey } // 存储授权返回数据,到状态管理 this.$store.commit('SET_WEIXINLOGIN', weixinLogin); // 给父组件传递方法 this.$emit('savevalue', res.data.roleId) } else { this.wamingPopup = true; this.popupcontent = res.msg; } }) } } }, // 2、父组件: // 控制跳转页面 saveValue(roleId) { if (roleId == 0) { uni.navigateTo({ url: '/reportObstacles/report/index' }) } else if (roleId == 1) { uni.navigateTo({ url: '/reportObstacles/handle/index' }) } }, // 3、功能页面 onLoad() { this.malfunctionGetDict(); }, methods:{ // 位置查询 malfunctionGetDict() { const parmas = { dictType: 'ssvb_address' } this.$api.malfunctionGetDict(parmas).then(res => { if (res.code == 'BSC00000') { this.locationList = res.data; this.$store.commit('SET_LOCATIONLIST', this.locationList); this.selectBtn(); } else { this.confirmPopup = true; this.popupcontent = res.msg; } }) }, // 查询页面数据 selectBtn() { if (!this.hasMoreData) { return; } const parmas = { appUserId: this.loginResInfo.user_id, appUserName: this.loginResInfo.user_name, page: { pageSize: this.pageSize, // 每页数据条数 page: this.page } } this.$api.malfunctionSelect(parmas).then(res => { if (res.code == 'BSC00000') { let newReportList = res.data.data; newReportList.forEach(item => { if (item.level != '' && item.level != undefined && item.level != null) { if (item.level == '0') { item.levelFormat = '紧急' } else if (item.level == '1') { item.levelFormat = '一般' } else if (item.level == '2') { item.levelFormat = '普通' } } if (item.status != '' && item.status != undefined && item.status != null) { if (item.status == '0') { item.statusFormat = '待接单' } else if (item.status == '1') { item.statusFormat = '已接单' } else if (item.status == '2') { item.statusFormat = '退回待接单' } else if (item.status == '3') { item.statusFormat = '待评价' } else if (item.status == '4') { item.statusFormat = '已完结' } } if (item.appDate != '' && item.appDate != undefined && item.appDate != null) { item.appDateFormat = formatDateSplice(item.appDate) } if (item.appTime != '' && item.appTime != undefined && item.appTime != null) { item.appTimeFormat = formatDateTim(item.appTime) } if (item.fileList.length != 0) { item.fileList.forEach(iteam => { if (!iteam.filePath.indexOf('/') == '0') { iteam.filePath = '/' + iteam.filePath } iteam.imgUrl = apiUrl.baseUrl + '/api/file/download' + iteam .filePath + iteam.fileName }) } }) if (newReportList) { newReportList = filterArr(newReportList, this.locationList); } this.reportList = this.reportList.concat(newReportList); console.log('this.reportList', this.reportList) if (!res.data.page.pages) { this.hasMoreData = false; this.status = 'noMore'; } else if (this.page >= res.data.page.pages) { this.hasMoreData = false; this.status = 'noMore'; } else { this.hasMoreData = true; this.status = 'more'; } this.$appletAuthorize.appletAuthorize(); } else { this.confirmPopup = true; this.popupcontent = res.msg; } }) }, }
07-10 - wx.navigateToMiniProgram小程序跳转小程序闪退是什么原因?
使用API wx.navigateToMiniProgram, A小程序跳转B小程序时,闪退;是什么原因?有解决办法吗?
2023-07-28 - uniapp开发小程序后退回到webview的H5页面中,如何实现传参?
我的小程序项目中存在2个webview与小程序跳转传参的问题?目前存在2个问题: 第一个:从小程序回退到webview页时,如何实现传参,能否传参? 第二个:2个webview的参数数据如何实现共享?我看网上有些说,可以使用localStorage,这种方法是否可行?
2023-07-04 - 小程序免输绑卡小程序发布后,绑卡时提示小程序尚未发布?
[图片][图片][图片][图片]
2023-06-30 - webView在uniapp小程序中的使用及样式问题?
1、webView能否在小程序组件内打开,比如u-popup,实现webview的局部显示? 2、webView能否通过v-if控制其显示隐藏? 3、webView页面返回小程序,通过wx.miniProgram.navigateTo返回小程序,能否跳到小程序的分包页面中? 4、webView默认自动打开,铺满全屏,只能在一个新的空白页面中使用吗? 我使用中有以上几个疑问,麻烦技术人员给下解答,谢谢!
2023-06-09 - 小程序发布审核不通过?
[图片][图片][图片][图片] 我已经描述很清楚用户信息收集来源和目的,为啥一直审核不通过?
2022-09-27 - 小程序审核未通过?
我写的小程序是通过H5链接跳转小程序,链接跳转时携带ID,拿到参数后才能请求接口,获取数据渲染页面;你们审核说我页面空白,因为没有参数呀 AppID:wxbe6fc48e64e6967e [图片]
2022-09-22