zoukankan      html  css  js  c++  java
  • 微信小程序拒绝授权后提示信息以及重新授权

    wx.authorize({
        scope: 'scope.writePhotosAlbum',
        success() {
            // 授权成功
            wx.saveImageToPhotosAlbum({
                filePath: that.data.tempFilePath,
                success() {
                    app.func.setMask({
                        message: '图片保存成功',
                        bg: 'success'
                    }, that)
                    return
                }
            })
        },
        fail:function(){
            // 授权失败
            wx.showModal({
                title: '警告',
                content: '您点击了拒绝授权,将无法正常保存图片,点击确定重新获取授权。',
                success: function (res) {
                    if (res.confirm) {
                        wx.openSetting({
                            success: (res) => {
                                console.log('授权成功')
                            }
                        })
                    }
                }
            })
        }
    }) 

    uni-app小程序授权位置信息

    toPositioin() {
        let that = this
        uni.getSetting({
            success(res) {
                if(res.authSetting['scope.userLocation']){
                    // 已授权 
                    that.getChooseLocation()
                }else{
                    uni.authorize({
                        scope: 'scope.userLocation',
                        success(res) {
                            // 授权成功
                            that.getChooseLocation()
                        },
                        fail(err) {
                            wx.showModal({
                                title: '警告',
                                content: '您点击了拒绝授权,将无法正常使用发布功能,点击确定重新获取授权。',
                                success: function (res) {
                                    if (res.confirm) {
                                        wx.openSetting({
                                            success: (res) => {
                                                that.toPositioin()
                                            }
                                        })
                                    }
                                }
                            })
                        }
                    });
                }
            }
        })
    },
  • 相关阅读:
    C++11线程池
    muduo的事件处理(Reactor模型关键结构)
    sed和awk
    gdb
    C#访问级别
    C#表达式树浅析
    C#并发实战Parallel.ForEach使用
    c#获取本月有哪些周六、周日
    重装了Devexpress后项目报Dll引用找不到问题解决办法
    C#单例模式
  • 原文地址:https://www.cnblogs.com/cap-rq/p/9890358.html
Copyright © 2011-2022 走看看