From 0bb14902f2039a5c09376a857b9cef59ccc7ae2d Mon Sep 17 00:00:00 2001 From: alger Date: Sat, 23 Nov 2024 22:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=E4=BC=98=E5=8C=96=E6=92=AD?= =?UTF-8?q?=E6=94=BE=E6=A0=B7=E5=BC=8F=20=20=E4=BC=98=E5=8C=96=E6=AD=8C?= =?UTF-8?q?=E6=9B=B2=E8=83=8C=E6=99=AF=E8=89=B2=20=20=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?mv=E6=92=AD=E6=94=BE=E6=A0=B7=E5=BC=8F=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E6=92=AD=E6=94=BE=20=E7=AD=89=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 4 +- components.d.ts | 2 + package.json | 15 +- src/api/mv.ts | 7 +- src/components/MvPlayer.vue | 792 ++++++++++++++++++++++++++++ src/layout/components/MusicFull.vue | 119 ++++- src/layout/components/PlayBar.vue | 40 +- src/utils/linearColor.ts | 88 ++++ src/views/mv/index.vue | 162 +++--- 9 files changed, 1137 insertions(+), 92 deletions(-) create mode 100644 src/components/MvPlayer.vue diff --git a/app.js b/app.js index f6edc64..8d014cc 100644 --- a/app.js +++ b/app.js @@ -24,7 +24,9 @@ function createWindow() { } else { win.loadURL(`file://${__dirname}/dist/index.html`); } - const image = nativeImage.createFromPath(path.join(__dirname, 'public/icon_16x16.png')).resize({ width: 16, height: 16 }); + const image = nativeImage + .createFromPath(path.join(__dirname, 'public/icon_16x16.png')) + .resize({ width: 16, height: 16 }); const tray = new Tray(image); // 创建一个上下文菜单 diff --git a/components.d.ts b/components.d.ts index 78bddce..4fa0e0d 100644 --- a/components.d.ts +++ b/components.d.ts @@ -9,6 +9,7 @@ declare module 'vue' { export interface GlobalComponents { MPop: typeof import('./src/components/common/MPop.vue')['default'] MusicList: typeof import('./src/components/MusicList.vue')['default'] + MvPlayer: typeof import('./src/components/MvPlayer.vue')['default'] NAvatar: typeof import('naive-ui')['NAvatar'] NButton: typeof import('naive-ui')['NButton'] NConfigProvider: typeof import('naive-ui')['NConfigProvider'] @@ -23,6 +24,7 @@ declare module 'vue' { NPopover: typeof import('naive-ui')['NPopover'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSlider: typeof import('naive-ui')['NSlider'] + NSpin: typeof import('naive-ui')['NSpin'] NSwitch: typeof import('naive-ui')['NSwitch'] NTooltip: typeof import('naive-ui')['NTooltip'] NVirtualList: typeof import('naive-ui')['NVirtualList'] diff --git a/package.json b/package.json index ebfbc3b..24a7e2f 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,14 @@ "main": "app.js", "scripts": { "dev": "vite", - "build": "vite build", + "build": "cross-env NODE_ENV=production vite build", "serve": "vite preview", - "start": "set NODE_ENV=development&&electron .", + "start": "cross-env NODE_ENV=development electron .", "lint": "eslint --ext .vue,.js,.jsx,.ts,.tsx ./ --max-warnings 0", - "b:win:x64": "electron-builder --config ./build/win64.json", - "b:win:x86": "electron-builder --config ./build/win32.json", - "b:win:arm": "electron-builder --config ./build/winarm64.json", - "b:mac": "electron-builder --config ./build/mac.json" + "b:win:x64": "cross-env NODE_ENV=production electron-builder --config ./build/win64.json", + "b:win:x86": "cross-env NODE_ENV=production electron-builder --config ./build/win32.json", + "b:win:arm": "cross-env NODE_ENV=production electron-builder --config ./build/winarm64.json", + "b:mac": "cross-env NODE_ENV=production electron-builder --config ./build/mac.json" }, "dependencies": { "electron-store": "^8.1.0" @@ -57,6 +57,7 @@ "vue": "^3.5.0", "vue-router": "^4.4.3", "vue-tsc": "^2.1.4", - "vuex": "^4.1.0" + "vuex": "^4.1.0", + "cross-env": "^7.0.3" } } diff --git a/src/api/mv.ts b/src/api/mv.ts index 43d61a0..a97d074 100644 --- a/src/api/mv.ts +++ b/src/api/mv.ts @@ -3,10 +3,13 @@ import { IMvItem, IMvUrlData } from '@/type/mv'; import request from '@/utils/request'; // 获取 mv 排行 -export const getTopMv = (limit: number) => { - return request.get>>('/top/mv', { +export const getTopMv = (limit = 30, offset = 0) => { + return request({ + url: '/mv/all', + method: 'get', params: { limit, + offset, }, }); }; diff --git a/src/components/MvPlayer.vue b/src/components/MvPlayer.vue new file mode 100644 index 0000000..1c29c2d --- /dev/null +++ b/src/components/MvPlayer.vue @@ -0,0 +1,792 @@ + + + + + diff --git a/src/layout/components/MusicFull.vue b/src/layout/components/MusicFull.vue index 17917af..63c0a87 100644 --- a/src/layout/components/MusicFull.vue +++ b/src/layout/components/MusicFull.vue @@ -1,5 +1,10 @@