feat: 添加 eslint-plugin-unicorn 依赖,更新 ESLint 配置以支持新规则
All checks were successful
/ depcheck (push) Successful in 2m3s
/ build-and-deploy-to-vercel (push) Successful in 2m52s
/ lint-build-and-check (push) Successful in 2m57s
/ surge (push) Successful in 2m32s
/ playwright (push) Successful in 3m10s

This commit is contained in:
严浩
2025-03-14 12:50:54 +08:00
parent 8b12d3e3dd
commit 31909c906d
24 changed files with 520 additions and 294 deletions

View File

@ -2,30 +2,32 @@ import type { Viewer } from 'cesium';
import * as Cesium from 'cesium';
export const VIEWER_OPTIONS: Viewer.ConstructorOptions = {
animation: true, // .cesium-viewer-animationContainer https://cesium.com/learn/ion-sdk/ref-doc/Animation.html
baseLayer: Cesium.ImageryLayer.fromProviderAsync(
Cesium.TileMapServiceImageryProvider.fromUrl(Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')),
),
baseLayerPicker: false,
fullscreenButton: !true, // 全屏按钮
geocoder: false, // = IonGeocodeProviderType.DEFAULT] - 在使用Geocoder小部件进行搜索时使用的地理编码服务或服务。如果设置为false则不会创建Geocoder小部件。
export const VIEWER_OPTIONS = (): Viewer.ConstructorOptions => {
return {
animation: true, // .cesium-viewer-animationContainer https://cesium.com/learn/ion-sdk/ref-doc/Animation.html
baseLayer: Cesium.ImageryLayer.fromProviderAsync(
Cesium.TileMapServiceImageryProvider.fromUrl(Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII')),
),
baseLayerPicker: false,
fullscreenButton: !true, // 全屏按钮
geocoder: false, // = IonGeocodeProviderType.DEFAULT] - 在使用Geocoder小部件进行搜索时使用的地理编码服务或服务。如果设置为false则不会创建Geocoder小部件。
// globe: false, // 地球
homeButton: true, // Home按钮
infoBox: false, // InfoBox小部件。
navigationHelpButton: false, // 是否显示导航帮助按钮
orderIndependentTranslucency: false, // 顺序无关透明度
projectionPicker: !true, // 投影选择器
requestRenderMode: !true, // 如果为真渲染帧将仅在场景内部发生变化时需要时发生。启用此功能可以减少应用程序的CPU/GPU使用率并在移动设备上节省更多电量但在此模式下需要使用{@link Scene#requestRender}显式渲染新帧。在API的其他部分对场景进行更改后在许多情况下都需要这样做。请参阅{@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|使用显式渲染提高性能}。
sceneModePicker: true, // 是否显示场景模式选择器(2D/3D切换)
selectionIndicator: true,
shadows: true, // Determines if shadows are cast by light sources.
// globe: false, // 地球
homeButton: true, // Home按钮
infoBox: false, // InfoBox小部件。
navigationHelpButton: false, // 是否显示导航帮助按钮
orderIndependentTranslucency: false, // 顺序无关透明度
projectionPicker: !true, // 投影选择器
requestRenderMode: !true, // 如果为真渲染帧将仅在场景内部发生变化时需要时发生。启用此功能可以减少应用程序的CPU/GPU使用率并在移动设备上节省更多电量但在此模式下需要使用{@link Scene#requestRender}显式渲染新帧。在API的其他部分对场景进行更改后在许多情况下都需要这样做。请参阅{@link https://cesium.com/blog/2018/01/24/cesium-scene-rendering-performance/|使用显式渲染提高性能}。
sceneModePicker: true, // 是否显示场景模式选择器(2D/3D切换)
selectionIndicator: true,
shadows: true, // Determines if shadows are cast by light sources.
/* animationContainer: !true, */
/* timelineContainer: true, */
/* bottomContainer: document.createElement('p'), // The DOM element or ID that will contain the bottomContainer. If not specified, the bottomContainer is added to the widget itself. */
shouldAnimate: !true,
showRenderLoopErrors: true, // 如果为真当发生渲染循环错误时此小部件将自动向用户显示包含错误的HTML面板。
timeline: true,
/* animationContainer: !true, */
/* timelineContainer: true, */
/* bottomContainer: document.createElement('p'), // The DOM element or ID that will contain the bottomContainer. If not specified, the bottomContainer is added to the widget itself. */
shouldAnimate: !true,
showRenderLoopErrors: true, // 如果为真当发生渲染循环错误时此小部件将自动向用户显示包含错误的HTML面板。
timeline: true,
};
};

View File

@ -6,12 +6,12 @@ import 'cesium/Build/Cesium/Widgets/widgets.css';
Cesium.Ion.defaultAccessToken = import.meta.env.VITE_CESIUM_ION_TOKEN; // 用了离线地图的情况是不需要的。
Object.assign(window, { Cesium });
Object.assign(globalThis, { Cesium });
_configureCesium();
export function cesium_init(container: Element) {
const viewer = new Cesium.Viewer(container, VIEWER_OPTIONS);
const viewer = new Cesium.Viewer(container, VIEWER_OPTIONS());
viewer.scene.debugShowFramesPerSecond = true;

View File

@ -13,8 +13,8 @@ class SatelliteEntity {
private totalSeconds!: number;
private trailTime!: number;
constructor(tle2LineStr = '' /* , options = {} */) {
const [name, tleLine1, tleLine2] = this._checkTle(tle2LineStr);
constructor(tle2LineString = '' /* , options = {} */) {
const [name, tleLine1, tleLine2] = this._checkTle(tle2LineString);
const circle = Number(tleLine2.slice(52, 64));
this.name = name.trim();
@ -28,8 +28,8 @@ class SatelliteEntity {
this.trailTime = 0;
}
_checkTle(tle2LineStr: string) {
const elements = tle2LineStr.split('\n');
_checkTle(tle2LineString: string) {
const elements = tle2LineString.split('\n');
if (elements.length !== 3) throw new Error('tle data error');
return elements as [string, string, string];
}
@ -40,11 +40,11 @@ class SatelliteEntity {
const positionProperty = new Cesium.SampledPositionProperty(Cesium.ReferenceFrame.INERTIAL);
const now = Date.now();
for (let i = 0; i < this.totalSeconds / this.stepSeconds; i++) {
const sateTime = new Date(now + i * this.stepSeconds * 1000);
for (let index = 0; index < this.totalSeconds / this.stepSeconds; index++) {
const sateTime = new Date(now + index * this.stepSeconds * 1000);
const sateCoord = this.getPositionEci(sateTime);
if (!sateCoord) continue;
const cesiumTime = Cesium.JulianDate.addSeconds(start, i * this.stepSeconds, new Cesium.JulianDate());
const cesiumTime = Cesium.JulianDate.addSeconds(start, index * this.stepSeconds, new Cesium.JulianDate());
const cesiumPosition = {
x: sateCoord.x * 1000,
y: sateCoord.y * 1000,

View File

@ -1,43 +1,46 @@
/* eslint-disable perfectionist/sort-objects */
// eslint-disable no-useless-spread
/* eslint-disable unicorn/numeric-separators-style */
// eslint-disable no-unused-vars
import { twoline2satrec } from 'satellite.js';
// https://en.wikipedia.org/wiki/Two-line_element_set#Format
const longstr1 = `1 62949U 25029B 25070.91668981 .00039463 00000+0 99294-3 0 9990`;
const longstr2 = `2 62949 53.1596 120.9032 0001355 101.1211 35.9659 15.39574303 5809`;
export const DEMO_DATA = {
// #############################
tleJson: {
ARG_OF_PERICENTER: 181.9338,
BSTAR: 0.00039937,
CLASSIFICATION_TYPE: 'U',
ECCENTRICITY: 0.7375486,
ELEMENT_SET_NO: 999,
EPHEMERIS_TYPE: 0,
EPOCH: '2025-03-12T15:49:04.420416',
INCLINATION: 19.0363,
MEAN_ANOMALY: 171.615,
MEAN_MOTION: 2.21786616,
MEAN_MOTION_DDOT: -5.0502e-7,
MEAN_MOTION_DOT: 0.00072212,
NORAD_CAT_ID: 63158,
OBJECT_ID: '2025-045B',
OBJECT_NAME: '2025-045B',
RA_OF_ASC_NODE: 63.0294,
REV_AT_EPOCH: 13,
},
tleString: `2025-045B
1 63158U 25045B 25071.65907894 .00072212 -50502-6 39937-3 0 9999
2 63158 19.0363 63.0294 7375486 181.9338 171.6150 2.21786616 127`,
};
export const TLE_LIST = [
`STARLINK-32857
${longstr1}
${longstr2}`,
`STARLINK-32915
DEMO_DATA.tleString,
...[
`STARLINK-32915
1 63152U 25043W 25070.91668981 .00451203 87802-4 12020-2 0 9994
2 63152 43.0011 279.4620 0003944 269.6759 119.1758 15.93738994 2341`,
`STARLINK-32915 [测修改1]
`STARLINK-32915 [测修改1]
1 00000U 00000W 25070.91668981 .00000000 00000-0 00000-0 0 0000
2 00000 43.0011 279.4620 0003944 269.6759 119.1758 15.93738994 0000`,
];
export const TLE_LIST_JSON = [
{
ARG_OF_PERICENTER: 179.7218, // 近地点角距Argument of Perigee单位是度表示近地点相对于升交点的角度。
BSTAR: 0, // 轨道模型类型0=SGP4模型
CLASSIFICATION_TYPE: 'U', // U 表示未分类(可能是临时编号)。
ECCENTRICITY: 0.732_766_1, // 偏心率Eccentricity无单位科学记数法为 0.7327661,表示轨道是一个高度椭圆的形状(接近 1 表示非常扁平)。
ELEMENT_SET_NO: 999, // 校验码或元素集编号,表示这是第 999 次更新的 TLE 数据。
EPHEMERIS_TYPE: 0, // 轨道模型类型(通常为 0表示 SGP4 模型)。
EPOCH: '2025-03-10T08:27:09.857952',
INCLINATION: 19.0062, // 轨道倾角Inclination单位是度表示轨道平面与地球赤道的夹角。此处为 19.0062°,属于低倾角轨道。
MEAN_ANOMALY: 141.4162, // 平近点角Mean Anomaly单位是度表示卫星在轨道上的位置。
MEAN_MOTION: 2.262_061_55, // 平均运动Mean Motion单位是圈/天,表示卫星每天绕地球运行的圈数,此处约为 2.26 圈(周期约 10.6 小时)。
MEAN_MOTION_DDOT: -6.5692e-7, // 平均运动的二阶导数(科学记数法:-6.5692 × 10⁻⁶表示轨道受摄动如大气阻力的加速度变化。
MEAN_MOTION_DOT: 5.45e-6, // 0.00000545 // 平均运动的一阶导数(每天的轨道变化率),单位是圈/天²,这里非常小,表示轨道衰减缓慢。
NORAD_CAT_ID: 63_157, // NORAD
OBJECT_ID: '2025-045A',
OBJECT_NAME: '2025-045A',
RA_OF_ASC_NODE: 64.6364, // 升交点赤经RAAN, Right Ascension of Ascending Node单位是度表示轨道平面在赤道上的交叉点位置。
REV_AT_EPOCH: 2, // Checksum 校验和
},
],
];
// 为了twoline2satrec函数需要哪些参数
@ -89,61 +92,6 @@ function twoline2satrecFake(longstr1: string, longstr2: string) {
console.groupEnd();
return satrec;
}
// if ($__DEV__)
// console.debug(
// `twoline2satrecFake(longstr1, longstr2) :>>`,
// twoline2satrecFake(longstr1, longstr2),
// );
const = twoline2satrec(
`1 63157 25069.35219743 .00000545 -65692-6 00000+0 `,
`2 19.0062 64.6364 7327661 179.7218 141.4162 2.26206155 `,
);
const item = {
gdzj: '7',
wxzj: '2025029F',
wxmc: 'STARLINK-32884',
wxbh: '62953',
lysj: '25070.91668981',
ysjbh: '999',
xllx: '0',
bstarqzxt: '-0.01591824',
pjyddyjds: '-0.01591824',
drry: null,
drsj: null,
xgry: null,
xgsj: null,
isFlag: 0,
pjyddejds: '0',
gdqj: '53.1597',
sjdcj: '125.942',
pxl: '0.0001413',
jddfj: '92.4266',
pjdj: '189.6779',
pjyd: '15.48632226',
fsyldgdqs: '556',
};
const r = {
ARG_OF_PERICENTER: 101.1211,
BSTAR: 0.00099294,
CLASSIFICATION_TYPE: 'U',
ECCENTRICITY: 0.0001355,
ELEMENT_SET_NO: 999,
EPHEMERIS_TYPE: 0,
EPOCH: '2025-03-11T22:00:01.999584',
INCLINATION: 53.1596,
MEAN_ANOMALY: 35.9659,
MEAN_MOTION: 15.39574303,
MEAN_MOTION_DDOT: 0,
MEAN_MOTION_DOT: 0.00039463,
NORAD_CAT_ID: 62949,
OBJECT_ID: '2025-029B',
OBJECT_NAME: 'STARLINK-32857',
RA_OF_ASC_NODE: 120.9032,
REV_AT_EPOCH: 580,
};
const satrec1 = twoline2satrec(longstr1, longstr2); // 正确结果
let line1 = '';
line1 += '1'; //
line1 += ' '; //
@ -194,13 +142,24 @@ line2 += '9';
// `${numbers}${numbers}${numbers}${numbers}${numbers}${numbers}`,
// '',
// );
const satrec2 = twoline2satrec(
`1 62949 25070.91668981 .00039463 00000+0 99294-3 `,
`2 53.1596 120.9032 0001355 101.1211 35.9659 15.39574303 `,
);
const satrec1_str = JSON.stringify(satrec1, null, 2);
const satrec2_str = JSON.stringify(satrec2, null, 2);
if ($__DEV__) console.debug(`satrec1_str === satrec2_str :>>`, satrec1_str === satrec2_str);
// if ($__DEV__) {
// const tle = TLE_LIST[0] as string;
// const line1 = tle.split('\n')[1] as string;
// const line2 = tle.split('\n')[2] as string;
// console.clear();
// twoline2satrecFake(line1, line2);
// }
// if ($__DEV__) {
// const satrec2 = twoline2satrec(
// `1 62949 25070.91668981 .00039463 00000+0 99294-3 `,
// `2 53.1596 120.9032 0001355 101.1211 35.9659 15.39574303 `,
// );
// const satrec1_str = JSON.stringify(satrec1, null, 2);
// const satrec2_str = JSON.stringify(satrec2, null, 2);
// console.debug(`satrec1_str === satrec2_str :>>`, satrec1_str === satrec2_str);
// }
// longstr1.substring(2, 7) :>> "63157"
// longstr1.substring(18, 20) :>> "25"

View File

@ -0,0 +1,20 @@
/* prettier-ignore */
export const TOOLTIP_MAP = {
ARG_OF_PERICENTER_近地点幅角: "8位数字如'181.9338'表示近地点相对升交点的角度范围0°-360°",
BSTAR_BSTAR拖曳项: "BSTAR参数。8位科学计数法如'39937-3'表示0.39937×10⁻³/地球半径,表示大气拖曳影响",
CLASSIFICATION_TYPE_卫星分类: "1个字母如'U',表示数据分类",
ECCENTRICITY_离心率: "7位数字无小数点如'7375486'表示0.7375486,小数点隐含在最前面",
ELEMENT_SET_NO_元素集编号: "4位数字如'9999'表示TLE版本号",
EPHEMERIS_TYPE_星历类型: "通常为'0'表示使用SGP4星历模型",
EPOCH_历元时间: "14位数字如'25071.65907894',表示轨道数据的参考时间(年份+年积日.一天中的小数部分)",
// CHECKSUM_校验和: "1位数字用于验证数据完整性可选项",
INCLINATION_轨道倾角: "8位数字如'19.0363'表示轨道与赤道平面的夹角范围0°-180°",
MEAN_ANOMALY_平近点角: "8位数字如'171.6150'表示历元时的平近点角范围0°-360°",
MEAN_MOTION_DDOT_平均运动二阶导数: "8位科学计数法如'-50502-6'表示-5.0502×10⁻⁶圈/天³,最后一位是指数",
MEAN_MOTION_DOT_平均运动一阶导数: "10位数字如'.00072212',表示平均运动变化率的一半,单位圈/天²,左侧补空格",
MEAN_MOTION_平均运动: "11位数字如'2.21786616',表示卫星每天绕地球的圈数(圈/天)",
NORAD_CAT_ID_卫星编号: "5位数字如'63158'表示NORAD卫星唯一目录编号",
OBJECT_ID_国际标识符: "8个字符如'25045B'(年份+发射编号+部件),不足时右侧补空格",
RA_OF_ASC_NODE_升交点赤经: "8位数字如'63.0294'表示轨道升交点的赤经范围0°-360°",
REV_AT_EPOCH_历元时的圈数: "5位数字如'13',表示卫星在历元时完成的轨道圈数",
};

View File

@ -28,9 +28,9 @@ export async function demo_01_OrbitGeneration(viewer: Viewer) {
await new Promise((resolve) => setTimeout(resolve, 500));
// 计算一条完整的轨道
for (let i = 0; i < totalMinutes; i += timeStepInMinutes) {
for (let index = 0; index < totalMinutes; index += timeStepInMinutes) {
// 创建时间点
const time = new Date(now.getTime() + i * 60_000);
const time = new Date(now.getTime() + index * 60_000);
// 获取卫星位置
const positionAndVelocity = propagate(satrec, time);

View File

@ -73,8 +73,8 @@ export async function demo_02_Track(viewer: Viewer) {
// const satelliteAltitude = 550_000; // 默认高度为550公里
// 计算轨道上的点
for (let i = 0; i <= totalSeconds; i += timeStepInSeconds) {
const time = Cesium.JulianDate.addSeconds(startTime, i, new Cesium.JulianDate());
for (let index = 0; index <= totalSeconds; index += timeStepInSeconds) {
const time = Cesium.JulianDate.addSeconds(startTime, index, new Cesium.JulianDate());
const jsDate = Cesium.JulianDate.toDate(time);
// 计算卫星位置

View File

@ -2,7 +2,7 @@
import type { Entity, Viewer } from 'cesium';
import { FilterOutlined, SearchOutlined } from '@ant-design/icons-vue';
import { computed, onBeforeUnmount, reactive, ref, watchEffect } from 'vue';
import { computed, reactive, ref, watchEffect } from 'vue';
import SatelliteEntity from '../cesium-helper/SatelliteEntity';
@ -17,7 +17,7 @@ const getSatelliteName = (tle: string) => {
};
// 将satellites改为计算属性响应tleList的变化
const satellites = computed(() => Array.from(new Set(tleList)));
const satellites = computed(() => [...new Set(tleList)]);
// 创建Map存储卫星实体
const satelliteEntities = ref<Map<string, Entity>>(new Map());
@ -66,8 +66,8 @@ const updateSatelliteEntity = (tle: string, selected: boolean) => {
if (selected) {
// 添加卫星到viewer
try {
const satelliteObj = new SatelliteEntity(tle);
const cesiumSateEntity = satelliteObj.createSatelliteEntity();
const satelliteObject = new SatelliteEntity(tle);
const cesiumSateEntity = satelliteObject.createSatelliteEntity();
const result = viewer.entities.add(cesiumSateEntity);
satelliteEntities.value.set(tle, result);
} catch (error) {
@ -100,7 +100,7 @@ const toggleSatellite = (tle: string) => {
const onCheckAllChange = (e: { target: { checked: boolean } }) => {
const checked = e.target.checked;
filteredSatellites.value.forEach((tle) => {
for (const tle of filteredSatellites.value) {
const isCurrentlySelected = isSatelliteSelected(tle);
if (isCurrentlySelected !== checked) {
@ -112,20 +112,8 @@ const onCheckAllChange = (e: { target: { checked: boolean } }) => {
updateSatelliteEntity(tle, checked);
}
});
};
// 组件卸载时清理所有卫星实体
onBeforeUnmount(() => {
if (viewer) {
// 移除所有实体
satelliteEntities.value.forEach((entity) => {
viewer?.entities.remove(entity);
});
satelliteEntities.value.clear();
selectedSatellites.value.clear();
}
});
};
</script>
<template>

View File

@ -19,7 +19,8 @@ declare global {
}
export async function demoOrbitGeneration(viewer: Viewer) {
window.spaceCatalog = new SpaceCatalogDataSource({ name: 'celestrak' });
// @ts-expect-error globalThis
globalThis.spaceCatalog = new SpaceCatalogDataSource({ name: 'celestrak' });
viewer.extend(viewerReferenceFrameMixin);
viewer.referenceFrame = 1;
@ -30,8 +31,8 @@ export async function demoOrbitGeneration(viewer: Viewer) {
backgroundColor: new Color(0.1, 0.1, 0.1, 0.9),
font: `1rem Helvetica`,
pixelOffset: new Cartesian2(10, 0),
pixelOffsetScaleByDistance: new NearFarScalar(1.5e2, 3.0, 1.5e7, 0.5),
scaleByDistance: new NearFarScalar(1.5e2, 1.5, 13.0e7, 0.0),
pixelOffsetScaleByDistance: new NearFarScalar(1.5e2, 3, 1.5e7, 0.5),
scaleByDistance: new NearFarScalar(1.5e2, 1.5, 13e7, 0),
show: false,
showBackground: true,
},
@ -39,13 +40,13 @@ export async function demoOrbitGeneration(viewer: Viewer) {
point: {
pixelSize: 1,
},
viewFrom: new Cartesian3(-1678500.7493507154, -17680994.63403464, 24667690.486357275),
viewFrom: new Cartesian3(-1_678_500.749_350_715_4, -17_680_994.634_034_64, 24_667_690.486_357_275),
});
ISS.position.loadOMM({
/* CCSDS OMM版本 */ ARG_OF_PERICENTER: 149.2285,
/* 创建日期(ISO 8601 UTC格式) */ BSTAR: 0.00028217,
/* 创建者 */ CCSDS_OMM_VERS: 0.0,
/* 创建日期(ISO 8601 UTC格式) */ BSTAR: 0.000_282_17,
/* 创建者 */ CCSDS_OMM_VERS: 0,
/* 卫星名称 */ CENTER_NAME: null,
/* 国际标识符(YYYY-NNNAAA) */ CLASSIFICATION_TYPE: 'U',
/* 中心名称(例如:EARTH, MARS) */ COMMENT: null,
@ -74,7 +75,7 @@ export async function demoOrbitGeneration(viewer: Viewer) {
/* 根数组编号 */ CZ_Z: 0,
/* 历元时的圈次 */ DRAG_AREA: 0,
/* 气阻系数(1/地球半径) */ DRAG_COEFF: 0,
/* 平均运动一阶导数(圈/天²) */ ECCENTRICITY: 0.0003349,
/* 平均运动一阶导数(圈/天²) */ ECCENTRICITY: 0.000_334_9,
/* 平均运动二阶导数(圈/天³) */ ELEMENT_SET_NO: 999,
/* 协方差矩阵参考坐标系 */ EPHEMERIS_TYPE: 0,
/* --- 位置/速度协方差矩阵(6x6下三角) --- */
@ -84,17 +85,17 @@ export async function demoOrbitGeneration(viewer: Viewer) {
/* 位置协方差矩阵元素(km²) */ MASS: 0,
/* 位置协方差矩阵元素(km²) */ MEAN_ANOMALY: 210.8902,
/* 位置协方差矩阵元素(km²) */ MEAN_ELEMENT_THEORY: 0,
/* 速度-位置协方差矩阵元素(km²/s) */ MEAN_MOTION: 15.51025615,
/* 速度-位置协方差矩阵元素(km²/s) */ MEAN_MOTION: 15.510_256_15,
/* 速度-位置协方差矩阵元素(km²/s) */ MEAN_MOTION_DDOT: 0,
/* 速度-位置协方差矩阵元素(km²/s) */ MEAN_MOTION_DOT: 0.00016275,
/* 速度协方差矩阵元素(km²/s²) */ NORAD_CAT_ID: 25544,
/* 速度-位置协方差矩阵元素(km²/s) */ MEAN_MOTION_DOT: 0.000_162_75,
/* 速度协方差矩阵元素(km²/s²) */ NORAD_CAT_ID: 25_544,
/* 速度-位置协方差矩阵元素(km²/s) */ OBJECT_ID: '1998-067A',
/* 速度-位置协方差矩阵元素(km²/s) */ OBJECT_NAME: 'ISS (ZARYA)',
/* 速度-位置协方差矩阵元素(km²/s) */ ORIGINATOR: null,
/* 速度协方差矩阵元素(km²/s²) */ RA_OF_ASC_NODE: 150.5366,
/* 速度协方差矩阵元素(km²/s²) */ REFERENCE_FRAME: 2,
/* 速度-位置协方差矩阵元素(km²/s) */ REFERENCE_FRAME_EPOCH: null,
/* 速度-位置协方差矩阵元素(km²/s) */ REV_AT_EPOCH: 45244,
/* 速度-位置协方差矩阵元素(km²/s) */ REV_AT_EPOCH: 45_244,
/* 速度-位置协方差矩阵元素(km²/s) */ SEMI_MAJOR_AXIS: 0,
/* 速度协方差矩阵元素(km²/s²) */ SOLAR_RAD_AREA: 0,
/* 速度协方差矩阵元素(km²/s²) */ SOLAR_RAD_COEFF: 0,
@ -118,7 +119,7 @@ export async function demoOrbitGeneration(viewer: Viewer) {
});
const issDataSource = new SpaceCatalogDataSource({ name: 'issSource' });
Object.assign(window, { issDataSource });
Object.assign(globalThis, { issDataSource });
issDataSource.entities.add(ISS); // FIXME: add后有问题。
await viewer.dataSources.add(issDataSource);

View File

@ -3,9 +3,11 @@ const baseURL = '/fake-api';
let fakeApiResult = $ref<null | Record<string, unknown>>(null);
fetch(`${baseURL}/mock/get-user-info`)
.then((response) => response.json())
.then((json) => (fakeApiResult = json));
onMounted(() => {
fetch(`${baseURL}/mock/get-user-info`)
.then((response) => response.json())
.then((json) => (fakeApiResult = json));
});
/* fetch('https://jsonplaceholder.typicode.com/posts/1')
.then((response) => response.json())

View File

@ -1,5 +1,6 @@
<script lang="ts">
const structuredClone = window.structuredClone || ((obj) => JSON.parse(JSON.stringify(obj)));
// eslint-disable-next-line unicorn/prefer-structured-clone
const structuredClone = globalThis.structuredClone || ((object) => JSON.parse(JSON.stringify(object)));
const K_INITIAL_STATE = deepFreeze({
complete: false,
@ -51,7 +52,7 @@ async function loadMore() {
}
});
const data = await response.json();
state.list = state.list.concat(data);
state.list = [...state.list, ...data];
if ($__DEV__) await new Promise((resolve) => setTimeout(resolve, 500));
state.complete = state.list.length >= 5;
} catch (error) {

View File

@ -4,8 +4,8 @@ import { defineBasicLoader } from 'unplugin-vue-router/data-loaders/basic';
export const usePageData = defineBasicLoader(
'DataLoadersId',
async (route, ...otherArgs) => {
console.log('[DefineLoaderFn]', 'otherArgs :>> ', otherArgs);
async (route, ...otherArguments) => {
console.log('[DefineLoaderFn]', 'otherArgs :>>', otherArguments);
await new Promise((resolve) => setTimeout(resolve, 777));
return { idFromPreviousPage: route.params.id, someOtherData: 'someOtherData' };
},