fix: move settings button from home to library

This commit is contained in:
qier222 2021-01-29 16:52:36 +08:00
parent b80c509d1b
commit 09c54486cc
3 changed files with 46 additions and 19 deletions

View File

@ -105,10 +105,18 @@ export default {
border-radius: 7px; border-radius: 7px;
cursor: default; cursor: default;
color: var(--color-text); color: var(--color-text);
display: flex;
align-items: center;
&:hover { &:hover {
color: var(--color-primary); color: var(--color-primary);
background: var(--color-primary-bg-for-transparent); background: var(--color-primary-bg-for-transparent);
} }
.svg-icon {
height: 16px;
width: 16px;
margin-right: 5px;
}
} }
hr { hr {

View File

@ -51,16 +51,6 @@
:imageSize="1024" :imageSize="1024"
/> />
</div> </div>
<footer>
<ButtonTwoTone
:iconClass="'settings'"
:color="'grey'"
@click.native="goTo('/settings')"
>
{{ $t("settings.settings") }}
</ButtonTwoTone>
</footer>
</div> </div>
</template> </template>
@ -73,11 +63,10 @@ import NProgress from "nprogress";
import { mapState } from "vuex"; import { mapState } from "vuex";
import CoverRow from "@/components/CoverRow.vue"; import CoverRow from "@/components/CoverRow.vue";
import ButtonTwoTone from "@/components/ButtonTwoTone.vue";
export default { export default {
name: "Home", name: "Home",
components: { CoverRow, ButtonTwoTone }, components: { CoverRow },
data() { data() {
return { return {
show: false, show: false,
@ -132,9 +121,6 @@ export default {
); );
}); });
}, },
goTo(path) {
this.$router.push({ path });
},
}, },
activated() { activated() {
this.loadData(); this.loadData();

View File

@ -1,9 +1,12 @@
<template> <template>
<div v-show="show"> <div v-show="show">
<h1> <h1>
<img class="head" :src="data.user.avatarUrl | resizeImage" />{{ <img class="avatar" :src="data.user.avatarUrl | resizeImage" />{{
data.user.nickname data.user.nickname
}}{{ $t("library.sLibrary") }} }}{{ $t("library.sLibrary") }}
<button-icon @click.native="showUserProfileMenu"
><svg-icon icon-class="arrow-right"
/></button-icon>
</h1> </h1>
<div class="section-one"> <div class="section-one">
<div class="liked-songs" @click="goToLikedSongsList"> <div class="liked-songs" @click="goToLikedSongsList">
@ -109,6 +112,15 @@
<MvRow :mvs="mvs" /> <MvRow :mvs="mvs" />
</div> </div>
</div> </div>
<ContextMenu ref="userProfileMenu">
<div class="item" @click="settings"
><svg-icon icon-class="settings" />设置</div
>
<div class="item" @click="logout"
><svg-icon icon-class="logout" />退出登录</div
>
</ContextMenu>
</div> </div>
</template> </template>
@ -124,9 +136,11 @@ import {
} from "@/api/user"; } from "@/api/user";
import { randomNum, dailyTask } from "@/utils/common"; import { randomNum, dailyTask } from "@/utils/common";
import { getPlaylistDetail } from "@/api/playlist"; import { getPlaylistDetail } from "@/api/playlist";
import { isAccountLoggedIn } from "@/utils/auth"; import { isAccountLoggedIn, doLogout } from "@/utils/auth";
import NProgress from "nprogress"; import NProgress from "nprogress";
import ContextMenu from "@/components/ContextMenu.vue";
import ButtonIcon from "@/components/ButtonIcon.vue";
import TrackList from "@/components/TrackList.vue"; import TrackList from "@/components/TrackList.vue";
import CoverRow from "@/components/CoverRow.vue"; import CoverRow from "@/components/CoverRow.vue";
import SvgIcon from "@/components/SvgIcon.vue"; import SvgIcon from "@/components/SvgIcon.vue";
@ -134,7 +148,7 @@ import MvRow from "@/components/MvRow.vue";
export default { export default {
name: "Library", name: "Library",
components: { SvgIcon, CoverRow, TrackList, MvRow }, components: { SvgIcon, CoverRow, TrackList, MvRow, ButtonIcon, ContextMenu },
data() { data() {
return { return {
show: false, show: false,
@ -297,6 +311,17 @@ export default {
value: true, value: true,
}); });
}, },
showUserProfileMenu(e) {
this.$refs.userProfileMenu.openMenu(e);
},
logout() {
if (!confirm("确定要退出登录吗?")) return;
doLogout();
this.$router.push({ name: "home" });
},
settings() {
this.$router.push({ name: "settings" });
},
}, },
watch: { watch: {
likedSongsInState() { likedSongsInState() {
@ -310,13 +335,21 @@ export default {
h1 { h1 {
font-size: 42px; font-size: 42px;
color: var(--color-text); color: var(--color-text);
.head { display: flex;
align-items: center;
.avatar {
height: 44px; height: 44px;
margin-right: 12px; margin-right: 12px;
vertical-align: -7px; vertical-align: -7px;
border-radius: 50%; border-radius: 50%;
border: rgba(0, 0, 0, 0.2); border: rgba(0, 0, 0, 0.2);
} }
.svg-icon {
width: 28px;
height: 28px;
opacity: 0.18;
}
} }
.section-one { .section-one {