diff --git a/.gitignore b/.gitignore index c2bbf93..8af6673 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist dist-ssr *.local dist_electron +.idea pnpm-lock.yaml package-lock.json diff --git a/app.js b/app.js index a8de65a..4190b18 100644 --- a/app.js +++ b/app.js @@ -4,8 +4,8 @@ const path = require('path') let mainWin = null function createWindow() { mainWin = new BrowserWindow({ - width: 1280, - height: 900, + width: 1200, + height: 780, frame: false, webPreferences: { nodeIntegration: true, @@ -13,7 +13,7 @@ function createWindow() { }, }) const win = mainWin - win.setMinimumSize(1280, 900) + win.setMinimumSize(1200, 780) if (process.env.NODE_ENV === 'development') { win.webContents.openDevTools({ mode: 'detach' }) win.loadURL('http://localhost:4678/') diff --git a/auto-imports.d.ts b/auto-imports.d.ts new file mode 100644 index 0000000..7007359 --- /dev/null +++ b/auto-imports.d.ts @@ -0,0 +1,70 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// noinspection JSUnusedGlobalSymbols +// Generated by unplugin-auto-import +export {} +declare global { + const EffectScope: typeof import('vue')['EffectScope'] + const computed: typeof import('vue')['computed'] + const createApp: typeof import('vue')['createApp'] + const customRef: typeof import('vue')['customRef'] + const defineAsyncComponent: typeof import('vue')['defineAsyncComponent'] + const defineComponent: typeof import('vue')['defineComponent'] + const effectScope: typeof import('vue')['effectScope'] + const getCurrentInstance: typeof import('vue')['getCurrentInstance'] + const getCurrentScope: typeof import('vue')['getCurrentScope'] + const h: typeof import('vue')['h'] + const inject: typeof import('vue')['inject'] + const isProxy: typeof import('vue')['isProxy'] + const isReactive: typeof import('vue')['isReactive'] + const isReadonly: typeof import('vue')['isReadonly'] + const isRef: typeof import('vue')['isRef'] + const markRaw: typeof import('vue')['markRaw'] + const nextTick: typeof import('vue')['nextTick'] + const onActivated: typeof import('vue')['onActivated'] + const onBeforeMount: typeof import('vue')['onBeforeMount'] + const onBeforeUnmount: typeof import('vue')['onBeforeUnmount'] + const onBeforeUpdate: typeof import('vue')['onBeforeUpdate'] + const onDeactivated: typeof import('vue')['onDeactivated'] + const onErrorCaptured: typeof import('vue')['onErrorCaptured'] + const onMounted: typeof import('vue')['onMounted'] + const onRenderTracked: typeof import('vue')['onRenderTracked'] + const onRenderTriggered: typeof import('vue')['onRenderTriggered'] + const onScopeDispose: typeof import('vue')['onScopeDispose'] + const onServerPrefetch: typeof import('vue')['onServerPrefetch'] + const onUnmounted: typeof import('vue')['onUnmounted'] + const onUpdated: typeof import('vue')['onUpdated'] + const provide: typeof import('vue')['provide'] + const reactive: typeof import('vue')['reactive'] + const readonly: typeof import('vue')['readonly'] + const ref: typeof import('vue')['ref'] + const resolveComponent: typeof import('vue')['resolveComponent'] + const shallowReactive: typeof import('vue')['shallowReactive'] + const shallowReadonly: typeof import('vue')['shallowReadonly'] + const shallowRef: typeof import('vue')['shallowRef'] + const toRaw: typeof import('vue')['toRaw'] + const toRef: typeof import('vue')['toRef'] + const toRefs: typeof import('vue')['toRefs'] + const toValue: typeof import('vue')['toValue'] + const triggerRef: typeof import('vue')['triggerRef'] + const unref: typeof import('vue')['unref'] + const useAttrs: typeof import('vue')['useAttrs'] + const useCssModule: typeof import('vue')['useCssModule'] + const useCssVars: typeof import('vue')['useCssVars'] + const useDialog: typeof import('naive-ui')['useDialog'] + const useLoadingBar: typeof import('naive-ui')['useLoadingBar'] + const useMessage: typeof import('naive-ui')['useMessage'] + const useNotification: typeof import('naive-ui')['useNotification'] + const useSlots: typeof import('vue')['useSlots'] + const watch: typeof import('vue')['watch'] + const watchEffect: typeof import('vue')['watchEffect'] + const watchPostEffect: typeof import('vue')['watchPostEffect'] + const watchSyncEffect: typeof import('vue')['watchSyncEffect'] +} +// for type re-export +declare global { + // @ts-ignore + export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' + import('vue') +} diff --git a/components.d.ts b/components.d.ts new file mode 100644 index 0000000..fbd8c9f --- /dev/null +++ b/components.d.ts @@ -0,0 +1,36 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-vue-components +// Read more: https://github.com/vuejs/core/pull/3399 +export {} + +declare module 'vue' { + export interface GlobalComponents { + MPop: typeof import('./src/components/common/MPop.vue')['default'] + MusicList: typeof import('./src/components/MusicList.vue')['default'] + NAvatar: typeof import('naive-ui')['NAvatar'] + NButton: typeof import('naive-ui')['NButton'] + NConfigProvider: typeof import('naive-ui')['NConfigProvider'] + NDialogProvider: typeof import('naive-ui')['NDialogProvider'] + NDrawer: typeof import('naive-ui')['NDrawer'] + NDropdown: typeof import('naive-ui')['NDropdown'] + NEllipsis: typeof import('naive-ui')['NEllipsis'] + NImage: typeof import('naive-ui')['NImage'] + NInput: typeof import('naive-ui')['NInput'] + NLayout: typeof import('naive-ui')['NLayout'] + NMessageProvider: typeof import('naive-ui')['NMessageProvider'] + NPopover: typeof import('naive-ui')['NPopover'] + NScrollbar: typeof import('naive-ui')['NScrollbar'] + NSlider: typeof import('naive-ui')['NSlider'] + NTooltip: typeof import('naive-ui')['NTooltip'] + PlayBottom: typeof import('./src/components/common/PlayBottom.vue')['default'] + PlaylistType: typeof import('./src/components/PlaylistType.vue')['default'] + RecommendAlbum: typeof import('./src/components/RecommendAlbum.vue')['default'] + RecommendSinger: typeof import('./src/components/RecommendSinger.vue')['default'] + RecommendSonglist: typeof import('./src/components/RecommendSonglist.vue')['default'] + RouterLink: typeof import('vue-router')['RouterLink'] + RouterView: typeof import('vue-router')['RouterView'] + SongItem: typeof import('./src/components/common/SongItem.vue')['default'] + } +} diff --git a/package.json b/package.json index 7d709e0..ff9ad87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "alger-music", - "version": "1.1.0", + "version": "1.2.0", "description": "这是一个用于音乐播放的应用程序。", "author": "Alger ", "main": "app.js", @@ -24,7 +24,8 @@ "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.4", "vue": "^3.3.4", "vue-router": "^4.2.4", - "vuex": "^4.1.0" + "vuex": "^4.1.0", + "naive-ui": "^2.34.4" }, "devDependencies": { "@sicons/antd": "^0.10.0", @@ -33,11 +34,12 @@ "@vue/compiler-sfc": "^3.3.4", "electron": "^28.0.0", "electron-builder": "^24.9.1", - "naive-ui": "^2.34.4", "typescript": "^4.3.2", "vfonts": "^0.1.0", "vite": "^4.4.7", "vite-plugin-vue-devtools": "1.0.0-beta.5", - "vue-tsc": "^0.0.24" + "vue-tsc": "^0.0.24", + "unplugin-auto-import": "^0.17.2", + "unplugin-vue-components": "^0.26.0" } } diff --git a/public/icon/iconfont.css b/public/icon/iconfont.css index a469ad5..3f90c64 100644 --- a/public/icon/iconfont.css +++ b/public/icon/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2685283 */ - src: url('iconfont.woff2?t=1702897818159') format('woff2'), - url('iconfont.woff?t=1702897818159') format('woff'), - url('iconfont.ttf?t=1702897818159') format('truetype'); + src: url('iconfont.woff2?t=1703643214551') format('woff2'), + url('iconfont.woff?t=1703643214551') format('woff'), + url('iconfont.ttf?t=1703643214551') format('truetype'); } .iconfont { @@ -13,6 +13,10 @@ -moz-osx-font-smoothing: grayscale; } +.icon-list:before { + content: "\e603"; +} + .icon-maxsize:before { content: "\e692"; } diff --git a/public/icon/iconfont.js b/public/icon/iconfont.js index 408275a..d905a33 100644 --- a/public/icon/iconfont.js +++ b/public/icon/iconfont.js @@ -1 +1 @@ -window._iconfont_svg_string_2685283='',function(a){var c=(c=document.getElementsByTagName("script"))[c.length-1],l=c.getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var o,i,t,h,s,d=function(c,l){l.parentNode.insertBefore(c,l)};if(l&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}o=function(){var c,l=document.createElement("div");l.innerHTML=a._iconfont_svg_string_2685283,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(c=document.body).firstChild?d(l,c.firstChild):c.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(o,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),o()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(t=o,h=a.document,s=!1,e(),h.onreadystatechange=function(){"complete"==h.readyState&&(h.onreadystatechange=null,p())})}function p(){s||(s=!0,t())}function e(){try{h.documentElement.doScroll("left")}catch(c){return void setTimeout(e,50)}p()}}(window); \ No newline at end of file +window._iconfont_svg_string_2685283='',function(a){var c=(c=document.getElementsByTagName("script"))[c.length-1],l=c.getAttribute("data-injectcss"),c=c.getAttribute("data-disable-injectsvg");if(!c){var o,i,t,h,s,d=function(c,l){l.parentNode.insertBefore(c,l)};if(l&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(c){console&&console.log(c)}}o=function(){var c,l=document.createElement("div");l.innerHTML=a._iconfont_svg_string_2685283,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(c=document.body).firstChild?d(l,c.firstChild):c.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(o,0):(i=function(){document.removeEventListener("DOMContentLoaded",i,!1),o()},document.addEventListener("DOMContentLoaded",i,!1)):document.attachEvent&&(t=o,h=a.document,s=!1,e(),h.onreadystatechange=function(){"complete"==h.readyState&&(h.onreadystatechange=null,p())})}function p(){s||(s=!0,t())}function e(){try{h.documentElement.doScroll("left")}catch(c){return void setTimeout(e,50)}p()}}(window); \ No newline at end of file diff --git a/public/icon/iconfont.json b/public/icon/iconfont.json index 9d04061..42adf90 100644 --- a/public/icon/iconfont.json +++ b/public/icon/iconfont.json @@ -5,6 +5,13 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "1111849", + "name": "list", + "font_class": "list", + "unicode": "e603", + "unicode_decimal": 58883 + }, { "icon_id": "1306794", "name": "maxsize", diff --git a/public/icon/iconfont.ttf b/public/icon/iconfont.ttf index 0b1b37a..cef8b1d 100644 Binary files a/public/icon/iconfont.ttf and b/public/icon/iconfont.ttf differ diff --git a/public/icon/iconfont.woff b/public/icon/iconfont.woff index a599293..7323dcc 100644 Binary files a/public/icon/iconfont.woff and b/public/icon/iconfont.woff differ diff --git a/public/icon/iconfont.woff2 b/public/icon/iconfont.woff2 index 1226cdb..6ffb140 100644 Binary files a/public/icon/iconfont.woff2 and b/public/icon/iconfont.woff2 differ diff --git a/src/App.vue b/src/App.vue index b26f2d5..9125e82 100644 --- a/src/App.vue +++ b/src/App.vue @@ -11,7 +11,6 @@ diff --git a/src/components/common/MPop.vue b/src/components/common/MPop.vue index 52fe4f8..fa8fdf0 100644 --- a/src/components/common/MPop.vue +++ b/src/components/common/MPop.vue @@ -1,43 +1,42 @@ - - - - - \ No newline at end of file diff --git a/src/components/common/PlayBottom.vue b/src/components/common/PlayBottom.vue index 4cb1a03..c98a781 100644 --- a/src/components/common/PlayBottom.vue +++ b/src/components/common/PlayBottom.vue @@ -3,7 +3,6 @@ diff --git a/src/views/user/index.vue b/src/views/user/index.vue index cba6093..2976b85 100644 --- a/src/views/user/index.vue +++ b/src/views/user/index.vue @@ -64,7 +64,7 @@ const formatDetail = computed(() => (detail: any) => { const handlePlay = (item: any) => { const tracks = recordList.value || [] const musicIndex = (tracks.findIndex((music: any) => music.id == item.id) || 0) - store.commit('setPlayList', tracks.slice(musicIndex)) + store.commit('setPlayList', tracks) } diff --git a/tsconfig.json b/tsconfig.json index b39aac2..1812fd7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,32 +1,37 @@ -{ - "compilerOptions": { - "target": "esnext", - "module": "esnext", - "moduleResolution": "node", - "strict": true, - "jsx": "preserve", - "sourceMap": true, - "skipLibCheck": true, - "resolveJsonModule": true, - "esModuleInterop": true, - "lib": [ - "esnext", - "dom" - ], - "baseUrl": "./", - "paths": { - "@": [ - "src" - ], - "@/*": [ - "src/*" - ], - } - }, - "include": [ - "src/**/*.ts", - "src/**/*.d.ts", - "src/**/*.tsx", - "src/**/*.vue" - ] +{ + "compilerOptions": { + "target": "esnext", + "module": "esnext", + "moduleResolution": "node", + "strict": true, + "jsx": "preserve", + "sourceMap": true, + "skipLibCheck": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "types": [ + "naive-ui/volar", + "./auto-imports.d.ts", + "./components.d.ts" + ], + "lib": [ + "esnext", + "dom" + ], + "baseUrl": "./", + "paths": { + "@": [ + "src" + ], + "@/*": [ + "src/*" + ], + } + }, + "include": [ + "src/**/*.ts", + "src/**/*.d.ts", + "src/**/*.tsx", + "src/**/*.vue" + ] } \ No newline at end of file diff --git a/vite.config.ts b/vite.config.ts index 488c893..2341b94 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,10 +2,32 @@ import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path' import VueDevTools from 'vite-plugin-vue-devtools' +import AutoImport from 'unplugin-auto-import/vite' +import Components from 'unplugin-vue-components/vite' +import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' // https://vitejs.dev/config/ export default defineConfig({ - plugins: [vue(), VueDevTools()], + plugins: [ + vue(), + VueDevTools(), + AutoImport({ + imports: [ + 'vue', + { + 'naive-ui': [ + 'useDialog', + 'useMessage', + 'useNotification', + 'useLoadingBar', + ], + }, + ], + }), + Components({ + resolvers: [NaiveUiResolver()], + }), + ], base: './', resolve: { alias: { @@ -36,4 +58,15 @@ export default defineConfig({ }, }, }, + build: { + rollupOptions: { + output: { + manualChunks: { + vendor: ['vue', 'axios'], + naiveui: ['naive-ui'], + lodash: ['lodash'], + }, + }, + }, + }, })