chore: format codes

This commit is contained in:
qier222 2021-04-26 16:26:49 +08:00
parent 6922c716e2
commit 9351f6bc89
No known key found for this signature in database
GPG key ID: 9C85007ED905F14D
73 changed files with 2321 additions and 2321 deletions

View file

@ -1,135 +1,135 @@
import Vue from "vue";
import VueRouter from "vue-router";
import NProgress from "nprogress";
import "@/assets/css/nprogress.css";
import { isLooseLoggedIn, isAccountLoggedIn } from "@/utils/auth";
import Vue from 'vue';
import VueRouter from 'vue-router';
import NProgress from 'nprogress';
import '@/assets/css/nprogress.css';
import { isLooseLoggedIn, isAccountLoggedIn } from '@/utils/auth';
NProgress.configure({ showSpinner: false, trickleSpeed: 100 });
Vue.use(VueRouter);
const routes = [
{
path: "/",
name: "home",
component: () => import("@/views/home.vue"),
path: '/',
name: 'home',
component: () => import('@/views/home.vue'),
meta: {
keepAlive: true,
},
},
{
path: "/login",
name: "login",
component: () => import("@/views/login.vue"),
path: '/login',
name: 'login',
component: () => import('@/views/login.vue'),
},
{
path: "/login/username",
name: "loginUsername",
component: () => import("@/views/loginUsername.vue"),
path: '/login/username',
name: 'loginUsername',
component: () => import('@/views/loginUsername.vue'),
},
{
path: "/login/account",
name: "loginAccount",
component: () => import("@/views/loginAccount.vue"),
path: '/login/account',
name: 'loginAccount',
component: () => import('@/views/loginAccount.vue'),
},
{
path: "/playlist/:id",
name: "playlist",
component: () => import("@/views/playlist.vue"),
path: '/playlist/:id',
name: 'playlist',
component: () => import('@/views/playlist.vue'),
},
{
path: "/album/:id",
name: "album",
component: () => import("@/views/album.vue"),
path: '/album/:id',
name: 'album',
component: () => import('@/views/album.vue'),
},
{
path: "/artist/:id",
name: "artist",
component: () => import("@/views/artist.vue"),
path: '/artist/:id',
name: 'artist',
component: () => import('@/views/artist.vue'),
meta: {
keepAlive: true,
},
},
{
path: "/artist/:id/mv",
name: "artistMV",
component: () => import("@/views/artistMV.vue"),
path: '/artist/:id/mv',
name: 'artistMV',
component: () => import('@/views/artistMV.vue'),
meta: {
keepAlive: true,
},
},
{
path: "/mv/:id",
name: "mv",
component: () => import("@/views/mv.vue"),
path: '/mv/:id',
name: 'mv',
component: () => import('@/views/mv.vue'),
},
{
path: "/next",
name: "next",
component: () => import("@/views/next.vue"),
path: '/next',
name: 'next',
component: () => import('@/views/next.vue'),
meta: {
keepAlive: true,
},
},
{
path: "/search/:keywords?",
name: "search",
component: () => import("@/views/search.vue"),
path: '/search/:keywords?',
name: 'search',
component: () => import('@/views/search.vue'),
meta: {
keepAlive: true,
},
},
{
path: "/search/:keywords/:type",
name: "searchType",
component: () => import("@/views/searchType.vue"),
path: '/search/:keywords/:type',
name: 'searchType',
component: () => import('@/views/searchType.vue'),
},
{
path: "/new-album",
name: "newAlbum",
component: () => import("@/views/newAlbum.vue"),
path: '/new-album',
name: 'newAlbum',
component: () => import('@/views/newAlbum.vue'),
},
{
path: "/explore",
name: "explore",
component: () => import("@/views/explore.vue"),
path: '/explore',
name: 'explore',
component: () => import('@/views/explore.vue'),
meta: {
keepAlive: true,
},
},
{
path: "/library",
name: "library",
component: () => import("@/views/library.vue"),
path: '/library',
name: 'library',
component: () => import('@/views/library.vue'),
meta: {
requireLogin: true,
keepAlive: true,
},
},
{
path: "/library/liked-songs",
name: "likedSongs",
component: () => import("@/views/playlist.vue"),
path: '/library/liked-songs',
name: 'likedSongs',
component: () => import('@/views/playlist.vue'),
meta: {
requireLogin: true,
},
},
{
path: "/settings",
name: "settings",
component: () => import("@/views/settings.vue"),
path: '/settings',
name: 'settings',
component: () => import('@/views/settings.vue'),
},
{
path: "/daily/songs",
name: "dailySongs",
component: () => import("@/views/dailyTracks.vue"),
path: '/daily/songs',
name: 'dailySongs',
component: () => import('@/views/dailyTracks.vue'),
meta: {
requireAccountLogin: true,
},
},
{
path: "/lastfm/callback",
name: "lastfmCallback",
component: () => import("@/views/lastfmCallback.vue"),
path: '/lastfm/callback',
name: 'lastfmCallback',
component: () => import('@/views/lastfmCallback.vue'),
},
];
const router = new VueRouter({
@ -145,7 +145,7 @@ const router = new VueRouter({
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch((err) => err);
return originalPush.call(this, location).catch(err => err);
};
router.beforeEach((to, from, next) => {
@ -154,7 +154,7 @@ router.beforeEach((to, from, next) => {
if (isAccountLoggedIn()) {
next();
} else {
next({ path: "/login/account" });
next({ path: '/login/account' });
}
}
if (to.meta.requireLogin) {
@ -162,9 +162,9 @@ router.beforeEach((to, from, next) => {
next();
} else {
if (process.env.IS_ELECTRON === true) {
next({ path: "/login/account" });
next({ path: '/login/account' });
} else {
next({ path: "/login" });
next({ path: '/login' });
}
}
} else {
@ -172,10 +172,10 @@ router.beforeEach((to, from, next) => {
}
});
router.afterEach((to) => {
router.afterEach(to => {
if (
to.matched.some((record) => !record.meta.keepAlive) &&
!["settings", "dailySongs", "lastfmCallback"].includes(to.name)
to.matched.some(record => !record.meta.keepAlive) &&
!['settings', 'dailySongs', 'lastfmCallback'].includes(to.name)
) {
NProgress.start();
}