anytrek-front-public-component 1.13.16 → 1.13.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -15
- package/anytrek-front-public-component.mjs +7944 -7664
- package/anytrek-front-public-component.umd.js +62 -62
- package/package.json +1 -1
- package/style.css +1 -1
package/README.md
CHANGED
|
@@ -757,6 +757,7 @@ const saveFunctionLandmark = async (
|
|
|
757
757
|
:on-get-history-trail="fetchHistoryTrail"
|
|
758
758
|
:on-get-history-trail-point="fetchHistoryTrailPoint"
|
|
759
759
|
:get-img-list="fetchImgList"
|
|
760
|
+
:getImageVideo="getImageVideo"
|
|
760
761
|
@handle-close="onClose"
|
|
761
762
|
@handle-download="onDownload"
|
|
762
763
|
@update-cur-img="onUpdateCurImg"
|
|
@@ -788,24 +789,41 @@ const showImageDisplay = () => {
|
|
|
788
789
|
// 2310视频,uuid一样,含有media字段
|
|
789
790
|
export const groupCargoHandlingImages = (list: any[]): any[] => {
|
|
790
791
|
const groupMap = new Map<string, any[]>();
|
|
792
|
+
const mergedSet = new Set<any>();
|
|
793
|
+
// 第1步:先合并 triggerType 为 CargoHandling 或 eventType 为 9 且 uuid 相同的图片组
|
|
791
794
|
list.forEach((item: any) => {
|
|
792
795
|
if ((item.triggerType === 'CargoHandling' || item.eventType === 9) && item.uuid) {
|
|
793
796
|
const key = `picture-${item.uuid}-${item.index}`;
|
|
794
797
|
if (!groupMap.has(key)) groupMap.set(key, []);
|
|
795
798
|
groupMap.get(key)!.push(item);
|
|
796
799
|
}
|
|
797
|
-
|
|
800
|
+
});
|
|
801
|
+
// 第2步:处理带 media 的项,uuid + index 匹配到图片组则并入该组并记录为已合并,否则走 videoList 分组
|
|
802
|
+
list.forEach((item: any) => {
|
|
803
|
+
if (!item.media || !item.uuid) return;
|
|
804
|
+
if (item.triggerType === 'CargoHandling' || item.eventType === 9) {
|
|
805
|
+
// 自身既是 CargoHandling 又带 media:按 CargoHandling 算,已在图片组中,不重复处理
|
|
806
|
+
mergedSet.add(item);
|
|
807
|
+
return;
|
|
808
|
+
}
|
|
809
|
+
const pictureKey = `picture-${item.uuid}-${item.index}`;
|
|
810
|
+
if (groupMap.has(pictureKey)) {
|
|
811
|
+
groupMap.get(pictureKey)!.push(item);
|
|
812
|
+
mergedSet.add(item);
|
|
813
|
+
} else {
|
|
798
814
|
const key = `media-${item.uuid}`;
|
|
799
815
|
if (!groupMap.has(key)) groupMap.set(key, []);
|
|
800
816
|
groupMap.get(key)!.push(item);
|
|
801
817
|
}
|
|
802
818
|
});
|
|
803
|
-
const groupedUuids = new Set(groupMap.keys());
|
|
804
819
|
const result: any[] = [];
|
|
805
820
|
groupMap.forEach((items) => {
|
|
806
821
|
items.sort((a: any, b: any) => new Date(a.takeTime).getTime() - new Date(b.takeTime).getTime());
|
|
822
|
+
const mediaItems = items.filter((i: any) => i.media);
|
|
823
|
+
const imageItems = items.filter((i: any) => !i.media);
|
|
824
|
+
const isPureMediaGroup = !!mediaItems.length && !imageItems.length;
|
|
807
825
|
let timeStampGap = 0;
|
|
808
|
-
if (
|
|
826
|
+
if (isPureMediaGroup) {
|
|
809
827
|
timeStampGap = new Date(items[items.length - 1].endTime).getTime() - new Date(items[0].startTime).getTime();
|
|
810
828
|
} else {
|
|
811
829
|
timeStampGap = new Date(items[items.length - 1].takeTime).getTime() - new Date(items[0].takeTime).getTime();
|
|
@@ -818,28 +836,32 @@ export const groupCargoHandlingImages = (list: any[]): any[] => {
|
|
|
818
836
|
const obj: any = {
|
|
819
837
|
...l,
|
|
820
838
|
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
obj.url = obj.url.replace('https://oss.anytrek.app', '/oss-anytrek-app');
|
|
826
|
-
obj.url = obj.url.replace('https://oss.anytrek.com', '/oss-anytrek-com');
|
|
827
|
-
}
|
|
839
|
+
obj.media && (obj.media = obj.media.replace('https://oss.anytrek.app', '/oss-anytrek-app'));
|
|
840
|
+
obj.media && (obj.media = obj.media.replace('https://oss.anytrek.com', '/oss-anytrek-com'));
|
|
841
|
+
obj.url && (obj.url = obj.url.replace('https://oss.anytrek.app', '/oss-anytrek-app'));
|
|
842
|
+
obj.url && (obj.url = obj.url.replace('https://oss.anytrek.com', '/oss-anytrek-com'));
|
|
828
843
|
return {
|
|
829
844
|
...obj,
|
|
830
845
|
}
|
|
831
846
|
})
|
|
832
847
|
}
|
|
833
|
-
if (
|
|
848
|
+
if (isPureMediaGroup) {
|
|
834
849
|
result.push({ ...items[0], videoList: [...list], timeGap });
|
|
835
850
|
} else {
|
|
836
|
-
|
|
837
|
-
|
|
851
|
+
const merged = list.find((i: any) => i.media);
|
|
852
|
+
const hasMethodType = list.find((i: any) => i.methodType === 'final');
|
|
853
|
+
const imageList = list.filter((i: any) => !i.media);
|
|
854
|
+
timeGap = timeGap === '0s' ? `${imageList.length}s` : timeGap;
|
|
855
|
+
const obj: any = { ...items[0], imageList: [...imageList], timeGap };
|
|
856
|
+
if (merged) obj.media = merged.media;
|
|
857
|
+
if (hasMethodType) obj.isCarousel = true;
|
|
858
|
+
result.push(obj);
|
|
838
859
|
}
|
|
839
|
-
|
|
840
860
|
});
|
|
841
861
|
|
|
842
862
|
list.forEach((item: any) => {
|
|
863
|
+
// 已并入图片组的 media 项不再重复添加
|
|
864
|
+
if (mergedSet.has(item)) return;
|
|
843
865
|
const isNotMutiplePicture = !item.media && (!item.uuid || (item.triggerType !== 'CargoHandling' && item.eventType !== 9));
|
|
844
866
|
const isNotMergeMedia = item.media && !item.uuid;
|
|
845
867
|
if (isNotMutiplePicture) {
|
|
@@ -905,6 +927,24 @@ const fetchImgList = async (successFun: Function) => {
|
|
|
905
927
|
successFun();
|
|
906
928
|
}
|
|
907
929
|
|
|
930
|
+
const getImageVideo = async(item: any) => {
|
|
931
|
+
const params = `userPackageId=${item.deviceId}&uuid=${item.uuid}`;
|
|
932
|
+
const res = await Api.getCargoHandlingVideo(params);
|
|
933
|
+
const index = curImgList.value.findIndex((l: any) => l.url === curImg.value.url);
|
|
934
|
+
if (index === -1) return;
|
|
935
|
+
let url = '';
|
|
936
|
+
if (!res || res.errorCode || !res.list?.[0]?.media) {
|
|
937
|
+
url = '';
|
|
938
|
+
} else {
|
|
939
|
+
url = res.list[0].media;
|
|
940
|
+
}
|
|
941
|
+
if (import.meta.env.MODE === 'development') {
|
|
942
|
+
url = url.replace('https://oss.anytrek.app', '/oss-anytrek-app');
|
|
943
|
+
url = url.replace('https://oss.anytrek.com', '/oss-anytrek-com');
|
|
944
|
+
}
|
|
945
|
+
curImg.value.media = url;
|
|
946
|
+
}
|
|
947
|
+
|
|
908
948
|
const onDownload = async(data: any) => {
|
|
909
949
|
imageDisplayRef.value?.changeDownloadImageLoading(true);
|
|
910
950
|
|
|
@@ -980,7 +1020,7 @@ const onToHistory = (data: any) => {
|
|
|
980
1020
|
| `onGetHistoryTrail` | 获取历史轨迹 | `Function` | — |
|
|
981
1021
|
| `onGetHistoryTrailPoint` | 获取轨迹点详情 | `Function` | — |
|
|
982
1022
|
| `getImgList` | 获取图片列表(弹窗打开且列表为空时调用) | `Function` | — |
|
|
983
|
-
|
|
1023
|
+
| `getImageVideo` | 获取视频列表 | `Function` | — |
|
|
984
1024
|
|
|
985
1025
|
|
|
986
1026
|
### 📋 Events Reference
|