|
|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<img :src="tempPhoto" class="face-animation" v-if="tempPhoto" ref="coverRef" />
|
|
|
<div class="photo-layout" v-if="disabledMap.photo">
|
|
|
- <ButtonPane class="photo-btn fun-ctrl" :size="size" @click="photo">
|
|
|
+ <ButtonPane class="photo-btn fun-ctrl" :size="size" @click="photo" box-shadow>
|
|
|
<ui-icon type="photo" class="icon" :size="size / 2" />
|
|
|
</ButtonPane>
|
|
|
|
|
|
@@ -23,7 +23,7 @@
|
|
|
import UiIcon from "@/components/base/components/icon/index.vue";
|
|
|
import ButtonPane from "@/components/button-pane/index.vue";
|
|
|
import { list } from "@/store/measure";
|
|
|
-import { fixPoints } from "@/store/fixPoint";
|
|
|
+import { FixType, GFixPoint, fixPoints } from "@/store/fixPoint";
|
|
|
import { baseLines } from "@/store/baseLine";
|
|
|
import { basePoints } from "@/store/basePoint";
|
|
|
import { photos } from "@/store/photos";
|
|
|
@@ -35,7 +35,7 @@ import { base64ToBlob, formatDate, getId } from "@/utils";
|
|
|
import { computed, nextTick, ref, watchEffect } from "vue";
|
|
|
import { api, downloadImage, uploadImage } from "@/store/sync";
|
|
|
import { router, writeRouteName } from "@/router";
|
|
|
-import { LaserSDK, Pos, Pos3D } from "@/sdk";
|
|
|
+import { LaserSDK, Pos, Pos3D, TypeEmu } from "@/sdk";
|
|
|
import { useStaticUrl } from "@/hook/useStaticUrl";
|
|
|
import { Loading } from "@kankan/components/index";
|
|
|
import { generateMixMenus, MenuRaw, menus, findMenuByKey } from "./menus/menus";
|
|
|
@@ -120,40 +120,61 @@ const photo = async () => {
|
|
|
tempPhoto.value = await api.getFile(data.rawUrl);
|
|
|
console.log("获取到临时文件");
|
|
|
await nextTick();
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ const handler = async () => {
|
|
|
+ coverRef.value.removeEventListener("animationend", handler);
|
|
|
+ tempPhoto.value = null;
|
|
|
|
|
|
- const handler = async () => {
|
|
|
- coverRef.value.removeEventListener("animationend", handler);
|
|
|
- tempPhoto.value = null;
|
|
|
- const photoData = {
|
|
|
- id: getId(),
|
|
|
- url: data.url,
|
|
|
- urlRaw: data.rawUrl,
|
|
|
- time: new Date().getTime(),
|
|
|
- meterPerPixel: data.meterPerPixel,
|
|
|
- measures: list.value
|
|
|
- .map((data) => {
|
|
|
- const pos = getCurrentScreens(data.points);
|
|
|
- if (pos.length) {
|
|
|
- return { pos, dis: sdk.carry.measureMap.get(data).getDistance().value };
|
|
|
- } else {
|
|
|
- return null;
|
|
|
- }
|
|
|
+ const fixMeasures = fixPoints.value
|
|
|
+ .filter((fix) => fix.measure && fix.lines)
|
|
|
+ .map((fix) => {
|
|
|
+ return fix.lines.reduce(
|
|
|
+ (t, line) => t.concat({ dis: line.dis, pos: getCurrentScreens(line.points) }),
|
|
|
+ [] as { pos: Pos[]; dis: number }[]
|
|
|
+ );
|
|
|
})
|
|
|
- .filter((poss) => poss?.pos.length === 2),
|
|
|
- baseLines: baseLines.value
|
|
|
- .map((data) => getCurrentScreens(data.points))
|
|
|
- .filter((poss) => poss.length === 2),
|
|
|
- fixPoints: fixPoints.value
|
|
|
- .map((data) => ({ text: data.text, pos: getCurrentScreen(data.pos) }))
|
|
|
- .filter((data) => !!data.pos),
|
|
|
- basePoints: getCurrentScreens(basePoints.value.map((data) => data.pos)),
|
|
|
+ .flat();
|
|
|
+ const fixGraph = fixPoints.value
|
|
|
+ .filter((fix) => "type" in fix && fix.type === FixType.GRAPH)
|
|
|
+ .map((fix) => getCurrentScreens((fix as GFixPoint).points))
|
|
|
+ .filter((points) => points.length > 1);
|
|
|
+
|
|
|
+ const photoData = {
|
|
|
+ id: getId(),
|
|
|
+ url: data.url,
|
|
|
+ urlRaw: data.rawUrl,
|
|
|
+ time: new Date().getTime(),
|
|
|
+ meterPerPixel: data.meterPerPixel,
|
|
|
+ measures: list.value
|
|
|
+ .map((data) => {
|
|
|
+ const pos = getCurrentScreens(data.points);
|
|
|
+ if (pos.length) {
|
|
|
+ return { pos, dis: sdk.carry.measureMap.get(data).getDistance().value };
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .concat(fixMeasures)
|
|
|
+ .filter((poss) => poss?.pos.length === 2),
|
|
|
+ fixGraph,
|
|
|
+ baseLines: baseLines.value
|
|
|
+ .map((data) => getCurrentScreens(data.points))
|
|
|
+ .filter((poss) => poss.length === 2),
|
|
|
+ fixPoints: fixPoints.value
|
|
|
+ .map((data) => ({ text: data.text, pos: getCurrentScreen(data.pos) }))
|
|
|
+ .filter((data) => !!data.pos),
|
|
|
+ basePoints: getCurrentScreens(basePoints.value.map((data) => data.pos)),
|
|
|
+ };
|
|
|
+ console.log(photoData);
|
|
|
+ photos.value.push(photoData);
|
|
|
+ Loading.hide();
|
|
|
+ resolve(photoData);
|
|
|
};
|
|
|
- console.log(photoData);
|
|
|
- photos.value.push(photoData);
|
|
|
- Loading.hide();
|
|
|
- };
|
|
|
- coverRef.value.addEventListener("animationend", handler);
|
|
|
+ coverRef.value.addEventListener("animationend", handler);
|
|
|
+ });
|
|
|
};
|
|
|
+
|
|
|
+(window as any).photo = photo;
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|