From 925f0fda16ac0214905bcedc40c061bf8e90d6e5 Mon Sep 17 00:00:00 2001 From: VK <370725567@qq.com> Date: Mon, 25 Nov 2024 13:23:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96choose-location=E7=9A=84?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../API/choose-location/choose-location.uvue | 48 +++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/pages/API/choose-location/choose-location.uvue b/pages/API/choose-location/choose-location.uvue index c12ffaf8..f2ce1390 100644 --- a/pages/API/choose-location/choose-location.uvue +++ b/pages/API/choose-location/choose-location.uvue @@ -15,7 +15,10 @@ - 注意:Web和App需要正确配置地图服务商的Key并且保证Key的权限和余额足够,才能正常选择位置 + 注意:\n1. Web和App需要正确配置地图服务商的Key并且保证Key的权限和余额足够,才能正常选择位置\n2. 若没有关联uniCloud空间,则只能全屏地图选点,不能根据POI选择位置\n3. payload参数会原样透传给uni-map-co,可用于用户鉴权 + + + @@ -38,12 +41,15 @@ } as Location, locationName: '', locationAddress: '', - dialogPagesNum: -1 + dialogPagesNum: -1, + hoverLocation: false, + hoverKeyword: false, + hoverPayload: false } }, methods: { chooseLocation: function () { - uni.chooseLocation({ + let chooseLocationOptions = { success: (res) => { console.log('chooseLocation success', res) this.hasLocation = true @@ -51,13 +57,23 @@ this.locationName = res.name this.locationAddress = res.address } - }) + } + if (this.hoverLocation) { + chooseLocationOptions['latitude'] = 39.908823 + chooseLocationOptions['longitude'] = 116.39747 + } + if (this.hoverKeyword) { + chooseLocationOptions['keyword'] = '公园' + } + if (this.hoverPayload) { + chooseLocationOptions['payload'] = { + token: 'xxx' + } + } + uni.chooseLocation(chooseLocationOptions) // 自动化测试 setTimeout(() => { - const pages = getCurrentPages() - const page = pages[pages.length - 1] - const dialogPages = page.getDialogPages() - this.dialogPagesNum = dialogPages.length + this.test() }, 500) }, formatLocation: function(longitude:number, latitude:number):Location { @@ -76,6 +92,22 @@ }, clear: function () { this.hasLocation = false + }, + changeLocationBoolean(checked : boolean) { + this.hoverLocation = checked + }, + changeKeywordBoolean(checked : boolean) { + this.hoverKeyword = checked + }, + changePayloadBoolean(checked : boolean) { + this.hoverPayload = checked + }, + // 自动化测试 + test() { + const pages = getCurrentPages() + const page = pages[pages.length - 1] + const dialogPages = page.getDialogPages() + this.dialogPagesNum = dialogPages.length } } } -- GitLab