|
|
@@ -1,15 +1,19 @@
|
|
|
<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="80" @click="photo">
|
|
|
- <ui-icon type="photo" class="icon" />
|
|
|
+ <ButtonPane class="photo-btn fun-ctrl" :size="size" @click="photo" box-shadow>
|
|
|
+ <ui-icon type="photo" class="icon" :size="size / 2" />
|
|
|
</ButtonPane>
|
|
|
|
|
|
<img
|
|
|
v-if="showCoverUrl"
|
|
|
:src="showCoverUrl.value"
|
|
|
class="cover"
|
|
|
- :style="{ opacity: showCoverUrl ? '1' : 0 }"
|
|
|
+ :style="{
|
|
|
+ opacity: showCoverUrl ? '1' : 0,
|
|
|
+ width: `${size - 24}px`,
|
|
|
+ height: `${size - 24}px`,
|
|
|
+ }"
|
|
|
@click="router.push(writeRouteName.photos)"
|
|
|
/>
|
|
|
</div>
|
|
|
@@ -19,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";
|
|
|
@@ -31,10 +35,12 @@ 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";
|
|
|
+
|
|
|
+defineProps<{ size: number }>();
|
|
|
const menusMix = computed(() => menus);
|
|
|
const store = generateMixMenus("children", (m) => m, menusMix.value);
|
|
|
const showCoverUrl = computed(() => {
|
|
|
@@ -114,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">
|
|
|
@@ -170,18 +197,17 @@ const photo = async () => {
|
|
|
.photo-btn {
|
|
|
position: static;
|
|
|
margin-bottom: 16px;
|
|
|
+ border-radius: 50% !important;
|
|
|
|
|
|
.icon {
|
|
|
- font-size: 28px;
|
|
|
+ font-size: 40px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.cover {
|
|
|
- width: 48px;
|
|
|
- height: 48px;
|
|
|
border: 1px solid #fff;
|
|
|
object-fit: cover;
|
|
|
- border-radius: 24px;
|
|
|
+ border-radius: 50%;
|
|
|
overflow: hidden;
|
|
|
}
|
|
|
.face-animation {
|