fix: bugs

This commit is contained in:
qier222 2021-01-05 22:21:01 +08:00
parent 15ac2b5815
commit db14c9283f
11 changed files with 64 additions and 25 deletions

View File

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

View File

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

View File

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

View File

@ -6,11 +6,7 @@
:key="item.id"
:class="{ artist: type === 'artist' }"
>
<Cover
:imageUrl="item.img1v1Url || item.picUrl || item.coverImgUrl"
:type="type"
:id="item.id"
/>
<Cover :imageUrl="getImageUrl(item)" :type="type" :id="item.id" />
<div class="text">
<div class="info" v-if="showPlayCount">
<span class="play-count"
@ -86,8 +82,18 @@ export default {
return this.type === "album" && item.mark === 1056768;
},
getTitleLink(item) {
let type = this.type === "chart" ? "playlist" : this.type;
return `/${type}/${item.id}`;
return `/${this.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;
},
},
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@
:key="artist.id"
>
<Cover
:imageUrl="artist.img1v1Url | resizeImage"
:imageUrl="getArtistImageUrl(artist)"
type="artist"
:id="artist.id"
:fixedSize="128"
@ -159,6 +159,17 @@ export default {
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() {
this.getData(this.$route.query.keywords);

View File

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