From becb337b960b1d731923bfe7e2a4145bc0f8b53b Mon Sep 17 00:00:00 2001 From: mrdong916 Date: Sat, 3 Oct 2020 14:23:09 +0800 Subject: [PATCH] :bookmark: V1.2.0 --- CHANGELOG.md | 28 +++++ package.json | 20 ++-- publish/changeLog.md | 24 +++- publish/version.json | 2 +- src/common/ipcNames.js | 1 - src/common/utils.js | 5 +- src/main/modules/winLyric/event.js | 24 ++-- src/main/modules/winLyric/index.js | 19 ++-- src/main/modules/winLyric/rendererEvent.js | 4 +- src/main/modules/winLyric/utils.js | 106 ++++++++++-------- src/main/rendererEvents/data.js | 2 +- src/main/rendererEvents/playList.js | 16 +-- src/renderer-lyric/App.vue | 6 +- src/renderer-lyric/components/core/Lyric.vue | 24 +++- src/renderer/App.vue | 4 +- src/renderer/components/core/Aside.vue | 16 +-- src/renderer/components/core/Player.vue | 35 ++++-- src/renderer/components/core/PlayerDetail.vue | 12 +- src/renderer/components/core/Toolbar.vue | 6 +- .../components/material/DownloadModal.vue | 2 +- src/renderer/components/material/Input.vue | 19 +--- .../components/material/ListButtons.vue | 18 +-- .../components/material/Pagination.vue | 10 +- .../components/material/SearchInput.vue | 6 +- .../components/material/Selection.vue | 2 +- .../components/material/listAddModal.vue | 4 +- .../material/listAddMultipleModal.vue | 4 +- src/renderer/lang/en-us/core/player.json | 2 + src/renderer/lang/en-us/view/setting.json | 4 +- src/renderer/lang/zh-cn/core/player.json | 2 + src/renderer/lang/zh-cn/view/setting.json | 4 +- src/renderer/lang/zh-tw/core/player.json | 2 + src/renderer/lang/zh-tw/view/setting.json | 4 +- src/renderer/main.js | 1 + src/renderer/plugins/Tips/Tips.js | 30 +++++ src/renderer/plugins/Tips/Tips.vue | 93 +++++++++++++++ src/renderer/plugins/Tips/index.js | 55 +++++++++ src/renderer/plugins/index.js | 1 + src/renderer/store/modules/download.js | 11 +- src/renderer/store/modules/list.js | 4 +- src/renderer/store/mutations.js | 3 + src/renderer/utils/music/kg/lyric.js | 4 +- src/renderer/utils/music/tx/lyric.js | 2 +- src/renderer/utils/music/wy/leaderboard.js | 2 +- src/renderer/views/Leaderboard.vue | 4 +- src/renderer/views/List.vue | 23 ++-- src/renderer/views/Search.vue | 4 +- src/renderer/views/Setting.vue | 57 +++++----- src/renderer/views/SongList.vue | 2 +- 49 files changed, 508 insertions(+), 225 deletions(-) create mode 100644 src/renderer/plugins/Tips/Tips.js create mode 100644 src/renderer/plugins/Tips/Tips.vue create mode 100644 src/renderer/plugins/Tips/index.js diff --git a/CHANGELOG.md b/CHANGELOG.md index f5a75b06..999b087d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,34 @@ Project versioning adheres to [Semantic Versioning](http://semver.org/). Commit convention is based on [Conventional Commits](http://conventionalcommits.org). Change log format is based on [Keep a Changelog](http://keepachangelog.com/). +## [1.2.0](https://github.com/lyswhut/lx-music-desktop/compare/v1.1.1...v1.2.0) - 2020-09-30 + +提前祝大家中秋&国庆快乐~ + +### 新增 + +- 播放控制栏开启/关闭桌面歌词按钮 新增右击按钮时锁定/解锁桌面歌词功能 + +### 优化 + +- 优化我的列表滚动条位置的保存逻辑 +- 更新设置-备份与恢复功能的描述 +- 优化软件内鼠标悬停的提示界面 + +### 修复 + +- 修复桌面歌词窗口不允许拖出桌面之外的位置计算偏移Bug +- 修复网易云KTV嗨榜无法加载的问题 +- 修复初始化搜索历史列表功能 +- 修复重启软件后试听列表与收藏列表无法恢复上次的滚动位置的问题 +- 修复歌曲封面无法嵌入的Bug +- 修复酷狗歌词格式问题 +- 修复关闭切换动画时从搜索候选列表点击内容无效的问题 + +### 其他 + +- 更新 Electron 到 v10.1.3 + ## [1.1.1](https://github.com/lyswhut/lx-music-desktop/compare/v1.1.0...v1.1.1) - 2020-09-19 ### 修复 diff --git a/package.json b/package.json index 0810159e..49892f1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lx-music-desktop", - "version": "1.1.1", + "version": "1.2.0", "description": "一个免费的音乐下载助手", "main": "./dist/electron/main.js", "productName": "洛雪音乐助手(五音版)", @@ -59,7 +59,7 @@ "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-formatter-friendly --fix src" }, "browserslist": [ - "Electron 10.1.2" + "Electron 10.1.3" ], "engines": { "node": ">= 12" @@ -175,23 +175,23 @@ "core-js": "^3.6.5", "cross-env": "^7.0.2", "css-loader": "^4.3.0", - "del": "^5.1.0", - "electron": "^10.1.2", + "del": "^6.0.0", + "electron": "^10.1.3", "electron-builder": "^22.8.1", "electron-debug": "^3.1.0", "electron-devtools-installer": "^3.1.1", - "eslint": "^7.9.0", + "eslint": "^7.10.0", "eslint-config-standard": "^14.1.1", "eslint-formatter-friendly": "^7.0.0", "eslint-loader": "^4.0.2", "eslint-plugin-html": "^6.1.0", - "eslint-plugin-import": "^2.22.0", + "eslint-plugin-import": "^2.22.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^4.2.1", "eslint-plugin-standard": "^4.0.1", "file-loader": "^6.1.0", "friendly-errors-webpack-plugin": "^1.7.0", - "html-webpack-plugin": "^4.4.1", + "html-webpack-plugin": "^4.5.0", "less": "^3.12.2", "less-loader": "^7.0.1", "markdown-it": "^11.0.1", @@ -207,7 +207,7 @@ "spinnies": "^0.5.1", "stylus": "^0.54.8", "stylus-loader": "^3.0.2", - "terser-webpack-plugin": "^4.2.1", + "terser-webpack-plugin": "^4.2.2", "url-loader": "^4.1.0", "vue-loader": "^15.9.3", "vue-template-compiler": "^2.6.12", @@ -228,11 +228,11 @@ "js-htmlencode": "^0.3.0", "lrc-file-parser": "^1.0.5", "needle": "^2.5.2", - "node-id3": "^0.1.18", + "node-id3": "^0.1.19", "request": "^2.88.2", "vue": "^2.6.12", "vue-i18n": "^8.21.1", - "vue-router": "^3.4.3", + "vue-router": "^3.4.5", "vuex": "^3.5.1", "vuex-router-sync": "^5.0.0" } diff --git a/publish/changeLog.md b/publish/changeLog.md index 9a53de65..3be7f95e 100644 --- a/publish/changeLog.md +++ b/publish/changeLog.md @@ -1,3 +1,25 @@ +提前祝大家中秋&国庆快乐~ + +### 新增 + +- 播放控制栏开启/关闭桌面歌词按钮 新增右击按钮时锁定/解锁桌面歌词功能 + +### 优化 + +- 优化我的列表滚动条位置的保存逻辑 +- 更新设置-备份与恢复功能的描述 +- 优化软件内鼠标悬停的提示界面 + ### 修复 -- 修复某些情况下桌面歌词不会播放的问题 +- 修复桌面歌词窗口不允许拖出桌面之外的位置计算偏移Bug +- 修复网易云KTV嗨榜无法加载的问题 +- 修复初始化搜索历史列表功能 +- 修复重启软件后试听列表与收藏列表无法恢复上次的滚动位置的问题 +- 修复歌曲封面无法嵌入的Bug +- 修复酷狗歌词格式问题 +- 修复关闭切换动画时从搜索候选列表点击内容无效的问题 + +### 其他 + +- 更新 Electron 到 v10.1.3 diff --git a/publish/version.json b/publish/version.json index 9433c938..7d418cb2 100644 --- a/publish/version.json +++ b/publish/version.json @@ -1 +1 @@ -{"version":"1.1.1","desc":"

修复

\n\n","history":[{"version":"1.1.0","desc":"

新增

\n\n

修复

\n\n

优化

\n\n

移除

\n\n

其他

\n\n"},{"version":"1.0.1","desc":"

优化

\n\n

修复

\n\n"},{"version":"1.0.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

更变

\n\n

其他

\n\n"},{"version":"0.18.2","desc":"

修复

\n\n"},{"version":"0.18.1","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.18.0","desc":"

新增

\n\n

优化

\n\n

更变

\n\n

修复

\n\n

移除

\n\n

其他

\n

更新 Electron 到 8.2.5

\n"},{"version":"0.17.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.16.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.15.0","desc":"

洛雪提前祝大家新年快乐、身体健康、阖家幸福!

\n

修复

\n\n"},{"version":"0.14.1","desc":"

洛雪提前祝大家新年快乐、身体健康、阖家幸福!

\n

修复

\n\n"},{"version":"0.14.0","desc":"

洛雪提前祝大家新年快乐、身体健康、阖家幸福!

\n

新增

\n\n

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.13.1","desc":"

修复

\n\n

其他

\n\n"},{"version":"0.13.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

移除

\n\n

其他

\n\n"},{"version":"0.12.1","desc":"

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.12.0","desc":"

由于新下载库仍然没有完成,但下载功能已经可用,so 移除之前使用的第三方下载库,暂时把新下载库的下载模块直接加入本程序,若出现下载问题欢迎反馈!

\n

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.11.0","desc":"

新增

\n\n

优化

\n\n"},{"version":"0.10.0","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.9.1","desc":"

修复

\n\n"},{"version":"0.9.0","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.8.2","desc":"

修复

\n\n"},{"version":"0.8.1","desc":"

修复

\n\n"},{"version":"0.8.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.7.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.6.2","desc":"

祝贺祖国成立70周年~!

\n

新增

\n\n

修复

\n\n"},{"version":"0.6.1","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.6.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.5.5","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.5.4","desc":"

移除

\n\n"},{"version":"0.5.3","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.5.2","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.5.1","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.5.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.4.0","desc":"

新增

\n\n

移除

\n\n"},{"version":"0.3.5","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.3.4","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.3.3","desc":"

修复

\n\n"},{"version":"0.3.2","desc":"

新增

\n\n"},{"version":"0.3.1","desc":"

修复

\n\n"},{"version":"0.3.0","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.2.3","desc":"

新增

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.2.2","desc":"

修复

\n\n"},{"version":"0.2.1","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.2.0","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.1.6","desc":"

修复

\n\n"},{"version":"0.1.5","desc":"

新增

\n\n

优化

\n\n"},{"version":"0.1.4","desc":"

新增

\n\n

优化

\n\n"},{"version":"0.1.3","desc":"

新增

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.1.2","desc":"

修复

\n\n"},{"version":"0.1.1","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.1.0","desc":"0.1.0版本发布"}]} +{"version":"1.2.0","desc":"

提前祝大家中秋&国庆快乐~

\n

新增

\n\n

优化

\n\n

修复

\n\n

其他

\n\n","history":[{"version":"1.1.1","desc":"

修复

\n\n"},{"version":"1.1.0","desc":"

新增

\n\n

修复

\n\n

优化

\n\n

移除

\n\n

其他

\n\n"},{"version":"1.0.1","desc":"

优化

\n\n

修复

\n\n"},{"version":"1.0.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

更变

\n\n

其他

\n\n"},{"version":"0.18.2","desc":"

修复

\n\n"},{"version":"0.18.1","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.18.0","desc":"

新增

\n\n

优化

\n\n

更变

\n\n

修复

\n\n

移除

\n\n

其他

\n

更新 Electron 到 8.2.5

\n"},{"version":"0.17.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.16.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.15.0","desc":"

洛雪提前祝大家新年快乐、身体健康、阖家幸福!

\n

修复

\n\n"},{"version":"0.14.1","desc":"

洛雪提前祝大家新年快乐、身体健康、阖家幸福!

\n

修复

\n\n"},{"version":"0.14.0","desc":"

洛雪提前祝大家新年快乐、身体健康、阖家幸福!

\n

新增

\n\n

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.13.1","desc":"

修复

\n\n

其他

\n\n"},{"version":"0.13.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

移除

\n\n

其他

\n\n"},{"version":"0.12.1","desc":"

优化

\n\n

修复

\n\n

其他

\n\n"},{"version":"0.12.0","desc":"

由于新下载库仍然没有完成,但下载功能已经可用,so 移除之前使用的第三方下载库,暂时把新下载库的下载模块直接加入本程序,若出现下载问题欢迎反馈!

\n

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.11.0","desc":"

新增

\n\n

优化

\n\n"},{"version":"0.10.0","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.9.1","desc":"

修复

\n\n"},{"version":"0.9.0","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.8.2","desc":"

修复

\n\n"},{"version":"0.8.1","desc":"

修复

\n\n"},{"version":"0.8.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.7.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.6.2","desc":"

祝贺祖国成立70周年~!

\n

新增

\n\n

修复

\n\n"},{"version":"0.6.1","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.6.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.5.5","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.5.4","desc":"

移除

\n\n"},{"version":"0.5.3","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.5.2","desc":"

新增

\n\n

优化

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.5.1","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.5.0","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.4.0","desc":"

新增

\n\n

移除

\n\n"},{"version":"0.3.5","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.3.4","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.3.3","desc":"

修复

\n\n"},{"version":"0.3.2","desc":"

新增

\n\n"},{"version":"0.3.1","desc":"

修复

\n\n"},{"version":"0.3.0","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.2.3","desc":"

新增

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.2.2","desc":"

修复

\n\n"},{"version":"0.2.1","desc":"

优化

\n\n

修复

\n\n"},{"version":"0.2.0","desc":"

新增

\n\n

修复

\n\n"},{"version":"0.1.6","desc":"

修复

\n\n"},{"version":"0.1.5","desc":"

新增

\n\n

优化

\n\n"},{"version":"0.1.4","desc":"

新增

\n\n

优化

\n\n"},{"version":"0.1.3","desc":"

新增

\n\n

修复

\n\n

移除

\n\n"},{"version":"0.1.2","desc":"

修复

\n\n"},{"version":"0.1.1","desc":"

新增

\n\n

优化

\n\n

修复

\n\n"},{"version":"0.1.0","desc":"0.1.0版本发布"}]} diff --git a/src/common/ipcNames.js b/src/common/ipcNames.js index 9aac43ce..ecc44d9c 100644 --- a/src/common/ipcNames.js +++ b/src/common/ipcNames.js @@ -48,7 +48,6 @@ const names = { get_playlist: 'get_playlist', save_playlist: 'save_playlist', get_data: 'get_data', - set_data: 'set_data', save_data: 'save_data', get_hot_key: 'get_hot_key', }, diff --git a/src/common/utils.js b/src/common/utils.js index 47fee60c..ae274f99 100644 --- a/src/common/utils.js +++ b/src/common/utils.js @@ -173,10 +173,11 @@ exports.initSetting = () => { // 迁移列表滚动位置设置 ~0.18.3 if (setting.list.scroll) { let scroll = setting.list.scroll - electronStore_list.set('defaultList.location', scroll.locations.defaultList || 0) - electronStore_list.set('loveList.location', scroll.locations.loveList || 0) + electronStore_list.set('defaultList.location', scroll.locations.default || 0) + electronStore_list.set('loveList.location', scroll.locations.love || 0) electronStore_config.delete('setting.list.scroll') electronStore_config.set('setting.list.isSaveScrollLocation', scroll.enable) + delete setting.list.scroll } } diff --git a/src/main/modules/winLyric/event.js b/src/main/modules/winLyric/event.js index 513adc16..43de0f63 100644 --- a/src/main/modules/winLyric/event.js +++ b/src/main/modules/winLyric/event.js @@ -1,7 +1,7 @@ const { common: COMMON_EVENT_NAME, winLyric: WIN_LYRIC_EVENT_NAME, hotKey: HOT_KEY_EVENT_NAME, mainWindow: MAIN_WINDOW_EVENT_NAME } = require('../../events/_name') const { mainSend, NAMES: { winLyric: ipcWinLyricNames } } = require('../../../common/ipc') const { desktop_lyric } = require('../../../common/hotKey') -const { setLyricWindow } = require('./utils') +const { getLyricWindowBounds } = require('./utils') let isLock = null let isEnable = null @@ -27,6 +27,17 @@ const setLrcConfig = () => { isAlwaysOnTop = desktopLyric.isAlwaysOnTop global.modules.lyricWindow.setAlwaysOnTop(desktopLyric.isAlwaysOnTop, 'screen-saver') } + if (isLockScreen != desktopLyric.isLockScreen) { + isLockScreen = desktopLyric.isLockScreen + if (desktopLyric.isLockScreen) { + global.modules.lyricWindow.setBounds(getLyricWindowBounds(global.modules.lyricWindow.getBounds(), { + x: null, + y: null, + w: desktopLyric.width, + h: desktopLyric.height, + })) + } + } } if (isEnable != desktopLyric.enable) { isEnable = desktopLyric.enable @@ -36,17 +47,6 @@ const setLrcConfig = () => { global.lx_event.winLyric.close() } } - if (isLockScreen != desktopLyric.isLockScreen) { - isLockScreen = desktopLyric.isLockScreen - if (desktopLyric.isLockScreen) { - setLyricWindow({ - x: desktopLyric.x, - y: desktopLyric.y, - w: desktopLyric.width, - h: desktopLyric.height, - }) - } - } } global.lx_event.common.on(COMMON_EVENT_NAME.config, name => { if (WIN_LYRIC_EVENT_NAME.name === name) return diff --git a/src/main/modules/winLyric/index.js b/src/main/modules/winLyric/index.js index 3b2e150d..49cf2cb5 100644 --- a/src/main/modules/winLyric/index.js +++ b/src/main/modules/winLyric/index.js @@ -1,6 +1,7 @@ const { BrowserWindow } = require('electron') const { winLyric: WIN_LYRIC_EVENT_NAME } = require('../../events/_name') const { debounce } = require('../../../common/utils') +const { getLyricWindowBounds } = require('./utils') require('./event') require('./rendererEvent') @@ -67,29 +68,29 @@ const winEvent = lyricWindow => { }) } -let offset = 8 const createWindow = () => { if (global.modules.lyricWindow) return if (!global.appSetting.desktopLyric.enable) return // const windowSizeInfo = getWindowSizeInfo(global.appSetting) let { x, y, width, height, isAlwaysOnTop } = global.appSetting.desktopLyric let { width: screenWidth, height: screenHeight } = global.envParams.workAreaSize - screenWidth += offset * 2 - screenHeight += offset * 2 if (x == null) { - x = screenWidth - width - offset - y = screenHeight - height - offset + x = screenWidth - width + y = screenHeight - height } if (global.appSetting.desktopLyric.isLockScreen) { - x = Math.max(-offset, screenWidth < (width + x) ? screenWidth - width : x) - y = Math.max(-offset, screenHeight < (height + y) ? screenHeight - height : y) + let bounds = getLyricWindowBounds({ x, y, width, height }, { x: null, y: null, w: width, h: height }) + x = bounds.x + y = bounds.y + width = bounds.width + height = bounds.height } /** * Initial window options */ global.modules.lyricWindow = new BrowserWindow({ - height: Math.max(height > screenHeight ? screenHeight : height, 80), - width: Math.max(width > screenWidth ? screenWidth : width, 380), + height, + width, x, y, minWidth: 380, diff --git a/src/main/modules/winLyric/rendererEvent.js b/src/main/modules/winLyric/rendererEvent.js index 75d38dbc..ce8721a8 100644 --- a/src/main/modules/winLyric/rendererEvent.js +++ b/src/main/modules/winLyric/rendererEvent.js @@ -8,7 +8,7 @@ const { }, } = require('../../../common/ipc') const { winLyric: WIN_LYRIC_EVENT_NAME } = require('../../events/_name') -const { setLyricWindow } = require('./utils') +const { getLyricWindowBounds } = require('./utils') mainOn(ipcWinLyricNames.get_lyric_info, (event, action) => { if (!global.modules.mainWindow) return @@ -28,5 +28,5 @@ mainHandle(ipcWinLyricNames.get_lyric_config, async() => { }) mainOn(ipcWinLyricNames.set_win_bounds, (event, options) => { - setLyricWindow(options) + global.modules.lyricWindow.setBounds(getLyricWindowBounds(global.modules.lyricWindow.getBounds(), options)) }) diff --git a/src/main/modules/winLyric/utils.js b/src/main/modules/winLyric/utils.js index 48c891eb..a82c1a23 100644 --- a/src/main/modules/winLyric/utils.js +++ b/src/main/modules/winLyric/utils.js @@ -1,56 +1,68 @@ // 设置窗口位置、大小 -let bounds let winX let winY let wasW -let wasY +let wasH let offset = 8 -exports.setLyricWindow = ({ x = 0, y = 0, w = 0, h = 0 }) => { - if (!global.modules.lyricWindow) return - bounds = global.modules.lyricWindow.getBounds() - wasW = global.envParams.workAreaSize.width - wasY = global.envParams.workAreaSize.height + offset +let minWidth = 380 +let minHeight = 80 +exports.getLyricWindowBounds = (bounds, { x = 0, y = 0, w = 0, h = 0 }) => { + if (w < minWidth) w = minWidth + if (h < minHeight) h = minHeight + + if (global.appSetting.desktopLyric.isLockScreen) { + wasW = global.envParams.workAreaSize.width + offset + wasH = global.envParams.workAreaSize.height + offset + if (w > wasW + offset) w = wasW + offset + if (h > wasH + offset) h = wasH + offset + if (x == null) { + if (bounds.x > wasW - w) { + x = wasW - w - bounds.x + } else if (bounds.x < -offset) { + x = bounds.x + offset + } else { + x = 0 + } + if (bounds.y > wasH - h) { + y = wasH - h - bounds.y + } else if (bounds.y < -offset) { + y = bounds.y + offset + } else { + y = 0 + } + } + winX = bounds.x + x + winY = bounds.y + y + + if (x != 0) { + if (winX < -offset) { + winX = -offset + } else if (winX + w > wasW) { + winX = wasW - w + } + } + if (y != 0) { + if (winY < -offset) { + winY = -offset + } else if (winY + h > wasH) { + winY = wasH - h + } + } + + x = winX + y = winY + + if (x + w > wasW) w = wasW - x + if (y + h > wasH) h = wasH - y + } else { + y += bounds.y + x += bounds.x + } bounds.width = w bounds.height = h - if (bounds.width > wasW - offset) { - bounds.width = wasW - offset - } else if (bounds.width < 380) { - bounds.width = 380 - } - if (bounds.height > wasY) { - bounds.height = wasY + offset - } else if (bounds.height < 80) { - bounds.height = 80 - } - - if (global.appSetting.desktopLyric.isLockScreen) { - if (x != 0) { - winX = bounds.x + x - if (winX > wasW - bounds.width + offset) { - winX = wasW - bounds.width + offset - } else if (winX < -offset) { - winX = -offset - } - bounds.x = winX - } - if (y != 0) { - winY = bounds.y + y - if (winY > wasY - bounds.height) { - winY = wasY - bounds.height - } else if (winY < -offset) { - winY = -offset - } - bounds.y = winY - } - } else { - if (x != 0) { - bounds.x = bounds.x + x - } - if (y != 0) { - bounds.y = bounds.y + y - } - } - // console.log(bounds, x, y, w, h) - global.modules.lyricWindow.setBounds(bounds) + bounds.x = x + bounds.y = y + // console.log('util bounds', bounds) + return bounds } diff --git a/src/main/rendererEvents/data.js b/src/main/rendererEvents/data.js index 18cdf81a..f8e23c42 100644 --- a/src/main/rendererEvents/data.js +++ b/src/main/rendererEvents/data.js @@ -9,4 +9,4 @@ const electronStore_data = new Store({ mainHandle(ipcMainWindowNames.get_data, async(event, path) => electronStore_data.get(path)) -mainOn(ipcMainWindowNames.save_data, (event, { path, data }) => electronStore_data.get(path, data)) +mainOn(ipcMainWindowNames.save_data, (event, { path, data }) => electronStore_data.set(path, data)) diff --git a/src/main/rendererEvents/playList.js b/src/main/rendererEvents/playList.js index 32d15aa1..219046da 100644 --- a/src/main/rendererEvents/playList.js +++ b/src/main/rendererEvents/playList.js @@ -2,15 +2,15 @@ const Store = require('electron-store') const { mainOn, NAMES: { mainWindow: ipcMainWindowNames }, mainHandle } = require('../../common/ipc') -const electronStore_list = new Store({ - name: 'playList', -}) +let electronStore_list mainHandle(ipcMainWindowNames.get_playlist, async(event, isIgnoredError = false) => { - let electronStore_list = new Store({ - name: 'playList', - clearInvalidConfig: !isIgnoredError, - }) + if (!electronStore_list) { + electronStore_list = new Store({ + name: 'playList', + clearInvalidConfig: !isIgnoredError, + }) + } return { defaultList: electronStore_list.get('defaultList'), @@ -20,4 +20,4 @@ mainHandle(ipcMainWindowNames.get_playlist, async(event, isIgnoredError = false) } }) -mainOn(ipcMainWindowNames.save_playlist, (event, { type, data }) => electronStore_list.set(type, data)) +mainOn(ipcMainWindowNames.save_playlist, (event, { type, data }) => electronStore_list && electronStore_list.set(type, data)) diff --git a/src/renderer-lyric/App.vue b/src/renderer-lyric/App.vue index c66cfd67..d77e9c38 100644 --- a/src/renderer-lyric/App.vue +++ b/src/renderer-lyric/App.vue @@ -4,7 +4,7 @@ transition(enter-active-class="animated-fast fadeIn" leave-active-class="animated-fast fadeOut") .control-bar(v-show="!lrcConfig.isLock") core-control-bar(:lrcConfig="lrcConfig" :themes="themeList") - core-lyric(:lrcConfig="lrcConfig") + core-lyric(:lrcConfig="lrcConfig" :isShowLyricTransition="isShowLyricTransition") div.resize-left(@mousedown.self="handleMouseDown('left', $event)") div.resize-top(@mousedown.self="handleMouseDown('top', $event)") div.resize-right(@mousedown.self="handleMouseDown('right', $event)") @@ -44,6 +44,7 @@ export default { isZoomActiveLrc: true, }, }, + isShowLyricTransition: true, themeList: [ { id: 0, @@ -117,8 +118,9 @@ export default { document.removeEventListener('mouseup', this.handleMouseUp) }, methods: { - handleUpdateConfig({ config, languageId }) { + handleUpdateConfig({ config, languageId, isShowLyricTransition }) { this.lrcConfig = config + this.isShowLyricTransition = isShowLyricTransition if (this.$i18n.locale !== languageId && languageId != null) this.$i18n.locale = languageId }, handleMouseDown(origin, event) { diff --git a/src/renderer-lyric/components/core/Lyric.vue b/src/renderer-lyric/components/core/Lyric.vue index 4949341a..c73bd333 100644 --- a/src/renderer-lyric/components/core/Lyric.vue +++ b/src/renderer-lyric/components/core/Lyric.vue @@ -27,6 +27,10 @@ export default { } }, }, + isShowLyricTransition: { + type: Boolean, + default: true, + }, }, data() { return { @@ -58,6 +62,10 @@ export default { lyricLines: [], isSetedLines: false, isPlay: false, + lyrics: { + lyric: '', + tlyric: '', + }, } }, computed: { @@ -112,6 +120,11 @@ export default { }, immediate: true, }, + isShowLyricTransition(n) { + console.log(n) + this.setLyric() + rendererSend(NAMES.winLyric.get_lyric_info, 'status') + }, }, created() { rendererOn(NAMES.winLyric.set_lyric_info, (event, data) => this.handleSetInfo(data)) @@ -144,7 +157,9 @@ export default { // console.log(type, data) switch (type) { case 'lyric': - window.lrc.setLyric(data) + this.lyrics.lyric = data.lrc + this.lyrics.tlyric = data.tlrc + this.setLyric() break case 'play': this.isPlay = true @@ -156,7 +171,9 @@ export default { break case 'info': // console.log('info', data) - window.lrc.setLyric(data.lyric) + this.lyrics.lyric = data.lyric + this.lyrics.tlyric = data.tlyric + this.setLyric() this.$nextTick(() => { this.lyric.line = data.line rendererSend(NAMES.winLyric.get_lyric_info, 'status') @@ -261,6 +278,9 @@ export default { close() { rendererSend(NAMES.winLyric.close) }, + setLyric() { + window.lrc.setLyric((this.isShowLyricTransition && this.lyrics.tlyric ? this.lyrics.tlyric + '\n' : '') + this.lyrics.lyric) + }, }, } diff --git a/src/renderer/App.vue b/src/renderer/App.vue index 7b94dfbd..d9b4d3b5 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -94,7 +94,7 @@ export default { }) }, 1000) this.saveSearchHistoryList = throttle(n => { - rendererSend(NAMES.mainWindow.set_data, { + rendererSend(NAMES.mainWindow.save_data, { path: 'searchHistoryList', data: n, }) @@ -292,7 +292,7 @@ export default { rendererInvoke(NAMES.mainWindow.get_data, 'searchHistoryList').then(historyList => { if (historyList == null) { historyList = [] - rendererInvoke(NAMES.mainWindow.set_data, { path: 'searchHistoryList', data: historyList }) + rendererSend(NAMES.mainWindow.save_data, { path: 'searchHistoryList', data: historyList }) } else { this.setSearchHistoryList(historyList) } diff --git a/src/renderer/components/core/Aside.vue b/src/renderer/components/core/Aside.vue index 73099a60..4bef41a1 100644 --- a/src/renderer/components/core/Aside.vue +++ b/src/renderer/components/core/Aside.vue @@ -1,10 +1,10 @@ diff --git a/src/renderer/components/core/Toolbar.vue b/src/renderer/components/core/Toolbar.vue index 5ed938a8..e9f3bdbb 100644 --- a/src/renderer/components/core/Toolbar.vue +++ b/src/renderer/components/core/Toolbar.vue @@ -6,14 +6,14 @@ @event="handleEvent" :list="tipList" :visibleList="visibleList" v-model="searchText") - div(:class="$style.logo" v-if="setting.controlBtnPosition == 'left'") + div(:class="$style.logo" v-if="setting.controlBtnPosition == 'left'") div(:class="$style.control" v-else) - button(type="button" :class="$style.min" :title="$t('core.toolbar.min')" @click="min") + button(type="button" :class="$style.min" :tips="$t('core.toolbar.min')" @click="min") svg(:class="$style.icon" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='100%' viewBox='0 0 24 24' space='preserve') use(xlink:href='#icon-window-minimize') //- button(type="button" :class="$style.max" @click="max") - button(type="button" :class="$style.close" :title="$t('core.toolbar.close')" @click="close") + button(type="button" :class="$style.close" :tips="$t('core.toolbar.close')" @click="close") svg(:class="$style.icon" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='100%' viewBox='0 0 24 24' space='preserve') use(xlink:href='#icon-window-close') diff --git a/src/renderer/components/material/DownloadModal.vue b/src/renderer/components/material/DownloadModal.vue index b2f01afd..d47d02d6 100644 --- a/src/renderer/components/material/DownloadModal.vue +++ b/src/renderer/components/material/DownloadModal.vue @@ -5,7 +5,7 @@ material-modal(:show="show" :bg-close="bgClose" @close="handleClose") | {{ info.name }} br | {{ info.singer }} - material-btn(:class="$style.btn" v-if="checkSource(type.type)" :title="!checkSource(type.type) && $t('material.download_modal.btn_tip')" :disabled="!checkSource(type.type)" :key="type.type" @click="handleClick(type.type)" v-for="type in info.types") {{getTypeName(type.type)}} {{ type.type.toUpperCase() }}{{ type.size && ` - ${type.size.toUpperCase()}` }} + material-btn(:class="$style.btn" v-if="checkSource(type.type)" :tips="!checkSource(type.type) && $t('material.download_modal.btn_tip')" :disabled="!checkSource(type.type)" :key="type.type" @click="handleClick(type.type)" v-for="type in info.types") {{getTypeName(type.type)}} {{ type.type.toUpperCase() }}{{ type.size && ` - ${type.size.toUpperCase()}` }} diff --git a/src/renderer/components/material/Input.vue b/src/renderer/components/material/Input.vue index 6928667a..958bbecf 100644 --- a/src/renderer/components/material/Input.vue +++ b/src/renderer/components/material/Input.vue @@ -1,6 +1,6 @@ @@ -24,21 +24,6 @@ export default { default: 'text', }, }, - data() { - return { - text: '', - } - }, - watch: { - value(n) { - this.text = n - }, - }, - methods: { - handleInput() { - - }, - }, } diff --git a/src/renderer/components/material/ListButtons.vue b/src/renderer/components/material/ListButtons.vue index aa588b26..2189b1b3 100644 --- a/src/renderer/components/material/ListButtons.vue +++ b/src/renderer/components/material/ListButtons.vue @@ -1,30 +1,30 @@ + + diff --git a/src/renderer/plugins/Tips/index.js b/src/renderer/plugins/Tips/index.js new file mode 100644 index 00000000..4e2aee98 --- /dev/null +++ b/src/renderer/plugins/Tips/index.js @@ -0,0 +1,55 @@ +import tips from './Tips' +import { debounce } from '../../utils' + +let instance +let prevTips + +const getTips = el => el.getAttribute('tips') + ? el.getAttribute('tips') + : el.parentNode === document.documentElement + ? null + : getTips(el.parentNode) + +const showTips = debounce(event => { + let msg = getTips(event.target) + if (!msg) return + prevTips = msg + instance = tips({ + message: msg, + position: { + top: event.y + 12, + left: event.x + 8, + }, + }) +}, 400) + +const hideTips = () => { + if (!instance) return + instance.cancel() + prevTips = null + instance = null +} + +const setTips = tips => { + if (!instance) return + instance.setTips(tips) +} + +const updateTips = event => { + if (!instance) return + setTimeout(() => { + let msg = getTips(event.target) + if (!msg || prevTips === msg) return + setTips(msg) + prevTips = msg + }) +} + +document.body.addEventListener('mousemove', event => { + hideTips() + showTips(event) +}) + +document.body.addEventListener('click', updateTips) + +document.body.addEventListener('contextmenu', updateTips) diff --git a/src/renderer/plugins/index.js b/src/renderer/plugins/index.js index bff0ea0f..e94f9bdc 100644 --- a/src/renderer/plugins/index.js +++ b/src/renderer/plugins/index.js @@ -1 +1,2 @@ // import './axios' +import './Tips' diff --git a/src/renderer/store/modules/download.js b/src/renderer/store/modules/download.js index e62bbeac..13e30e00 100644 --- a/src/renderer/store/modules/download.js +++ b/src/renderer/store/modules/download.js @@ -158,6 +158,9 @@ const getUrl = (downloadInfo, isRefresh) => { return url && !isRefresh ? Promise.resolve({ url }) : music[downloadInfo.musicInfo.source].getMusicUrl(downloadInfo.musicInfo, downloadInfo.type).promise } +// 修复 1.1.x版本 酷狗源歌词格式 +const fixKgLyric = lrc => /\[00:\d\d:\d\d.\d+\]/.test(lrc) ? lrc.replace(/(?:\[00:(\d\d:\d\d.\d+\]))/gm, '[$1') : lrc + /** * 设置歌曲meta信息 * @param {*} downloadInfo @@ -184,7 +187,8 @@ const saveMeta = (downloadInfo, filePath, isEmbedPic, isEmbedLyric) => { }) : Promise.resolve(), ] - Promise.all(tasks).then(([imgUrl, lyrics]) => { + Promise.all(tasks).then(([imgUrl, lyrics = {}]) => { + if (lyrics.lyric) lyrics.lyric = fixKgLyric(lyrics.lyric) setMeta(filePath, { title: downloadInfo.musicInfo.name, artist: downloadInfo.musicInfo.singer, @@ -205,7 +209,10 @@ const downloadLyric = (downloadInfo, filePath) => { ? Promise.resolve({ lyric: downloadInfo.musicInfo.lrc, tlyric: downloadInfo.musicInfo.tlrc || '' }) : music[downloadInfo.musicInfo.source].getLyric(downloadInfo.musicInfo).promise promise.then(lrcs => { - if (lrcs.lyric) saveLrc(filePath.replace(/(mp3|flac|ape|wav)$/, 'lrc'), lrcs.lyric) + if (lrcs.lyric) { + lrcs.lyric = fixKgLyric(lrcs.lyric) + saveLrc(filePath.replace(/(mp3|flac|ape|wav)$/, 'lrc'), lrcs.lyric) + } }) } diff --git a/src/renderer/store/modules/list.js b/src/renderer/store/modules/list.js index 04978ce3..e46f2782 100644 --- a/src/renderer/store/modules/list.js +++ b/src/renderer/store/modules/list.js @@ -54,8 +54,8 @@ const actions = { // mitations const mutations = { initList(state, { defaultList, loveList, userList }) { - if (defaultList != null) state.defaultList.list = defaultList.list - if (loveList != null) state.loveList.list = loveList.list + if (defaultList != null) Object.assign(state.defaultList, { list: defaultList.list, location: defaultList.location }) + if (loveList != null) Object.assign(state.loveList, { list: loveList.list, location: loveList.location }) if (userList != null) state.userList = userList allListInit(state.defaultList, state.loveList, state.userList) state.isInitedList = true diff --git a/src/renderer/store/mutations.js b/src/renderer/store/mutations.js index 8e23cb76..5cd60e33 100644 --- a/src/renderer/store/mutations.js +++ b/src/renderer/store/mutations.js @@ -55,6 +55,9 @@ export default { setVisibleDesktopLyric(state, val) { state.setting.desktopLyric.enable = val }, + setLockDesktopLyric(state, val) { + state.setting.desktopLyric.isLock = val + }, setMediaDeviceId(state, val) { state.setting.player.mediaDeviceId = val }, diff --git a/src/renderer/utils/music/kg/lyric.js b/src/renderer/utils/music/kg/lyric.js index 52b66612..e5398e24 100644 --- a/src/renderer/utils/music/kg/lyric.js +++ b/src/renderer/utils/music/kg/lyric.js @@ -21,12 +21,10 @@ const parseLyric = str => { let time = parseInt(result[2]) let ms = time % 1000 time /= 1000 - let h = parseInt(time / 3600).toString().padStart(2, '0') - time %= 3600 let m = parseInt(time / 60).toString().padStart(2, '0') time %= 60 let s = parseInt(time).toString().padStart(2, '0') - time = `${h}:${m}:${s}.${ms}` + time = `${m}:${s}.${ms}` if (tlyric) tlyric[i] = `[${time}]${tlyric[i++][0]}` return str.replace(result[1], time) }) diff --git a/src/renderer/utils/music/tx/lyric.js b/src/renderer/utils/music/tx/lyric.js index 3feac17c..a371a6e7 100644 --- a/src/renderer/utils/music/tx/lyric.js +++ b/src/renderer/utils/music/tx/lyric.js @@ -12,7 +12,7 @@ export default { }, }) requestObj.promise = requestObj.promise.then(({ body }) => { - if (body.code != 0) return Promise.reject(new Error('ȡʧ')) + if (body.code != 0) return Promise.reject(new Error('获取歌词失败')) return { lyric: decodeName(b64DecodeUnicode(body.lyric)), tlyric: decodeName(b64DecodeUnicode(body.trans)), diff --git a/src/renderer/utils/music/wy/leaderboard.js b/src/renderer/utils/music/wy/leaderboard.js index 02a9218e..dd6aa60d 100644 --- a/src/renderer/utils/music/wy/leaderboard.js +++ b/src/renderer/utils/music/wy/leaderboard.js @@ -16,7 +16,7 @@ const topList = [ { id: 'wy__991319590', bangid: '991319590', name: '云音乐说唱榜' }, { id: 'wy__180106', bangid: '180106', name: 'UK排行榜周榜' }, { id: 'wy__60198', bangid: '60198', name: '美国Billboard周榜' }, - { id: '21845217', bangid: '21845217', name: 'KTV嗨榜' }, + { id: 'wy__21845217', bangid: '21845217', name: 'KTV嗨榜' }, { id: 'wy__11641012', bangid: '11641012', name: 'iTunes榜' }, { id: 'wy__120001', bangid: '120001', name: 'Hit FM Top榜' }, { id: 'wy__60131', bangid: '60131', name: '日本Oricon周榜' }, diff --git a/src/renderer/views/Leaderboard.vue b/src/renderer/views/Leaderboard.vue index c95c7d72..7d90705f 100644 --- a/src/renderer/views/Leaderboard.vue +++ b/src/renderer/views/Leaderboard.vue @@ -7,11 +7,11 @@ div(:class="$style.listsSelect") //- h2(:class="$style.listsTitle") {{$t('core.aside.my_list')}} material-selection(:class="$style.select" :list="sources" item-key="id" item-name="name" v-model="source") - //- button(:class="$style.listsAdd" @click="handleShowNewList" :title="$t('view.list.lists_new_list_btn')") + //- button(:class="$style.listsAdd" @click="handleShowNewList" :tips="$t('view.list.lists_new_list_btn')") svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='70%' viewBox='0 0 24 24' space='preserve') use(xlink:href='#icon-list-add') ul.scroll(:class="$style.listsContent" ref="dom_lists_list") - li(:class="[$style.listsItem, item.id == tabId ? $style.active : null]" :title="item.name" v-for="item in boardList" :key="item.id" @click="handleToggleList(item.id)") + li(:class="[$style.listsItem, item.id == tabId ? $style.active : null]" :tips="item.name" v-for="item in boardList" :key="item.id" @click="handleToggleList(item.id)") span(:class="$style.listsLabel") {{item.name}} div(:class="$style.list") material-song-list(v-model="selectedData" :rowWidth="{r1: '5%', r2: 'auto', r3: '22%', r4: '22%', r5: '9%', r6: '15%'}" @action="handleSongListAction" :source="source" :page="page" :limit="info.limit" :total="info.total" :noItem="$t('material.song_list.loding_list')" :list="list") diff --git a/src/renderer/views/List.vue b/src/renderer/views/List.vue index 79b75cba..251e2b2a 100644 --- a/src/renderer/views/List.vue +++ b/src/renderer/views/List.vue @@ -3,15 +3,15 @@ div(:class="$style.lists" ref="dom_lists") div(:class="$style.listHeader") h2(:class="$style.listsTitle") {{$t('core.aside.my_list')}} - button(:class="$style.listsAdd" @click="handleShowNewList" :title="$t('view.list.lists_new_list_btn')") + button(:class="$style.listsAdd" @click="handleShowNewList" :tips="$t('view.list.lists_new_list_btn')") svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='70%' viewBox='0 0 24 24' space='preserve') use(xlink:href='#icon-list-add') ul.scroll(:class="$style.listsContent" ref="dom_lists_list") - li(:class="[$style.listsItem, defaultList.id == listId ? $style.active : null]" :title="defaultList.name" @click="handleListToggle(defaultList.id)") + li(:class="[$style.listsItem, defaultList.id == listId ? $style.active : null]" :tips="defaultList.name" @click="handleListToggle(defaultList.id)") span(:class="$style.listsLabel") {{defaultList.name}} - li(:class="[$style.listsItem, loveList.id == listId ? $style.active : null]" :title="loveList.name" @click="handleListToggle(loveList.id)") + li(:class="[$style.listsItem, loveList.id == listId ? $style.active : null]" :tips="loveList.name" @click="handleListToggle(loveList.id)") span(:class="$style.listsLabel") {{loveList.name}} - li.user-list(:class="[$style.listsItem, item.id == listId ? $style.active : null, listsData.rightClickItemIndex == index ? $style.clicked : null]" @contextmenu="handleListsItemRigthClick($event, index)" :title="item.name" v-for="(item, index) in userList" :key="item.id") + li.user-list(:class="[$style.listsItem, item.id == listId ? $style.active : null, listsData.rightClickItemIndex == index ? $style.clicked : null]" @contextmenu="handleListsItemRigthClick($event, index)" :tips="item.name" v-for="(item, index) in userList" :key="item.id") span(:class="$style.listsLabel" @click="handleListToggle(item.id, index + 2)") {{item.name}} input.key-bind(:class="$style.listsInput" @contextmenu.stop type="text" @keyup.enter="handleListsSave(index, $event)" @blur="handleListsSave(index, $event)" :value="item.name" :placeholder="item.name") transition(enter-active-class="animated-fast slideInLeft" leave-active-class="animated-fast fadeOut" @after-leave="handleListsNewAfterLeave") @@ -86,7 +86,6 @@ export default { // isShowEditBtn: false, isShowDownloadMultiple: false, delayShow: false, - routeLeaveLocation: null, isShowListAdd: false, isShowListAddMultiple: false, delayTimeout: null, @@ -289,18 +288,14 @@ export default { // }, beforeRouteLeave(to, from, next) { this.clearDelayTimeout() - this.routeLeaveLocation = (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 + this.setListScroll({ id: this.listId, location: (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 }) next() }, created() { this.listId = this.$route.query.id || this.defaultList.id this.setPrevSelectListId(this.listId) - this.handleScroll = throttle(e => { - if (this.routeLeaveLocation) { - this.setListScroll({ id: this.listId, location: this.routeLeaveLocation }) - } else { - this.setListScroll({ id: this.listId, location: e.target.scrollTop }) - } + this.handleSaveScroll = throttle((listId, location) => { + this.setListScroll({ id: listId, location }) }, 1000) this.listenEvent() }, @@ -310,6 +305,7 @@ export default { }, beforeDestroy() { this.unlistenEvent() + this.setListScroll({ id: this.listId, location: (this.list.length && this.$refs.dom_scrollContent.scrollTop) || 0 }) }, methods: { ...mapMutations(['setPrevSelectListId']), @@ -369,6 +365,9 @@ export default { this.restoreScroll(this.$route.query.scrollIndex, false) } }, + handleScroll(e) { + this.handleSaveScroll(this.listId, e.target.scrollTop) + }, clearDelayTimeout() { if (this.delayTimeout) { clearTimeout(this.delayTimeout) diff --git a/src/renderer/views/Search.vue b/src/renderer/views/Search.vue index 05380d14..ccfcb344 100644 --- a/src/renderer/views/Search.vue +++ b/src/renderer/views/Search.vue @@ -45,10 +45,10 @@ dl(:class="$style.noitemList" v-if="setting.search.isShowHistorySearch && historyList.length") dt(:class="$style.noitemListTitle") span {{$t('view.search.history_search')}} - span(:class="$style.historyClearBtn" @click="clearHistory" :title="$t('view.search.history_clear')") + span(:class="$style.historyClearBtn" @click="clearHistory" :tips="$t('view.search.history_clear')") svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 512 512' space='preserve') use(xlink:href='#icon-eraser') - dd(:class="$style.noitemListItem" v-for="(item, index) in historyList" @contextmenu="removeHistory(index)" :key="index + item" @click="handleNoitemSearch(item)" :title="$t('view.search.history_remove')") {{item}} + dd(:class="$style.noitemListItem" v-for="(item, index) in historyList" @contextmenu="removeHistory(index)" :key="index + item" @click="handleNoitemSearch(item)" :tips="$t('view.search.history_remove')") {{item}} div(v-else :class="$style.noitem_list") p {{$t('view.search.no_item')}} material-download-modal(:show="isShowDownload" :musicInfo="musicInfo" @select="handleAddDownload" @close="isShowDownload = false") diff --git a/src/renderer/views/Setting.vue b/src/renderer/views/Setting.vue index 484f72cf..2bf3b452 100644 --- a/src/renderer/views/Setting.vue +++ b/src/renderer/views/Setting.vue @@ -6,7 +6,7 @@ div.scroll(:class="$style.setting") h3 {{$t('view.setting.basic_theme')}} div ul(:class="$style.theme") - li(v-for="theme in themes.list" :key="theme.id" :title="$t('store.state.theme_' + theme.class)" @click="current_setting.themeId = theme.id" :class="[theme.class, themes.active == theme.id ? $style.active : '']") + li(v-for="theme in themes.list" :key="theme.id" :tips="$t('store.state.theme_' + theme.class)" @click="current_setting.themeId = theme.id" :class="[theme.class, themes.active == theme.id ? $style.active : '']") span label {{$t('store.state.theme_' + theme.class)}} @@ -15,37 +15,37 @@ div.scroll(:class="$style.setting") div material-checkbox(id="setting_show_animate" v-model="current_setting.isShowAnimation" :label="$t('view.setting.is_show')") - dd(:title="$t('view.setting.basic_animation_title')") + dd(:tips="$t('view.setting.basic_animation_title')") h3 {{$t('view.setting.basic_animation')}} div material-checkbox(id="setting_animate" v-model="current_setting.randomAnimate" :label="$t('view.setting.is_enable')") - dd(:title="$t('view.setting.basic_source_title')") + dd(:tips="$t('view.setting.basic_source_title')") h3 {{$t('view.setting.basic_source')}} div div(v-for="item in apiSources" :key="item.id" :class="$style.gapTop") material-checkbox(:id="`setting_api_source_${item.id}`" name="setting_api_source" @change="handleAPISourceChange(item.id)" need v-model="current_setting.apiSource" :disabled="item.disabled" :value="item.id" :label="item.label") - dd(:title="$t('view.setting.basic_to_tray_title')") + dd(:tips="$t('view.setting.basic_to_tray_title')") h3 {{$t('view.setting.basic_to_tray')}} div material-checkbox(id="setting_to_tray" v-model="current_setting.tray.isShow" @change="handleTrayShowChange" :label="$t('view.setting.is_enable')") - dd(:title="$t('view.setting.basic_window_size_title')") + dd(:tips="$t('view.setting.basic_window_size_title')") h3 {{$t('view.setting.basic_window_size')}} div material-checkbox(v-for="(item, index) in windowSizeList" :id="`setting_window_size_${item.id}`" name="setting_window_size" @change="handleWindowSizeChange" :class="$style.gapLeft" need v-model="current_setting.windowSizeId" :value="item.id" :label="$t('view.setting.basic_window_size_' + item.name)" :key="item.id") - dd(:title="$t('view.setting.basic_lang_title')") + dd(:tips="$t('view.setting.basic_lang_title')") h3 {{$t('view.setting.basic_lang')}} div material-checkbox(v-for="item in languageList" :key="item.locale" :id="`setting_lang_${item.locale}`" name="setting_lang" @change="handleLangChange(item.locale)" :class="$style.gapLeft" need v-model="current_setting.langId" :value="item.locale" :label="item.name") - dd(:title="$t('view.setting.basic_sourcename_title')") + dd(:tips="$t('view.setting.basic_sourcename_title')") h3 {{$t('view.setting.basic_sourcename')}} div material-checkbox(v-for="item in sourceNameTypes" :key="item.id" :class="$style.gapLeft" :id="`setting_abasic_sourcename_${item.id}`" @@ -58,7 +58,7 @@ div.scroll(:class="$style.setting") name="setting_basic_control_btn_position" need v-model="current_setting.controlBtnPosition" :value="item.id" :label="item.name") dt {{$t('view.setting.play')}} - dd(:title="$t('view.setting.play_toggle_title')") + dd(:tips="$t('view.setting.play_toggle_title')") h3 {{$t('view.setting.play_toggle')}} div material-checkbox(:id="`setting_player_togglePlay_${item.value}`" :class="$style.gapLeft" :value="item.value" :key="item.value" @@ -67,19 +67,19 @@ div.scroll(:class="$style.setting") h3 {{$t('view.setting.play_lyric_transition')}} div material-checkbox(id="setting_player_lyric_transition" v-model="current_setting.player.isShowLyricTransition" :label="$t('view.setting.is_show')") - dd(:title="$t('view.setting.play_quality_title')") + dd(:tips="$t('view.setting.play_quality_title')") h3 {{$t('view.setting.play_quality')}} div material-checkbox(id="setting_player_highQuality" v-model="current_setting.player.highQuality" :label="$t('view.setting.is_enable')") - dd(:title="$t('view.setting.play_task_bar_title')") + dd(:tips="$t('view.setting.play_task_bar_title')") h3 {{$t('view.setting.play_task_bar')}} div material-checkbox(id="setting_player_showTaskProgess" v-model="current_setting.player.isShowTaskProgess" :label="$t('view.setting.is_enable')") - dd(:title="$t('view.setting.play_mediaDevice_remove_stop_play_title')") + dd(:tips="$t('view.setting.play_mediaDevice_remove_stop_play_title')") h3 {{$t('view.setting.play_mediaDevice_remove_stop_play')}} div material-checkbox(id="setting_player_isMediaDeviceRemovedStopPlay" v-model="current_setting.player.isMediaDeviceRemovedStopPlay" :label="$t('view.setting.is_enable')") - dd(:title="$t('view.setting.play_mediaDevice_title')") + dd(:tips="$t('view.setting.play_mediaDevice_title')") h3 {{$t('view.setting.play_mediaDevice')}} div material-selection(:list="mediaDevices" :class="$style.gapLeft" v-model="current_setting.player.mediaDeviceId" item-key="deviceId" item-name="label") @@ -94,44 +94,44 @@ div.scroll(:class="$style.setting") div(:class="$style.gapTop") material-checkbox(id="setting_desktop_lyric_lockScreen" v-model="current_setting.desktopLyric.isLockScreen" :label="$t('view.setting.desktop_lyric_lock_screen')") dt {{$t('view.setting.search')}} - dd(:title="$t('view.setting.search_hot_title')") + dd(:tips="$t('view.setting.search_hot_title')") h3 {{$t('view.setting.search_hot')}} div material-checkbox(id="setting_search_showHot_enable" v-model="current_setting.search.isShowHotSearch" :label="$t('view.setting.is_show')") - dd(:title="$t('view.setting.search_history_title')") + dd(:tips="$t('view.setting.search_history_title')") h3 {{$t('view.setting.search_history')}} div material-checkbox(id="setting_search_showHistory_enable" v-model="current_setting.search.isShowHistorySearch" :label="$t('view.setting.is_show')") - dd(:title="$t('view.setting.search_focus_search_box_title')") + dd(:tips="$t('view.setting.search_focus_search_box_title')") h3 {{$t('view.setting.search_focus_search_box')}} div material-checkbox(id="setting_search_focusSearchBox_enable" v-model="current_setting.search.isFocusSearchBox" :label="$t('view.setting.is_enable')") dt {{$t('view.setting.list')}} - dd(:title="$t('view.setting.list_source_title')") + dd(:tips="$t('view.setting.list_source_title')") h3 {{$t('view.setting.list_source')}} div material-checkbox(id="setting_list_showSource_enable" v-model="current_setting.list.isShowSource" :label="$t('view.setting.is_show')") - dd(:title="$t('view.setting.list_scroll_title')") + dd(:tips="$t('view.setting.list_scroll_title')") h3 {{$t('view.setting.list_scroll')}} div material-checkbox(id="setting_list_scroll_enable" v-model="current_setting.list.isSaveScrollLocation" :label="$t('view.setting.is_enable')") - //- dd(:title="播放列表是否显示专辑栏") + //- dd(:tips="播放列表是否显示专辑栏") h3 专辑栏 div material-checkbox(id="setting_list_showalbum" v-model="current_setting.list.isShowAlbumName" label="是否显示专辑栏") dt {{$t('view.setting.download')}} dd material-checkbox(id="setting_download_enable" v-model="current_setting.download.enable" :label="$t('view.setting.download_enable')") - dd(:title="$t('view.setting.download_path_title')") + dd(:tips="$t('view.setting.download_path_title')") h3 {{$t('view.setting.download_path')}} div p | {{$t('view.setting.download_path_label')}} - span.auto-hidden.hover(:title="$t('view.setting.download_path_open_label')" :class="$style.savePath" @click="handleOpenDir(current_setting.download.savePath)") {{current_setting.download.savePath}} + span.auto-hidden.hover(:tips="$t('view.setting.download_path_open_label')" :class="$style.savePath" @click="handleOpenDir(current_setting.download.savePath)") {{current_setting.download.savePath}} p material-btn(:class="$style.btn" min @click="handleChangeSavePath") {{$t('view.setting.download_path_change_btn')}} - dd(:title="$t('view.setting.download_name_title')") + dd(:tips="$t('view.setting.download_name_title')") h3 {{$t('view.setting.download_name')}} div material-checkbox(:id="`setting_download_musicName_${item.value}`" :class="$style.gapLeft" name="setting_download_musicName" :value="item.value" :key="item.value" need @@ -142,7 +142,7 @@ div.scroll(:class="$style.setting") material-checkbox(id="setting_download_isEmbedPic" v-model="current_setting.download.isEmbedPic" :label="$t('view.setting.download_embed_pic')") div(:class="$style.gapTop") material-checkbox(id="setting_download_isEmbedLyric" v-model="current_setting.download.isEmbedLyric" :label="$t('view.setting.download_embed_lyric')") - dd(:title="$t('view.setting.download_lyric_title')") + dd(:tips="$t('view.setting.download_lyric_title')") h3 {{$t('view.setting.download_lyric')}} div material-checkbox(id="setting_download_isDownloadLrc" v-model="current_setting.download.isDownloadLrc" :label="$t('view.setting.is_enable')") @@ -216,7 +216,7 @@ div.scroll(:class="$style.setting") div p | {{$t('view.setting.other_cache_label')}} - span.auto-hidden(:title="$t('view.setting.other_cache_label_title')") {{cacheSize}} + span.auto-hidden(:tips="$t('view.setting.other_cache_label_title')") {{cacheSize}} p material-btn(:class="$style.btn" min @click="clearCache") {{$t('view.setting.other_cache_clear_btn')}} dt {{$t('view.setting.update')}} @@ -240,17 +240,17 @@ div.scroll(:class="$style.setting") | , 此版本主要为五音助手APP用户制作,后续会跟进原版迭代更新,感谢五音助手用户的支持! p.small | 五音助手最新版本发布地址(包含Android、Windows、MAC、Linux版):  - span.hover.underline(:title="$t('view.setting.click_open')" @click="handleOpenUrl('https://www.sixyin.com/42.html')") 点我前往下载 + span.hover.underline(:tips="$t('view.setting.click_open')" @click="handleOpenUrl('https://www.sixyin.com/42.html')") 点我前往下载 br p.small | 软件的常见问题可转至洛雪音乐助手常见问题:  - span.hover.underline(:title="$t('view.setting.click_open')" @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/blob/master/FAQ.md')") 常见问题 + span.hover.underline(:tips="$t('view.setting.click_open')" @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/blob/master/FAQ.md')") 常见问题 p.small strong 仔细 仔细 仔细  | 地阅读常见问题后, p.small | 仍有问题可加五音不全QQ群  - span.hover(:title="$t('view.setting.click_open')" @click="handleOpenUrl('https://jq.qq.com/?_wv=1027&k=0NGcjsSt')") 604939182 + span.hover(:tips="$t('view.setting.click_open')" @click="handleOpenUrl('https://jq.qq.com/?_wv=1027&k=0NGcjsSt')") 604939182 |  反馈 p.small @@ -268,7 +268,7 @@ div.scroll(:class="$style.setting") p.small | 原版洛雪音乐助手开源地址: - span.hover.underline(:title="$t('view.setting.click_open')" @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop#readme')") https://github.com/lyswhut/lx-music-desktop + span.hover.underline(:tips="$t('view.setting.click_open')" @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop#readme')") https://github.com/lyswhut/lx-music-desktop