This commit is contained in:
13684185576
2025-11-05 09:33:38 +08:00
parent aed0ed60ba
commit 5c7efdd1e8
6 changed files with 362 additions and 231 deletions

View File

@ -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);