Skip to content

Commit

Permalink
Fix: 打包后部分图片路径错误;优化体验;代码优化;
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhu188 committed Feb 24, 2020
1 parent e552733 commit a760803
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 19 deletions.
6 changes: 4 additions & 2 deletions src/main/modules/ipcEvent.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export default function () {

ipcMain.on('ondragstart', (event, e) => {
event.sender.startDrag({
file: 'static/images/play.png',
icon: 'static/images/play.png'
file: 'images/play.png',
icon: 'images/play.png'
})
})

Expand Down Expand Up @@ -207,9 +207,11 @@ export default function () {
updateWindow.close()
updateWindow = null
})

ipcMain.on('toggle-updatewin', (event, data) => {
if (!updateWindow) {
updateWindow = createUpdateWindow(BrowserWindow)
updateWindow.show()
} else {
if (updateWindow.isVisible()) {
updateWindow.hide()
Expand Down
2 changes: 1 addition & 1 deletion src/main/windows/updateWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LOAD_URL } from './../config'
const miniWinURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/#update`
: `${LOAD_URL}#update`
const previewIcon = process.env.NODE_ENV === 'development' ? 'static/images/tray.ico' : `${global.__static}/images/tray.ico`
const previewIcon = process.env.NODE_ENV === 'development' ? '/images/tray.ico' : `${global.__static}/images/tray.ico`
let updateWindow
const createUpdateWindow = function (BrowserWindow) {
if (updateWindow) return false
Expand Down
2 changes: 0 additions & 2 deletions src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export default {
icon: 'public/images/icon.ico'
})
this.$store.commit('App/SET_ONLINE', status)
},
onTap () {
}
},
created () {
Expand Down
12 changes: 6 additions & 6 deletions src/renderer/components/Common/progressBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,12 @@ export default {
}
},
destroy () {
window.onresize = null
window.removeEventListener('resize', debounce(this.handleResize, 50))
},
mounted () {
this.changeProgressbarWidth(this.percent)
let _this = this
window.onresize = debounce(function () {
console.log(_this.bufferedPercent)
_this.changeBufferedWidth(_this.bufferedPercent)
}, 500)
// window.addEventListener('resize', )
window.addEventListener('resize', debounce(this.handleResize, 50))
const virtualBar = this.$refs.virtualBar
virtualBar.addEventListener('mousemove', debounce(function (e) {
const progressBar = _this.$refs.progressBar
Expand Down Expand Up @@ -85,6 +81,10 @@ export default {
}
},
methods: {
handleResize () {
this.changeBufferedWidth(this.bufferedPercent)
this.changeProgressbarWidth(this.percent)
},
onMouseDown (e) {
e.preventDefault()
this.mouse.startX = e.pageX
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/PlayBar/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ export default {
},
methods: {
async handleSongChange (newSong, oldSong) {
// console.log('handleSongChange', newSong, oldSong)
if (!newSong.id || (oldSong && (newSong.id === oldSong.id))) return
this.isSongReady = false
if (newSong.folder) { // 如果是本地歌曲
Expand All @@ -256,6 +255,7 @@ export default {
}, 20)
this.getLocalLyric(newSong.name)
} else {
this.$refs.audio.pause()
this.getOnlineSong(newSong).then(songUrl => {
if (songUrl) {
this.$store.commit('play/SET_SOURCE', songUrl)
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/core/createdInit.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function normalLocalSong ({ songname, picture, metadata, filePath, size }) {
return {
id: uuid(),
name: songname,
avatar: picture || 'static/images/default_album.jpg',
avatar: picture || 'images/default_album.jpg',
album: {
name: metadata.common.album || '未知专辑'
},
Expand Down
1 change: 0 additions & 1 deletion src/renderer/layouts/BasicLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export default {
}
.basic-layout-footer {
border-top: 1px solid #ddd;
/* cursor: url('/static/images/gunlun.png'),default; */
}
.basic-layout-header {
background: @primary-color;
Expand Down
3 changes: 1 addition & 2 deletions src/renderer/store/modules/Localsong.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { normalSong } from '../../utils/song'
const fs = require('fs')
const path = require('path')
const mm = require('music-metadata')
const avatarIcon = process.env.NODE_ENV === 'development' ? 'static/images/default_album.jpg' : `${global.__static}/images/default_album.jpg`
const avatarIcon = 'images/default_album.jpg'

function isSongInArray (song, arr) {
return arr.findIndex(item => item.id == song.id) >= 0
Expand All @@ -19,7 +19,6 @@ export default {
},
getters: {
localSongs: state => state.localSongs

},
mutations: {
clear (state) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/modules/play.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const actions = {
commit('SET_CURRENT_PLAY_LIST', tracks)
}
commit('SET_CURRENT_INDEX', index)
commit('SET_PLAY_STATUS', true)
// commit('SET_PLAY_STATUS', true)
},
addHistorySong ({ commit }, song) {
let songs = ls.get(PLAY_HISTORY_KEY, [])
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/utils/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function debounce (func, wait) {
let args = arguments
let context = this
timer && clearTimeout(timer)
timer = setTimeout(() => {
timer = setTimeout(function () {
func.apply(context, args)
}, wait)
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/utils/song.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getLyric, getSongUrl, getIntelligence } from '@/api/song'

// param图片宽高
export function normalSong (song, param = '200y200', isFm = false) {
let avatar = (song.album && (song.album.picUrl || song.album.artist.img1v1Url)) || (song.al && song.al.picUrl) || 'static/images/default_album.jpg'
let avatar = (song.album && (song.album.picUrl || song.album.artist.img1v1Url)) || (song.al && song.al.picUrl) || 'images/default_album.jpg'
return {
id: song.id,
name: song.name,
Expand Down

0 comments on commit a760803

Please sign in to comment.