-
- 歌曲 {albumList.length}
-
-
message.info('开发中!')}
- >
- 专辑信息
-
-
message.info('开发中!')}
- >
- 评论
-
-
-
-
+
+ 歌曲 {albumList.length}
+
+ {/*
message.info('开发中!')}
+ >
+ 专辑信息
+
+
message.info('开发中!')}
+ >
+ 评论
+
*/}
+
+
+
+ {albumList.map((a, i) => (
+
+
onClick(a)}
+ >
+
+ {i + 1 > 9 ? i + 1 : '0' + (i + 1)}
+
+ {a.name}
+
+
李志
+
+ onClick(a)}
+ >
+
+
+ handleDownload(a)}
+ >
+ {currDownloadingName && currDownloadingName === a.name ? (
+
+ ) : (
+
+ )}
+
+
+
+ ))}
+
+
+
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index af4a4ae..5fe44d0 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -1,4 +1,3 @@
-import { useEffect, useState } from 'react';
import { Link } from 'umi';
const LIVE = [
@@ -28,15 +27,6 @@ interface IAlbum {
interface IAlbumList extends Array {}
-interface ISong {
- artist: string;
- cover: string;
- name: string;
- url: string;
-}
-
-interface ISongList extends Array {}
-
export default function IndexPage() {
return (
<>
@@ -57,7 +47,7 @@ export default function IndexPage() {
我们不能失去信仰 · 李志
- {(window.album as IAlbumList).map((v, i) => (
+ {((window as any).album as IAlbumList).map((v, i) => (
diff --git a/src/pages/video.tsx b/src/pages/video.tsx
index 9b1b774..dca389d 100644
--- a/src/pages/video.tsx
+++ b/src/pages/video.tsx
@@ -1,6 +1,7 @@
-import { useEffect, useRef, useState } from 'react';
-import { Link } from 'umi';
+import Back from '@/components/back';
+import PlayerContext from '@/contexts/playerContext';
import Hls from 'hls.js';
+import { useContext, useEffect, useRef, useState } from 'react';
const videoList = [
{
@@ -22,16 +23,19 @@ const videoList = [
];
function Video() {
- const ref = useRef
();
-
- const hls = useRef(null);
+ const videoRef = useRef(null);
+ const hls = useRef(null);
+ const { player } = useContext(PlayerContext);
const [index, setIndex] = useState(2);
useEffect(() => {
- document.querySelector('.music-player-audio')?.pause();
- const video = ref.current;
+ if (!videoRef.current) return;
+
+ player?.pause();
+ const video = videoRef.current;
const videoSrc = videoList[index].url;
+
if (Hls.isSupported()) {
hls.current = new Hls();
hls.current.loadSource(videoSrc);
@@ -41,44 +45,23 @@ function Video() {
}
}, []);
- const handleSelect = (index) => {
+ const handleSelect = (index: number) => {
+ if (!hls.current || !videoRef.current) return;
+
setIndex(index);
hls.current.loadSource(videoList[index].url);
- hls.current.attachMedia(ref.current);
+ hls.current.attachMedia(videoRef.current);
};
return (
<>
-
-
- Back
-
+
+
{/*
Live 现场
*/}
-
+
{videoList.map((v, k) => (
diff --git a/src/types.ts b/src/types.ts
new file mode 100644
index 0000000..e201843
--- /dev/null
+++ b/src/types.ts
@@ -0,0 +1,16 @@
+export interface SongInfo {
+ name: string;
+ artist: string;
+ url: string;
+ cover: string;
+}
+
+/** @see https://github.com/nj-lizhi/song/blob/main/audio/list-v2.js */
+export type SongList = SongInfo[];
+
+export interface AlbumInfo {
+ name: string;
+ cover: string;
+ year: number | null;
+ publisher: string;
+}
diff --git a/tailwind.config.js b/tailwind.config.js
index f43c0b9..9cfd53f 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -1,8 +1,7 @@
-/** @type {import('tailwindcss').Config} */
module.exports = {
- content: ['./src/**/*.{html,ejs,js,tsx,ts}'],
- theme: {
- extend: {},
- },
- plugins: [],
+ content: [
+ './src/pages/**/*.tsx',
+ './src/components/**/*.tsx',
+ './src/layouts/**/*.tsx',
+ ],
};
diff --git a/src/input.css b/tailwind.css
similarity index 64%
rename from src/input.css
rename to tailwind.css
index bd6213e..b5c61c9 100644
--- a/src/input.css
+++ b/tailwind.css
@@ -1,3 +1,3 @@
@tailwind base;
@tailwind components;
-@tailwind utilities;
\ No newline at end of file
+@tailwind utilities;