在用uni-app开发小程序的时候我们经常会遇到,需要授权的时候,用户没有点击确认按钮,然后用户再次点击的时候,系统默认执行失败回调函数,权限获取无法再次被挂起。
1、授权登录
先调取uni.getUserProfile 设置desc: 'Wexin'
再调去uni.login
然后用返回的code码向接口换取open-id
再用open-id向接口请求userid完成登录
2、获取麦克风授权
直接上一个示例点击函数
startRecord() {
this.ti = '00:00'
this.minutes = 0
this.seconds = 0;
recorderManager.stop();
// console.log('开始录音');
let that = this
uni.authorize({
scope: 'scope.record',
success() { //1.1 允许授权
that.opening = false,
that.closeing = true,
&nbs
304



被折叠的 条评论
为什么被折叠?



