From 4aec6bf9eebbf81a0dfcdc723044e4abec3316cb Mon Sep 17 00:00:00 2001 From: limqhz <540344226@qq.com> Date: Sat, 22 Apr 2023 16:03:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AE=9A=E4=BD=8D=E6=9D=83?= =?UTF-8?q?=E9=99=90=E4=B8=A2=E5=A4=B1=E5=B0=8F=E7=A8=8B=E5=BA=8F=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=BF=90=E8=A1=8C=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/home/index.js | 59 +++++++++++++++++++++++++------ pages/home/index.wxml | 2 +- pages/sportsGroundList/index.js | 35 ++---------------- pages/sportsGroundList/index.wxml | 4 +-- project.config.json | 22 ++++-------- 5 files changed, 59 insertions(+), 63 deletions(-) diff --git a/pages/home/index.js b/pages/home/index.js index 46ae0e2..587e488 100644 --- a/pages/home/index.js +++ b/pages/home/index.js @@ -325,11 +325,19 @@ Page({ }); }, fail: function(res) { - console.log(res); + that.setData({ + latitude: 31.2336800000, + longitude: 121.4715700000, + }) + that.getData({ + latitude: that.data.latitude, + longitude: that.data.longitude, + zoom: 1 + }); if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') { - that.setData({ - isShowAuth: true - }) + // that.setData({ + // isShowAuth: true + // }) } }, }) @@ -480,15 +488,44 @@ Page({ }) }, - // 回到开始 + // 由原来的回到开始改为定位 goFrist() { - let list = [{ - longitude: this.data.longitude, - latitude: this.data.latitude - }]; - // this.data.includePoints + let that = this; + wx.getLocation({ + type: 'gcj02', + success: function(res) { + that.setData({ + latitude: res.latitude, + longitude: res.longitude, + }) + that.getData({ + latitude: res.latitude, + longitude: res.longitude, + zoom: 1 + }); + let list = [{ + longitude: this.data.longitude, + latitude: this.data.latitude + }]; + // this.data.includePoints + this.setData({ + includePoints: list + }) + }, + fail: function(res) { + console.log(res.errMsg) + if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') { + that.setData({ + isShowAuth: true + }) + } + }, + }) + }, + onCancel(e){ + console.log(e) this.setData({ - includePoints: list + isShowAuth: false }) } }) diff --git a/pages/home/index.wxml b/pages/home/index.wxml index cf5db33..9cffc2a 100644 --- a/pages/home/index.wxml +++ b/pages/home/index.wxml @@ -112,4 +112,4 @@ - + diff --git a/pages/sportsGroundList/index.js b/pages/sportsGroundList/index.js index f94a717..653519f 100644 --- a/pages/sportsGroundList/index.js +++ b/pages/sportsGroundList/index.js @@ -24,7 +24,7 @@ Page({ this.setData({ state: options.state }) - this.getLocation(); + this.getData(); }, /** @@ -144,35 +144,6 @@ Page({ isShowNewplot: true }) }) - }, + } - // 活动当前坐标 - getLocation() { - let that = this; - wx.getLocation({ - type: 'gcj02', - success: function(res) { - latitude = res.latitude; - longitude = res.longitude; - that.getData() - }, - fail: function(res) { - if (res.errMsg == 'getLocation:fail auth deny' || res.errMsg == 'getLocation:fail:auth denied') { - that.setData({ - isShowAuth: true - }) - } - }, - }) - }, - - // 获取授权 - setAuthSuccess(e) { - if (e.detail.authSetting['scope.userLocation']) { - this.getLocation(); - this.setData({ - isShowAuth: false - }) - } - }, -}) \ No newline at end of file +}) diff --git a/pages/sportsGroundList/index.wxml b/pages/sportsGroundList/index.wxml index dabf4f7..ef6eb5b 100644 --- a/pages/sportsGroundList/index.wxml +++ b/pages/sportsGroundList/index.wxml @@ -34,9 +34,7 @@ - - 暂无运动场馆 ~ - \ No newline at end of file + diff --git a/project.config.json b/project.config.json index b22fba3..fbb3691 100644 --- a/project.config.json +++ b/project.config.json @@ -1,7 +1,8 @@ { "description": "项目配置文件。", "packOptions": { - "ignore": [] + "ignore": [], + "include": [] }, "setting": { "urlCheck": false, @@ -42,22 +43,11 @@ "libVersion": "2.17.0", "appid": "wx73eb8a9ed10a029d", "projectname": "%E6%99%BA%E6%85%A7%E4%BA%91%E9%A6%86", - "isGameTourist": false, "simulatorType": "wechat", "simulatorPluginLibVersion": {}, - "condition": { - "search": { - "list": [] - }, - "conversation": { - "list": [] - }, - "game": { - "currentL": -1, - "list": [] - }, - "miniprogram": { - "list": [] - } + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 } } \ No newline at end of file