From 7e47a3265762a85c0834a06783203efcacff9e03 Mon Sep 17 00:00:00 2001 From: cheng.xu Date: Mon, 23 Sep 2019 15:02:28 +0800 Subject: [PATCH] gps开启关闭判断 --- pages/goods/goodsInfo/goodsInfo.js | 37 ++++++++++++++++++++++++++++++++++++- pages/index/index/index.js | 2 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index b3df843..87913cd 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -1,7 +1,7 @@ var t = require("../../../utils/util.js"), ut = t, e = require("../../../utils/common.js"), - a = require("../../../utils/wxParse/wxParse.js"), + a = require("../../../utils/wxParse/wxParse.js"), s = getApp(), i = s.request, rq = i, @@ -223,6 +223,7 @@ Page({ is_get_local_ok:0,//获取坐标是否完成 region_name:"门店分类",//区域的名字 + is_gps:1, }, //------初始化加载---------- @@ -264,6 +265,13 @@ Page({ th.data.is_get_local_ok=1; }, fail: function (res) { + + if (res.errCode == 2) { + th.setData({ is_gps: 0 }); + } else { + th.setData({ is_gps: "3" }); + } + th.data.is_get_local_ok=1; } }) @@ -2723,6 +2731,33 @@ Page({ }, // 选择门店 choice_store:function(){ + var th=this; + wx.getLocation({ + type: 'wgs84', + success: function (res) { + console.log("GPS成功的回调是上面"); + th.data.lat = res.latitude; + th.data.lon = res.longitude; + th.data.is_get_local_ok = 1; + th.setData({ is_gps: 1 }); + }, + fail: function (res) { + console.log("GPS失败的回调"); + if (res.errCode == 2) { + console.log("GPS失败的回调22222222222222222"); + th.setData({ is_gps: 0 }); + if (this.data.is_gps == 0) { + console.log(this.data.is_gps, "GPS提示框"); + s.showWarning("请开启GPS定位", null, 1000, !1); + } + } else { + th.setData({ is_gps: "3" }); + } + + th.data.is_get_local_ok = 1; + } + }) + this.setData({ store:1, openSpecModal: !1, diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 948c5b6..fc209cc 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -1,6 +1,6 @@ var e = function (e) { return e && e.__esModule ? e : { - default: e + default: e }; }(require("../../../utils/LoadMore.js")), t = getApp(), a = t.request, o = t.globalData.setting, os = o, i = require("../../../utils/util.js"), ut = i, s = require("../../../utils/common.js"), n = new e.default(); -- libgit2 0.21.4