123
This commit is contained in:
@ -14,8 +14,8 @@ const info = ref({});
|
||||
const pointsList = ref([]);
|
||||
const listQuery = ref({
|
||||
dktp: "",
|
||||
jd: "104.67926708276372",
|
||||
wd: "31.038282761737406",
|
||||
jd: "",
|
||||
wd: "",
|
||||
});
|
||||
const zxdksj = ref("");
|
||||
const dwIndex = ref();
|
||||
@ -67,33 +67,33 @@ const loadData = async () => {
|
||||
});
|
||||
emitter.emit("setMapCenter", { location: centerPoint, zoomLevel: 12 });
|
||||
// 获取所有唯一的图片ID
|
||||
const uniqueImageIds = new Set();
|
||||
detail.bxds?.forEach((item) => {
|
||||
if (item?.dktp) uniqueImageIds.add(item.dktp);
|
||||
});
|
||||
// 批量获取图片URL
|
||||
const imageEntries = await Promise.allSettled(
|
||||
Array.from(uniqueImageIds).map(async (id) => {
|
||||
try {
|
||||
const url = await getImageUrl(id);
|
||||
return { id, url };
|
||||
} catch (error) {
|
||||
return { id, url: null };
|
||||
}
|
||||
})
|
||||
);
|
||||
// 创建图片映射表
|
||||
const imageMap = new Map();
|
||||
imageEntries.forEach((entry) => {
|
||||
if (entry.status === "fulfilled") {
|
||||
imageMap.set(entry.value.id, entry.value.url);
|
||||
const uniqueImageIds = new Set();
|
||||
detail.bxds?.forEach((item) => {
|
||||
if (item?.dktp) uniqueImageIds.add(item.dktp);
|
||||
});
|
||||
// 批量获取图片URL
|
||||
const imageEntries = await Promise.allSettled(
|
||||
Array.from(uniqueImageIds).map(async (id) => {
|
||||
try {
|
||||
const url = await getImageUrl(id);
|
||||
return { id, url };
|
||||
} catch (error) {
|
||||
return { id, url: null };
|
||||
}
|
||||
});
|
||||
// 设置数据
|
||||
pointsList.value = detail.bxds.map((item, index) => ({
|
||||
...item,
|
||||
imgUrlDkFj: item?.dktp ? imageMap.get(item.dktp) : null,
|
||||
}));
|
||||
})
|
||||
);
|
||||
// 创建图片映射表
|
||||
const imageMap = new Map();
|
||||
imageEntries.forEach((entry) => {
|
||||
if (entry.status === "fulfilled") {
|
||||
imageMap.set(entry.value.id, entry.value.url);
|
||||
}
|
||||
});
|
||||
// 设置数据
|
||||
pointsList.value = detail.bxds.map((item, index) => ({
|
||||
...item,
|
||||
imgUrlDkFj: item?.dktp ? imageMap.get(item.dktp) : null,
|
||||
}));
|
||||
// 为每个必到点添加图片URL
|
||||
zxdksj.value = detail.zxdksj;
|
||||
info.value = detail.fgrw;
|
||||
@ -141,10 +141,10 @@ const photoFn = (val, index) => {
|
||||
// 判断此任务最新打卡时间如果在打卡间隔时间之后才能继续打卡
|
||||
if (zxdksj.value) {
|
||||
if (!isInThirtyMinutes(zxdksj.value, info.value.dkjgsj)) {
|
||||
const now = new Date();
|
||||
const time1 = new Date(zxdksj.value);
|
||||
const nowtime = new Date();
|
||||
const time1 = new Date(zxdksj.value);//最新打卡时间
|
||||
let newMin = time1.getTime() + Number(info.value.dkjgsj) * 60 * 1000;//30分钟后的时间
|
||||
let max = Math.floor((newMin - now.getTime()) / 1000 / 60);//最大可打卡时间
|
||||
let max = Math.floor((newMin - nowtime.getTime()) / 1000 / 60);//最大可打卡时间
|
||||
hintToast(`请于${max}分钟后打卡`);
|
||||
return;
|
||||
}
|
||||
@ -153,7 +153,7 @@ const photoFn = (val, index) => {
|
||||
} catch (err) {
|
||||
console.log(err, "err");
|
||||
}
|
||||
handleClick()
|
||||
// handleClick()
|
||||
} else {
|
||||
try {
|
||||
bridge.pZ("photo");
|
||||
@ -165,9 +165,9 @@ const photoFn = (val, index) => {
|
||||
};
|
||||
// 打卡
|
||||
const handleClick = () => {
|
||||
// const { lng, lat } = getLocation();
|
||||
// listQuery.value.jd = lng;
|
||||
// listQuery.value.wd = lat;
|
||||
const { lng, lat } = getLocation();
|
||||
listQuery.value.jd = lng;
|
||||
listQuery.value.wd = lat;
|
||||
qcckPost(listQuery.value, "/mosty-yjzl/tbZdyrw/zdyRwdk")
|
||||
.then((res) => {
|
||||
if (res) {
|
||||
@ -178,13 +178,11 @@ const handleClick = () => {
|
||||
.catch((err) => {
|
||||
console.log(err, "err");
|
||||
hintToast("打卡失败");
|
||||
loadData()
|
||||
});
|
||||
};
|
||||
function setimage_base64(pzid, base64) {
|
||||
pointsList.value[
|
||||
dwIndex.value
|
||||
].imgUrlDkFj = `data:image/jpeg;base64,${base64}`;
|
||||
console.log(pointsList.value[dwIndex.value].imgUrlDkFj, "point");
|
||||
pointsList.value[dwIndex.value].imgUrlDkFj = `data:image/jpeg;base64,${base64}`;
|
||||
qcckPost({ base64: base64 }, "/mosty-base/minio/image/upload/base64").then(
|
||||
(res) => {
|
||||
listQuery.value.dktp = res;
|
||||
@ -195,6 +193,9 @@ function setimage_base64(pzid, base64) {
|
||||
onMounted(async () => {
|
||||
await loadData();
|
||||
window.setimagebase64 = setimage_base64;
|
||||
setInterval(() => {
|
||||
getUserLocation()
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
@ -205,7 +206,6 @@ onUnmounted(() => {
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<TopNav nav-title="任务详情" show-left />
|
||||
|
||||
<div class="content">
|
||||
<!-- Header Card -->
|
||||
<div class="card header-card">
|
||||
@ -218,28 +218,24 @@ onUnmounted(() => {
|
||||
打卡间隔时间:{{ info.dkjgsj ? info.dkjgsj : "100min" }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Point List -->
|
||||
<div class="list">
|
||||
<div v-for="(item, index) in pointsList" :key="index" class="card point-card">
|
||||
<div class="row header-row">
|
||||
<div class="name">{{ item.bxdMc }}</div>
|
||||
<div class="status-tag">{{item.dkzt}}</div>
|
||||
<div class="status-tag">{{ item.dkzt }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Checked In: Show Image -->
|
||||
<div v-if="item.dktp || item.imgUrlDkFj" class="img-container" @click="preview(item.imgUrlDkFj)">
|
||||
<div v-if="item.imgUrlDkFj" class="img-container" @click="preview(item.imgUrlDkFj)">
|
||||
<img :src="item.imgUrlDkFj" alt="打卡图片" />
|
||||
<div class="time-overlay">{{ item.dksj }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Not Checked In: Show Button (Visual only) -->
|
||||
<div v-else class="btn-container">
|
||||
<div class="btn" @click="photoFn(item, index)">打卡拍照</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Map Section -->
|
||||
<div class="card map-card">
|
||||
<div class="map-title">当前位置</div>
|
||||
|
||||
Reference in New Issue
Block a user