Skip to content

Commit f74df6a

Browse files
Merge pull request #7 from Jerry-CodeHub/fix/code
Fix/code
2 parents 4d03f8a + c519b42 commit f74df6a

20 files changed

Lines changed: 140 additions & 146 deletions

File tree

src/app.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ declare global {
1616
}
1717

1818
import * as Cesium from 'cesium';
19-
// 仅在需要时挂载到 window,避免全局污染
19+
// 仅在需要时挂载到 window,避免全局污染;同时统一初始化 Cesium Ion token
2020
if (typeof window !== 'undefined' && !window.Cesium) {
2121
window.Cesium = Cesium;
2222
}
23+
if (typeof CESIUM_ION_TOKEN !== 'undefined' && CESIUM_ION_TOKEN) {
24+
Cesium.Ion.defaultAccessToken = CESIUM_ION_TOKEN as string;
25+
}
2326

2427
// NOTE:全局初始化数据配置,用于 Layout 用户信息和权限初始化
2528
// 更多信息见文档:https://umijs.org/docs/api/runtime-config#getinitialstate

src/components/Designable/src/components/ArrayBase/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
import { createBehavior } from '@pind/designable-core';
23
import { AllLocales } from '../../locales';
34
import { AllSchemas } from '../../schemas';

src/components/Designable/src/components/Field/preview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
import { FormItem } from '@formily/antd-v5';
23
import { FormPath } from '@formily/core';
34
import { ArrayField, ISchema, Field as InternalField, ObjectField, Schema, VoidField, observer } from '@formily/react';

src/components/Designable/widgets/LogoWidget.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const logo = {
77
};
88

99
export const LogoWidget: React.FC = () => {
10-
const url = logo[useTheme()];
10+
const url = logo[(useTheme() ?? 'light') as keyof typeof logo];
1111
return (
1212
<div style={{ display: 'flex', alignItems: 'center', fontSize: 14 }}>
1313
<img src={url} style={{ margin: '12px 8px', height: 18, width: 'auto' }} />

src/components/Designable/widgets/MarkupSchemaWidget.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-nocheck
12
// 该文件不做 ESLint 检测
23
/* eslint-disable */
34
import { isEmpty, isPlainObj } from '@formily/shared';

src/pages/Feature/AudioFeature/AudioPlayer/index.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ import 'xgplayer-music/dist/index.min.css';
66
import 'xgplayer/dist/index.min.css';
77
import { AudioPlayerStyles } from './AudioPlayerStyle';
88

9+
declare global {
10+
interface Window {
11+
analyze: InstanceType<typeof Analyze> | undefined;
12+
}
13+
}
14+
915
export default function AudioPlayer() {
1016
useMount(() => {
1117
function initEvents() {
@@ -53,13 +59,13 @@ export default function AudioPlayer() {
5359

5460
// 初始化频谱
5561
// eslint-disable-next-line @typescript-eslint/no-unused-vars
56-
let analyze = new Analyze(player, document.querySelector('canvas'), {
62+
let analyze = new Analyze(player, document.querySelector('canvas') as HTMLElement, {
5763
bgColor: 'rgba(0,0,0,0.7)',
5864
stroke: 3,
5965
});
6066

6167
// 初始化歌词模块
62-
let lyric = new Lyric([lyricTxts], document.querySelector('#gc'), {});
68+
let lyric = new Lyric([lyricTxts], document.querySelector('#gc'));
6369
lyric.bind(player);
6470
// eslint-disable-next-line @typescript-eslint/no-unused-vars
6571
let nullText = 0;
@@ -71,7 +77,7 @@ export default function AudioPlayer() {
7177

7278
player.on('playing', function () {
7379
lyric.show();
74-
player.mode = 2;
80+
(player as any).mode = 2;
7581
});
7682
let canvasDom = document.getElementById('canvas') as HTMLCanvasElement;
7783
canvasDom.width = window.innerWidth;

src/pages/Feature/AudioFeature/AudioVisible/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import Timeline from 'wavesurfer.js/plugins/timeline';
77
import { AudioVisibleStyles } from './AudioVisible.style';
88

99
// WaveSurfer hook
10-
const useWavesurfer = (containerRef, options) => {
11-
const [wavesurfer, setWavesurfer] = useState(null);
10+
const useWavesurfer = (containerRef: React.RefObject<HTMLDivElement>, options: any) => {
11+
const [wavesurfer, setWavesurfer] = useState<WaveSurfer | null>(null);
1212

1313
// Initialize wavesurfer when the container mounts
1414
// or any of the props change
@@ -25,21 +25,22 @@ const useWavesurfer = (containerRef, options) => {
2525
return () => {
2626
ws.destroy();
2727
};
28-
}, [options, containerRef]);
28+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
2929

3030
return wavesurfer;
3131
};
3232

3333
// Create a React component that will render wavesurfer.
3434
// Props are wavesurfer options.
3535
const WaveSurferPlayer = (props: any) => {
36-
const containerRef = useRef();
36+
const containerRef = useRef<HTMLDivElement>(null);
3737
const [isPlaying, setIsPlaying] = useState(false);
3838
const [currentTime, setCurrentTime] = useState(0);
3939
const wavesurfer = useWavesurfer(containerRef, props);
4040

4141
// On play button click
4242
const onPlayClick = useCallback(() => {
43+
if (!wavesurfer) return;
4344
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
4445
wavesurfer.isPlaying() ? wavesurfer.pause() : wavesurfer.play();
4546
}, [wavesurfer]);
@@ -55,7 +56,7 @@ const WaveSurferPlayer = (props: any) => {
5556
const subscriptions = [
5657
wavesurfer.on('play', () => setIsPlaying(true)),
5758
wavesurfer.on('pause', () => setIsPlaying(false)),
58-
wavesurfer.on('timeupdate', (currentTime) => setCurrentTime(currentTime)),
59+
wavesurfer.on('timeupdate', (currentTime: number) => setCurrentTime(currentTime)),
5960
];
6061

6162
return () => {

src/pages/Feature/D3/DataDemo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ProCard } from '@ant-design/pro-components';
2+
import * as d3 from 'd3';
23
import { axisBottom, axisTop, pointer, select } from 'd3';
34
import { useEffect, useRef } from 'react';
45
import { data, frequencyTicks } from './components/DataUnit.ts';

src/pages/Feature/D3/Frequency.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { ProCard } from '@ant-design/pro-components';
2+
import * as d3 from 'd3';
23
import { axisBottom, axisTop, pointer, select } from 'd3';
34
import { useEffect, useRef } from 'react';
45
import { data, frequencyTicks } from './components/DataUnit.ts';
@@ -62,7 +63,7 @@ const Frequency = () => {
6263

6364
// 设置尺寸和边距
6465
const margin = { top: 50, right: 0, bottom: 50, left: 0 };
65-
const width = Math.max(containerRef.current.clientWidth - margin.left - margin.right, 800);
66+
const width = Math.max((containerRef.current?.clientWidth ?? 800) - margin.left - margin.right, 800);
6667
// const typeHeight = 150;
6768
// const height = data.length * typeHeight + margin.top + margin.bottom;
6869

@@ -135,7 +136,7 @@ const Frequency = () => {
135136

136137
// 创建hover tooltip
137138
const hoverTooltip = d3
138-
.select(svgRef.current.parentNode)
139+
.select(svgRef.current.parentNode as Element)
139140
.append('div')
140141
.attr('class', 'hover-tooltip')
141142
.style('position', 'absolute')

src/pages/Feature/Map/AutonaviMap/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useState } from 'react';
1313
import { AutonaviMapStyle } from './AutonaviMapStyle';
1414

1515
export default function AutonaviMap() {
16-
const [position, setPosition] = useState<ReactAMap.Position>();
16+
const [position, setPosition] = useState<[number, number] | undefined>();
1717

1818
const mapEvents: MapProps['events'] = {
1919
click: (event: any) => {
@@ -27,7 +27,9 @@ export default function AutonaviMap() {
2727
<AutonaviMapStyle>
2828
<ProCard>
2929
<div style={{ height: 500 }}>
30-
<Map events={mapEvents}>{position && <Marker position={position} />}</Map>
30+
<Map WebGLParams={{}} events={mapEvents}>
31+
{position && <Marker position={position} />}
32+
</Map>
3133
</div>
3234
</ProCard>
3335
</AutonaviMapStyle>

0 commit comments

Comments
 (0)