Merge branch 'dev' into md

This commit is contained in:
lyswhut
2020-03-03 12:31:40 +08:00
6 changed files with 59 additions and 21 deletions
+23 -12
View File
@@ -112,18 +112,8 @@ export default {
...mapMutations('download', ['updateDownloadList']),
...mapMutations(['setSetting']),
init() {
rendererInvoke('getEnvParams').then(envParams => {
this.envParams = envParams
this.isNt = isLinux || this.envParams.nt
if (this.isNt) {
document.body.classList.remove('transparent')
document.body.classList.add('noTransparent')
}
if (this.isProd && !this.isNt) {
document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents)
document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents)
}
})
rendererInvoke('getEnvParams').then(this.handleEnvParamsInit)
document.body.addEventListener('click', this.handleBodyClick, true)
rendererOn('update-available', (e, info) => {
// this.showUpdateModal(true)
@@ -259,6 +249,27 @@ export default {
event.preventDefault()
if (/^https?:\/\//.test(event.target.href)) openUrl(event.target.href)
},
handleEnvParamsInit(envParams) {
this.envParams = envParams
this.isNt = isLinux || this.envParams.nt
if (this.isNt) {
document.body.classList.remove('transparent')
document.body.classList.add('noTransparent')
}
if (this.isProd && !this.isNt) {
document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents)
document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents)
}
if (this.envParams.search != null) {
this.$router.push({
path: 'search',
query: {
text: this.envParams.search,
},
})
}
},
},
beforeDestroy() {
this.clearUpdateTimeout()
+12 -2
View File
@@ -48,7 +48,7 @@ div(:class="$style.player")
<script>
import Lyric from 'lrc-file-parser'
import { rendererSend } from '../../../common/ipc'
import { rendererSend, rendererOn } from '../../../common/ipc'
import { formatPlayTime2, getRandom, checkPath, setTitle, clipboardWriteText, debounce } from '../../utils'
import { mapGetters, mapActions, mapMutations } from 'vuex'
import { requestMsg } from '../../utils/message'
@@ -128,6 +128,9 @@ export default {
this.setVolume(volume)
}, 300)
rendererOn('restore', () => {
this.handleSetTransition()
})
document.addEventListener('mousemove', this.handleVolumeMsMove)
document.addEventListener('mouseup', this.handleVolumeMsUp)
window.addEventListener('resize', this.handleResize)
@@ -179,6 +182,9 @@ export default {
volume(n) {
this.handleSaveVolume(n)
},
nowPlayTime(n, o) {
if (Math.abs(n - o) > 1) this.handleSetTransition()
},
},
methods: {
...mapActions('player', ['getUrl', 'getPic', 'getLrc']),
@@ -390,7 +396,7 @@ export default {
},
setProgess(e) {
if (!this.audio.src) return
this.isActiveTransition = true
// this.isActiveTransition = true
this.$nextTick(() => {
const time = (e.offsetX / this.pregessWidth) * this.maxPlayTime
if (this.audioErrorTime) this.audioErrorTime = time
@@ -583,6 +589,10 @@ export default {
this.setMediaDeviceId(null)
})
},
handleSetTransition() {
this.isActiveTransition = true
// console.log('active transition')
},
},
}
</script>