diff --git a/.env.development b/.env.development index 6420007..7fb820e 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,3 @@ VITE_API = /api -VITE_API_MT = /mt VITE_API_MUSIC = /music VITE_API_PROXY = http://110.42.251.190:9856 \ No newline at end of file diff --git a/.env.production b/.env.production index 0a70917..e5c86f3 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,3 @@ VITE_API = http://110.42.251.190:9898 -VITE_API_MT = http://mt.myalger.top VITE_API_MUSIC = http://110.42.251.190:4100 VITE_API_PROXY = http://110.42.251.190:9856 \ No newline at end of file diff --git a/README.md b/README.md index 1273cd7..8624abf 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,27 @@ - 播放历史 - 歌单 mv 搜索 专辑等功能 +## 项目运行 +```bash + # 安装依赖 + npm install + + # 运行项目 web + npm run dev + + # 运行项目 electron + npm run start + + # 打包项目 web + npm run build + + # 打包项目 electron + npm run win ... + # 具体看 package.json +``` + + + ## 软件截图 ![首页](./docs/img/image.png) ![歌单](./docs/img/image-1.png) diff --git a/electron.config.json b/electron.config.json deleted file mode 100644 index 2129ab8..0000000 --- a/electron.config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "appId": "com.alger.music", - "productName": "AlgerMusic", - "directories": { - "output": "dist_electron" - }, - "files": ["dist/**/*", "package.json", "app.js", "electron/**/*"], - "win": { - "icon": "public/icon.png", - "target": "nsis", - "extraFiles": [ - { - "from": "installer/installer.nsh", - "to": "$INSTDIR" - } - ] - } -} diff --git a/src/layout/components/SearchBar.vue b/src/layout/components/SearchBar.vue index 2c0d993..8324d2b 100644 --- a/src/layout/components/SearchBar.vue +++ b/src/layout/components/SearchBar.vue @@ -46,7 +46,6 @@ import { getSearchKeyword } from '@/api/home'; import { getUserDetail, logout } from '@/api/login'; import { SEARCH_TYPES, USER_SET_OPTIONS } from '@/const/bar-const'; import { getImgUrl } from '@/utils'; -import request from '@/utils/request_mt'; const router = useRouter(); const store = useStore(); @@ -106,30 +105,15 @@ const search = () => { } }; -const selectSearchType = (key: any) => { +const selectSearchType = (key: number) => { searchType.value = key; }; const searchTypeOptions = ref(SEARCH_TYPES); -const selectItem = async (key: any) => { +const selectItem = async (key: string) => { // switch 判断 switch (key) { - case 'card': - await request.get('/?do=sign').then((res) => { - console.log(res); - }); - break; - case 'card_music': - await request.get('/?do=daka').then((res) => { - console.log(res); - }); - break; - case 'listen': - await request.get('/?do=listen&id=1885175990&time=300').then((res) => { - console.log(res); - }); - break; case 'logout': logout().then(() => { store.state.user = null; diff --git a/src/utils/request_mt.ts b/src/utils/request_mt.ts deleted file mode 100644 index 91ce7f3..0000000 --- a/src/utils/request_mt.ts +++ /dev/null @@ -1,20 +0,0 @@ -import axios from 'axios'; - -const baseURL = `${import.meta.env.VITE_API_MT}`; -const request = axios.create({ - baseURL, - timeout: 10000, -}); - -// 请求拦截器 -request.interceptors.request.use( - (config) => { - return config; - }, - (error) => { - // 当请求异常时做一些处理 - return Promise.reject(error); - }, -); - -export default request; diff --git a/tailwind.config.js b/tailwind.config.js index b807610..860df56 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,8 +1,5 @@ module.exports = { - purge: [ - './index.html', - './src/**/*.{vue,js,ts,jsx,tsx}' - ], + purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], darkMode: false, // or 'media' or 'class' theme: { extend: {}, @@ -11,4 +8,4 @@ module.exports = { extend: {}, }, plugins: [], -} +}; diff --git a/vite.config.ts b/vite.config.ts index c960c46..7fc069f 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,10 +1,10 @@ -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' -import path from 'path' +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' +import AutoImport from 'unplugin-auto-import/vite'; +import { NaiveUiResolver } from 'unplugin-vue-components/resolvers'; +import Components from 'unplugin-vue-components/vite'; +import { defineConfig } from 'vite'; // https://vitejs.dev/config/ export default defineConfig({ @@ -15,12 +15,7 @@ export default defineConfig({ imports: [ 'vue', { - 'naive-ui': [ - 'useDialog', - 'useMessage', - 'useNotification', - 'useLoadingBar', - ], + 'naive-ui': ['useDialog', 'useMessage', 'useNotification', 'useLoadingBar'], }, ], }), @@ -35,16 +30,10 @@ export default defineConfig({ }, }, server: { - host: '0.0.0.0', //允许本机 + host: '0.0.0.0', // 指定端口 port: 4678, proxy: { - // string shorthand - '/mt': { - target: 'http://mt.myalger.top', - changeOrigin: true, - rewrite: (path) => path.replace(/^\/mt/, ''), - }, // with options '/api': { target: 'http://110.42.251.190:9898', @@ -69,4 +58,4 @@ export default defineConfig({ }, }, }, -}) +});