diff --git a/manifest.json b/manifest.json index 2d059e9..71d1a1d 100644 --- a/manifest.json +++ b/manifest.json @@ -51,8 +51,11 @@ /* ios打包配置 */ "sdkConfigs" : { "geolocation" : { - "system" : { - "__platform__" : [ "ios", "android" ] + "amap" : { + "name" : "amap_15882397084BqtLneFOK", + "__platform__" : [ "android" ], + "appkey_ios" : "", + "appkey_android" : "1b552fec0195ad646852a1eac91ba7ae" } }, "ad" : {} diff --git a/pages/index/index.vue b/pages/index/index.vue index 746ee77..41779b1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -299,7 +299,7 @@ }, location() { uni.getLocation({ - type: 'wgs84', + type: 'gcj02', success: (res) => { console.log('当前位置的经度:' + res.longitude); console.log('当前位置的纬度:' + res.latitude); @@ -565,23 +565,24 @@ var tdt = new TileLayer({ source: new XYZ({ maxZoom: 18, - url: 'http://t{0-5}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=cef191b507ff5cb698811cd8a9b11ca0', + url: "https://webst0{1-4}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}", + // url: 'http://t{0-5}.tianditu.gov.cn/DataServer?T=img_w&x={x}&y={y}&l={z}&tk=cef191b507ff5cb698811cd8a9b11ca0', projection: 'EPSG:3857', crossOrigin: '*', }), }) //天地图标注 - var tdtLabel = new TileLayer({ - source: new XYZ({ - maxZoom: 18, - url: 'http://t{0-5}.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cef191b507ff5cb698811cd8a9b11ca0', - projection: 'EPSG:3857', - }), - }) + // var tdtLabel = new TileLayer({ + // source: new XYZ({ + // maxZoom: 18, + // url: 'http://t{0-5}.tianditu.gov.cn/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=cef191b507ff5cb698811cd8a9b11ca0', + // projection: 'EPSG:3857', + // }), + // }) map = new Map({ controls: [], target: 'map', - layers: [tdt, tdtLabel], + layers: [tdt], view: new View({ projection: 'EPSG:4326', center: [102.45438, 32.53223], diff --git a/pages/sjsb/sjsb.vue b/pages/sjsb/sjsb.vue index fdb2875..7c779b5 100644 --- a/pages/sjsb/sjsb.vue +++ b/pages/sjsb/sjsb.vue @@ -86,47 +86,52 @@ success: (res) => { console.log(res.networkType); this.networkType = res.networkType; + uni.getStorage({ + key: 'token', + success: (token) => { + this.token = token.data; + if (!e.id) { + this.locationLoading = true + if (res.networkType !== 'none') { + uni.getLocation({ + type: 'gcj02', + success: (res) => { + this.jd = res.longitude; + this.wd = res.latitude; + this.locationLoading = false + }, + fail: (error) => { + this.locationLoading = false + uni.showModal({ + content: JSON.stringify(error), + title: '定位失败' + }) + } + }); + } else { + plus.geolocation.getCurrentPosition((res) => { + this.jd = res.coords.longitude; + this.wd = res.coords.latitude; + this.locationLoading = false + }, (error) => { + this.locationLoading = false + uni.showModal({ + content: JSON.stringify(error), + title: '定位失败' + }) + }); + } + } else { + this.id = e.id + this.requestItem(e.id); + } + }, + fail(err) {}, + complete: () => {} + }) + } }); - uni.getStorage({ - key: 'token', - success: (token) => { - this.token = token.data; - - if (!e.id) { - // uni.getLocation({ - // type: 'wgs84', - // success: (res) => { - // this.jd = res.longitude; - // this.wd = res.latitude; - // } - // }); - this.locationLoading = true - plus.geolocation.getCurrentPosition((res) => { - this.jd = res.coords.longitude; - this.wd = res.coords.latitude; - this.locationLoading = false - // resolve({ - // lat: res.coords.latitude, - // lng: res.coords.longitude - // }); - }, (error) => { - this.locationLoading = false - // uni.showToast({ - // title: error.message, - // duration: 3000, - // icon: 'icon' - // }); - // reject(); - }); - } else { - this.id = e.id - this.requestItem(e.id); - } - }, - fail(err) {}, - complete: () => {} - }) }, methods: { delImg(index) { @@ -153,7 +158,7 @@ const str = item.geom?.replace('POINT (', '').replace(')', ''); console.log(str) const strs = str.split(' '); - this.jd = parseFloat(strs[0]); + this.jd = parseFloat(strs[0]); this.wd = parseFloat(strs[1]); this.reason = item.reason; this.imgStrs = item.img?.split(','); diff --git a/pages/workbench/workbench.vue b/pages/workbench/workbench.vue index 0bb2738..f65e71a 100644 --- a/pages/workbench/workbench.vue +++ b/pages/workbench/workbench.vue @@ -13,7 +13,7 @@ 草原核查数据 - + 数据上报 @@ -24,8 +24,8 @@ - - + + 临时数据管理 @@ -74,8 +74,8 @@ } .action-img { - width: 64px; - height: 64px; + width: 48px; + height: 48px; margin-bottom: -14px; }