mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-05-06 04:51:29 +08:00
窗口合二为一,更完美的精简模式,按Esc键退出
This commit is contained in:
@@ -306,7 +306,8 @@ export default {
|
||||
showHistory: true,
|
||||
videoTitle: true,
|
||||
airplay: true,
|
||||
closeVideoTouch: true
|
||||
closeVideoTouch: true,
|
||||
ignores: ['cssFullscreen']
|
||||
},
|
||||
state: {
|
||||
showList: false,
|
||||
@@ -318,7 +319,8 @@ export default {
|
||||
scroll: false,
|
||||
isStar: false,
|
||||
isTop: false,
|
||||
mini: {},
|
||||
miniMode: false,
|
||||
mainWindowBounds: {},
|
||||
searchTxt: '',
|
||||
searchRecordList: [],
|
||||
channelList: [],
|
||||
@@ -743,40 +745,33 @@ export default {
|
||||
info: this.video.info
|
||||
}
|
||||
},
|
||||
miniEvent () {
|
||||
if (this.xg) {
|
||||
this.xg.pause()
|
||||
}
|
||||
mini.find().then(res => {
|
||||
var doc = {}
|
||||
if (!this.video.iptv) {
|
||||
doc = {
|
||||
id: 0,
|
||||
mode: 'video',
|
||||
site: this.video.key,
|
||||
ids: this.video.info.id,
|
||||
name: this.video.info.name,
|
||||
index: this.video.info.index,
|
||||
time: this.xg.currentTime
|
||||
}
|
||||
} else {
|
||||
doc = {
|
||||
id: 0,
|
||||
mode: 'iptv',
|
||||
url: this.video.iptv.url
|
||||
}
|
||||
async miniEvent () {
|
||||
const win = remote.getCurrentWindow()
|
||||
this.mainWindowBounds = JSON.parse(JSON.stringify(win.getBounds()))
|
||||
let miniWindowBounds
|
||||
await mini.find().then(res => { if (res) miniWindowBounds = res.bounds })
|
||||
if (!miniWindowBounds) miniWindowBounds = { x: win.getPosition()[0], y: win.getPosition()[1], width: 550, height: 340 }
|
||||
win.setBounds(miniWindowBounds)
|
||||
this.xg.getCssFullscreen()
|
||||
this.miniMode = true
|
||||
},
|
||||
async exitMiniEvent () {
|
||||
const win = remote.getCurrentWindow()
|
||||
await mini.find().then(res => {
|
||||
let doc = {}
|
||||
doc = {
|
||||
id: 0,
|
||||
bounds: win.getBounds()
|
||||
}
|
||||
if (res) {
|
||||
mini.update(doc)
|
||||
} else {
|
||||
mini.add(doc)
|
||||
}
|
||||
this.mini = doc
|
||||
clearInterval(this.timer)
|
||||
const win = remote.getCurrentWindow()
|
||||
win.hide()
|
||||
ipcRenderer.send('mini')
|
||||
})
|
||||
win.setBounds(this.mainWindowBounds)
|
||||
this.xg.exitCssFullscreen()
|
||||
this.miniMode = false
|
||||
},
|
||||
shareEvent () {
|
||||
this.share = {
|
||||
@@ -1061,6 +1056,9 @@ export default {
|
||||
return false
|
||||
}
|
||||
if (e === 'escape') {
|
||||
if (this.miniMode) {
|
||||
this.exitMiniEvent()
|
||||
}
|
||||
if (this.xg.fullscreen) {
|
||||
this.xg.exitFullscreen()
|
||||
this.xg.exitCssFullscreen()
|
||||
@@ -1246,6 +1244,10 @@ export default {
|
||||
})
|
||||
},
|
||||
bindEvent () {
|
||||
this.xg.on('exitFullscreen', () => {
|
||||
if (this.miniMode) this.xg.getCssFullscreen()
|
||||
})
|
||||
|
||||
this.xg.on('playNextOne', () => {
|
||||
this.nextEvent()
|
||||
})
|
||||
|
||||
@@ -12,7 +12,8 @@ db.version(4).stores({
|
||||
recommendation: '++id, [key+ids], site, name, detail, index, rate, hasUpdate',
|
||||
sites: '++id, key, name, api, download, isActive, group',
|
||||
history: '++id, [site+ids], name, type, year, index, time, duration, detail',
|
||||
mini: 'id, mode, site, ids, name, index, time, url',
|
||||
// mini: 'id, mode, site, ids, name, index, time, url',
|
||||
mini: 'id, bounds',
|
||||
iptv: '++id, name, url, channelID, isActive',
|
||||
channelList: '++id, name, prefer, channels, group, isActive'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user