diff --git a/src/pages/taskList/historyDetail.vue b/src/pages/taskList/historyDetail.vue index c5f7c52..f5e11c8 100644 --- a/src/pages/taskList/historyDetail.vue +++ b/src/pages/taskList/historyDetail.vue @@ -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(() => {