master
qier222 4 years ago
parent 15ac2b5815
commit db14c9283f

@ -1,4 +1,5 @@
const { cookieToJson } = require('../util/index'); const { cookieToJson } = require('../util/index');
const crypto = require('crypto');
const request = require('../util/request'); const request = require('../util/request');
module.exports = { module.exports = {
'/yunbei/today': (req, res) => { '/yunbei/today': (req, res) => {

@ -18,8 +18,8 @@
" "
/></transition> /></transition>
<Toast /> <Toast />
<ModalAddTrackToPlaylist /> <ModalAddTrackToPlaylist v-if="isAccountLoggedIn" />
<ModalNewPlaylist /> <ModalNewPlaylist v-if="isAccountLoggedIn" />
</div> </div>
</template> </template>
@ -30,6 +30,7 @@ import Navbar from "./components/Navbar.vue";
import Player from "./components/Player.vue"; import Player from "./components/Player.vue";
import Toast from "./components/Toast.vue"; import Toast from "./components/Toast.vue";
import { ipcRenderer } from "./electron/ipcRenderer"; import { ipcRenderer } from "./electron/ipcRenderer";
import { isAccountLoggedIn } from "@/utils/auth";
export default { export default {
name: "App", name: "App",
@ -45,6 +46,11 @@ export default {
isElectron: process.env.IS_ELECTRON, // true || undefined isElectron: process.env.IS_ELECTRON, // true || undefined
}; };
}, },
computed: {
isAccountLoggedIn() {
return isAccountLoggedIn();
},
},
created() { created() {
if (this.isElectron) { if (this.isElectron) {
ipcRenderer(this); ipcRenderer(this);

@ -1,7 +1,6 @@
"use strict"; "use strict";
import { app, protocol, BrowserWindow, shell, dialog } from "electron"; import { app, protocol, BrowserWindow, shell, dialog } from "electron";
import { createProtocol } from "vue-cli-plugin-electron-builder/lib"; import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
import { startNeteaseMusicApi } from "./electron/services"; import { startNeteaseMusicApi } from "./electron/services";
import { initIpcMain } from "./electron/ipcMain.js"; import { initIpcMain } from "./electron/ipcMain.js";
import { createMenu } from "./electron/menu"; import { createMenu } from "./electron/menu";
@ -9,6 +8,7 @@ import { createTray } from "@/electron/tray";
import { createTouchBar } from "./electron/touchBar"; import { createTouchBar } from "./electron/touchBar";
import { createDockMenu } from "./electron/dockMenu"; import { createDockMenu } from "./electron/dockMenu";
import { autoUpdater } from "electron-updater"; import { autoUpdater } from "electron-updater";
import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
import express from "express"; import express from "express";
import expressProxy from "express-http-proxy"; import expressProxy from "express-http-proxy";
import Store from "electron-store"; import Store from "electron-store";
@ -91,8 +91,8 @@ class Background {
this.window = new BrowserWindow({ this.window = new BrowserWindow({
width: this.store.get("window.width") | 1440, width: this.store.get("window.width") | 1440,
height: this.store.get("window.height") | 840, height: this.store.get("window.height") | 840,
minWidth: 768, minWidth: 1080,
minHeight: 608, minHeight: 720,
titleBarStyle: "hiddenInset", titleBarStyle: "hiddenInset",
webPreferences: { webPreferences: {
webSecurity: false, webSecurity: false,

@ -6,11 +6,7 @@
:key="item.id" :key="item.id"
:class="{ artist: type === 'artist' }" :class="{ artist: type === 'artist' }"
> >
<Cover <Cover :imageUrl="getImageUrl(item)" :type="type" :id="item.id" />
:imageUrl="item.img1v1Url || item.picUrl || item.coverImgUrl"
:type="type"
:id="item.id"
/>
<div class="text"> <div class="text">
<div class="info" v-if="showPlayCount"> <div class="info" v-if="showPlayCount">
<span class="play-count" <span class="play-count"
@ -86,8 +82,18 @@ export default {
return this.type === "album" && item.mark === 1056768; return this.type === "album" && item.mark === 1056768;
}, },
getTitleLink(item) { getTitleLink(item) {
let type = this.type === "chart" ? "playlist" : this.type; return `/${this.type}/${item.id}`;
return `/${type}/${item.id}`; },
getImageUrl(item) {
if (item.img1v1Url) {
let img1v1ID = item.img1v1Url.split("/");
img1v1ID = img1v1ID[img1v1ID.length - 1];
if (img1v1ID === "5639395138885805.jpg") {
// img1v1Url 😅😅😅
return "https://p2.music.126.net/VnZiScyynLG7atLIZ2YPkw==/18686200114669622.jpg?param=512x512";
}
}
return item.img1v1Url || item.picUrl || item.coverImgUrl;
}, },
}, },
}; };

@ -28,9 +28,10 @@
</ContextMenu> </ContextMenu>
<div :style="listStyles"> <div :style="listStyles">
<TrackListItem <TrackListItem
v-for="track in tracks" v-for="(track, index) in tracks"
:track="track" :track="track"
:key="track.id" :key="itemKey === 'id' ? track.id : `${track.id}${index}`"
:highlightPlayingTrack="highlightPlayingTrack"
@dblclick.native="playThisList(track.id)" @dblclick.native="playThisList(track.id)"
@click.right.native="openMenu($event, track)" @click.right.native="openMenu($event, track)"
/> />
@ -81,6 +82,14 @@ export default {
type: Number, type: Number,
default: 4, default: 4,
}, },
highlightPlayingTrack: {
type: Boolean,
default: true,
},
itemKey: {
type: String,
default: "id",
},
}, },
data() { data() {
return { return {

@ -8,7 +8,7 @@
@mouseleave="hover = false" @mouseleave="hover = false"
> >
<img <img
:src="imgUrl | resizeImage(224)" :src="imgUrl"
v-if="!isAlbum" v-if="!isAlbum"
@click="goToAlbum" @click="goToAlbum"
:class="{ hover: focus }" :class="{ hover: focus }"
@ -89,6 +89,10 @@ export default {
components: { ArtistsInLine, ExplicitSymbol }, components: { ArtistsInLine, ExplicitSymbol },
props: { props: {
track: Object, track: Object,
highlightPlayingTrack: {
type: Boolean,
default: true,
},
}, },
data() { data() {
return { hover: false, trackStyle: {} }; return { hover: false, trackStyle: {} };
@ -96,9 +100,11 @@ export default {
computed: { computed: {
...mapState(["settings"]), ...mapState(["settings"]),
imgUrl() { imgUrl() {
if (this.track.al !== undefined) return this.track.al.picUrl; let image =
if (this.track.album !== undefined) return this.track.album.picUrl; this.track?.al?.picUrl ??
return ""; this.track?.album?.picUrl ??
"https://p2.music.126.net/UeTuwE7pvjBpypWLudqukA==/3132508627578625.jpg";
return image + "?param=224y224";
}, },
artists() { artists() {
if (this.track.ar !== undefined) return this.track.ar; if (this.track.ar !== undefined) return this.track.ar;
@ -127,7 +133,8 @@ export default {
let trackClass = [this.type]; let trackClass = [this.type];
if (!this.track.playable && this.settings.showUnavailableSongInGreyStyle) if (!this.track.playable && this.settings.showUnavailableSongInGreyStyle)
trackClass.push("disable"); trackClass.push("disable");
if (this.isPlaying) trackClass.push("playing"); if (this.isPlaying && this.highlightPlayingTrack)
trackClass.push("playing");
if (this.focus) trackClass.push("focus"); if (this.focus) trackClass.push("focus");
return trackClass; return trackClass;
}, },

@ -287,6 +287,7 @@ h1 {
.load-more { .load-more {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin-top: 32px;
} }
.button.more { .button.more {

@ -41,7 +41,7 @@
}}</router-link> }}</router-link>
</div> </div>
<CoverRow <CoverRow
:type="'chart'" type="playlist"
:items="topList.items" :items="topList.items"
:subText="'updateFrequency'" :subText="'updateFrequency'"
:imageSize="1024" :imageSize="1024"

@ -401,9 +401,6 @@ h1 {
} }
.section-two { .section-two {
// margin-top: 42px;
// padding-top: 14px;
// border-top: 1px solid rgba(128, 128, 128, 0.18);
margin-top: 54px; margin-top: 54px;
min-height: calc(100vh - 182px); min-height: calc(100vh - 182px);
} }
@ -411,7 +408,7 @@ h1 {
.tabs-row { .tabs-row {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 12px; margin-bottom: 24px;
} }
.tabs { .tabs {

@ -14,7 +14,7 @@
:key="artist.id" :key="artist.id"
> >
<Cover <Cover
:imageUrl="artist.img1v1Url | resizeImage" :imageUrl="getArtistImageUrl(artist)"
type="artist" type="artist"
:id="artist.id" :id="artist.id"
:fixedSize="128" :fixedSize="128"
@ -159,6 +159,17 @@ export default {
this.mvs = data.result.mvs; this.mvs = data.result.mvs;
}); });
}, },
getArtistImageUrl(artist) {
if (artist.img1v1Url) {
let img1v1ID = artist.img1v1Url.split("/");
img1v1ID = img1v1ID[img1v1ID.length - 1];
if (img1v1ID === "5639395138885805.jpg") {
// img1v1Url 😅😅😅
return "https://p2.music.126.net/VnZiScyynLG7atLIZ2YPkw==/18686200114669622.jpg?param=512x512";
}
}
return artist.img1v1Url + "?param=512x512";
},
}, },
created() { created() {
this.getData(this.$route.query.keywords); this.getData(this.$route.query.keywords);

@ -87,6 +87,7 @@ module.exports = {
nsis: { nsis: {
oneClick: false, oneClick: false,
allowToChangeInstallationDirectory: true, allowToChangeInstallationDirectory: true,
perMachine: true,
}, },
}, },
// 主线程的配置文件 // 主线程的配置文件

Loading…
Cancel
Save