定位
This commit is contained in:
54
src/App.vue
54
src/App.vue
@ -1,22 +1,31 @@
|
||||
|
||||
<template>
|
||||
<router-view v-slot="{ Component }">
|
||||
<Component :is="Component"></Component>
|
||||
<van-popup v-model:show="showAlert" closeable :close-on-click-overlay="false" close-icon-position="top-right"
|
||||
position="bottom" @close="closePopup">
|
||||
<van-popup
|
||||
v-model:show="showAlert"
|
||||
closeable
|
||||
:close-on-click-overlay="false"
|
||||
close-icon-position="top-right"
|
||||
position="bottom"
|
||||
@close="closePopup"
|
||||
>
|
||||
<div class="alert-content">
|
||||
<div class="alert-cnt">
|
||||
<van-icon name="warning-o" color="orange"></van-icon> {{ message }}
|
||||
</div>
|
||||
<div class="foot-btn">
|
||||
<van-button round block type="primary" @click="okUpdate"> 确定更新 </van-button>
|
||||
<van-button round block type="primary" @click="okUpdate">
|
||||
确定更新
|
||||
</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</van-popup>
|
||||
</router-view>
|
||||
</template>
|
||||
<GdMap />
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import GdMap from "./components/GdMap/index.vue";
|
||||
import watermark from "./utils/watermark.js";
|
||||
import emitter from "./utils/eventBus.js";
|
||||
import { onMounted, onUnmounted, ref, watch, reactive } from "vue";
|
||||
@ -24,6 +33,7 @@ import { getMyTaskList, getMyTaskTotal } from "./api/rwzx.js";
|
||||
import { updateDate } from "./api/checkponit.js";
|
||||
import { getDistance, hintToast, timeValidate } from "./utils/tools";
|
||||
import { getAPPLocation } from "./api/spsApi";
|
||||
import { qcckPost, qcckGet } from "@/api/qcckApi";
|
||||
import { useRoute } from "vue-router";
|
||||
import router from "./router/index.js";
|
||||
import store from "./store";
|
||||
@ -76,6 +86,10 @@ watch(
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
getLocation(); //获取经纬度
|
||||
setInterval(() => {
|
||||
getLocation(); //获取经纬度
|
||||
}, 10000);
|
||||
//默认设置用户主题色
|
||||
if (!getStorage("themeSetting")) {
|
||||
setStorage("themeSetting", "light");
|
||||
@ -88,9 +102,31 @@ onMounted(() => {
|
||||
setAttribute(res); // 应用主题
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
const getLocation = () => {
|
||||
if ("geolocation" in navigator) {
|
||||
console.log(navigator.geolocation, "navigator.geolocation");
|
||||
navigator.geolocation.getCurrentPosition(
|
||||
(pos) => {
|
||||
console.log(pos.coords, "pos");
|
||||
if (pos.coords) {
|
||||
var latitude = pos.coords.latitude;
|
||||
var longitude = pos.coords.longitude;
|
||||
qcckPost(
|
||||
{ jd: longitude, wd: latitude, bbid: "" },
|
||||
"/mosty-qwzx/tbQwXfbb/updateBbJzwz"
|
||||
).then((res) => {
|
||||
console.log(res, "res");
|
||||
});
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
console.log(err, "err");
|
||||
}
|
||||
);
|
||||
} else {
|
||||
console.log("Geolocation is not supported by this browser.");
|
||||
}
|
||||
};
|
||||
|
||||
// 关闭提示
|
||||
function closePopup() {
|
||||
@ -117,7 +153,7 @@ function _getTaskList() {
|
||||
pageSize: 10,
|
||||
pageCurrent: 1,
|
||||
};
|
||||
getMyTaskList(data).then((res) => { });
|
||||
getMyTaskList(data).then((res) => {});
|
||||
}
|
||||
onUnmounted(() => {
|
||||
clearInterval(bbTime.value);
|
||||
|
||||
Reference in New Issue
Block a user