diff --git a/pages/API/choose-location/choose-location.uvue b/pages/API/choose-location/choose-location.uvue index c12ffaf898a8878380670f5b1e727e893c413226..f2ce1390d4b4dab211074c1aa03c66bcd385a160 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 } } }