fix:水印相机,地图切换成天地图
This commit is contained in:
parent
dff94da7b6
commit
ac0c95dbe7
@ -16,7 +16,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|||||||
__name: "index",
|
__name: "index",
|
||||||
setup(__props) {
|
setup(__props) {
|
||||||
common_vendor.onLoad((e) => {
|
common_vendor.onLoad((e) => {
|
||||||
let address = common_libraries_map.getShowApiAddress();
|
let address = common_libraries_map.getMapAddress();
|
||||||
INDEX_watermark_camera_model.useModel.source.value = (e == null ? void 0 : e.source) || "save";
|
INDEX_watermark_camera_model.useModel.source.value = (e == null ? void 0 : e.source) || "save";
|
||||||
address.then((res) => {
|
address.then((res) => {
|
||||||
INDEX_watermark_camera_model.useModel.address.value = res;
|
INDEX_watermark_camera_model.useModel.address.value = res;
|
||||||
|
|||||||
12
dist/dev/mp-weixin/common/libraries/map.js
vendored
12
dist/dev/mp-weixin/common/libraries/map.js
vendored
@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
const common_vendor = require("../vendor.js");
|
const common_vendor = require("../vendor.js");
|
||||||
function getShowApiAddress() {
|
function getMapAddress() {
|
||||||
const SHOWAPI_APP_KEY = "C59885FE214644168eB4197eFe9a48b9";
|
const TIANDITU_KEY = "ee3611ed7d1e3061a5271f6e40cda354";
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
common_vendor.index.getLocation({
|
common_vendor.index.getLocation({
|
||||||
type: "wgs84",
|
type: "wgs84",
|
||||||
@ -9,17 +9,17 @@ function getShowApiAddress() {
|
|||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log(res, "经纬度");
|
console.log(res, "经纬度");
|
||||||
const url = `https://route.showapi.com/238-3?appKey=${SHOWAPI_APP_KEY}&lng=${res.longitude}&lat=${res.latitude}&from=5`;
|
const url = `https://api.tianditu.gov.cn/geocoder?postStr={'lon':${res.longitude},'lat':${res.latitude},'ver':2}&type=geocode&tk=${TIANDITU_KEY}`;
|
||||||
common_vendor.index.request({
|
common_vendor.index.request({
|
||||||
url,
|
url,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
success(res2) {
|
success(res2) {
|
||||||
var _a, _b;
|
var _a, _b;
|
||||||
|
resolve({ address: ((_b = (_a = res2 == null ? void 0 : res2.data) == null ? void 0 : _a.result) == null ? void 0 : _b.formatted_address) || "" });
|
||||||
console.log(res2, "address");
|
console.log(res2, "address");
|
||||||
resolve({ formatted_address: ((_b = (_a = res2 == null ? void 0 : res2.data) == null ? void 0 : _a.showapi_res_body) == null ? void 0 : _b.formatted_address) || "" });
|
|
||||||
},
|
},
|
||||||
fail(res2) {
|
fail(res2) {
|
||||||
resolve({ formatted_address: "拒绝定位" });
|
resolve({ address: "拒绝定位" });
|
||||||
console.error("获取地址失败:", res2);
|
console.error("获取地址失败:", res2);
|
||||||
common_vendor.index.showModal({
|
common_vendor.index.showModal({
|
||||||
title: "提示",
|
title: "提示",
|
||||||
@ -42,4 +42,4 @@ function getShowApiAddress() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getShowApiAddress = getShowApiAddress;
|
exports.getMapAddress = getMapAddress;
|
||||||
|
|||||||
@ -33,14 +33,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getShowApiAddress } from '@/common/libraries/map'
|
import { getMapAddress } from '@/common/libraries/map'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad } from '@dcloudio/uni-app'
|
||||||
import method from './method'
|
import method from './method'
|
||||||
import useModel from './model'
|
import useModel from './model'
|
||||||
onLoad(e => {
|
onLoad(e => {
|
||||||
let address = getShowApiAddress()
|
let address = getMapAddress()
|
||||||
useModel.source.value = e?.source || 'save'
|
useModel.source.value = e?.source || 'save'
|
||||||
address.then((res: { formatted_address?: string }) => {
|
address.then((res: { address?: string }) => {
|
||||||
useModel.address.value = res
|
useModel.address.value = res
|
||||||
console.log(res, '地址')
|
console.log(res, '地址')
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
export function getMapAddress() {
|
export function getMapAddress() {
|
||||||
// 高德配置
|
// 天地图配置
|
||||||
const TIANDITU_KEY = '4ce26ecef55ae1ec47910a72a098efc0'
|
const TIANDITU_KEY = 'ee3611ed7d1e3061a5271f6e40cda354'
|
||||||
return new Promise<{ address: string }>((resolve, reject) => {
|
return new Promise<{ address: string }>((resolve, reject) => {
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
@ -94,7 +94,7 @@ export function getShowApiAddress() {
|
|||||||
isHighAccuracy: true,
|
isHighAccuracy: true,
|
||||||
success(res) {
|
success(res) {
|
||||||
console.log(res, '经纬度')
|
console.log(res, '经纬度')
|
||||||
const url = `https://route.showapi.com/238-3?appKey=${SHOWAPI_APP_KEY}&lng=${res.longitude}&lat=${res.latitude}&from=5`
|
const url = `https://route.showapi.com/238-3?appKey=${SHOWAPI_APP_KEY}&lng=${res.longitude}&lat=${res.latitude}&from=1`
|
||||||
uni.request({
|
uni.request({
|
||||||
url: url,
|
url: url,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user