zoukankan      html  css  js  c++  java
  • 小程序之经纬度获取权限取消之后的处理

    wx.getLocation({
                altitude: false,
                success: function (res) {
                    var latitude = res.latitude;
                    var longitude = res.longitude;
                    that.globalData.location = {
                        latitude: latitude,
                        longitude: longitude
                    }
                },
                fail: function () {
                    setTimeout(function () {
    
                        wx.getSetting({
                            success: (res) => {
    
                                if (!res.authSetting['scope.userLocation']) {
    
                                    wx.openSetting({
                                        success: (response) => {
                                            wx.showModal({
                                                title: '请重新授权',
                                                content: '需要获取您的地址信息',
                                                success: function (data) {
                                                    // console.log("授权1" + data.cancel);   //点击了取消data.cancel==true
                                                    // console.log("授权2" + data.confirm);  //点击了确定data.confirm==true
                                                    wx.getLocation({
                                                        success: function (res) {
                                                            console.log("地址" + res.latitude)
                                                            var latitude = res.latitude;
                                                            var longitude = res.longitude;
                                                            that.globalData.location = {
                                                                latitude: latitude,
                                                                longitude: longitude
                                                            }
                                                        }
                                                    })
                                                }
                                            });
    
    
                                        }
                                    })
    
                                }
                            }
                        })
    
                    }, 1000);
                }
            });
        }
  • 相关阅读:
    RESTful架构的设计误区
    CRUD的http请求方式
    RESTful API的安全性
    REST风格的原则
    REST架构风格理解
    ansible上手之认识Playbook
    ansible模块之file
    ansible模块之yum,yum_repository
    ansible模块之copy
    Pygame
  • 原文地址:https://www.cnblogs.com/wanan-01/p/9077940.html
Copyright © 2011-2022 走看看