mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-04-24 08:07:23 +08:00
✨ feat: 添加设置菜单 优化移动端菜单显示
This commit is contained in:
@@ -13,12 +13,19 @@ import { darkTheme } from 'naive-ui';
|
|||||||
import { onMounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
import { isElectron } from '@/hooks/MusicHook';
|
import { isElectron } from '@/hooks/MusicHook';
|
||||||
|
import homeRouter from '@/router/home';
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
|
|
||||||
import { isMobile } from './utils';
|
import { isMobile } from './utils';
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
store.dispatch('initializeSettings');
|
store.dispatch('initializeSettings');
|
||||||
|
if (isMobile.value) {
|
||||||
|
store.commit(
|
||||||
|
'setMenus',
|
||||||
|
homeRouter.filter((item) => item.meta.isMobile),
|
||||||
|
);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
import { onMounted, ref } from 'vue';
|
import { onMounted, ref } from 'vue';
|
||||||
|
|
||||||
import config from '@/../package.json';
|
import config from '@/../package.json';
|
||||||
|
import { isMobile } from '@/utils';
|
||||||
|
|
||||||
const showModal = ref(false);
|
const showModal = ref(false);
|
||||||
const isElectron = ref((window as any).electron !== undefined);
|
const isElectron = ref((window as any).electron !== undefined);
|
||||||
@@ -37,7 +38,7 @@ const closeModal = () => {
|
|||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// 如果是 electron 环境,不显示安装提示
|
// 如果是 electron 环境,不显示安装提示
|
||||||
if (isElectron.value) {
|
if (isElectron.value || isMobile.value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="layout-page">
|
<div class="layout-page">
|
||||||
<div id="layout-main" class="layout-main" :style="{ background: backgroundColor }">
|
<div id="layout-main" class="layout-main" :style="{ background: backgroundColor }">
|
||||||
<title-bar />
|
<title-bar v-if="!isMobile" />
|
||||||
<div class="layout-main-page">
|
<div class="layout-main-page">
|
||||||
<!-- 侧边菜单栏 -->
|
<!-- 侧边菜单栏 -->
|
||||||
<app-menu v-if="!isMobile" class="menu" :menus="menus" />
|
<app-menu v-if="!isMobile" class="menu" :menus="menus" />
|
||||||
@@ -39,7 +39,6 @@ import { useStore } from 'vuex';
|
|||||||
|
|
||||||
import InstallAppModal from '@/components/common/InstallAppModal.vue';
|
import InstallAppModal from '@/components/common/InstallAppModal.vue';
|
||||||
import PlayBottom from '@/components/common/PlayBottom.vue';
|
import PlayBottom from '@/components/common/PlayBottom.vue';
|
||||||
import { isElectron } from '@/hooks/MusicHook';
|
|
||||||
import homeRouter from '@/router/home';
|
import homeRouter from '@/router/home';
|
||||||
import { isMobile } from '@/utils';
|
import { isMobile } from '@/utils';
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const layoutRouter = [
|
|||||||
title: '首页',
|
title: '首页',
|
||||||
icon: 'icon-Home',
|
icon: 'icon-Home',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
isMobile: true,
|
||||||
},
|
},
|
||||||
component: () => import('@/views/home/index.vue'),
|
component: () => import('@/views/home/index.vue'),
|
||||||
},
|
},
|
||||||
@@ -17,6 +18,7 @@ const layoutRouter = [
|
|||||||
noScroll: true,
|
noScroll: true,
|
||||||
icon: 'icon-Search',
|
icon: 'icon-Search',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
isMobile: true,
|
||||||
},
|
},
|
||||||
component: () => import('@/views/search/index.vue'),
|
component: () => import('@/views/search/index.vue'),
|
||||||
},
|
},
|
||||||
@@ -27,6 +29,7 @@ const layoutRouter = [
|
|||||||
title: '歌单',
|
title: '歌单',
|
||||||
icon: 'icon-Paper',
|
icon: 'icon-Paper',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
isMobile: true,
|
||||||
},
|
},
|
||||||
component: () => import('@/views/list/index.vue'),
|
component: () => import('@/views/list/index.vue'),
|
||||||
},
|
},
|
||||||
@@ -37,6 +40,7 @@ const layoutRouter = [
|
|||||||
title: 'MV',
|
title: 'MV',
|
||||||
icon: 'icon-recordfill',
|
icon: 'icon-recordfill',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
|
isMobile: true,
|
||||||
},
|
},
|
||||||
component: () => import('@/views/mv/index.vue'),
|
component: () => import('@/views/mv/index.vue'),
|
||||||
},
|
},
|
||||||
@@ -67,8 +71,20 @@ const layoutRouter = [
|
|||||||
icon: 'icon-Profile',
|
icon: 'icon-Profile',
|
||||||
keepAlive: true,
|
keepAlive: true,
|
||||||
noScroll: true,
|
noScroll: true,
|
||||||
|
isMobile: true,
|
||||||
},
|
},
|
||||||
component: () => import('@/views/user/index.vue'),
|
component: () => import('@/views/user/index.vue'),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/set',
|
||||||
|
name: 'set',
|
||||||
|
meta: {
|
||||||
|
title: '设置',
|
||||||
|
icon: 'ri-settings-3-fill',
|
||||||
|
keepAlive: true,
|
||||||
|
noScroll: true,
|
||||||
|
},
|
||||||
|
component: () => import('@/views/set/index.vue'),
|
||||||
|
},
|
||||||
];
|
];
|
||||||
export default layoutRouter;
|
export default layoutRouter;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-scrollbar>
|
<n-scrollbar>
|
||||||
<div class="set-page">
|
<div class="set-page" :class="setAnimationClass('animate__bounceInLeft')">
|
||||||
<div v-if="isElectron" class="set-item">
|
<div v-if="isElectron" class="set-item">
|
||||||
<div>
|
<div>
|
||||||
<div class="set-item-title">代理</div>
|
<div class="set-item-title">代理</div>
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
}}</n-button>
|
}}</n-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="p-6 bg-black rounded-lg shadow-lg mt-20">
|
<div class="p-6 bg-black rounded-lg shadow-lg mt-10">
|
||||||
<div class="text-gray-100 text-base text-center">支持作者</div>
|
<div class="text-gray-100 text-base text-center">支持作者</div>
|
||||||
<div class="flex gap-60">
|
<div class="flex gap-60">
|
||||||
<div class="flex flex-col items-center gap-2 cursor-none hover:scale-[2] transition-all z-10 bg-black">
|
<div class="flex flex-col items-center gap-2 cursor-none hover:scale-[2] transition-all z-10 bg-black">
|
||||||
@@ -85,6 +85,7 @@ import config from '@/../package.json';
|
|||||||
import alipay from '@/assets/alipay.png';
|
import alipay from '@/assets/alipay.png';
|
||||||
import wechat from '@/assets/wechat.png';
|
import wechat from '@/assets/wechat.png';
|
||||||
import store from '@/store';
|
import store from '@/store';
|
||||||
|
import { setAnimationClass } from '@/utils';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'Setting',
|
name: 'Setting',
|
||||||
@@ -108,7 +109,7 @@ const handleSave = () => {
|
|||||||
if (isElectron.value) {
|
if (isElectron.value) {
|
||||||
(window as any).electronAPI.restart();
|
(window as any).electronAPI.restart();
|
||||||
}
|
}
|
||||||
router.back();
|
router.push('/');
|
||||||
};
|
};
|
||||||
|
|
||||||
const openAuthor = () => {
|
const openAuthor = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user