🌈 style: 去除无用代码

This commit is contained in:
alger
2024-05-21 10:16:30 +08:00
parent da8216e2ca
commit e52a02cf3c
8 changed files with 34 additions and 83 deletions

View File

@@ -1,4 +1,3 @@
VITE_API = /api
VITE_API_MT = /mt
VITE_API_MUSIC = /music
VITE_API_PROXY = http://110.42.251.190:9856

View File

@@ -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

View File

@@ -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)

View File

@@ -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"
}
]
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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: [],
}
};

View File

@@ -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({
},
},
},
})
});