diff --git a/manifest.json b/manifest.json index 517123a..f00ed55 100644 --- a/manifest.json +++ b/manifest.json @@ -43,7 +43,13 @@ /* ios打包配置 */ "ios" : {}, /* SDK配置 */ - "sdkConfigs" : {} + "sdkConfigs" : { + "geolocation" : { + "system" : { + "__platform__" : [ "ios", "android" ] + } + } + } } }, /* 快应用特有相关 */ diff --git a/pages/index/index.vue b/pages/index/index.vue index 473c842..a14b9ef 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -173,7 +173,7 @@ { title: '电影购票', img: 'https://static.ticket.sz-trip.com/changshu/images/index/dygp.png', - // url: 'https://m.cloud.sz-trip.com/MoviesChangShu', + url: 'https://m.cloud.sz-trip.com/MoviesChangShu', }, { title: '场馆预约', diff --git a/subPackages/webPage/webPage.vue b/subPackages/webPage/webPage.vue index ae2b81a..c5ffa7d 100644 --- a/subPackages/webPage/webPage.vue +++ b/subPackages/webPage/webPage.vue @@ -58,10 +58,34 @@ export default { .map(([key, value]) => `${(key)}=${(value)}`) .join('&'); - const fullUrl = `${baseUrl}?${queryString}`; - console.log(fullUrl); + let location = uni.getStorageSync('location') + if (location) { + queryString+=`&lon=${location.lon}&lat=${location.lat}` + let fullUrl = `${baseUrl}?${queryString}`; + console.log(fullUrl); + this.url = fullUrl + } else { + uni.getLocation({ + success: data => { + uni.setStorageSync('location', { + lat: data.latitude, + lon: data.longitude + }); + queryString+=`&lon=${data.longitude}&lat=${data.latitude}` + let fullUrl = `${baseUrl}?${queryString}`; + console.log(fullUrl); + this.url = fullUrl + + }, + fail: res=> { + let fullUrl = `${baseUrl}?${queryString}`; + console.log(fullUrl, '获取定位失败', res); + this.url = fullUrl + } + }) + } + - this.url = fullUrl } }) } @@ -79,10 +103,34 @@ export default { let queryString = Object.entries(param).filter(v=>v[0]!='tempUrl') .map(([key, value]) => `${(key)}=${(value)}`) .join('&'); + + let location = uni.getStorageSync('location') + if (location) { + queryString+=`&lon=${location.lon}&lat=${location.lat}` + let fullUrl = `${baseUrl}?${queryString}`; + console.log(fullUrl); + this.url = fullUrl + } else { + uni.getLocation({ + success: data => { + uni.setStorageSync('location', { + lat: data.latitude, + lon: data.longitude + }); + queryString+=`&lon=${data.longitude}&lat=${data.latitude}` + let fullUrl = `${baseUrl}?${queryString}`; + console.log(fullUrl); + this.url = fullUrl + + }, + fail: res=> { + let fullUrl = `${baseUrl}?${queryString}`; + console.log(fullUrl, '获取定位失败', res); + this.url = fullUrl + } + }) + } - const fullUrl = `${baseUrl}?${queryString}`; - console.log(fullUrl); - this.url = fullUrl } }).finally(()=>{ this.saveUrl = url