This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
appcat
/
sonist
Archived
1
0
Fork 0
sonist/src/js/mini-win.js

75 lines
1.4 KiB
JavaScript

/**
* 迷你模式
* @author yutent<yutent@doui.cc>
* @date 2019/01/22 17:52:23
*/
'use strict'
import '/lib/anot.next.js'
const { remote } = require('electron')
const WIN = remote.getCurrentWindow()
const MAIN_WIN = WIN.getParentWindow()
window.WIN = WIN
Anot({
$id: 'mini',
state: {
isPlaying: false,
curr: {
id: '',
title: '假装不合适',
artist: '',
album: '',
time: 0,
duration: 0,
cover: '/images/album.png'
},
pinned: true,
playMode: Anot.ls('play-mode') >>> 0
},
mounted() {
WIN.on('ktv-lrc', lrc => {
this.lrc = lrc
})
},
methods: {
play() {},
nextSong() {},
handleTool(ev) {
let key = ev.target.dataset.key
switch (key) {
case 'pin':
this.pinned = !this.pinned
WIN.setAlwaysOnTop(this.pinned)
break
case 'quit':
WIN.hide()
MAIN_WIN.show()
break
default:
break
}
},
handleAction(ev) {
let key = ev.target.dataset.key
switch (key) {
case 'lrc':
MAIN_WIN.emit('toggle-desktoplrc')
break
case 'mode':
let mod = this.playMode
mod++
if (mod > 2) {
mod = 0
}
this.playMode = mod
MAIN_WIN.emit('play-mode', mod)
}
}
}
})
一个音乐播放器, 主打本地音乐播放。支持 自动歌词/自动封面/均衡器等常见功能。
JavaScript 60.1%
SCSS 19.2%
HTML 16.9%
CSS 3.8%