mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/lyswhut/lx-music-desktop.git
synced 2026-09-20 08:04:00 +08:00
Compare commits
112 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c0cbe3253 | ||
|
|
462dc5da51 | ||
|
|
40fad5f785 | ||
|
|
c0791acbf6 | ||
|
|
3cb0a56647 | ||
|
|
95f38e8048 | ||
|
|
a3493a6c74 | ||
|
|
3535bb4e4e | ||
|
|
3be6242cb5 | ||
|
|
64a53830e4 | ||
|
|
b3e3860b23 | ||
|
|
4db560fb4b | ||
|
|
b00de4d976 | ||
|
|
ac162103a7 | ||
|
|
16876502d1 | ||
|
|
4cdd2110a6 | ||
|
|
b820adf0bf | ||
|
|
1cee2febf4 | ||
|
|
43f8d9d72b | ||
|
|
66ffe03224 | ||
|
|
5c96c83f98 | ||
|
|
6d1ddece92 | ||
|
|
897107ca23 | ||
|
|
0baaffdad8 | ||
|
|
784d2fda6d | ||
|
|
19817249db | ||
|
|
240260e598 | ||
|
|
fcf92f06ef | ||
|
|
fe1c2a1896 | ||
|
|
d55c65e275 | ||
|
|
93064bb18b | ||
|
|
dec1b24c86 | ||
|
|
8c76c3d81c | ||
|
|
8d8cabd5b3 | ||
|
|
aa948b0149 | ||
|
|
a25ef6e2a0 | ||
|
|
c404d3ac8d | ||
|
|
8eb71495a1 | ||
|
|
db824c4601 | ||
|
|
029886cc87 | ||
|
|
42604ec737 | ||
|
|
caaa62db30 | ||
|
|
0f135e0587 | ||
|
|
dae6826cc1 | ||
|
|
ddf2ac7ece | ||
|
|
5e011356f2 | ||
|
|
82e047dc66 | ||
|
|
7720b416d5 | ||
|
|
c40dc0fa50 | ||
|
|
36ed7bca66 | ||
|
|
1fa015704a | ||
|
|
7e2097ba6d | ||
|
|
3a630edaa5 | ||
|
|
1b561bbf4c | ||
|
|
37de0b59c3 | ||
|
|
2f528d2a03 | ||
|
|
686d55a672 | ||
|
|
07c58e2ce7 | ||
|
|
6fe794fdf5 | ||
|
|
d0ec90130c | ||
|
|
f7806d9781 | ||
|
|
63219b49f2 | ||
|
|
320e84627c | ||
|
|
fc9e697249 | ||
|
|
a68c626fa2 | ||
|
|
66f17cf05b | ||
|
|
5949e8fb3f | ||
|
|
3bb0fcc4cd | ||
|
|
d32d5d0eb8 | ||
|
|
5ee2c030ec | ||
|
|
58ca7df105 | ||
|
|
fc77dbc73b | ||
|
|
8aedde2422 | ||
|
|
526b5fe140 | ||
|
|
1c4e9ed474 | ||
|
|
21cbb441e2 | ||
|
|
01fedc59e2 | ||
|
|
b3d13c3a90 | ||
|
|
24ee42e0c7 | ||
|
|
3a18eccdd6 | ||
|
|
a3b763ecc9 | ||
|
|
822c74ad2f | ||
|
|
0a71e34459 | ||
|
|
25b68081ea | ||
|
|
ac0e1e7698 | ||
|
|
4be5bcc979 | ||
|
|
f3c2d7e43a | ||
|
|
9fa0700f72 | ||
|
|
868da542ab | ||
|
|
04c810e292 | ||
|
|
86478c0268 | ||
|
|
b453a8934f | ||
|
|
669c1fe490 | ||
|
|
c15895ab45 | ||
|
|
44acc7d5ac | ||
|
|
341df0dab7 | ||
|
|
8df3ff3536 | ||
|
|
85c683b714 | ||
|
|
6606edafb9 | ||
|
|
91ff7b658a | ||
|
|
27c500e950 | ||
|
|
078245cb96 | ||
|
|
e54597b944 | ||
|
|
1af9b3a018 | ||
|
|
315d041fc7 | ||
|
|
f7f1cdab34 | ||
|
|
597f0da42f | ||
|
|
497add09b3 | ||
|
|
ff05225b56 | ||
|
|
ac053e9ac9 | ||
|
|
9aeae1e460 | ||
|
|
d710f204b3 |
125
CHANGELOG.md
125
CHANGELOG.md
@@ -6,6 +6,131 @@ 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.4.1](https://github.com/lyswhut/lx-music-desktop/compare/v1.4.0...v1.4.1) - 2020-11-25
|
||||
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复有歌词翻译与无歌词的音乐间切换会导致歌词翻译残留显示的问题
|
||||
- 修复歌曲URL过期时,等待刷新URL的自动切换歌曲时间间隔太短的问题
|
||||
- 修复某些电脑上的某些歌曲没有声音的问题(升级Electron9.3.4导致的,现降级到9.3.3)
|
||||
|
||||
## [1.4.0](https://github.com/lyswhut/lx-music-desktop/compare/v1.3.0...v1.4.0) - 2020-11-21
|
||||
|
||||
### 新增
|
||||
|
||||
- 托盘菜单新增显示、隐藏主界面选项,为Linux、MAC版添加托盘菜单
|
||||
- 新增播放进度信息保存
|
||||
|
||||
### 优化
|
||||
|
||||
- 移除kg源的歌词文件开头的空白字符串
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复专辑图片无法嵌入的问题
|
||||
- 修复播放状态栏切换“上一首”歌曲按钮提示错误的问题
|
||||
- 修复移动单首歌曲时,如果目标列表存在该歌曲,会导致将源列表与目标列表里的目标歌曲移除
|
||||
- 修复kg源歌曲信息带有单引号等特殊字符被转义的问题
|
||||
|
||||
## [1.3.0](https://github.com/lyswhut/lx-music-desktop/compare/v1.2.2...v1.3.0) - 2020-11-01
|
||||
|
||||
### 新增
|
||||
|
||||
- 播放详情页新增歌曲评论加载显示(某些平台暂不支持显示子评论)
|
||||
|
||||
### 优化
|
||||
|
||||
- 修改播放详情页的歌曲图片的显示效果
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复小芸源音乐搜索结果最多只有20条搜索结果的问题
|
||||
|
||||
## [1.2.2](https://github.com/lyswhut/lx-music-desktop/compare/v1.2.1...v1.2.2) - 2020-10-18
|
||||
|
||||
### 修复
|
||||
|
||||
- 降级 Electron 到 9.x.x 版本修复 Linux 版桌面歌词窗口变白的问题
|
||||
|
||||
## [1.2.1](https://github.com/lyswhut/lx-music-desktop/compare/v1.2.0...v1.2.1) - 2020-10-18
|
||||
|
||||
### 优化
|
||||
|
||||
- Linux版的软件界面默认使用圆角与阴影,顺便修复了桌面歌词窗口变白的问题,已在Ubuntu 18.10测试正常,若显示异常可尝试添加`-nt`参数启动
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复聚合搜索的分页问题
|
||||
- 修复代理输入框输入的内容不生效的问题
|
||||
|
||||
## [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
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复某些情况下桌面歌词不会播放的问题
|
||||
|
||||
## [1.1.0](https://github.com/lyswhut/lx-music-desktop/compare/v1.0.1...v1.1.0) - 2020-09-18
|
||||
|
||||
### 新增
|
||||
|
||||
- 在歌单详情界面新增播放当前歌单按钮、收藏歌单按钮,注:播放歌单不会将歌曲添加到试听列表
|
||||
- 新增`不允许将歌词窗口拖出主屏幕之外`的设置项,默认开启,在连接多个屏幕时想要拖动到其他屏幕时可关闭此设置
|
||||
- 新增大部分平台的歌词翻译,感谢 @InoriHimea 提供的[krc解码算法](https://github.com/lyswhut/lx-music-desktop/issues/296#issuecomment-683285784)
|
||||
- 新增`显示歌词翻译`设置,默认开启,仅支持某些平台,注:无论该设置是否开启,嵌入或下载歌词时都不会带上翻译
|
||||
- 新增`显示切换动画`设置,默认开启,关闭时将基本禁用软件内的所有切换动画
|
||||
- 播放状态栏新增桌面歌词的开关、播放模式的切换、歌曲的收藏按钮,Thanks to @andylow for the [icon](https://github.com/lyswhut/lx-music-desktop/pull/309)!
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复使用全局快捷键还原窗口时,窗口没有获取焦点的问题
|
||||
- 修复我的列表搜索对最后一个字符的匹配问题
|
||||
- 修复窗口在`较小`模式下最小化/关闭按钮不居中的问题
|
||||
|
||||
### 优化
|
||||
|
||||
- 桌面歌词当前播放行改为上下居中
|
||||
- 为区分静音状态,静音时音量条会变淡,调整音量条时将会取消静音
|
||||
- 优化随机播放机制,现在通过`下一曲`切换歌曲时,直到播放完整个列表之前将不会再随机到之前播放过的歌曲,并且通过`上一曲`可以正确播放上一首歌曲
|
||||
- 当下载目录没有写入权限时将显示没有写入权限的提示
|
||||
|
||||
### 移除
|
||||
|
||||
- 移除默认的全局声音媒体快捷键接管
|
||||
- 移除对百度音乐的支持,因百度音乐原有的大部分API失效,而且该平台相对其他平台来说音乐太少了,可有可无,以后再看情况恢复
|
||||
|
||||
### 其他
|
||||
|
||||
- 更新electron到 10.1.2
|
||||
|
||||
## [1.0.1](https://github.com/lyswhut/lx-music-desktop/compare/v1.0.0...v1.0.1) - 2020-07-25
|
||||
|
||||
### 优化
|
||||
|
||||
104
FAQ.md
104
FAQ.md
@@ -2,7 +2,7 @@
|
||||
|
||||
在阅读本常见问题后,仍然无法解决你的问题,请提交issue或者加企鹅群`830125506`反馈(无事勿加,入群先看群公告),反馈时请**注明**已阅读常见问题!
|
||||
|
||||
## 软件为什么没有桌面歌词与自定义列表功能
|
||||
## ~~软件为什么没有桌面歌词与自定义列表功能~~
|
||||
|
||||
洛雪音乐的最初定位不是作为播放器开发的,它主要用于**查找歌曲**,软件的播放功能仅用于试听,不建议用作为常用播放器使用。
|
||||
|
||||
@@ -33,24 +33,70 @@
|
||||
|
||||
用`Shift`或`Ctrl`选择时,鼠标点击未选中的内容会将其选中,点击已选择的内容会将其取消选择,若想全部取消选择,在不按`Shift`或`Alt`键的情况下,随意点击列表里的一项内容即可全部取消选择。(P.S:`Ctrl`键对应Mac OS上的`Command`键)
|
||||
|
||||
注:选完后可用鼠标右击弹出右键菜单操作已选的内容
|
||||
|
||||
## 播放整个歌单或排行榜
|
||||
|
||||
播放在线列表内的歌曲需要将它们都添加到我的列表才能播放,你可以全选列表内的歌曲然后添加到现有列表或者新创建的列表,然后去播放改列表内的歌曲。
|
||||
播放在线列表内的歌曲需要将它们都添加到我的列表才能播放,你可以全选列表内的歌曲然后添加到现有列表或者新创建的列表,然后去播放该列表内的歌曲。
|
||||
|
||||
## 无法打开外部歌单
|
||||
|
||||
不支持垮源打开歌单,请**确认**你需要打开的歌单平台是否与软件标签所写的**歌单源**对应(不一样的话请通过右上角切换歌单源);<br>
|
||||
对于分享出来的歌单,若打开失败,可尝试先在浏览器中打开后,再从浏览器地址栏复制URL地址到软件打开;<br>
|
||||
或者如果你知道歌单 id 也可以直接输入歌单 id 打开。<br>
|
||||
|
||||
## Windows 7 下界面异常(界面显示不完整)
|
||||
|
||||
由于软件默认使用了透明窗口,根据Electron官方文档的[说明](https://electronjs.org/docs/api/frameless-window#%E5%B1%80%E9%99%90%E6%80%A7):
|
||||
> 在 windows 操作系统上, 当 DWM 被禁用时, 透明窗口将无法工作。
|
||||
|
||||
因此,当 win7 没有使用**AERO**主题时界面将会显示异常,开启AERO的方法请自行百度:`win7开启aero效果`(开启后可看到任务栏变透明)。<br>
|
||||
从`0.14.0`版本起不再强制要求开启透明效果,若你实在不想开启(若非电脑配置太低,墙裂建议开启!),可通过添加运行参数`-nt`来运行程序即可,例如:`.\lx-music-desktop.exe -nt`,添加方法可自行百度“给快捷方式加参数”,该参数的作用是用来控制程序是否使用非透明窗口运行。
|
||||
|
||||
对于一些完全无法正常显示界面、开启了AERO后问题仍未解决的情况,请阅读下面的 **软件启动后,界面无法显示** 解决
|
||||
|
||||
## 软件启动后,界面无法显示
|
||||
|
||||
对于软件启动后,可以在任务栏看到软件,但软件界面在桌面上无任何显示,或者整个界面偶尔闪烁的情况。<br>
|
||||
原始问题看:<https://github.com/electron/electron/issues/19569#issuecomment-522231083><br>
|
||||
解决办法:下载`.NET Framework 4.7.1`或**更高**版本安装即可(建议安装最新版,若安装过程中遇到问题可尝试自行百度解决)。<br>
|
||||
微软官方下载地址:<https://dotnet.microsoft.com/download/dotnet-framework><br>
|
||||
下载`Runtime(运行时)`版即可,安装完成后可能需要重启才生效。
|
||||
|
||||
若还是不行可尝试以下操作:
|
||||
|
||||
- 更新显卡驱动
|
||||
- 尝试将绿色版的软件放在**桌面**或**我的文档**运行
|
||||
|
||||
## 安装版安装失败,提示安装程序并未成功地运行完成
|
||||
|
||||
对于部分电脑出现安装失败的问题,可以做出以下尝试:
|
||||
|
||||
- 若你之前可以安装成功,但现在安装失败,就去**控制面板-程序和功能**或用第三方卸载工具看下有没有之前的版本残留,若同时在不同路径下安装了多个版本就可能会出现该问题,这种情况卸载掉所有版本重新安装即可
|
||||
- 清理安装路径下的残留文件
|
||||
- 清理注册表(建议用清理工具清理)
|
||||
|
||||
## 软件无法联网
|
||||
|
||||
软件的排行榜、歌单、搜索列表**都**无法加载:
|
||||
|
||||
- 检查是否在设置界面开启了代理(当代理乱设置时软件将无法联网)
|
||||
- 检查软件是否被第三方软件/防火墙阻止联网
|
||||
|
||||
## 桌面歌词显示异常
|
||||
|
||||
### Windows 7 系统桌面歌词显示异常
|
||||
|
||||
Windows 7 未开启 Aero 效果时桌面歌词会有问题,详情看下面的**Windows 7 下界面异常(界面显示不完整)**方法解决。
|
||||
Windows 7 未开启 Aero 效果时桌面歌词会有问题,详情看下面的 **Windows 7 下界面异常(界面显示不完整)** 方法解决。
|
||||
|
||||
### MAC OS系统、桌面歌词有残留阴影
|
||||
### MAC OS 系统、桌面歌词有残留阴影
|
||||
|
||||
此问题似乎是Electron的Bug,翻阅electron的issue列表发现该Bug以存在很久了,遗憾的是没有一直都没有修复,由于我没有装MAC平台的电脑,没法重现,就没再去electron提issue,更多信息看:
|
||||
|
||||
- <https://github.com/electron/electron/issues/21173>
|
||||
- <https://github.com/electron/electron/issues/14304>
|
||||
|
||||
### Linux系统下桌面歌词窗口异常
|
||||
### Linux 系统下桌面歌词窗口异常
|
||||
|
||||
目前在 Ubuntu 18.10 下第一次开启桌面歌词时歌词窗口会变白,需要关闭后再开启,
|
||||
|
||||
@@ -79,38 +125,6 @@ Windows 7 未开启 Aero 效果时桌面歌词会有问题,详情看下面的*
|
||||
注意:**绿色版**的软件自动更新功能**不可用**,建议使用安装版!!<br>
|
||||
注意:**Mac版**、**Linux deb**版不支持自动更新!
|
||||
|
||||
## Windows 7 下界面异常(界面显示不完整)
|
||||
|
||||
由于软件默认使用了透明窗口,根据Electron官方文档的[说明](https://electronjs.org/docs/api/frameless-window#%E5%B1%80%E9%99%90%E6%80%A7):
|
||||
> 在 windows 操作系统上, 当 DWM 被禁用时, 透明窗口将无法工作。
|
||||
|
||||
因此,当 win7 没有使用**AERO**主题时界面将会显示异常,开启AERO的方法请自行百度:`win7开启aero效果`(开启后可看到任务栏变透明)。<br>
|
||||
从`0.14.0`版本起不再强制要求开启透明效果,若你实在不想开启(若非电脑配置太低,墙裂建议开启!),可通过添加运行参数`-nt`来运行程序即可,例如:`.\lx-music-desktop.exe -nt`,添加方法可自行百度“给快捷方式加参数”,该参数的作用是用来控制程序是否使用非透明窗口运行。
|
||||
|
||||
对于一些完全无法正常显示界面的情况,请阅读下面的 **软件启动后,界面无法显示**
|
||||
|
||||
## 软件启动后,界面无法显示
|
||||
|
||||
软件启动后,可以在任务栏看到软件,但软件界面在桌面上无任何显示。<br>
|
||||
原始问题看:<https://github.com/electron/electron/issues/19569#issuecomment-522231083><br>
|
||||
解决办法:下载`.NET Framework 4.7.1`或**更高**版本安装即可(建议安装最新版,若安装过程中遇到问题可尝试自行百度解决)。<br>
|
||||
微软官方下载地址:<https://dotnet.microsoft.com/download/dotnet-framework><br>
|
||||
下载`Runtime(运行时)`版即可,安装完成后可能需要重启才生效。
|
||||
|
||||
若还是不行可尝试以下操作:
|
||||
|
||||
- 更新显卡驱动
|
||||
- 尝试将绿色版的软件放在**桌面**或**我的文档**运行
|
||||
|
||||
## 安装版安装失败,提示安装程序并未成功地运行完成
|
||||
|
||||
对于部分电脑出现安装失败的问题,可以做出以下尝试:
|
||||
|
||||
- 若你之前可以安装成功,但现在安装失败,就去**控制面板-程序和功能**或用第三方卸载工具看下有没有之前的版本残留,若同时在不同路径下安装了多个版本就可能会出现该问题,这种情况卸载掉所有版本重新安装即可
|
||||
- 清理安装路径下的残留文件
|
||||
- 以管理员权限打开`cmd`,输入`sfc /scannow`回车等待检查完成重启电脑
|
||||
- 若还是不行我也没办法了。。
|
||||
|
||||
## 缺少`xxx.dll`
|
||||
|
||||
这个是电脑缺少某些dll导致的,正常的系统是没有这个问题的,可以尝试如下几个解决办法:
|
||||
@@ -120,22 +134,10 @@ Windows 7 未开启 Aero 效果时桌面歌词会有问题,详情看下面的*
|
||||
|
||||
## 杀毒软件提示有病毒或恶意行为
|
||||
|
||||
本人只能保证我写的代码不包含任何**恶意代码**、**收集用户信息**的行为,并且软件代码已开源,请自行查阅,软件安装包也是由CI拉取源代码构建,构建日志:[windows包](https://ci.appveyor.com/project/lyswhut/lx-music-desktop)、[Mac/Linux包](https://travis-ci.org/lyswhut/lx-music-desktop)<br>
|
||||
本人只能保证我写的代码不包含任何**恶意代码**、**收集用户信息**的行为,并且软件代码已开源,请自行查阅,软件安装包也是由CI拉取源代码构建,构建日志:[windows包](https://ci.appveyor.com/project/lyswhut/lx-music-desktop)、[Mac/Linux包](https://travis-ci.com/github/lyswhut/lx-music-desktop)<br>
|
||||
尽管如此,但这不意味着软件是100%安全的,由于软件使用了第三方依赖,当这些依赖存在恶意行为时([供应链攻击](https://docs.microsoft.com/zh-cn/windows/security/threat-protection/intelligence/supply-chain-malware)),软件也将会受到牵连,所以我只能尽量选择使用较多人用、信任度较高的依赖。<br>
|
||||
当然,以上说明建立的前提是在你所用的安装包是从**本项目主页上写的链接**下载的,或者有相关能力者还可以下载源代码自己构建安装包。
|
||||
|
||||
从`0.17.0`起,由于加入了音频输出设备切换功能,该功能调用了 [MediaDevices.enumerateDevices()](https://developer.mozilla.org/zh-CN/docs/Web/API/MediaDevices/enumerateDevices),可能导致安全软件提示洛雪要访问摄像头(目前发现卡巴斯基会提示),但实际上没有用到摄像头,并且摄像头的提示灯也不会亮,你可以选择阻止访问。
|
||||
从`v0.17.0`起,由于加入了音频输出设备切换功能,该功能调用了 [MediaDevices.enumerateDevices()](https://developer.mozilla.org/zh-CN/docs/Web/API/MediaDevices/enumerateDevices),可能导致安全软件提示洛雪要访问摄像头(目前发现卡巴斯基会提示),但实际上没有用到摄像头,并且摄像头的提示灯也不会亮,你可以选择阻止访问。
|
||||
|
||||
最后,若出现杀毒软件报毒、存在恶意行为,请自行判断选择是否继续使用本软件!
|
||||
|
||||
## 软件无法联网
|
||||
|
||||
软件的排行榜、歌单、搜索列表**都**无法加载:
|
||||
|
||||
- 检查是否在设置界面开启了代理(当代理乱设置时软件将无法联网)
|
||||
- 检查软件是否被第三方软件/防火墙阻止联网
|
||||
|
||||
## 无法打开外部歌单
|
||||
|
||||
对于分享出来的歌单,若打开失败,可尝试先在浏览器中打开后,再从浏览器地址栏复制URL地址到软件打开;<br>
|
||||
或者如果你知道歌单 id 也可以直接输入歌单 id 打开。<br>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/lyswhut/lx-music-desktop/releases"><img src="https://img.shields.io/github/release/lyswhut/lx-music-desktop" alt="Release version"></a>
|
||||
<a href="https://ci.appveyor.com/project/lyswhut/lx-music-desktop"><img src="https://ci.appveyor.com/api/projects/status/flrsqd5ymp8fnte5?svg=true" alt="Build status"></a>
|
||||
<a href="https://travis-ci.org/lyswhut/lx-music-desktop"><img src="https://travis-ci.org/lyswhut/lx-music-desktop.svg?branch=master" alt="Build status"></a>
|
||||
<a href="https://travis-ci.com/lyswhut/lx-music-desktop"><img src="https://travis-ci.com/lyswhut/lx-music-desktop.svg?branch=master" alt="Build status"></a>
|
||||
<a href="https://electronjs.org/releases/stable"><img src="https://img.shields.io/github/package-json/dependency-version/lyswhut/lx-music-desktop/dev/electron/master" alt="Electron version"></a>
|
||||
<!-- <a href="https://github.com/lyswhut/lx-music-desktop/releases"><img src="https://img.shields.io/github/downloads/lyswhut/lx-music-desktop/latest/total" alt="Downloads"></a> -->
|
||||
<a href="https://github.com/lyswhut/lx-music-desktop/tree/dev"><img src="https://img.shields.io/github/package-json/v/lyswhut/lx-music-desktop/dev" alt="Dev branch version"></a>
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
软件变化请查看:[更新日志](https://github.com/lyswhut/lx-music-desktop/blob/master/CHANGELOG.md)<br>
|
||||
软件下载请转到:[发布页面](https://github.com/lyswhut/lx-music-desktop/releases)<br>
|
||||
或者到网盘下载(网盘内有MAC、windows版):`https://t-s.lanzous.com/b0bf2cfa/` 密码:`glqw`<br>
|
||||
或者到网盘下载(网盘内有MAC、windows版):`https://www.lanzoux.com/b0bf2cfa/` 密码:`glqw`<br>
|
||||
使用常见问题请转至:[常见问题](https://github.com/lyswhut/lx-music-desktop/blob/master/FAQ.md)
|
||||
|
||||
### 源码使用方法
|
||||
@@ -100,7 +100,7 @@ npm run pack:linux
|
||||
5. 由于使用本项目产生的包括由于本协议或由于使用或无法使用本项目而引起的任何性质的任何直接、间接、特殊、偶然或结果性损害(包括但不限于因商誉损失、停工、计算机故障或故障引起的损害赔偿,或任何及所有其他商业损害或损失)由使用者负责。
|
||||
6. 本项目完全免费,且开源发布于 GitHub 面向全世界人用作对技术的学习交流,本项目不对项目内的技术可能存在违反当地法律法规的行为作保证,**禁止在违反当地法律法规的情况下使用本项目**,对于使用者在明知或不知当地法律法规不允许的情况下使用本项目所造成的任何违法违规行为由使用者承担,本项目不承担由此造成的任何直接、间接、特殊、偶然或结果性责任。
|
||||
|
||||
若你使用了本项目,将代表你接收以上协议。
|
||||
若你使用了本项目,将代表你接受以上协议。
|
||||
|
||||
音乐平台不易,请尊重版权,支持正版。<br>
|
||||
若对此有疑问请 mail to: lyswhut+qq.com (请将`+`替换成`@`)
|
||||
|
||||
@@ -3,6 +3,6 @@ const isDev = process.env.NODE_ENV === 'development'
|
||||
module.exports = {
|
||||
modules: {
|
||||
localIdentName: isDev ? '[folder]-[name]--[local]--[hash:base64:5]' : '[hash:base64:5]',
|
||||
exportLocalsConvention: 'camelCase',
|
||||
},
|
||||
localsConvention: 'camelCase',
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ module.exports = merge(baseConfig, {
|
||||
onErrors(severity, errors) { // Silent warning from electron-debug
|
||||
if (severity != 'warning') return
|
||||
|
||||
for (let i = errors.length; i > -1; i--) {
|
||||
for (let i = errors.length - 1; i > -1; i--) {
|
||||
const error = errors[i]
|
||||
if (error.file == './node_modules/electron-debug/index.js') errors.splice(i, 1)
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ const okayLog = chalk.bgGreen.white(' OKAY ') + ' '
|
||||
|
||||
|
||||
function build() {
|
||||
del.sync(['dist/electron', 'build'])
|
||||
del.sync(['dist/electron/**', 'build/**'])
|
||||
|
||||
const spinners = new Spinnies({ color: 'blue' })
|
||||
spinners.add('main', { text: 'main building' })
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
const path = require('path')
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||
const HTMLPlugin = require('html-webpack-plugin')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
|
||||
const vueLoaderConfig = require('../vue-loader.config')
|
||||
const { mergeCSSLoader } = require('../utils')
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
module.exports = {
|
||||
target: 'electron-renderer',
|
||||
@@ -46,6 +49,28 @@ module.exports = {
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
oneOf: mergeCSSLoader(),
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
oneOf: mergeCSSLoader({
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.styl(:?us)?$/,
|
||||
oneOf: mergeCSSLoader({
|
||||
loader: 'stylus-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.pug$/,
|
||||
oneOf: [
|
||||
@@ -98,5 +123,11 @@ module.exports = {
|
||||
__dirname,
|
||||
}),
|
||||
new VueLoaderPlugin(),
|
||||
new MiniCssExtractPlugin({
|
||||
// Options similar to the same options in webpackOptions.output
|
||||
// both options are optional
|
||||
filename: isDev ? '[name].css' : '[name].[contenthash:8].css',
|
||||
chunkFilename: isDev ? '[id].css' : '[id].[contenthash:8].css',
|
||||
}),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -6,37 +6,9 @@ const { merge } = require('webpack-merge')
|
||||
|
||||
const baseConfig = require('./webpack.config.base')
|
||||
|
||||
const { mergeCSSLoaderDev } = require('../utils')
|
||||
|
||||
module.exports = merge(baseConfig, {
|
||||
mode: 'development',
|
||||
devtool: 'eval-source-map',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
oneOf: mergeCSSLoaderDev(),
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
oneOf: mergeCSSLoaderDev({
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.styl(:?us)?$/,
|
||||
oneOf: mergeCSSLoaderDev({
|
||||
loader: 'stylus-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const TerserPlugin = require('terser-webpack-plugin')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
@@ -8,7 +7,6 @@ const { merge } = require('webpack-merge')
|
||||
|
||||
const baseConfig = require('./webpack.config.base')
|
||||
|
||||
const { mergeCSSLoaderProd } = require('../utils')
|
||||
const { dependencies } = require('../../package.json')
|
||||
|
||||
let whiteListedModules = ['vue']
|
||||
@@ -20,32 +18,6 @@ module.exports = merge(baseConfig, {
|
||||
externals: [
|
||||
...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
oneOf: mergeCSSLoaderProd(),
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
oneOf: mergeCSSLoaderProd({
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.styl(:?us)?$/,
|
||||
oneOf: mergeCSSLoaderProd({
|
||||
loader: 'stylus-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
@@ -60,18 +32,11 @@ module.exports = merge(baseConfig, {
|
||||
NODE_ENV: '"production"',
|
||||
},
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css',
|
||||
}),
|
||||
new webpack.NamedChunksPlugin(),
|
||||
],
|
||||
optimization: {
|
||||
chunkIds: 'named',
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
cache: true,
|
||||
parallel: true,
|
||||
sourceMap: false, // set to true if you want JS source maps
|
||||
}),
|
||||
new TerserPlugin(),
|
||||
new OptimizeCSSAssetsPlugin({}),
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
const path = require('path')
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||
const HTMLPlugin = require('html-webpack-plugin')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
|
||||
const vueLoaderConfig = require('../vue-loader.config')
|
||||
const { mergeCSSLoader } = require('../utils')
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
module.exports = {
|
||||
target: 'electron-renderer',
|
||||
@@ -46,6 +49,28 @@ module.exports = {
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
oneOf: mergeCSSLoader(),
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
oneOf: mergeCSSLoader({
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.styl(:?us)?$/,
|
||||
oneOf: mergeCSSLoader({
|
||||
loader: 'stylus-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.pug$/,
|
||||
oneOf: [
|
||||
@@ -98,5 +123,11 @@ module.exports = {
|
||||
__dirname,
|
||||
}),
|
||||
new VueLoaderPlugin(),
|
||||
new MiniCssExtractPlugin({
|
||||
// Options similar to the same options in webpackOptions.output
|
||||
// both options are optional
|
||||
filename: isDev ? '[name].css' : '[name].[contenthash:8].css',
|
||||
chunkFilename: isDev ? '[id].css' : '[id].[contenthash:8].css',
|
||||
}),
|
||||
],
|
||||
}
|
||||
|
||||
@@ -6,37 +6,9 @@ const { merge } = require('webpack-merge')
|
||||
|
||||
const baseConfig = require('./webpack.config.base')
|
||||
|
||||
const { mergeCSSLoaderDev } = require('../utils')
|
||||
|
||||
module.exports = merge(baseConfig, {
|
||||
mode: 'development',
|
||||
devtool: 'eval-source-map',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
oneOf: mergeCSSLoaderDev(),
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
oneOf: mergeCSSLoaderDev({
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.styl(:?us)?$/,
|
||||
oneOf: mergeCSSLoaderDev({
|
||||
loader: 'stylus-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
const path = require('path')
|
||||
const webpack = require('webpack')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const TerserPlugin = require('terser-webpack-plugin')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
@@ -8,7 +7,6 @@ const { merge } = require('webpack-merge')
|
||||
|
||||
const baseConfig = require('./webpack.config.base')
|
||||
|
||||
const { mergeCSSLoaderProd } = require('../utils')
|
||||
const { dependencies } = require('../../package.json')
|
||||
|
||||
let whiteListedModules = ['vue']
|
||||
@@ -20,32 +18,6 @@ module.exports = merge(baseConfig, {
|
||||
externals: [
|
||||
...Object.keys(dependencies || {}).filter(d => !whiteListedModules.includes(d)),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.css$/,
|
||||
oneOf: mergeCSSLoaderProd(),
|
||||
},
|
||||
{
|
||||
test: /\.less$/,
|
||||
oneOf: mergeCSSLoaderProd({
|
||||
loader: 'less-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
{
|
||||
test: /\.styl(:?us)?$/,
|
||||
oneOf: mergeCSSLoaderProd({
|
||||
loader: 'stylus-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
@@ -60,18 +32,11 @@ module.exports = merge(baseConfig, {
|
||||
NODE_ENV: '"production"',
|
||||
},
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: '[name].css',
|
||||
}),
|
||||
new webpack.NamedChunksPlugin(),
|
||||
],
|
||||
optimization: {
|
||||
chunkIds: 'named',
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
cache: true,
|
||||
parallel: true,
|
||||
sourceMap: false, // set to true if you want JS source maps
|
||||
}),
|
||||
new TerserPlugin(),
|
||||
new OptimizeCSSAssetsPlugin({}),
|
||||
],
|
||||
},
|
||||
|
||||
@@ -2,62 +2,21 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const cssLoaderConfig = require('./css-loader.config')
|
||||
const chalk = require('chalk')
|
||||
|
||||
// merge css-loader in development
|
||||
exports.mergeCSSLoaderDev = beforeLoader => {
|
||||
const loader = [
|
||||
// 这里匹配 `<style module>`
|
||||
{
|
||||
resourceQuery: /module/,
|
||||
use: [
|
||||
'vue-style-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: Object.assign({
|
||||
sourceMap: true,
|
||||
}, cssLoaderConfig),
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
// 这里匹配普通的 `<style>` 或 `<style scoped>`
|
||||
{
|
||||
use: [
|
||||
'vue-style-loader',
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
if (beforeLoader) {
|
||||
loader[0].use.push(beforeLoader)
|
||||
loader[1].use.push(beforeLoader)
|
||||
}
|
||||
return loader
|
||||
}
|
||||
const isDev = process.env.NODE_ENV === 'development'
|
||||
|
||||
// merge css-loader in production
|
||||
exports.mergeCSSLoaderProd = beforeLoader => {
|
||||
// merge css-loader
|
||||
exports.mergeCSSLoader = beforeLoader => {
|
||||
const loader = [
|
||||
// 这里匹配 `<style module>`
|
||||
{
|
||||
resourceQuery: /module/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
hmr: isDev,
|
||||
},
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
options: cssLoaderConfig,
|
||||
@@ -68,7 +27,12 @@ exports.mergeCSSLoaderProd = beforeLoader => {
|
||||
// 这里匹配普通的 `<style>` 或 `<style scoped>`
|
||||
{
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {
|
||||
hmr: isDev,
|
||||
},
|
||||
},
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
],
|
||||
|
||||
5685
package-lock.json
generated
5685
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
92
package.json
92
package.json
@@ -1,11 +1,10 @@
|
||||
{
|
||||
"name": "lx-music-desktop",
|
||||
"version": "1.0.1",
|
||||
"version": "1.4.1",
|
||||
"description": "一个免费的音乐下载助手",
|
||||
"main": "./dist/electron/main.js",
|
||||
"productName": "lx-music-desktop",
|
||||
"scripts": {
|
||||
"php": "babel file.php -o file.js",
|
||||
"pack": "node build-config/pack.js && npm run pack:win",
|
||||
"pack:win": "npm run pack:win:setup:x86_64 && npm run pack:win:7z",
|
||||
"pack:win:setup:x86_64": "cross-env TARGET=win_安装版 ARCH=x86_64 electron-builder -w=nsis --x64 --ia32",
|
||||
@@ -51,7 +50,6 @@
|
||||
"pack:dir": "node build-config/pack.js && electron-builder --dir",
|
||||
"dev": "node build-config/runner-dev.js",
|
||||
"clean:electron": "rimraf dist/electron",
|
||||
"clean:web": "rimraf dist/web",
|
||||
"clean": "rimraf dist && rimraf build",
|
||||
"build:main": "cross-env NODE_ENV=production webpack --config build-config/main/webpack.config.prod.js --progress --hide-modules",
|
||||
"build:renderer": "cross-env NODE_ENV=production webpack --config build-config/renderer/webpack.config.prod.js --progress --hide-modules",
|
||||
@@ -61,7 +59,7 @@
|
||||
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-formatter-friendly --fix src"
|
||||
},
|
||||
"browserslist": [
|
||||
"Electron 9.1.1"
|
||||
"Electron 9.3.4"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
@@ -101,7 +99,7 @@
|
||||
"allowToChangeInstallationDirectory": true,
|
||||
"differentialPackage": true,
|
||||
"license": "./licenses/license.rtf",
|
||||
"shortcutName": "lx-music"
|
||||
"shortcutName": "LX Music"
|
||||
},
|
||||
"dmg": {
|
||||
"window": {
|
||||
@@ -112,7 +110,7 @@
|
||||
{
|
||||
"x": 106,
|
||||
"y": 252,
|
||||
"name": "lx-music"
|
||||
"name": "LX Music"
|
||||
},
|
||||
{
|
||||
"x": 490,
|
||||
@@ -160,83 +158,81 @@
|
||||
},
|
||||
"homepage": "https://github.com/lyswhut/lx-music-desktop#readme",
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.10.5",
|
||||
"@babel/core": "^7.12.3",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-transform-modules-umd": "^7.10.4",
|
||||
"@babel/plugin-transform-runtime": "^7.10.5",
|
||||
"@babel/polyfill": "^7.10.4",
|
||||
"@babel/preset-env": "^7.10.4",
|
||||
"@babel/plugin-transform-modules-umd": "^7.12.1",
|
||||
"@babel/plugin-transform-runtime": "^7.12.1",
|
||||
"@babel/polyfill": "^7.12.1",
|
||||
"@babel/preset-env": "^7.12.1",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-loader": "^8.2.1",
|
||||
"babel-minify-webpack-plugin": "^0.3.1",
|
||||
"babel-preset-minify": "^0.5.1",
|
||||
"browserslist": "^4.13.0",
|
||||
"cfonts": "^2.8.6",
|
||||
"chalk": "^4.1.0",
|
||||
"changelog-parser": "^2.8.0",
|
||||
"copy-webpack-plugin": "^6.0.3",
|
||||
"core-js": "^3.6.5",
|
||||
"copy-webpack-plugin": "^6.3.1",
|
||||
"core-js": "^3.7.0",
|
||||
"cross-env": "^7.0.2",
|
||||
"css-loader": "^3.6.0",
|
||||
"del": "^5.1.0",
|
||||
"electron": "^9.1.1",
|
||||
"electron-builder": "^22.7.0",
|
||||
"css-loader": "^4.3.0",
|
||||
"del": "^6.0.0",
|
||||
"electron": "^9.3.3",
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron-debug": "^3.1.0",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"eslint": "^7.5.0",
|
||||
"eslint": "^7.13.0",
|
||||
"eslint-config-standard": "^14.1.1",
|
||||
"eslint-formatter-friendly": "^7.0.0",
|
||||
"eslint-loader": "^4.0.2",
|
||||
"eslint-plugin-html": "^6.0.2",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-html": "^6.1.1",
|
||||
"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.0.0",
|
||||
"eslint-plugin-standard": "^4.1.0",
|
||||
"file-loader": "^6.2.0",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
"html-webpack-plugin": "^4.3.0",
|
||||
"html-webpack-plugin": "^4.5.0",
|
||||
"less": "^3.12.2",
|
||||
"less-loader": "^6.2.0",
|
||||
"markdown-it": "^11.0.0",
|
||||
"mini-css-extract-plugin": "^0.9.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.3",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"less-loader": "^7.1.0",
|
||||
"markdown-it": "^12.0.2",
|
||||
"mini-css-extract-plugin": "^0.12.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.4",
|
||||
"postcss-loader": "^4.0.4",
|
||||
"postcss-pxtorem": "^5.1.1",
|
||||
"pug": "^3.0.0",
|
||||
"pug-loader": "^2.4.0",
|
||||
"pug-plain-loader": "^1.0.0",
|
||||
"raw-loader": "^4.0.1",
|
||||
"raw-loader": "^4.0.2",
|
||||
"rimraf": "^3.0.2",
|
||||
"spinnies": "^0.5.1",
|
||||
"stylus": "^0.54.8",
|
||||
"stylus-loader": "^3.0.2",
|
||||
"terser-webpack-plugin": "^3.0.7",
|
||||
"url-loader": "^4.1.0",
|
||||
"vue-loader": "^15.9.3",
|
||||
"vue-style-loader": "^4.1.2",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
"webpack": "^4.43.0",
|
||||
"stylus-loader": "^4.3.0",
|
||||
"terser-webpack-plugin": "^4.2.3",
|
||||
"url-loader": "^4.1.1",
|
||||
"vue-loader": "^15.9.5",
|
||||
"vue-template-compiler": "^2.6.12",
|
||||
"webpack": "^4.44.2",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-dev-server": "^3.11.0",
|
||||
"webpack-hot-middleware": "^2.25.0",
|
||||
"webpack-merge": "^5.0.9"
|
||||
"webpack-merge": "^5.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"crypto-js": "^4.0.0",
|
||||
"dnscache": "^1.0.2",
|
||||
"electron-log": "^4.2.2",
|
||||
"electron-store": "^6.0.0",
|
||||
"electron-updater": "^4.3.1",
|
||||
"electron-log": "^4.3.0",
|
||||
"electron-store": "^6.0.1",
|
||||
"electron-updater": "^4.3.5",
|
||||
"iconv-lite": "^0.6.2",
|
||||
"image-size": "^0.8.3",
|
||||
"image-size": "^0.9.3",
|
||||
"js-htmlencode": "^0.3.0",
|
||||
"lrc-file-parser": "^1.0.5",
|
||||
"needle": "^2.5.0",
|
||||
"node-id3": "^0.1.17",
|
||||
"needle": "^2.5.2",
|
||||
"node-id3": "^0.1.21",
|
||||
"request": "^2.88.2",
|
||||
"vue": "^2.6.11",
|
||||
"vue-i18n": "^8.18.2",
|
||||
"vue-router": "^3.3.4",
|
||||
"vue": "^2.6.12",
|
||||
"vue-i18n": "^8.22.1",
|
||||
"vue-router": "^3.4.9",
|
||||
"vuex": "^3.5.1",
|
||||
"vuex-router-sync": "^5.0.0"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
### 优化
|
||||
|
||||
- 对我的列表歌曲搜索结果进行相似度排序
|
||||
|
||||
### 修复
|
||||
|
||||
- 修复在 Windows 系统下缩放比非100%时,拖动桌面歌词会自动加大桌面歌词窗口的问题
|
||||
- 修复有歌词翻译与无歌词的音乐间切换会导致歌词翻译残留显示的问题
|
||||
- 修复歌曲URL过期时,等待刷新URL的自动切换歌曲时间间隔太短的问题
|
||||
- 修复某些电脑上的某些歌曲没有声音的问题(升级Electron9.3.4导致的,现降级到9.3.3)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -44,21 +44,6 @@ module.exports = {
|
||||
name: null,
|
||||
action: hotKeyPlayer.next.action,
|
||||
},
|
||||
VolumeUp: {
|
||||
type: hotKeyPlayer.volume_up.type,
|
||||
name: null,
|
||||
action: hotKeyPlayer.volume_up.action,
|
||||
},
|
||||
VolumeDown: {
|
||||
type: hotKeyPlayer.volume_down.type,
|
||||
name: null,
|
||||
action: hotKeyPlayer.volume_down.action,
|
||||
},
|
||||
VolumeMute: {
|
||||
type: hotKeyPlayer.volume_mute.type,
|
||||
name: null,
|
||||
action: hotKeyPlayer.volume_mute.action,
|
||||
},
|
||||
'mod+alt+f5': {
|
||||
type: hotKeyPlayer.toggle_play.type,
|
||||
name: hotKeyPlayer.toggle_play.name,
|
||||
|
||||
@@ -3,7 +3,7 @@ const os = require('os')
|
||||
const { isMac } = require('./utils')
|
||||
|
||||
const defaultSetting = {
|
||||
version: '1.0.34',
|
||||
version: '1.0.38',
|
||||
player: {
|
||||
togglePlayMethod: 'listLoop',
|
||||
highQuality: false,
|
||||
@@ -12,6 +12,7 @@ const defaultSetting = {
|
||||
isMute: false,
|
||||
mediaDeviceId: 'default',
|
||||
isMediaDeviceRemovedStopPlay: false,
|
||||
isShowLyricTransition: true,
|
||||
},
|
||||
desktopLyric: {
|
||||
enable: false,
|
||||
@@ -22,6 +23,7 @@ const defaultSetting = {
|
||||
x: null,
|
||||
y: null,
|
||||
theme: 0,
|
||||
isLockScreen: true,
|
||||
style: {
|
||||
fontSize: 120,
|
||||
opacity: 95,
|
||||
@@ -86,6 +88,7 @@ const defaultSetting = {
|
||||
sourceId: 'kw',
|
||||
apiSource: 'temp',
|
||||
sourceNameType: 'alias',
|
||||
isShowAnimation: true,
|
||||
randomAnimate: true,
|
||||
ignoreVersion: null,
|
||||
isAgreePact: false,
|
||||
|
||||
@@ -43,6 +43,13 @@ const names = {
|
||||
hide_toggle: 'hide_toggle',
|
||||
get_data_path: 'get_data_path',
|
||||
show_dialog: 'show_dialog',
|
||||
|
||||
get_setting: 'get_setting',
|
||||
get_playlist: 'get_playlist',
|
||||
save_playlist: 'save_playlist',
|
||||
get_data: 'get_data',
|
||||
save_data: 'save_data',
|
||||
get_hot_key: 'get_hot_key',
|
||||
},
|
||||
winLyric: {
|
||||
close: 'close',
|
||||
|
||||
@@ -151,29 +151,34 @@ exports.initSetting = () => {
|
||||
name: 'config',
|
||||
})
|
||||
let setting = electronStore_config.get('setting')
|
||||
if (!electronStore_config.get('version') && setting) { // 迁移配置
|
||||
electronStore_config.set('version', electronStore_config.get('setting.version'))
|
||||
electronStore_config.delete('setting.version')
|
||||
const list = electronStore_config.get('list')
|
||||
if (list) {
|
||||
if (list.defaultList) electronStore_list.set('defaultList', list.defaultList)
|
||||
if (list.loveList) electronStore_list.set('loveList', list.loveList)
|
||||
electronStore_config.delete('list')
|
||||
if (setting) {
|
||||
let version = electronStore_config.get('version')
|
||||
if (!version) { // 迁移配置
|
||||
version = electronStore_config.get('setting.version')
|
||||
electronStore_config.set('version', version)
|
||||
electronStore_config.delete('setting.version')
|
||||
const list = electronStore_config.get('list')
|
||||
if (list) {
|
||||
if (list.defaultList) electronStore_list.set('defaultList', list.defaultList)
|
||||
if (list.loveList) electronStore_list.set('loveList', list.loveList)
|
||||
electronStore_config.delete('list')
|
||||
}
|
||||
const downloadList = electronStore_config.get('download')
|
||||
if (downloadList) {
|
||||
if (downloadList.list) electronStore_list.set('downloadList', downloadList.list)
|
||||
electronStore_config.delete('download')
|
||||
}
|
||||
}
|
||||
const downloadList = electronStore_config.get('download')
|
||||
if (downloadList) {
|
||||
if (downloadList.list) electronStore_list.set('downloadList', downloadList.list)
|
||||
electronStore_config.delete('download')
|
||||
}
|
||||
}
|
||||
|
||||
// 迁移列表滚动位置设置 ~0.18.3
|
||||
if (setting && 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_config.delete('setting.list.scroll')
|
||||
electronStore_config.set('setting.list.isSaveScrollLocation', scroll.enable)
|
||||
// 迁移列表滚动位置设置 ~0.18.3
|
||||
if (setting.list.scroll) {
|
||||
let scroll = setting.list.scroll
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
const { version: settingVersion, setting: newSetting } = exports.mergeSetting(setting, electronStore_config.get('version'))
|
||||
@@ -184,7 +189,7 @@ exports.initSetting = () => {
|
||||
// newSetting.controlBtnPosition = 'right'
|
||||
electronStore_config.set('version', settingVersion)
|
||||
electronStore_config.set('setting', newSetting)
|
||||
return newSetting
|
||||
return { version: settingVersion, setting: newSetting }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,6 +207,15 @@ exports.initHotKey = () => {
|
||||
}
|
||||
|
||||
let globalConfig = electronStore_hotKey.get('global')
|
||||
|
||||
// 移除v1.0.1及之前设置的全局声音媒体快捷键接管
|
||||
if (globalConfig && globalConfig.keys.VolumeUp) {
|
||||
delete globalConfig.keys.VolumeUp
|
||||
delete globalConfig.keys.VolumeDown
|
||||
delete globalConfig.keys.VolumeMute
|
||||
electronStore_hotKey.set('global', globalConfig)
|
||||
}
|
||||
|
||||
if (!globalConfig) {
|
||||
globalConfig = defaultHotKey.global
|
||||
electronStore_hotKey.set('global', globalConfig)
|
||||
|
||||
@@ -22,6 +22,7 @@ global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.toggle_minimize, () => {
|
||||
global.modules.mainWindow.show()
|
||||
}
|
||||
global.modules.mainWindow.restore()
|
||||
global.modules.mainWindow.focus()
|
||||
} else {
|
||||
global.modules.mainWindow.minimize()
|
||||
}
|
||||
|
||||
@@ -17,6 +17,18 @@ class MainWindow extends EventEmitter {
|
||||
toggleHide() {
|
||||
this.emit(MAIN_WINDOW_EVENT_NAME.toggle_hide)
|
||||
}
|
||||
|
||||
readyToShow() {
|
||||
this.emit(MAIN_WINDOW_EVENT_NAME.ready_to_show)
|
||||
}
|
||||
|
||||
show() {
|
||||
this.emit(MAIN_WINDOW_EVENT_NAME.show)
|
||||
}
|
||||
|
||||
hide() {
|
||||
this.emit(MAIN_WINDOW_EVENT_NAME.hide)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = MainWindow
|
||||
|
||||
@@ -10,6 +10,9 @@ exports.mainWindow = {
|
||||
quit: 'quit',
|
||||
toggle_minimize: 'toggle_minimize',
|
||||
toggle_hide: 'toggle_hide',
|
||||
ready_to_show: 'ready_to_show',
|
||||
show: 'show',
|
||||
hide: 'hide',
|
||||
}
|
||||
|
||||
exports.tray = {
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
const { EventEmitter } = require('events')
|
||||
const { tray: TRAY_EVENT_NAME } = require('./_name')
|
||||
|
||||
class Tray extends EventEmitter {
|
||||
create() {
|
||||
this.emit(TRAY_EVENT_NAME.create)
|
||||
}
|
||||
|
||||
destroy() {
|
||||
this.emit(TRAY_EVENT_NAME.destroy)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Tray
|
||||
@@ -1,15 +0,0 @@
|
||||
const { EventEmitter } = require('events')
|
||||
const { winLyric: WIN_LYRIC_EVENT_NAME } = require('./_name')
|
||||
// const { updateSetting } = require('../utils')
|
||||
|
||||
class WinLyric extends EventEmitter {
|
||||
create() {
|
||||
this.emit(WIN_LYRIC_EVENT_NAME.create)
|
||||
}
|
||||
|
||||
close() {
|
||||
this.emit(WIN_LYRIC_EVENT_NAME.close)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = WinLyric
|
||||
@@ -82,7 +82,7 @@ if (isDev) {
|
||||
winURL = 'http://localhost:9080'
|
||||
} else {
|
||||
global.__static = path.join(__dirname, '/static')
|
||||
winURL = `file://${__dirname}/index.html`
|
||||
winURL = `file://${path.join(__dirname, 'index.html')}`
|
||||
}
|
||||
|
||||
function createWindow() {
|
||||
@@ -95,7 +95,7 @@ function createWindow() {
|
||||
useContentSize: true,
|
||||
width: windowSizeInfo.width,
|
||||
frame: false,
|
||||
transparent: !isLinux && !global.envParams.nt,
|
||||
transparent: !global.envParams.nt,
|
||||
enableRemoteModule: false,
|
||||
// icon: path.join(global.__static, isWin ? 'icons/256x256.ico' : 'icons/512x512.png'),
|
||||
resizable: false,
|
||||
@@ -124,14 +124,17 @@ global.appHotKey = {
|
||||
}
|
||||
|
||||
function init() {
|
||||
global.appSetting = initSetting()
|
||||
const info = initSetting()
|
||||
global.appSetting = info.setting
|
||||
global.appSettingVersion = info.version
|
||||
global.appHotKey.config = initHotKey()
|
||||
global.lx_event.common.initSetting()
|
||||
global.lx_event.hotKey.init()
|
||||
createWindow()
|
||||
}
|
||||
|
||||
app.on('ready', init)
|
||||
// https://github.com/electron/electron/issues/16809
|
||||
app.on('ready', isLinux ? () => setTimeout(init, 300) : init)
|
||||
|
||||
app.on('activate', () => {
|
||||
if (global.modules.mainWindow) {
|
||||
|
||||
@@ -23,9 +23,11 @@ exports.registerHotkey = ({ key, info }) => {
|
||||
}
|
||||
}
|
||||
global.appHotKey.state[key].info = info
|
||||
let status = global.appHotKey.state[key].status = globalShortcut.isRegistered(transKey) ? false : globalShortcut.register(transKey, () => {
|
||||
handleKeyDown(key)
|
||||
})
|
||||
let status = global.appHotKey.state[key].status = globalShortcut.isRegistered(transKey)
|
||||
? false
|
||||
: globalShortcut.register(transKey, () => {
|
||||
handleKeyDown(key)
|
||||
})
|
||||
return status
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
const { app, Tray, Menu } = require('electron')
|
||||
const { isWin } = require('../../common/utils')
|
||||
const { tray: TRAY_EVENT_NAME, common: COMMON_EVENT_NAME } = require('../events/_name')
|
||||
const { tray: TRAY_EVENT_NAME, common: COMMON_EVENT_NAME, mainWindow: MAIN_WINDOW_NAME } = require('../events/_name')
|
||||
const path = require('path')
|
||||
let isEnableTray = null
|
||||
let themeId = null
|
||||
@@ -29,6 +29,16 @@ global.lx_event.common.on(COMMON_EVENT_NAME.config, sourceName => {
|
||||
createMenu(global.modules.tray)
|
||||
})
|
||||
|
||||
global.lx_event.mainWindow.on(MAIN_WINDOW_NAME.ready_to_show, () => {
|
||||
createMenu(global.modules.tray)
|
||||
})
|
||||
global.lx_event.mainWindow.on(MAIN_WINDOW_NAME.show, () => {
|
||||
createMenu(global.modules.tray)
|
||||
})
|
||||
global.lx_event.mainWindow.on(MAIN_WINDOW_NAME.hide, () => {
|
||||
createMenu(global.modules.tray)
|
||||
})
|
||||
|
||||
const createTray = () => {
|
||||
if ((global.modules.tray && !global.modules.tray.isDestroyed()) || !global.appSetting.tray || !global.appSetting.tray.isShow) return
|
||||
|
||||
@@ -58,8 +68,24 @@ const destroyTray = () => {
|
||||
}
|
||||
|
||||
const createMenu = tray => {
|
||||
if (!global.modules.tray || !isWin) return
|
||||
if (!global.modules.tray) return
|
||||
let menu = []
|
||||
global.modules.mainWindow && menu.push(global.modules.mainWindow.isVisible() ? {
|
||||
label: '隐藏主界面',
|
||||
click() {
|
||||
global.modules.mainWindow.hide()
|
||||
},
|
||||
} : {
|
||||
label: '显示主界面',
|
||||
click() {
|
||||
if (!global.modules.mainWindow) return
|
||||
if (!global.modules.mainWindow.isVisible()) {
|
||||
global.modules.mainWindow.show()
|
||||
}
|
||||
global.modules.mainWindow.restore()
|
||||
global.modules.mainWindow.focus()
|
||||
},
|
||||
})
|
||||
menu.push(global.appSetting.desktopLyric.enable ? {
|
||||
label: '关闭桌面歌词',
|
||||
click() {
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
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 { getLyricWindowBounds } = require('./utils')
|
||||
|
||||
let isLock = null
|
||||
let isEnable = null
|
||||
let isAlwaysOnTop = null
|
||||
let isLockScreen = null
|
||||
const setLrcConfig = () => {
|
||||
let desktopLyric = global.appSetting.desktopLyric
|
||||
if (global.modules.lyricWindow) {
|
||||
mainSend(global.modules.lyricWindow, ipcWinLyricNames.set_lyric_config, {
|
||||
config: desktopLyric,
|
||||
languageId: global.appSetting.langId,
|
||||
isShowLyricTransition: global.appSetting.player.isShowLyricTransition,
|
||||
})
|
||||
if (isLock != desktopLyric.isLock) {
|
||||
isLock = desktopLyric.isLock
|
||||
@@ -24,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,7 +50,7 @@ const setLrcConfig = () => {
|
||||
}
|
||||
global.lx_event.common.on(COMMON_EVENT_NAME.config, name => {
|
||||
if (WIN_LYRIC_EVENT_NAME.name === name) return
|
||||
setLrcConfig(false)
|
||||
setLrcConfig()
|
||||
})
|
||||
|
||||
global.lx_event.mainWindow.on(MAIN_WINDOW_EVENT_NAME.setLyricInfo, info => {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
const path = require('path')
|
||||
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')
|
||||
@@ -12,7 +14,7 @@ global.lx_event.winLyric.on(WIN_LYRIC_EVENT_NAME.close, () => {
|
||||
closeWindow()
|
||||
})
|
||||
|
||||
let winURL = global.isDev ? 'http://localhost:9081/lyric.html' : `file://${__dirname}/lyric.html`
|
||||
let winURL = global.isDev ? 'http://localhost:9081/lyric.html' : `file://${path.join(__dirname, 'lyric.html')}`
|
||||
|
||||
const setLyricsConfig = debounce(config => {
|
||||
// if (x != null) bounds.x = x
|
||||
@@ -67,27 +69,31 @@ 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) {
|
||||
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),
|
||||
x: Math.max(-offset, screenWidth < (width + x) ? screenWidth - width : x),
|
||||
y: Math.max(-offset, screenHeight < (height + y) ? screenHeight - height : y),
|
||||
height,
|
||||
width,
|
||||
x,
|
||||
y,
|
||||
minWidth: 380,
|
||||
minHeight: 80,
|
||||
useContentSize: true,
|
||||
|
||||
@@ -8,6 +8,7 @@ const {
|
||||
},
|
||||
} = require('../../../common/ipc')
|
||||
const { winLyric: WIN_LYRIC_EVENT_NAME } = require('../../events/_name')
|
||||
const { getLyricWindowBounds } = require('./utils')
|
||||
|
||||
mainOn(ipcWinLyricNames.get_lyric_info, (event, action) => {
|
||||
if (!global.modules.mainWindow) return
|
||||
@@ -23,54 +24,9 @@ mainOn(ipcWinLyricNames.set_lyric_config, (event, config) => {
|
||||
})
|
||||
|
||||
mainHandle(ipcWinLyricNames.get_lyric_config, async() => {
|
||||
return { config: global.appSetting.desktopLyric, languageId: global.appSetting.langId }
|
||||
return { config: global.appSetting.desktopLyric, languageId: global.appSetting.langId, isShowLyricTransition: global.appSetting.player.isShowLyricTransition }
|
||||
})
|
||||
|
||||
let bounds
|
||||
let winX
|
||||
let winY
|
||||
let wasW
|
||||
let wasY
|
||||
let offset = 8
|
||||
mainOn(ipcWinLyricNames.set_win_bounds, (event, { 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
|
||||
|
||||
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 (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
|
||||
}
|
||||
|
||||
// console.log(bounds, x, y, w, h)
|
||||
global.modules.lyricWindow.setBounds(bounds)
|
||||
mainOn(ipcWinLyricNames.set_win_bounds, (event, options) => {
|
||||
global.modules.lyricWindow.setBounds(getLyricWindowBounds(global.modules.lyricWindow.getBounds(), options))
|
||||
})
|
||||
|
||||
68
src/main/modules/winLyric/utils.js
Normal file
68
src/main/modules/winLyric/utils.js
Normal file
@@ -0,0 +1,68 @@
|
||||
// 设置窗口位置、大小
|
||||
let winX
|
||||
let winY
|
||||
let wasW
|
||||
let wasH
|
||||
let offset = 8
|
||||
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
|
||||
bounds.x = x
|
||||
bounds.y = y
|
||||
// console.log('util bounds', bounds)
|
||||
return bounds
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
const { mainWindow: MAIN_WINDOW_EVENT_NAME } = require('../events/_name')
|
||||
const { mainOn, NAMES: { mainWindow: ipcMainWindowNames } } = require('../../common/ipc')
|
||||
const { mainOn, NAMES: { mainWindow: ipcMainWindowNames }, mainHandle } = require('../../common/ipc')
|
||||
|
||||
mainOn(ipcMainWindowNames.set_app_setting, (event, config) => {
|
||||
if (!config) return
|
||||
global.lx_event.common.setAppConfig(config, MAIN_WINDOW_EVENT_NAME.name)
|
||||
})
|
||||
|
||||
mainHandle(ipcMainWindowNames.get_setting, async() => ({ setting: global.appSetting, version: global.appSettingVersion }))
|
||||
@@ -1,7 +1,11 @@
|
||||
const { mainHandle, NAMES: { mainWindow: ipcMainWindowNames } } = require('../../common/ipc')
|
||||
|
||||
mainHandle(ipcMainWindowNames.clear_cache, async(event, options) => {
|
||||
if (!global.modules.mainWindow) throw new Error('mainWindow is undefined')
|
||||
return global.modules.mainWindow.webContents.session.clearCache()
|
||||
})
|
||||
|
||||
mainHandle(ipcMainWindowNames.get_cache_size, async(event, options) => {
|
||||
if (!global.modules.mainWindow) throw new Error('mainWindow is undefined')
|
||||
return global.modules.mainWindow.webContents.session.getCacheSize()
|
||||
})
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
const { mainHandle, NAMES: { mainWindow: ipcMainWindowNames } } = require('../../common/ipc')
|
||||
|
||||
mainHandle(ipcMainWindowNames.clear_cache, async(event, options) => {
|
||||
if (!global.modules.mainWindow) throw new Error('mainWindow is undefined')
|
||||
return global.modules.mainWindow.webContents.session.clearCache()
|
||||
})
|
||||
|
||||
|
||||
12
src/main/rendererEvents/data.js
Normal file
12
src/main/rendererEvents/data.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const Store = require('electron-store')
|
||||
const { mainOn, NAMES: { mainWindow: ipcMainWindowNames }, mainHandle } = require('../../common/ipc')
|
||||
|
||||
|
||||
const electronStore_data = new Store({
|
||||
name: 'data',
|
||||
})
|
||||
|
||||
mainHandle(ipcMainWindowNames.get_data, async(event, path) => electronStore_data.get(path))
|
||||
|
||||
|
||||
mainOn(ipcMainWindowNames.save_data, (event, { path, data }) => electronStore_data.set(path, data))
|
||||
@@ -1,5 +1,10 @@
|
||||
const { mainSend, NAMES: { mainWindow: ipcMainWindowNames }, mainOn } = require('../../common/ipc')
|
||||
const Store = require('electron-store')
|
||||
const { mainSend, NAMES: { mainWindow: ipcMainWindowNames }, mainOn, mainHandle } = require('../../common/ipc')
|
||||
const { mainWindow: MAIN_WINDOW_EVENT_NAME, hotKey: HOT_KEY_EVENT_NAME } = require('../events/_name')
|
||||
|
||||
const electronStore_hotKey = new Store({
|
||||
name: 'hotKey',
|
||||
})
|
||||
// const { registerHotkey, unRegisterHotkey } = require('../modules/hotKey/utils')
|
||||
|
||||
// mainHandle(ipcMainWindowNames.set_hot_key_config, async(event, { action, data }) => {
|
||||
@@ -14,6 +19,11 @@ const { mainWindow: MAIN_WINDOW_EVENT_NAME, hotKey: HOT_KEY_EVENT_NAME } = requi
|
||||
// }
|
||||
// })
|
||||
|
||||
mainHandle(ipcMainWindowNames.get_hot_key, async() => ({
|
||||
local: electronStore_hotKey.get('local'),
|
||||
global: electronStore_hotKey.get('global'),
|
||||
}))
|
||||
|
||||
mainOn(ipcMainWindowNames.quit, () => global.lx_event.mainWindow.quit())
|
||||
mainOn(ipcMainWindowNames.min_toggle, () => global.lx_event.mainWindow.toggleMinimize())
|
||||
mainOn(ipcMainWindowNames.hide_toggle, () => global.lx_event.mainWindow.toggleHide())
|
||||
|
||||
@@ -7,15 +7,16 @@ require('./musicMeta')
|
||||
require('./selectDir')
|
||||
require('./setWindowSize')
|
||||
require('./showSaveDialog')
|
||||
require('./clearCache')
|
||||
require('./getCacheSize')
|
||||
require('./cache')
|
||||
require('./setIgnoreMouseEvent')
|
||||
require('./getEnvParams')
|
||||
require('./setAppSetting')
|
||||
require('./appSetting')
|
||||
require('./setLyricInfo')
|
||||
require('./hotKey')
|
||||
require('./getDataPath')
|
||||
require('./showDialog')
|
||||
require('./playList')
|
||||
require('./data')
|
||||
|
||||
require('./xm_verify')
|
||||
|
||||
|
||||
23
src/main/rendererEvents/playList.js
Normal file
23
src/main/rendererEvents/playList.js
Normal file
@@ -0,0 +1,23 @@
|
||||
const Store = require('electron-store')
|
||||
const { mainOn, NAMES: { mainWindow: ipcMainWindowNames }, mainHandle } = require('../../common/ipc')
|
||||
|
||||
|
||||
let electronStore_list
|
||||
|
||||
mainHandle(ipcMainWindowNames.get_playlist, async(event, isIgnoredError = false) => {
|
||||
if (!electronStore_list) {
|
||||
electronStore_list = new Store({
|
||||
name: 'playList',
|
||||
clearInvalidConfig: !isIgnoredError,
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
defaultList: electronStore_list.get('defaultList'),
|
||||
loveList: electronStore_list.get('loveList'),
|
||||
userList: electronStore_list.get('userList'),
|
||||
downloadList: electronStore_list.get('downloadList'),
|
||||
}
|
||||
})
|
||||
|
||||
mainOn(ipcMainWindowNames.save_playlist, (event, { type, data }) => electronStore_list && electronStore_list.set(type, data))
|
||||
@@ -29,5 +29,13 @@ module.exports = mainWindow => {
|
||||
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
mainWindow.show()
|
||||
global.lx_event.mainWindow.readyToShow()
|
||||
})
|
||||
|
||||
mainWindow.on('show', () => {
|
||||
global.lx_event.mainWindow.show()
|
||||
})
|
||||
mainWindow.on('hide', () => {
|
||||
global.lx_event.mainWindow.hide()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ module.exports = (filePath, meta) => {
|
||||
if (respones.statusCode !== 200 && respones.statusCode != 206) return writeMeta(filePath, meta)
|
||||
respones
|
||||
.pipe(fs.createWriteStream(picPath))
|
||||
.on('finish', () => {
|
||||
.on('finish', async() => {
|
||||
if (respones.complete) {
|
||||
writeMeta(filePath, meta, picPath)
|
||||
await writeMeta(filePath, meta, picPath)
|
||||
} else {
|
||||
writeMeta(filePath, meta)
|
||||
}
|
||||
|
||||
@@ -47,6 +47,9 @@ module.exports = (filePath, meta) => {
|
||||
if (err) console.log(err.message)
|
||||
delete meta.APIC
|
||||
handleWriteMeta(meta, filePath)
|
||||
fs.unlink(picPath, err => {
|
||||
if (err) console.log(err.message)
|
||||
})
|
||||
})
|
||||
})
|
||||
.on('error', err => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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')
|
||||
@@ -191,7 +208,7 @@ export default {
|
||||
}
|
||||
if (this.lyricEvent.isStopScroll) return
|
||||
let dom_p = this.dom_lines[this.lyric.line]
|
||||
cancelScrollFn = scrollTo(this.$refs.dom_lyric, dom_p ? (dom_p.offsetTop - this.$refs.dom_lyric.clientHeight * 0.38) : 0)
|
||||
cancelScrollFn = scrollTo(this.$refs.dom_lyric, dom_p ? (dom_p.offsetTop - this.$refs.dom_lyric.clientHeight * 0.5 + dom_p.clientHeight / 2) : 0)
|
||||
},
|
||||
handleLyricMouseDown(e) {
|
||||
if (e.target.classList.contains(this.$style.lrcLine)) {
|
||||
@@ -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 || ''))
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template lang="pug">
|
||||
#container(v-if="isProd && !isNt" :class="theme" @mouseenter="enableIgnoreMouseEvents" @mouseleave="dieableIgnoreMouseEvents")
|
||||
#container(v-if="isProd && !isNt && !isLinux" :class="theme" @mouseenter="enableIgnoreMouseEvents" @mouseleave="dieableIgnoreMouseEvents")
|
||||
core-aside#left
|
||||
#right
|
||||
core-toolbar#toolbar
|
||||
@@ -27,7 +27,7 @@ import { mapMutations, mapGetters, mapActions } from 'vuex'
|
||||
import { rendererOn, rendererSend, rendererInvoke, NAMES } from '../common/ipc'
|
||||
import { isLinux } from '../common/utils'
|
||||
import music from './utils/music'
|
||||
import { throttle, openUrl, compareVer } from './utils'
|
||||
import { throttle, openUrl, compareVer, getPlayList } from './utils'
|
||||
import { base as eventBaseName } from './event/names'
|
||||
|
||||
window.ELECTRON_DISABLE_SECURITY_WARNINGS = process.env.ELECTRON_DISABLE_SECURITY_WARNINGS
|
||||
@@ -42,6 +42,7 @@ export default {
|
||||
return {
|
||||
isProd: process.env.NODE_ENV === 'production',
|
||||
isNt: false,
|
||||
isLinux,
|
||||
globalObj: {
|
||||
apiSource: 'test',
|
||||
proxy: {},
|
||||
@@ -70,19 +71,34 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.saveDefaultList = throttle(n => {
|
||||
window.electronStore_list.set('defaultList', n)
|
||||
rendererSend(NAMES.mainWindow.save_playlist, {
|
||||
type: 'defaultList',
|
||||
data: n,
|
||||
})
|
||||
}, 500)
|
||||
this.saveLoveList = throttle(n => {
|
||||
window.electronStore_list.set('loveList', n)
|
||||
rendererSend(NAMES.mainWindow.save_playlist, {
|
||||
type: 'loveList',
|
||||
data: n,
|
||||
})
|
||||
}, 500)
|
||||
this.saveUserList = throttle(n => {
|
||||
window.electronStore_list.set('userList', n)
|
||||
rendererSend(NAMES.mainWindow.save_playlist, {
|
||||
type: 'userList',
|
||||
data: n,
|
||||
})
|
||||
}, 500)
|
||||
this.saveDownloadList = throttle(n => {
|
||||
window.electronStore_list.set('downloadList', n)
|
||||
rendererSend(NAMES.mainWindow.save_playlist, {
|
||||
type: 'downloadList',
|
||||
data: n,
|
||||
})
|
||||
}, 1000)
|
||||
this.saveSearchHistoryList = throttle(n => {
|
||||
window.electronStore_data.set('searchHistoryList', n)
|
||||
rendererSend(NAMES.mainWindow.save_data, {
|
||||
path: 'searchHistoryList',
|
||||
data: n,
|
||||
})
|
||||
}, 500)
|
||||
},
|
||||
mounted() {
|
||||
@@ -135,12 +151,32 @@ export default {
|
||||
'windowSizeActive.fontSize'(n) {
|
||||
document.documentElement.style.fontSize = n
|
||||
},
|
||||
'setting.isShowAnimation': {
|
||||
handler(n) {
|
||||
if (n) {
|
||||
if (document.body.classList.contains('disableAnimation')) {
|
||||
document.body.classList.remove('disableAnimation')
|
||||
}
|
||||
} else {
|
||||
if (!document.body.classList.contains('disableAnimation')) {
|
||||
document.body.classList.add('disableAnimation')
|
||||
}
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getVersionInfo']),
|
||||
...mapMutations(['setNewVersion', 'setVersionModalVisible', 'setDownloadProgress', 'setSetting', 'setDesktopLyricConfig']),
|
||||
...mapMutations('list', ['initList']),
|
||||
...mapMutations('download', ['updateDownloadList']),
|
||||
...mapMutations('search', {
|
||||
setSearchHistoryList: 'setHistory',
|
||||
}),
|
||||
...mapMutations('player', {
|
||||
setPlayList: 'setList',
|
||||
}),
|
||||
init() {
|
||||
document.documentElement.style.fontSize = this.windowSizeActive.fontSize
|
||||
|
||||
@@ -229,19 +265,24 @@ export default {
|
||||
},
|
||||
|
||||
initData() { // 初始化数据
|
||||
this.initPlayList() // 初始化播放列表
|
||||
this.initDownloadList() // 初始化下载列表
|
||||
this.initLocalList() // 初始化播放列表
|
||||
// this.initDownloadList() // 初始化下载列表
|
||||
this.initSearchHistoryList() // 初始化搜索历史列表
|
||||
},
|
||||
initPlayList() {
|
||||
let defaultList = window.electronStore_list.get('defaultList') || this.defaultList
|
||||
let loveList = window.electronStore_list.get('loveList') || this.loveList
|
||||
let userList = window.electronStore_list.get('userList') || this.userList
|
||||
if (!defaultList.list) defaultList.list = []
|
||||
if (!loveList.list) loveList.list = []
|
||||
this.initList({ defaultList, loveList, userList })
|
||||
initLocalList() {
|
||||
getPlayList().then(({ defaultList, loveList, userList, downloadList }) => {
|
||||
if (!defaultList) defaultList = this.defaultList
|
||||
if (!loveList) loveList = this.loveList
|
||||
if (!userList) userList = this.userList
|
||||
|
||||
if (!defaultList.list) defaultList.list = []
|
||||
if (!loveList.list) loveList.list = []
|
||||
this.initList({ defaultList, loveList, userList })
|
||||
this.initDownloadList(downloadList) // 初始化下载列表
|
||||
this.initPlayInfo()
|
||||
})
|
||||
},
|
||||
initDownloadList() {
|
||||
let downloadList = window.electronStore_list.get('downloadList')
|
||||
initDownloadList(downloadList) {
|
||||
if (downloadList) {
|
||||
downloadList.forEach(item => {
|
||||
if (item.status == this.downloadStatus.RUN || item.status == this.downloadStatus.WAITING) {
|
||||
@@ -252,6 +293,37 @@ export default {
|
||||
this.updateDownloadList(downloadList)
|
||||
}
|
||||
},
|
||||
initSearchHistoryList() {
|
||||
rendererInvoke(NAMES.mainWindow.get_data, 'searchHistoryList').then(historyList => {
|
||||
if (historyList == null) {
|
||||
historyList = []
|
||||
rendererSend(NAMES.mainWindow.save_data, { path: 'searchHistoryList', data: historyList })
|
||||
} else {
|
||||
this.setSearchHistoryList(historyList)
|
||||
}
|
||||
})
|
||||
},
|
||||
initPlayInfo() {
|
||||
rendererInvoke(NAMES.mainWindow.get_data, 'playInfo').then(info => {
|
||||
// console.log(info, window.allList)
|
||||
if (!info) return
|
||||
if (info.listId) {
|
||||
const list = window.allList[info.listId]
|
||||
// console.log(list)
|
||||
if (!list) return
|
||||
info.list = list.list
|
||||
}
|
||||
|
||||
window.restorePlayInfo = info
|
||||
this.setPlayList({
|
||||
list: {
|
||||
list: info.list,
|
||||
id: info.listId,
|
||||
},
|
||||
index: info.index,
|
||||
})
|
||||
})
|
||||
},
|
||||
showUpdateModal() {
|
||||
(this.version.newVersion && this.version.newVersion.history
|
||||
? Promise.resolve(this.version.newVersion)
|
||||
@@ -292,12 +364,12 @@ export default {
|
||||
},
|
||||
handleEnvParamsInit(envParams) {
|
||||
this.envParams = envParams
|
||||
this.isNt = isLinux || this.envParams.nt
|
||||
this.isNt = this.envParams.nt
|
||||
if (this.isNt) {
|
||||
document.body.classList.remove('transparent')
|
||||
document.body.classList.add('noTransparent')
|
||||
}
|
||||
if (this.isProd && !this.isNt) {
|
||||
if (this.isProd && !this.isNt && !this.isLinux) {
|
||||
document.body.addEventListener('mouseenter', this.dieableIgnoreMouseEvents)
|
||||
document.body.addEventListener('mouseleave', this.enableIgnoreMouseEvents)
|
||||
}
|
||||
@@ -354,6 +426,11 @@ body {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.disableAnimation * {
|
||||
transition: none !important;
|
||||
animation: none !important;
|
||||
}
|
||||
|
||||
.transparent {
|
||||
padding: @shadow-app;
|
||||
#container {
|
||||
|
||||
BIN
src/renderer/assets/images/defaultUser.jpg
Normal file
BIN
src/renderer/assets/images/defaultUser.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
@@ -23,6 +23,7 @@
|
||||
@color-theme_2-font-label: fadeout(@color-theme_2-font, 50%);
|
||||
// @color-theme_2-line: transparent;
|
||||
@color-theme_2-line: lighten(@color-theme, 35%);
|
||||
@color-reply-floor: fadeout(@color-theme, 95%);
|
||||
@color-theme-sidebar: @color-theme;
|
||||
@color-btn: lighten(@color-theme, 5%);
|
||||
@color-btn-background: fadeout(lighten(@color-theme, 35%), 70%);
|
||||
@@ -91,6 +92,7 @@
|
||||
@color-green-theme_2-font-label: fadeout(@color-green-theme_2-font, 50%);
|
||||
// @color-green-theme_2-line: transparent;
|
||||
@color-green-theme_2-line: lighten(@color-green-theme, 45%);
|
||||
@color-green-reply-floor: fadeout(@color-green-theme, 95%);
|
||||
@color-green-theme-sidebar: @color-green-theme;
|
||||
@color-green-btn: lighten(@color-green-theme, 5%);
|
||||
@color-green-btn-background: fadeout(lighten(@color-green-theme, 35%), 70%);
|
||||
@@ -148,6 +150,7 @@
|
||||
@color-yellow-theme_2-font-label: fadeout(@color-yellow-theme_2-font, 50%);
|
||||
// @color-yellow-theme_2-line: transparent;
|
||||
@color-yellow-theme_2-line: lighten(@color-yellow-theme, 28%);
|
||||
@color-yellow-reply-floor: fadeout(@color-yellow-theme, 94%);
|
||||
@color-yellow-theme-sidebar: @color-yellow-theme;
|
||||
@color-yellow-btn: darken(@color-yellow-theme, 5%);
|
||||
@color-yellow-btn-background: fadeout(lighten(@color-yellow-theme, 25%), 60%);
|
||||
@@ -204,6 +207,7 @@
|
||||
@color-orange-theme_2-font-label: fadeout(@color-orange-theme_2-font, 50%);
|
||||
// @color-orange-theme_2-line: transparent;
|
||||
@color-orange-theme_2-line: lighten(@color-orange-theme, 36%);
|
||||
@color-orange-reply-floor: fadeout(@color-orange-theme, 95%);
|
||||
@color-orange-theme-sidebar: @color-orange-theme;
|
||||
@color-orange-btn: lighten(@color-orange-theme, 5%);
|
||||
@color-orange-btn-background: fadeout(lighten(@color-orange-theme, 25%), 60%);
|
||||
@@ -260,6 +264,7 @@
|
||||
@color-blue-theme_2-font-label: fadeout(@color-blue-theme_2-font, 50%);
|
||||
// @color-blue-theme_2-line: transparent;
|
||||
@color-blue-theme_2-line: lighten(@color-blue-theme, 42%);
|
||||
@color-blue-reply-floor: fadeout(@color-blue-theme, 95%);
|
||||
@color-blue-theme-sidebar: @color-blue-theme;
|
||||
@color-blue-btn: lighten(@color-blue-theme, 5%);
|
||||
@color-blue-btn-background: fadeout(lighten(@color-blue-theme, 35%), 50%);
|
||||
@@ -316,6 +321,7 @@
|
||||
@color-red-theme_2-font-label: fadeout(@color-red-theme_2-font, 50%);
|
||||
// @color-red-theme_2-line: transparent;
|
||||
@color-red-theme_2-line: lighten(@color-red-theme, 42%);
|
||||
@color-red-reply-floor: fadeout(@color-red-theme, 95%);
|
||||
@color-red-theme-sidebar: @color-red-theme;
|
||||
@color-red-btn: lighten(@color-red-theme, 5%);
|
||||
@color-red-btn-background: fadeout(lighten(@color-red-theme, 35%), 70%);
|
||||
@@ -374,6 +380,7 @@
|
||||
@color-pink-theme_2-font-label: fadeout(@color-pink-theme_2-font, 50%);
|
||||
// @color-pink-theme_2-line: transparent;
|
||||
@color-pink-theme_2-line: lighten(@color-pink-theme, 25%);
|
||||
@color-pink-reply-floor: fadeout(@color-pink-theme, 93%);
|
||||
@color-pink-theme-sidebar: @color-pink-theme;
|
||||
@color-pink-btn: darken(@color-pink-theme, 3%);
|
||||
@color-pink-btn-background: fadeout(lighten(@color-pink-theme, 20%), 50%);
|
||||
@@ -430,6 +437,7 @@
|
||||
@color-purple-theme_2-font-label: fadeout(@color-purple-theme_2-font, 50%);
|
||||
// @color-purple-theme_2-line: transparent;
|
||||
@color-purple-theme_2-line: lighten(@color-purple-theme, 43%);
|
||||
@color-purple-reply-floor: fadeout(@color-purple-theme, 95%);
|
||||
@color-purple-theme-sidebar: @color-purple-theme;
|
||||
@color-purple-btn: lighten(@color-purple-theme, 5%);
|
||||
@color-purple-btn-background: fadeout(lighten(@color-purple-theme, 35%), 70%);
|
||||
@@ -486,6 +494,7 @@
|
||||
@color-grey-theme_2-font-label: fadeout(@color-grey-theme_2-font, 50%);
|
||||
// @color-grey-theme_2-line: transparent;
|
||||
@color-grey-theme_2-line: lighten(@color-grey-theme, 47%);
|
||||
@color-grey-reply-floor: fadeout(@color-grey-theme, 95%);
|
||||
@color-grey-theme-sidebar: @color-grey-theme;
|
||||
@color-grey-btn: lighten(@color-grey-theme, 5%);
|
||||
@color-grey-btn-background: fadeout(lighten(@color-grey-theme, 35%), 70%);
|
||||
@@ -543,6 +552,7 @@
|
||||
@color-ming-theme_2-font-label: fadeout(@color-ming-theme_2-font, 50%);
|
||||
// @color-ming-theme_2-line: transparent;
|
||||
@color-ming-theme_2-line: lighten(@color-ming-theme, 60%);
|
||||
@color-ming-reply-floor: fadeout(@color-ming-theme, 95%);
|
||||
@color-ming-theme-sidebar: @color-ming-theme;
|
||||
@color-ming-btn: lighten(@color-ming-theme, 5%);
|
||||
@color-ming-btn-background: fadeout(lighten(@color-ming-theme, 35%), 75%);
|
||||
@@ -602,6 +612,7 @@
|
||||
@color-blue2-theme_2-font-label: fadeout(@color-blue2-theme_2-font, 50%);
|
||||
// @color-blue2-theme_2-line: transparent;
|
||||
@color-blue2-theme_2-line: lighten(@color-blue2-theme, 41%);
|
||||
@color-blue2-reply-floor: fadeout(@color-blue2-theme, 95%);
|
||||
@color-blue2-theme-sidebar: @color-blue2-theme;
|
||||
@color-blue2-btn: lighten(@color-blue2-theme, 5%);
|
||||
@color-blue2-btn-background: fadeout(lighten(@color-blue2-theme, 30%), 70%);
|
||||
@@ -651,7 +662,7 @@
|
||||
@color-mid_autumn-theme-font: rgba(246, 233, 255, 0.9);
|
||||
@color-mid_autumn-theme-font-label: fadeout(lighten(@color-mid_autumn-theme, 20%), 20%);
|
||||
@color-mid_autumn-theme_2: rgba(255, 255, 255, .9);
|
||||
@color-mid_autumn-theme_2-background_1: #e7e7e9;
|
||||
@color-mid_autumn-theme_2-background_1: #ececec;
|
||||
@color-mid_autumn-theme_2-background_2: fadeout(@color-mid_autumn-theme_2-background_1, 2%);
|
||||
@color-mid_autumn-theme_2-hover: fadeout(lighten(@color-mid_autumn-theme, 15%), 80%);
|
||||
@color-mid_autumn-theme_2-active: fadeout(lighten(@color-mid_autumn-theme, 15%), 70%);
|
||||
@@ -659,6 +670,7 @@
|
||||
@color-mid_autumn-theme_2-font-label: desaturate(lighten(@color-mid_autumn-theme, 30%), 45%);
|
||||
// @color-mid_autumn-theme_2-line: transparent;
|
||||
@color-mid_autumn-theme_2-line: lighten(@color-mid_autumn-theme, 61%);
|
||||
@color-mid_autumn-reply-floor: fadeout(@color-mid_autumn-theme, 95%);
|
||||
@color-mid_autumn-theme-sidebar: rgba(255, 255, 255, 0);
|
||||
@color-mid_autumn-btn: lighten(@color-mid_autumn-theme, 10%);
|
||||
@color-mid_autumn-btn-background: fadeout(lighten(@color-mid_autumn-theme, 35%), 70%);
|
||||
@@ -716,6 +728,7 @@
|
||||
@color-mid_autumn-theme_2-font-label: desaturate(lighten(@color-mid_autumn-theme, 30%), 45%);
|
||||
// @color-mid_autumn-theme_2-line: transparent;
|
||||
@color-mid_autumn-theme_2-line: darken(@color-mid_autumn-theme, 18%);
|
||||
@color-mid_autumn-reply-floor: fadeout(@color-mid_autumn-theme, 95%);
|
||||
@color-mid_autumn-theme-sidebar: rgba(255, 255, 255, 0);
|
||||
@color-mid_autumn-btn: darken(@color-mid_autumn-theme, 10%);
|
||||
@color-mid_autumn-btn-background: fadeout(lighten(@color-mid_autumn-theme, 35%), 70%);
|
||||
@@ -772,6 +785,7 @@
|
||||
@color-naruto-theme_2-font-label: desaturate(lighten(@color-naruto-theme, 10%), 45%);
|
||||
// @color-naruto-theme_2-line: transparent;
|
||||
@color-naruto-theme_2-line: fadeout(lighten(@color-naruto-theme, 36%), 70%);
|
||||
@color-naruto-reply-floor: fadeout(lighten(@color-naruto-theme, 12%), 90%);
|
||||
@color-naruto-theme-sidebar: rgba(255, 255, 255, .3);
|
||||
@color-naruto-btn: lighten(@color-naruto-theme, 2%);
|
||||
@color-naruto-btn-background: fadeout(lighten(@color-naruto-theme, 35%), 70%);
|
||||
@@ -828,6 +842,7 @@
|
||||
@color-happy_new_year-theme_2-font-label: desaturate(darken(@color-happy_new_year-theme, 5%), 50%);
|
||||
// @color-happy_new_year-theme_2-line: transparent;
|
||||
@color-happy_new_year-theme_2-line: fadeout(lighten(@color-happy_new_year-theme, 16%), 70%);
|
||||
@color-happy_new_year-reply-floor: fadeout(lighten(@color-happy_new_year-theme, 12%), 85%);
|
||||
@color-happy_new_year-theme-sidebar: rgba(119, 37, 18, 0.1);
|
||||
@color-happy_new_year-btn: desaturate(@color-happy_new_year-theme, 10%);
|
||||
@color-happy_new_year-btn-background: fadeout(lighten(@color-happy_new_year-theme, 15%), 60%);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<template lang="pug">
|
||||
div(:class="$style.aside")
|
||||
div(:class="$style.controlBtn" v-if="setting.controlBtnPosition == 'left'")
|
||||
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.controlBtniIcon" 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')
|
||||
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.controlBtniIcon" 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')
|
||||
|
||||
@@ -16,18 +16,18 @@ div(:class="$style.aside")
|
||||
dl
|
||||
//- dt {{$t('core.aside.online_music')}}
|
||||
dd
|
||||
router-link(:active-class="$style.active" to="search" :title="$t('core.aside.search')")
|
||||
router-link(:active-class="$style.active" to="search" :tips="$t('core.aside.search')")
|
||||
div(:class="$style.icon")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 425.2 425.2' space='preserve')
|
||||
use(xlink:href='#icon-search-2')
|
||||
dd
|
||||
router-link(:active-class="$style.active" to="songList" :title="$t('core.aside.song_list')")
|
||||
router-link(:active-class="$style.active" to="songList" :tips="$t('core.aside.song_list')")
|
||||
div(:class="$style.icon")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 425.2 425.2' space='preserve')
|
||||
use(xlink:href='#icon-album')
|
||||
//- span {{$t('core.aside.song_list')}}
|
||||
dd
|
||||
router-link(:active-class="$style.active" to="leaderboard" :title="$t('core.aside.leaderboard')")
|
||||
router-link(:active-class="$style.active" to="leaderboard" :tips="$t('core.aside.leaderboard')")
|
||||
div(:class="$style.icon")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 425.22 425.2' space='preserve')
|
||||
use(xlink:href='#icon-leaderboard')
|
||||
@@ -35,20 +35,20 @@ div(:class="$style.aside")
|
||||
dl
|
||||
//- dt {{$t('core.aside.my_music')}}
|
||||
dd
|
||||
router-link(:active-class="$style.active" :title="$t('core.aside.my_list')" :to="`list?id=${setting.list.prevSelectListId || defaultList.id}`")
|
||||
router-link(:active-class="$style.active" :tips="$t('core.aside.my_list')" :to="`list?id=${setting.list.prevSelectListId || defaultList.id}`")
|
||||
div(:class="$style.icon")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 444.87 391.18' space='preserve')
|
||||
use(xlink:href='#icon-love')
|
||||
dl
|
||||
//- dt {{$t('core.aside.other')}}
|
||||
dd(v-if="setting.download.enable")
|
||||
router-link(:active-class="$style.active" to="download" :title="$t('core.aside.download')")
|
||||
router-link(:active-class="$style.active" to="download" :tips="$t('core.aside.download')")
|
||||
div(:class="$style.icon")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 425.2 425.2' space='preserve')
|
||||
use(xlink:href='#icon-download-2')
|
||||
//- span {{$t('core.aside.download')}}
|
||||
dd
|
||||
router-link(:active-class="$style.active" to="setting" :title="$t('core.aside.setting')")
|
||||
router-link(:active-class="$style.active" to="setting" :tips="$t('core.aside.setting')")
|
||||
div(:class="$style.icon")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 493.23 436.47' space='preserve')
|
||||
use(xlink:href='#icon-setting')
|
||||
@@ -147,7 +147,7 @@ export default {
|
||||
height: @control-btn-width;
|
||||
background: none;
|
||||
border: none;
|
||||
// display: flex;
|
||||
display: flex;
|
||||
// justify-content: center;
|
||||
// align-items: center;
|
||||
outline: none;
|
||||
|
||||
@@ -75,8 +75,8 @@ svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/19
|
||||
// 0 0 512 512
|
||||
path(d='M511.563,434.259c-1.728-142.329-124.42-258.242-277.087-263.419V95.999c0-17.645-14.342-31.999-31.974-31.999 c-7.931,0-15.591,3.042-21.524,8.562c0,0-134.828,124.829-173.609,163.755C2.623,241.109,0,248.088,0,255.994 c0,7.906,2.623,14.885,7.369,19.687c38.781,38.915,173.609,163.745,173.609,163.745c5.933,5.521,13.593,8.562,21.524,8.562 c17.631,0,31.974-14.354,31.974-31.999v-74.591c153.479,2.156,255.792,50.603,255.792,95.924c0,5.896,4.767,10.666,10.658,10.666 c0.167,0.021,0.333,0.01,0.416,0c5.891,0,10.658-4.771,10.658-10.666C512,436.259,511.854,435.228,511.563,434.259z')
|
||||
g#icon-refresh(fill='currentColor')
|
||||
// 0 0 512 512
|
||||
path(d='M440.65 12.57l4 82.77A247.16 247.16 0 0 0 255.83 8C134.73 8 33.91 94.92 12.29 209.82A12 12 0 0 0 24.09 224h49.05a12 12 0 0 0 11.67-9.26 175.91 175.91 0 0 1 317-56.94l-101.46-4.86a12 12 0 0 0-12.57 12v47.41a12 12 0 0 0 12 12H500a12 12 0 0 0 12-12V12a12 12 0 0 0-12-12h-47.37a12 12 0 0 0-11.98 12.57zM255.83 432a175.61 175.61 0 0 1-146-77.8l101.8 4.87a12 12 0 0 0 12.57-12v-47.4a12 12 0 0 0-12-12H12a12 12 0 0 0-12 12V500a12 12 0 0 0 12 12h47.35a12 12 0 0 0 12-12.6l-4.15-82.57A247.17 247.17 0 0 0 255.83 504c121.11 0 221.93-86.92 243.55-201.82a12 12 0 0 0-11.8-14.18h-49.05a12 12 0 0 0-11.67 9.26A175.86 175.86 0 0 1 255.83 432z')
|
||||
// 0 0 24 24
|
||||
path(d='M12,6V9L16,5L12,1V4A8,8 0 0,0 4,12C4,13.57 4.46,15.03 5.24,16.26L6.7,14.8C6.25,13.97 6,13 6,12A6,6 0 0,1 12,6M18.76,7.74L17.3,9.2C17.74,10.04 18,11 18,12A6,6 0 0,1 12,18V15L8,19L12,23V20A8,8 0 0,0 20,12C20,10.43 19.54,8.97 18.76,7.74Z')
|
||||
g#icon-eraser(fill='currentColor')
|
||||
// 0 0 512 512
|
||||
path(d='M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z')
|
||||
@@ -165,5 +165,57 @@ svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/19
|
||||
g#icon-window-close(fill='currentColor')
|
||||
//- 0 0 24 24
|
||||
path(d="M20 6.91L17.09 4L12 9.09L6.91 4L4 6.91L9.09 12L4 17.09L6.91 20L12 14.91L17.09 20L20 17.09L14.91 12L20 6.91Z")
|
||||
|
||||
|
||||
g#icon-list-loop(fill='currentColor')
|
||||
// 0 0 24 24
|
||||
path(d="M0 0h24v24H0z" fill="none")
|
||||
path(d='M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z')
|
||||
|
||||
g#icon-single-loop(fill='currentColor')
|
||||
// 0 0 24 24
|
||||
path(d="M0 0h24v24H0z" fill="none")
|
||||
path(d="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4zm-4-2V9h-1l-2 1v1h1.5v4H13z")
|
||||
|
||||
g#icon-list-random(fill='currentColor')
|
||||
// 0 0 24 24
|
||||
path(d="M0 0h24v24H0z" fill="none")
|
||||
path(d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z")
|
||||
|
||||
g#icon-list-order(fill='currentColor')
|
||||
// 0 0 24 24
|
||||
path(d="M0 0h24v24H0z" fill="none")
|
||||
path(d="M4 10h12v2H4zm0-4h12v2H4zm0 8h8v2H4zm10 0v6l5-3z")
|
||||
|
||||
g#icon-single(fill='currentColor')
|
||||
//- 0 0 24 24
|
||||
path(d='M18,6.8v9.9h-2.1v-5.3c0-0.8,0-1.2,0-1.4c0-0.2-0.1-0.3-0.3-0.4c-0.1-0.1-0.5-0.1-1-0.1h-0.2V8.4c1-0.3,1.8-0.8,2.3-1.6H18z')
|
||||
polygon(points='6,18 14.5,12 6,6 ')
|
||||
|
||||
g#icon-desktop-lyric-on(fill='currentColor')
|
||||
//- 0 0 512 512
|
||||
path(d='M162.64,335.554H81.017V152.1H55.143V359.7h107.5V335.554ZM288.807,291.4a117.012,117.012,0,0,0-11.222-20.092,29.568,29.568,0,0,0-13.365-10.562,54.323,54.323,0,0,0,17.225-7.7,50.6,50.6,0,0,0,12.579-12.23,52.253,52.253,0,0,0,7.648-15.724,64.034,64.034,0,0,0,2.573-18.345,67.706,67.706,0,0,0-3.5-22.316,42.831,42.831,0,0,0-11.007-17.233,51.262,51.262,0,0,0-19.227-11.118q-11.722-3.969-28.018-3.971H192.459V359.7H217.9v-92.44h12.008a37.092,37.092,0,0,1,10.078,1.271,24.136,24.136,0,0,1,8.291,4.209,32.591,32.591,0,0,1,7.076,7.941A76.14,76.14,0,0,1,261.79,293.3L289.664,359.7H318.4Zm-13.938-67.106a30.684,30.684,0,0,1-7.862,11.118,33.47,33.47,0,0,1-12.293,6.83,53.247,53.247,0,0,1-16.225,2.3H217.9V175.928H241.92q17.01,0,26.374,8.259t9.363,24.937A38.647,38.647,0,0,1,274.869,224.292ZM456.714,325.229a100.649,100.649,0,0,1-21.156,8.657,84.575,84.575,0,0,1-23.015,3.1q-28.448,0-43.17-20.489t-14.724-60.833a133.161,133.161,0,0,1,4-34.228q4-15.009,11.436-25.413a50.462,50.462,0,0,1,18.083-15.883,51.244,51.244,0,0,1,23.8-5.48,82.427,82.427,0,0,1,23.73,3.256,89.743,89.743,0,0,1,21.013,9.451v-27.8a94.1,94.1,0,0,0-21.442-7.544,112.019,112.019,0,0,0-24.158-2.462q-19.158,0-34.594,7.624a74.755,74.755,0,0,0-26.3,21.68q-10.865,14.056-16.724,34.228T327.632,258.2q0,51.461,21.227,77.748t60.825,26.286a111.234,111.234,0,0,0,47.03-10.324V325.229Z')
|
||||
|
||||
g#icon-desktop-lyric-off(fill='currentColor')
|
||||
//- 0 0 512 512
|
||||
path(d='M162.64,335.554H81.017V152.1H55.143V359.7h107.5V335.554ZM288.807,291.4a117.012,117.012,0,0,0-11.222-20.092,29.568,29.568,0,0,0-13.365-10.562,54.323,54.323,0,0,0,17.225-7.7,50.6,50.6,0,0,0,12.579-12.23,52.253,52.253,0,0,0,7.648-15.724,64.034,64.034,0,0,0,2.573-18.345,67.706,67.706,0,0,0-3.5-22.316,42.831,42.831,0,0,0-11.007-17.233,51.262,51.262,0,0,0-19.227-11.118q-11.722-3.969-28.018-3.971H192.459V359.7H217.9v-92.44h12.008a37.092,37.092,0,0,1,10.078,1.271,24.136,24.136,0,0,1,8.291,4.209,32.591,32.591,0,0,1,7.076,7.941A76.14,76.14,0,0,1,261.79,293.3L289.664,359.7H318.4Zm-13.938-67.106a30.684,30.684,0,0,1-7.862,11.118,33.47,33.47,0,0,1-12.293,6.83,53.247,53.247,0,0,1-16.225,2.3H217.9V175.928H241.92q17.01,0,26.374,8.259t9.363,24.937A38.647,38.647,0,0,1,274.869,224.292ZM456.714,325.229a100.649,100.649,0,0,1-21.156,8.657,84.575,84.575,0,0,1-23.015,3.1q-28.448,0-43.17-20.489t-14.724-60.833a133.161,133.161,0,0,1,4-34.228q4-15.009,11.436-25.413a50.462,50.462,0,0,1,18.083-15.883,51.244,51.244,0,0,1,23.8-5.48,82.427,82.427,0,0,1,23.73,3.256,89.743,89.743,0,0,1,21.013,9.451v-27.8a94.1,94.1,0,0,0-21.442-7.544,112.019,112.019,0,0,0-24.158-2.462q-19.158,0-34.594,7.624a74.755,74.755,0,0,0-26.3,21.68q-10.865,14.056-16.724,34.228T327.632,258.2q0,51.461,21.227,77.748t60.825,26.286a111.234,111.234,0,0,0,47.03-10.324V325.229Z')
|
||||
path(d='M69.148,97.826l17.7-17.651,333,334-17.7,17.652Z')
|
||||
|
||||
g#icon-add-2(fill='currentColor')
|
||||
//- 0 0 1024 1024
|
||||
path(d='M256,170s-62.469-76.808-141-24C44.762,222.824,84.909,325.08,256,415c21.339-8.361,44-17,44-17,19-6.392,28.155,20.742,16,26-27.589,11.935,5.974-4.141-60,28C-35.524,313.85,43.993,149.031,95,117c86.8-65.89,162,10,162,10s58.158-60.523,140-23c104.032,58.528,64,161.9,45,196-9.152,15.154-39.559-4.159-32-16,20.34-37.888,45.522-107.349-25-150C314.919,103.92,256,170,256,170Z')
|
||||
path(d='M383,368c-8.1.01-24.77-.155-40,0-15.713.16-15.282,34.964,0,35,15.1,0.035,40,0,40,0s-0.068,42.8,0,48c0.208,15.961,32.261,15.791,32-1-0.072-4.649,0-47,0-47s38.008-.031,43,0c15.732,0.046,14.947-33.98-1-34-4.884.093-42,0-42,0s-0.053-28.341,0-46c0.046-15.189-32.028-15.512-32,0C383.027,337.74,382.782,365.139,383,368Z')
|
||||
|
||||
g#icon-thumbs-up(fill='currentColor')
|
||||
// 0 0 512 512
|
||||
path(d='M466.27 286.69C475.04 271.84 480 256 480 236.85c0-44.015-37.218-85.58-85.82-85.58H357.7c4.92-12.81 8.85-28.13 8.85-46.54C366.55 31.936 328.86 0 271.28 0c-61.607 0-58.093 94.933-71.76 108.6-22.747 22.747-49.615 66.447-68.76 83.4H32c-17.673 0-32 14.327-32 32v240c0 17.673 14.327 32 32 32h64c14.893 0 27.408-10.174 30.978-23.95 44.509 1.001 75.06 39.94 177.802 39.94 7.22 0 15.22.01 22.22.01 77.117 0 111.986-39.423 112.94-95.33 13.319-18.425 20.299-43.122 17.34-66.99 9.854-18.452 13.664-40.343 8.99-62.99zm-61.75 53.83c12.56 21.13 1.26 49.41-13.94 57.57 7.7 48.78-17.608 65.9-53.12 65.9h-37.82c-71.639 0-118.029-37.82-171.64-37.82V240h10.92c28.36 0 67.98-70.89 94.54-97.46 28.36-28.36 18.91-75.63 37.82-94.54 47.27 0 47.27 32.98 47.27 56.73 0 39.17-28.36 56.72-28.36 94.54h103.99c21.11 0 37.73 18.91 37.82 37.82.09 18.9-12.82 37.81-22.27 37.81 13.489 14.555 16.371 45.236-5.21 65.62zM88 432c0 13.255-10.745 24-24 24s-24-10.745-24-24 10.745-24 24-24 24 10.745 24 24z')
|
||||
|
||||
g#icon-close(fill='currentColor')
|
||||
// 0 0 24 24
|
||||
path(d='M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z')
|
||||
|
||||
g#icon-comment(fill='currentColor')
|
||||
// 0 0 24 24
|
||||
path(d='M16 11H8V9H16V11M22 4V16C22 17.11 21.11 18 20 18H13.9L10.2 21.71C10 21.9 9.75 22 9.5 22H9C8.45 22 8 21.55 8 21V18H4C2.9 18 2 17.11 2 16V4C2 2.89 2.9 2 4 2H20C21.11 2 22 2.9 22 4M20 4H4V16H10V19.08L13.08 16H20V4')
|
||||
</template>
|
||||
|
||||
|
||||
@@ -8,13 +8,33 @@ div(:class="$style.player")
|
||||
div(:class="$style.middleContainer" v-if="!isShowPlayerDetail")
|
||||
div(:class="$style.column1")
|
||||
div(:class="$style.container")
|
||||
div(:class="$style.title" @click="handleCopy(title)" :title="title + $t('core.player.copy_title')") {{title}}
|
||||
div(:class="$style.volumeContent")
|
||||
div(:class="$style.volume")
|
||||
div(:class="$style.volumeBar" :style="{ transform: `scaleX(${volume || 0})` }")
|
||||
div(:class="$style.volumeMask" @mousedown="handleVolumeMsDown" ref="dom_volumeMask" :title="`${$t('core.player.volume')}${parseInt(volume * 100)}%`")
|
||||
div(:class="$style.title" @click="handleCopy(title)" :tips="title + $t('core.player.copy_title')") {{title}}
|
||||
div(:class="$style.controlBtn")
|
||||
|
||||
//- div(:class="$style.playBtn" @click='handleNext' title="音量")
|
||||
div(:class="$style.volumeContent")
|
||||
div(:class="[$style.volume, setting.player.isMute ? $style.muted : null]")
|
||||
div(:class="$style.volumeBar" :style="{ transform: `scaleX(${volume || 0})` }")
|
||||
div(:class="$style.volumeMask" @mousedown="handleVolumeMsDown" ref="dom_volumeMask" :tips="`${$t('core.player.volume')}${parseInt(volume * 100)}%`")
|
||||
div(:class="$style.titleBtn" @click='toggleDesktopLyric' @contextmenu="handleToggleLockDesktopLyric" :tips="toggleDesktopLyricBtnTitle")
|
||||
svg(v-if="setting.desktopLyric.enable" 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-desktop-lyric-on')
|
||||
svg(v-else 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-desktop-lyric-off')
|
||||
div(:class="$style.titleBtn" @click='toggleNextPlayMode' :tips="nextTogglePlayName")
|
||||
svg(v-if="setting.player.togglePlayMethod == 'listLoop'" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='80%' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-list-loop')
|
||||
svg(v-else-if="setting.player.togglePlayMethod == 'random'" 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-list-random')
|
||||
svg(v-else-if="setting.player.togglePlayMethod == 'list'" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='120%' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-list-order')
|
||||
svg(v-else-if="setting.player.togglePlayMethod == 'singleLoop'" 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-single-loop')
|
||||
svg(v-else version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='120%' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-single')
|
||||
div(:class="$style.titleBtn" @click='addMusicTo' :tips="$t('core.player.add_music_to')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='80%' viewBox='0 0 512 512' space='preserve')
|
||||
use(xlink:href='#icon-add-2')
|
||||
//- div(:class="$style.playBtn" @click='handleNext' tips="音量")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 291.063 291.064' space='preserve')
|
||||
use(xlink:href='#icon-sound')
|
||||
|
||||
@@ -29,24 +49,28 @@ div(:class="$style.player")
|
||||
span(style="margin: 0 5px;") /
|
||||
span {{maxPlayTimeStr}}
|
||||
div(:class="$style.right")
|
||||
div(:class="$style.playBtn" @click='handlePrev' :title="$t('core.player.next')" style="transform: rotate(180deg);")
|
||||
div(:class="$style.playBtn" @click='handlePrev' :tips="$t('core.player.prev')" style="transform: rotate(180deg);")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 220.847 220.847' space='preserve')
|
||||
use(xlink:href='#icon-nextMusic')
|
||||
div(:class="$style.playBtn" :title="isPlay ? $t('core.player.pause') : $t('core.player.play')" @click='togglePlay')
|
||||
div(:class="$style.playBtn" :tips="isPlay ? $t('core.player.pause') : $t('core.player.play')" @click='togglePlay')
|
||||
svg(v-if="isPlay" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 277.338 277.338' space='preserve')
|
||||
use(xlink:href='#icon-pause')
|
||||
svg(v-else version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 170 170' space='preserve')
|
||||
use(xlink:href='#icon-play')
|
||||
div(:class="$style.playBtn" @click='handleNext' :title="$t('core.player.next')")
|
||||
div(:class="$style.playBtn" @click='handleNext' :tips="$t('core.player.next')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 220.847 220.847' space='preserve')
|
||||
use(xlink:href='#icon-nextMusic')
|
||||
//- transition(enter-active-class="animated lightSpeedIn"
|
||||
transition(enter-active-class="animated lightSpeedIn"
|
||||
leave-active-class="animated slideOutDown")
|
||||
core-player-detail(v-if="isShowPlayerDetail" :musicInfo="musicInfo"
|
||||
core-player-detail(v-if="isShowPlayerDetail" :musicInfo="listId == 'download' ? targetSong.musicInfo : targetSong"
|
||||
:lyric="lyric" :list="list" :listId="listId"
|
||||
:playInfo="{ nowPlayTimeStr, maxPlayTimeStr, progress, nowPlayTime, status }"
|
||||
:isPlay="isPlay" @action="handlePlayDetailAction")
|
||||
:isPlay="isPlay" @action="handlePlayDetailAction"
|
||||
:nextTogglePlayName="nextTogglePlayName"
|
||||
@toggle-next-play-mode="toggleNextPlayMode" @add-music-to="addMusicTo")
|
||||
|
||||
material-list-add-modal(:show="isShowAddMusicTo" :musicInfo="listId == 'download' ? targetSong.musicInfo : targetSong" @close="isShowAddMusicTo = false")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' style="display: none;")
|
||||
defs
|
||||
g(:id="$style.iconPic")
|
||||
@@ -63,7 +87,7 @@ div(:class="$style.player")
|
||||
<script>
|
||||
import Lyric from 'lrc-file-parser'
|
||||
import { rendererSend, rendererOn, NAMES } from '../../../common/ipc'
|
||||
import { formatPlayTime2, getRandom, checkPath, setTitle, clipboardWriteText, debounce, assertApiSupport } from '../../utils'
|
||||
import { formatPlayTime2, getRandom, checkPath, setTitle, clipboardWriteText, debounce, throttle, assertApiSupport } from '../../utils'
|
||||
import { mapGetters, mapActions, mapMutations } from 'vuex'
|
||||
import { requestMsg } from '../../utils/message'
|
||||
import { isMac } from '../../../common/utils'
|
||||
@@ -72,6 +96,13 @@ import path from 'path'
|
||||
|
||||
let audio
|
||||
|
||||
const playNextModes = [
|
||||
'listLoop',
|
||||
'random',
|
||||
'list',
|
||||
'singleLoop',
|
||||
]
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -99,7 +130,7 @@ export default {
|
||||
line: 0,
|
||||
},
|
||||
delayNextTimeout: null,
|
||||
audioErrorTime: 0,
|
||||
restorePlayTime: 0,
|
||||
retryNum: 0,
|
||||
isMac,
|
||||
volumeEvent: {
|
||||
@@ -112,11 +143,12 @@ export default {
|
||||
timeout: null,
|
||||
playTime: 0,
|
||||
},
|
||||
isShowAddMusicTo: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['setting']),
|
||||
...mapGetters('player', ['list', 'playIndex', 'changePlay', 'listId', 'isShowPlayerDetail']),
|
||||
...mapGetters('player', ['list', 'playIndex', 'changePlay', 'listId', 'isShowPlayerDetail', 'playedList']),
|
||||
// pic() {
|
||||
// return this.musicInfo.img ? this.musicInfo.img : ''
|
||||
// },
|
||||
@@ -134,6 +166,26 @@ export default {
|
||||
progress() {
|
||||
return this.nowPlayTime / this.maxPlayTime || 0
|
||||
},
|
||||
nextTogglePlayName() {
|
||||
switch (this.setting.player.togglePlayMethod) {
|
||||
case 'listLoop': return this.$t('core.player.play_toggle_mode_list_loop')
|
||||
case 'random': return this.$t('core.player.play_toggle_mode_random')
|
||||
case 'singleLoop': return this.$t('core.player.play_toggle_mode_single_loop')
|
||||
case 'list': return this.$t('core.player.play_toggle_mode_list')
|
||||
default: return this.$t('core.player.play_toggle_mode_off')
|
||||
}
|
||||
},
|
||||
toggleDesktopLyricBtnTitle() {
|
||||
return `${
|
||||
this.setting.desktopLyric.enable
|
||||
? this.$t('core.player.desktop_lyric_off')
|
||||
: this.$t('core.player.desktop_lyric_on')
|
||||
}(${
|
||||
this.setting.desktopLyric.isLock
|
||||
? this.$t('core.player.desktop_lyric_unlock')
|
||||
: this.$t('core.player.desktop_lyric_lock')
|
||||
})`
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.init()
|
||||
@@ -143,6 +195,12 @@ export default {
|
||||
this.handleSaveVolume = debounce(volume => {
|
||||
this.setVolume(volume)
|
||||
}, 300)
|
||||
this.savePlayInfo = throttle(n => {
|
||||
rendererSend(NAMES.mainWindow.save_data, {
|
||||
path: 'playInfo',
|
||||
data: n,
|
||||
})
|
||||
}, 2000)
|
||||
|
||||
rendererOn(NAMES.mainWindow.get_lyric_info, (event, info) => {
|
||||
switch (info.action) {
|
||||
@@ -153,6 +211,7 @@ export default {
|
||||
name: this.musicInfo.name,
|
||||
album: this.musicInfo.album,
|
||||
lyric: this.musicInfo.lrc,
|
||||
tlyric: this.musicInfo.tlrc,
|
||||
isPlay: this.isPlay,
|
||||
line: this.lyric.line,
|
||||
played_time: audio.currentTime * 1000,
|
||||
@@ -194,6 +253,8 @@ export default {
|
||||
},
|
||||
'setting.player.togglePlayMethod'(n) {
|
||||
audio.loop = n === 'singleLoop'
|
||||
if (this.playedList.length) this.clearPlayedList()
|
||||
if (n == 'random' && this.playIndex > -1) this.setPlayedList(this.list[this.playIndex])
|
||||
},
|
||||
'setting.player.isMute'(n) {
|
||||
audio.muted = n
|
||||
@@ -201,6 +262,9 @@ export default {
|
||||
'setting.player.mediaDeviceId'(n) {
|
||||
this.setMediaDevice()
|
||||
},
|
||||
'setting.player.isShowLyricTransition'() {
|
||||
this.setLyric()
|
||||
},
|
||||
async list(n, o) {
|
||||
if (n === o && this.musicInfo.songmid) {
|
||||
let index = this.listId == 'download'
|
||||
@@ -229,6 +293,12 @@ export default {
|
||||
},
|
||||
nowPlayTime(n, o) {
|
||||
if (Math.abs(n - o) > 2) this.isActiveTransition = true
|
||||
this.savePlayInfo({
|
||||
time: n,
|
||||
listId: this.listId,
|
||||
list: this.listId == null ? this.list : null,
|
||||
index: this.playIndex,
|
||||
})
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -238,8 +308,12 @@ export default {
|
||||
'fixPlayIndex',
|
||||
'resetChangePlay',
|
||||
'visiblePlayerDetail',
|
||||
'clearPlayedList',
|
||||
'setPlayedList',
|
||||
'removePlayedList',
|
||||
'setList',
|
||||
]),
|
||||
...mapMutations(['setVolume']),
|
||||
...mapMutations(['setVolume', 'setPlayNextMode', 'setVisibleDesktopLyric', 'setLockDesktopLyric']),
|
||||
...mapMutations('list', ['updateMusicInfo']),
|
||||
...mapMutations(['setMediaDeviceId']),
|
||||
handleRegisterEvent(action) {
|
||||
@@ -287,7 +361,7 @@ export default {
|
||||
this.stopPlay()
|
||||
if (this.listId != 'download' && audio.error.code !== 1 && this.retryNum < 2) { // 若音频URL无效则尝试刷新2次URL
|
||||
// console.log(this.retryNum)
|
||||
if (!this.audioErrorTime) this.audioErrorTime = audio.currentTime // 记录出错的播放时间
|
||||
if (!this.restorePlayTime) this.restorePlayTime = audio.currentTime // 记录出错的播放时间
|
||||
this.retryNum++
|
||||
this.setUrl(this.list[this.playIndex], true)
|
||||
this.status = this.statusText = this.$t('core.player.refresh_url')
|
||||
@@ -299,15 +373,24 @@ export default {
|
||||
this.addDelayNextTimeout()
|
||||
})
|
||||
audio.addEventListener('loadeddata', () => {
|
||||
console.log('loadeddata')
|
||||
this.clearLoadingTimeout()
|
||||
this.status = this.statusText = this.$t('core.player.loading')
|
||||
this.maxPlayTime = audio.duration
|
||||
if (this.audioErrorTime) {
|
||||
audio.currentTime = this.audioErrorTime
|
||||
this.audioErrorTime = 0
|
||||
if (window.restorePlayInfo) {
|
||||
audio.currentTime = window.restorePlayInfo.time
|
||||
window.restorePlayInfo = null
|
||||
audio.pause()
|
||||
this.stopPlay()
|
||||
} else if (this.restorePlayTime) {
|
||||
audio.currentTime = this.restorePlayTime
|
||||
this.restorePlayTime = 0
|
||||
}
|
||||
if (!this.targetSong.interval && this.listId != 'download') this.updateMusicInfo({ id: this.listId, index: this.playIndex, data: { interval: formatPlayTime2(this.maxPlayTime) } })
|
||||
this.status = this.statusText = this.$t('core.player.loading')
|
||||
})
|
||||
audio.addEventListener('loadstart', () => {
|
||||
console.log('loadstart')
|
||||
this.startLoadingTimeout()
|
||||
this.status = this.statusText = this.$t('core.player.loading')
|
||||
})
|
||||
audio.addEventListener('canplay', () => {
|
||||
@@ -317,11 +400,10 @@ export default {
|
||||
this.mediaBuffer.playTime = 0
|
||||
audio.currentTime = playTime
|
||||
}
|
||||
if (this.mediaBuffer.timeout) {
|
||||
this.clearBufferTimeout()
|
||||
}
|
||||
this.clearBufferTimeout()
|
||||
|
||||
// if (this.musicInfo.lrc) window.lrc.play(audio.currentTime * 1000)
|
||||
this.status = this.statusText = this.$t('core.player.loading')
|
||||
this.status = this.statusText = ''
|
||||
})
|
||||
// audio.addEventListener('canplaythrough', () => {
|
||||
// console.log('音乐加载完毕')
|
||||
@@ -330,6 +412,7 @@ export default {
|
||||
// })
|
||||
audio.addEventListener('emptied', () => {
|
||||
this.mediaBuffer.playTime = 0
|
||||
this.clearLoadingTimeout()
|
||||
this.clearBufferTimeout()
|
||||
|
||||
// console.log('媒介资源元素突然为空,网络错误 or 切换歌曲?')
|
||||
@@ -360,7 +443,7 @@ export default {
|
||||
this.lyric.lines = lines
|
||||
this.lyric.line = 0
|
||||
},
|
||||
offset: 100,
|
||||
offset: 80,
|
||||
})
|
||||
|
||||
this.handleRegisterEvent('on')
|
||||
@@ -369,8 +452,9 @@ export default {
|
||||
console.log('play', this.playIndex)
|
||||
this.checkDelayNextTimeout()
|
||||
let targetSong = this.targetSong = this.list[this.playIndex]
|
||||
if (this.setting.player.togglePlayMethod == 'random') this.setPlayedList(targetSong)
|
||||
this.retryNum = 0
|
||||
this.audioErrorTime = 0
|
||||
this.restorePlayTime = 0
|
||||
|
||||
if (this.listId == 'download') {
|
||||
const filePath = path.join(this.setting.download.savePath, targetSong.fileName)
|
||||
@@ -420,20 +504,54 @@ export default {
|
||||
async filterList() {
|
||||
// if (this.list.listName === null) return
|
||||
let list
|
||||
let playedList = [...this.playedList]
|
||||
if (this.listId == 'download') {
|
||||
list = []
|
||||
for (const item of this.list) {
|
||||
const filePath = path.join(this.setting.download.savePath, item.fileName)
|
||||
if (!await checkPath(filePath) || !item.isComplate || /\.ape$/.test(filePath)) continue
|
||||
|
||||
let index = playedList.indexOf(item)
|
||||
if (index > -1) {
|
||||
playedList.splice(index, 1)
|
||||
continue
|
||||
}
|
||||
list.push(item)
|
||||
}
|
||||
} else {
|
||||
list = this.list.filter(s => this.assertApiSupport(s.source))
|
||||
list = this.list.filter(s => {
|
||||
let index = playedList.indexOf(s)
|
||||
if (index > -1) {
|
||||
playedList.splice(index, 1)
|
||||
return false
|
||||
}
|
||||
return this.assertApiSupport(s.source)
|
||||
})
|
||||
}
|
||||
if (!list.length && this.playedList.length) {
|
||||
this.clearPlayedList()
|
||||
return this.filterList()
|
||||
}
|
||||
return list
|
||||
},
|
||||
async handlePrev() {
|
||||
// console.log(playIndex)
|
||||
if (this.setting.player.togglePlayMethod == 'random' && this.playedList.length) {
|
||||
let index = this.playedList.indexOf(this.targetSong)
|
||||
index -= 1
|
||||
while (true) {
|
||||
if (index > -1) {
|
||||
let listIndex = this.list.indexOf(this.playedList[index])
|
||||
if (listIndex < 0) {
|
||||
this.removePlayedList(index)
|
||||
continue
|
||||
}
|
||||
this.setPlayIndex(listIndex)
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
let list = await this.filterList()
|
||||
if (!list.length) return this.setPlayIndex(-1)
|
||||
let playIndex = list.indexOf(this.list[this.playIndex])
|
||||
@@ -455,6 +573,23 @@ export default {
|
||||
},
|
||||
async handleNext() {
|
||||
// if (this.list.listName === null) return
|
||||
// eslint-disable-next-line no-debugger
|
||||
if (this.setting.player.togglePlayMethod == 'random' && this.playedList.length) {
|
||||
let index = this.playedList.indexOf(this.targetSong)
|
||||
index += 1
|
||||
while (true) {
|
||||
if (index < this.playedList.length) {
|
||||
let listIndex = this.list.indexOf(this.playedList[index])
|
||||
if (listIndex < 0) {
|
||||
this.removePlayedList(index)
|
||||
continue
|
||||
}
|
||||
this.setPlayIndex(listIndex)
|
||||
return
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
let list = await this.filterList()
|
||||
if (!list.length) return this.setPlayIndex(-1)
|
||||
let playIndex = list.indexOf(this.list[this.playIndex])
|
||||
@@ -500,7 +635,7 @@ export default {
|
||||
setProgress(pregress) {
|
||||
if (!audio.src) return
|
||||
const time = pregress * this.maxPlayTime
|
||||
if (this.audioErrorTime) this.audioErrorTime = time
|
||||
if (this.restorePlayTime) this.restorePlayTime = time
|
||||
if (this.mediaBuffer.playTime) {
|
||||
this.clearBufferTimeout()
|
||||
this.mediaBuffer.playTime = time
|
||||
@@ -560,27 +695,15 @@ export default {
|
||||
}
|
||||
},
|
||||
setLrc(targetSong) {
|
||||
this.musicInfo.lrc = targetSong.lrc
|
||||
|
||||
let lrcP = this.musicInfo.lrc
|
||||
? Promise.resolve()
|
||||
: this.getLrc(targetSong).then(() => {
|
||||
this.musicInfo.lrc = targetSong.lrc
|
||||
})
|
||||
|
||||
lrcP
|
||||
.then(() => {
|
||||
window.lrc.setLyric(this.musicInfo.lrc)
|
||||
this.handleUpdateWinLyricInfo('lyric', this.musicInfo.lrc)
|
||||
if (this.isPlay && (this.musicInfo.url || this.listId == 'download')) {
|
||||
window.lrc.play(audio.currentTime * 1000)
|
||||
this.handleUpdateWinLyricInfo('play', audio.currentTime * 1000)
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.handleUpdateWinLyricInfo('lyric', this.musicInfo.lrc)
|
||||
this.status = this.statusText = this.$t('core.player.lyric_error')
|
||||
})
|
||||
this.getLrc(targetSong).then(() => {
|
||||
this.musicInfo.lrc = targetSong.lrc
|
||||
this.musicInfo.tlrc = targetSong.tlrc
|
||||
}).catch(() => {
|
||||
this.status = this.statusText = this.$t('core.player.lyric_error')
|
||||
}).finally(() => {
|
||||
this.handleUpdateWinLyricInfo('lyric', { lrc: this.musicInfo.lrc, tlrc: this.musicInfo.tlrc })
|
||||
this.setLyric()
|
||||
})
|
||||
},
|
||||
handleRemoveMusic() {
|
||||
this.stopPlay()
|
||||
@@ -591,6 +714,7 @@ export default {
|
||||
this.status = this.musicInfo.name = this.musicInfo.singer = ''
|
||||
this.musicInfo.songmid = null
|
||||
this.musicInfo.lrc = null
|
||||
this.musicInfo.tlrc = null
|
||||
this.musicInfo.url = null
|
||||
this.nowPlayTime = 0
|
||||
this.maxPlayTime = 0
|
||||
@@ -623,8 +747,9 @@ export default {
|
||||
|
||||
this.volume = val
|
||||
this.volumeEvent.msDownVolume = val
|
||||
// console.log(val)
|
||||
if (audio) audio.volume = this.volume
|
||||
|
||||
if (this.setting.player.isMute) this.setVolume(false)
|
||||
},
|
||||
handleSetVolumeMute() {
|
||||
audio.muted = !audio.muted
|
||||
@@ -654,7 +779,7 @@ export default {
|
||||
this.setProgressWidth()
|
||||
},
|
||||
handleToMusicLocation() {
|
||||
if (this.listId == 'download') return
|
||||
if (!this.listId || this.listId == 'download') return
|
||||
if (this.playIndex == -1) return
|
||||
this.$router.push({
|
||||
path: 'list',
|
||||
@@ -665,14 +790,27 @@ export default {
|
||||
})
|
||||
},
|
||||
showPlayerDetail() {
|
||||
if (!this.targetSong) return
|
||||
this.visiblePlayerDetail(true)
|
||||
},
|
||||
handleTransitionEnd(e) {
|
||||
// console.log(e)
|
||||
this.isActiveTransition = false
|
||||
},
|
||||
startLoadingTimeout() {
|
||||
// console.log('start load timeout')
|
||||
this.loadingTimeout = setTimeout(() => {
|
||||
this.handleNext()
|
||||
}, 10000)
|
||||
},
|
||||
clearLoadingTimeout() {
|
||||
if (!this.loadingTimeout) return
|
||||
// console.log('clear load timeout')
|
||||
clearTimeout(this.loadingTimeout)
|
||||
this.loadingTimeout = null
|
||||
},
|
||||
startBuffering() {
|
||||
console.log('start t')
|
||||
console.error('start t')
|
||||
if (this.mediaBuffer.timeout) return
|
||||
this.mediaBuffer.timeout = setTimeout(() => {
|
||||
this.mediaBuffer.timeout = null
|
||||
@@ -766,6 +904,28 @@ export default {
|
||||
info,
|
||||
})
|
||||
},
|
||||
setLyric() {
|
||||
window.lrc.setLyric((this.setting.player.isShowLyricTransition && this.musicInfo.tlrc ? (this.musicInfo.tlrc + '\n') : '') + (this.musicInfo.lrc || ''))
|
||||
if (this.isPlay && (this.musicInfo.url || this.listId == 'download')) {
|
||||
window.lrc.play(audio.currentTime * 1000)
|
||||
this.handleUpdateWinLyricInfo('play', audio.currentTime * 1000)
|
||||
}
|
||||
},
|
||||
toggleDesktopLyric() {
|
||||
this.setVisibleDesktopLyric(!this.setting.desktopLyric.enable)
|
||||
},
|
||||
handleToggleLockDesktopLyric() {
|
||||
this.setLockDesktopLyric(!this.setting.desktopLyric.isLock)
|
||||
},
|
||||
toggleNextPlayMode() {
|
||||
let index = playNextModes.indexOf(this.setting.player.togglePlayMethod)
|
||||
if (++index >= playNextModes.length) index = -1
|
||||
this.setPlayNextMode(playNextModes[index] || '')
|
||||
},
|
||||
addMusicTo() {
|
||||
if (!this.musicInfo.songmid) return
|
||||
this.isShowAddMusicTo = true
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -855,17 +1015,26 @@ export default {
|
||||
}
|
||||
|
||||
.title {
|
||||
flex: 1 1 0;
|
||||
width: 0;
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
padding-right: 5px;
|
||||
font-size: 14px;
|
||||
line-height: 18px;
|
||||
.mixin-ellipsis-1;
|
||||
}
|
||||
|
||||
.controlBtn {
|
||||
flex: none;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
}
|
||||
|
||||
|
||||
.volume-content {
|
||||
flex: none;
|
||||
position: relative;
|
||||
width: 80px;
|
||||
margin-right: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
opacity: .5;
|
||||
@@ -882,13 +1051,17 @@ export default {
|
||||
border-radius: 10px;
|
||||
// overflow: hidden;
|
||||
transition: @transition-theme;
|
||||
transition-property: background-color;
|
||||
transition-property: background-color, opacity;
|
||||
background-color: @color-player-progress-bar1;
|
||||
// background-color: #f5f5f5;
|
||||
position: relative;
|
||||
border-radius: @radius-progress-border;
|
||||
}
|
||||
|
||||
.muted {
|
||||
opacity: .5;
|
||||
}
|
||||
|
||||
.volume-bar {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
@@ -905,6 +1078,7 @@ export default {
|
||||
box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
|
||||
.volume-mask {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -913,6 +1087,32 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.titleBtn {
|
||||
flex: none;
|
||||
margin-left: 5px;
|
||||
height: 100%;
|
||||
width: 20px;
|
||||
color: @color-theme;
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
transition: opacity 0.2s ease;
|
||||
opacity: .5;
|
||||
cursor: pointer;
|
||||
|
||||
svg {
|
||||
filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.2));
|
||||
}
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
&:active {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.play-btn {
|
||||
+ .play-btn {
|
||||
margin-left: 15px;
|
||||
@@ -997,6 +1197,7 @@ export default {
|
||||
display: flex;
|
||||
padding-top: 2px;
|
||||
// justify-content: space-between;
|
||||
height: 16px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
@@ -1041,6 +1242,9 @@ each(@themes, {
|
||||
// border-color: ~'@{color-@{value}-theme_2-background_1}';
|
||||
// }
|
||||
}
|
||||
.titleBtn {
|
||||
color: ~'@{color-@{value}-theme}';
|
||||
}
|
||||
.play-btn {
|
||||
color: ~'@{color-@{value}-theme}';
|
||||
svg {
|
||||
|
||||
@@ -4,37 +4,56 @@
|
||||
//- div(:class="$style.bg2")
|
||||
div(:class="$style.header")
|
||||
div(:class="$style.controBtn")
|
||||
button(type="button" :class="$style.hide" :title="$t('core.player.hide_detail')" @click="visiblePlayerDetail(false)")
|
||||
button(type="button" :class="$style.hide" :tips="$t('core.player.hide_detail')" @click="visiblePlayerDetail(false)")
|
||||
svg(:class="$style.controBtnIcon" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='80%' viewBox='0 0 30.727 30.727' space='preserve')
|
||||
use(xlink:href='#icon-window-hide')
|
||||
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.controBtnIcon" 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.controBtnIcon" 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')
|
||||
|
||||
div(:class="$style.main")
|
||||
div(:class="[$style.main, isShowComment ? $style.showComment : null]")
|
||||
div(:class="$style.left")
|
||||
//- div(:class="$style.info")
|
||||
div(:class="$style.info")
|
||||
div(:class="$style.img")
|
||||
img(:src="musicInfo.img" v-if="musicInfo.img")
|
||||
img(:class="$style.img" :src="musicInfo.img" v-if="musicInfo.img")
|
||||
div(:class="$style.description")
|
||||
p {{$t('core.player.name')}}{{musicInfo.name}}
|
||||
p {{$t('core.player.singer')}}{{musicInfo.singer}}
|
||||
p(v-if="musicInfo.album") {{$t('core.player.album')}}{{musicInfo.album}}
|
||||
//- div(:class="$style.list")
|
||||
ul
|
||||
|
||||
div(:class="$style.right")
|
||||
div(:class="[$style.lyric, lyricEvent.isMsDown ? $style.draging : null]" @wheel="handleWheel" @mousedown="handleLyricMouseDown" ref="dom_lyric")
|
||||
div(:class="$style.lyricSpace")
|
||||
p(v-for="(info, index) in lyricLines" :key="index" :class="lyric.line == index ? $style.lrcActive : null") {{info.text}}
|
||||
div(:class="$style.lyricSpace")
|
||||
|
||||
material-music-comment(:class="$style.comment" :titleFormat="this.setting.download.fileName" :musicInfo="musicInfo" v-model="isShowComment")
|
||||
|
||||
div(:class="$style.footer")
|
||||
div(:class="$style.left")
|
||||
div(:class="$style.footerLeft")
|
||||
div(:class="$style.footerLeftControlBtns")
|
||||
div(:class="[$style.footerLeftControlBtn, isShowComment ? $style.active : null]" @click="isShowComment = !isShowComment" :tips="$t('core.player.comment_show')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='95%' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-comment')
|
||||
div(:class="$style.footerLeftControlBtn" @click="$emit('toggle-next-play-mode')" :tips="nextTogglePlayName")
|
||||
svg(v-if="setting.player.togglePlayMethod == 'listLoop'" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-list-loop')
|
||||
svg(v-else-if="setting.player.togglePlayMethod == 'random'" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-list-random')
|
||||
svg(v-else-if="setting.player.togglePlayMethod == 'list'" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='120%' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-list-order')
|
||||
svg(v-else-if="setting.player.togglePlayMethod == 'singleLoop'" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='110%' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-single-loop')
|
||||
svg(v-else version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' width='120%' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-single')
|
||||
div(:class="$style.footerLeftControlBtn" @click="$emit('add-music-to', musicInfo)" :tips="$t('core.player.add_music_to')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 512 512' space='preserve')
|
||||
use(xlink:href='#icon-add-2')
|
||||
div(:class="$style.progressContainer")
|
||||
div(:class="$style.progressContent")
|
||||
div(:class="$style.progress")
|
||||
@@ -50,15 +69,15 @@
|
||||
div(:class="$style.playControl")
|
||||
//- div(:class="$style.playBtn")
|
||||
//- div(:class="$style.playBtn")
|
||||
div(:class="$style.playBtn" @click="$emit('action', { type: 'prev' })" style="transform: rotate(180deg);" :title="$t('core.player.prev')")
|
||||
div(:class="$style.playBtn" @click="$emit('action', { type: 'prev' })" style="transform: rotate(180deg);" :tips="$t('core.player.prev')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 220.847 220.847' space='preserve')
|
||||
use(xlink:href='#icon-nextMusic')
|
||||
div(:class="$style.playBtn" :title="isPlay ? $t('core.player.pause') : $t('core.player.play')" @click="$emit('action', { type: 'togglePlay' })")
|
||||
div(:class="$style.playBtn" :tips="isPlay ? $t('core.player.pause') : $t('core.player.play')" @click="$emit('action', { type: 'togglePlay' })")
|
||||
svg(v-if="isPlay" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 277.338 277.338' space='preserve')
|
||||
use(xlink:href='#icon-pause')
|
||||
svg(v-else version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 170 170' space='preserve')
|
||||
use(xlink:href='#icon-play')
|
||||
div(:class="$style.playBtn" @click="$emit('action', { type: 'next' })" :title="$t('core.player.next')")
|
||||
div(:class="$style.playBtn" @click="$emit('action', { type: 'next' })" :tips="$t('core.player.next')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 220.847 220.847' space='preserve')
|
||||
use(xlink:href='#icon-nextMusic')
|
||||
</template>
|
||||
@@ -124,6 +143,7 @@ export default {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
nextTogglePlayName: String,
|
||||
},
|
||||
watch: {
|
||||
// 'musicInfo.img': {
|
||||
@@ -205,6 +225,7 @@ export default {
|
||||
_lyricLines: [],
|
||||
lyricLines: [],
|
||||
isSetedLines: false,
|
||||
isShowComment: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@@ -452,33 +473,56 @@ export default {
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
padding: 0 30px;
|
||||
|
||||
&.showComment {
|
||||
.left {
|
||||
flex-basis: 18%;
|
||||
.description p {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
.right {
|
||||
flex-basis: 30%;
|
||||
.lyric {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
.comment {
|
||||
flex-basis: 50%;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
.left {
|
||||
flex: 0 0 40%;
|
||||
overflow: hidden;
|
||||
}
|
||||
.info {
|
||||
flex: 40%;
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
align-items: center;
|
||||
padding: 13px;
|
||||
overflow: hidden;
|
||||
transition: flex-basis @transition-theme;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
justify-content: flex-start;
|
||||
max-width: 300px;
|
||||
|
||||
}
|
||||
.img {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
border: 5px solid @color-theme-hover;
|
||||
// border-radius: @radius-border;
|
||||
// border: 5px solid #fff;
|
||||
}
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
min-width: 100%;
|
||||
box-shadow: 0 0 4px @color-theme-hover;
|
||||
border-radius: 6px;
|
||||
opacity: .8;
|
||||
// border: 5px solid @color-theme-hover;
|
||||
// border-radius: @radius-border;
|
||||
// border: 5px solid #fff;
|
||||
}
|
||||
.description {
|
||||
width: 300px;
|
||||
max-width: 300px;
|
||||
padding: 15px 0;
|
||||
overflow: hidden;
|
||||
p {
|
||||
@@ -492,6 +536,8 @@ export default {
|
||||
flex: 0 0 60%;
|
||||
// padding: 0 30px;
|
||||
position: relative;
|
||||
transition: flex-basis @transition-theme;
|
||||
|
||||
&:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@@ -526,7 +572,7 @@ export default {
|
||||
padding: 8px 0;
|
||||
line-height: 1.2;
|
||||
overflow-wrap: break-word;
|
||||
transition: @transition-theme;
|
||||
transition: @transition-theme !important;
|
||||
transition-property: color, font-size;
|
||||
}
|
||||
}
|
||||
@@ -537,18 +583,51 @@ export default {
|
||||
color: @color-theme;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.comment {
|
||||
flex: 0 0 0;
|
||||
opacity: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
flex: 0 0 100px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.left {
|
||||
.footerLeft {
|
||||
flex: auto;
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
align-items: center;
|
||||
padding-top: 13px;
|
||||
padding: 13px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.footerLeftControlBtns {
|
||||
color: @color-theme_2-font;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.footerLeftControlBtn {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
opacity: .5;
|
||||
cursor: pointer;
|
||||
transition: opacity @transition-theme;
|
||||
|
||||
&:hover {
|
||||
opacity: .9;
|
||||
}
|
||||
|
||||
+.footerLeftControlBtn {
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: @color-theme;
|
||||
opacity: .8;
|
||||
}
|
||||
}
|
||||
.progress-container {
|
||||
width: 100%;
|
||||
@@ -608,6 +687,7 @@ export default {
|
||||
}
|
||||
.time-label {
|
||||
width: 100%;
|
||||
height: 18px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
span {
|
||||
@@ -686,13 +766,20 @@ each(@themes, {
|
||||
}
|
||||
}
|
||||
.img {
|
||||
img {
|
||||
border-color: ~'@{color-@{value}-theme-hover}';
|
||||
}
|
||||
box-shadow: 0 0 4px ~'@{color-@{value}-theme-hover}';
|
||||
// border-color: ~'@{color-@{value}-theme-hover}';
|
||||
}
|
||||
.lrc-active {
|
||||
color: ~'@{color-@{value}-theme}';
|
||||
}
|
||||
.footerLeftControlBtns {
|
||||
color: ~'@{color-@{value}-theme_2-font}';
|
||||
}
|
||||
.footerLeftControlBtn {
|
||||
&.active {
|
||||
color: ~'@{color-@{value}-theme}';
|
||||
}
|
||||
}
|
||||
.progress {
|
||||
background-color: ~'@{color-@{value}-player-progress}';
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
|
||||
div(:class="$style.logo" v-if="setting.controlBtnPosition == 'left'") L X
|
||||
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')
|
||||
</template>
|
||||
@@ -183,6 +183,7 @@ export default {
|
||||
}
|
||||
|
||||
button {
|
||||
display: flex;
|
||||
position: relative;
|
||||
width: @control-btn-width;
|
||||
height: @control-btn-width;
|
||||
|
||||
162
src/renderer/components/material/CommentFloor.vue
Normal file
162
src/renderer/components/material/CommentFloor.vue
Normal file
@@ -0,0 +1,162 @@
|
||||
<template lang="pug">
|
||||
div(:class="$style.container")
|
||||
ul
|
||||
li(v-for="(item, index) in comments" :key="item.id" :class="$style.listItem")
|
||||
div(:class="$style.content")
|
||||
div(:class="$style.left")
|
||||
img( :class="$style.avatar" :src="item.avatar || commentDefImg" @error="handleUserImg")
|
||||
div(:class="$style.right")
|
||||
div(:class="$style.info")
|
||||
div.select(:class="$style.name") {{item.userName}}
|
||||
time(:class="$style.time" v-if="item.timeStr") {{timeFormat(item.timeStr)}}
|
||||
div(:class="$style.likes" v-if="item.likedCount != null")
|
||||
svg(:class="$style.likesIcon" version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 512 512' space='preserve')
|
||||
use(xlink:href='#icon-thumbs-up')
|
||||
| {{item.likedCount}}
|
||||
div.select(:class="$style.comment_text")
|
||||
p(v-for="text in item.text") {{text}}
|
||||
material-comment-floor(v-if="item.reply && item.reply.length" :class="$style.reply_floor" :comments="item.reply")
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import commentDefImg from '../../assets/images/defaultUser.jpg'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
comments: {
|
||||
type: Array,
|
||||
default() {
|
||||
return []
|
||||
},
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
commentDefImg,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
timeFormat(time) {
|
||||
return time
|
||||
// return formatTime(new Date(time), true)
|
||||
},
|
||||
handleUserImg(event) {
|
||||
event.target.src = this.commentDefImg
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" module>
|
||||
@import '../../assets/styles/layout.less';
|
||||
|
||||
@padding: 15px;
|
||||
|
||||
.container {
|
||||
|
||||
}
|
||||
|
||||
.listItem {
|
||||
border-bottom: 1px dashed @color-theme_2-line;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 12px 0;
|
||||
font-size: 13px;
|
||||
color: @color-theme_2-font;
|
||||
display: flex;
|
||||
}
|
||||
.left {
|
||||
flex: none;
|
||||
}
|
||||
.avatar {
|
||||
width: 40px;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 0 2px rgba(0, 0, 0, .15);
|
||||
}
|
||||
.right {
|
||||
flex: auto;
|
||||
min-width: 0;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: flex-end;
|
||||
min-width: 0;
|
||||
line-height: 1.3;
|
||||
color: @color-theme_2-font-label;
|
||||
}
|
||||
.name {
|
||||
flex: 0 1 auto;
|
||||
min-width: 0;
|
||||
.mixin-ellipsis-1;
|
||||
}
|
||||
.time {
|
||||
flex: none;
|
||||
font-size: 11px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
.likes {
|
||||
flex: 1 0 auto;
|
||||
margin-left: 10px;
|
||||
font-size: 11px;
|
||||
align-self: flex-end;
|
||||
text-align: right;
|
||||
}
|
||||
.likesIcon {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 3px;
|
||||
color: @color-theme-active;
|
||||
}
|
||||
.comment_text {
|
||||
text-align: justify;
|
||||
font-size: 14px;
|
||||
padding-top: 5px;
|
||||
p {
|
||||
line-height: 1.5;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
||||
.reply_floor {
|
||||
padding: 0 0 0 @padding;
|
||||
margin-left: @padding * 2;
|
||||
border-radius: .5rem;
|
||||
&:last-child {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.listItem:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
.right {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
background-color: @color-reply-floor;
|
||||
}
|
||||
|
||||
|
||||
each(@themes, {
|
||||
:global(#container.@{value}) {
|
||||
.listItem {
|
||||
border-bottom-color: ~'@{color-@{value}-theme_2-active}';
|
||||
}
|
||||
.content {
|
||||
color: ~'@{color-@{value}-theme_2-font}';
|
||||
}
|
||||
.info {
|
||||
color: ~'@{color-@{value}-theme_2-font-label}';
|
||||
}
|
||||
.likesIcon {
|
||||
color: ~'@{color-@{value}-theme-active}';
|
||||
}
|
||||
.reply_floor {
|
||||
background-color: ~'@{color-@{value}-reply-floor}';
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</style>
|
||||
@@ -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()}` }}
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
<template lang="pug">
|
||||
transition(enter-active-class="animated-fast zoomIn" leave-active-class="animated zoomOut")
|
||||
div(:class="$style.btns" v-show="show")
|
||||
button(type="button" v-if="playBtn" :title="$t('material.flow_btn.play')" @click.stop="handleClick('play')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 287.386 287.386' space='preserve')
|
||||
use(xlink:href='#icon-testPlay')
|
||||
button(type="button" v-if="addBtn" :title="$t('material.flow_btn.add')" @click.stop="handleClick('add')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 42 42' space='preserve')
|
||||
use(xlink:href='#icon-addTo')
|
||||
button(type="button" v-if="downloadBtn" :title="$t('material.flow_btn.download')" @click.stop="handleClick('download')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 475.078 475.077' space='preserve')
|
||||
use(xlink:href='#icon-download')
|
||||
button(type="button" v-if="startBtn" :title="$t('material.flow_btn.start')" @click.stop="handleClick('start')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 170 170' space='preserve')
|
||||
use(xlink:href='#icon-play')
|
||||
button(type="button" v-if="pauseBtn" :title="$t('material.flow_btn.pause')" @click.stop="handleClick('pause')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 277.338 277.338' space='preserve')
|
||||
use(xlink:href='#icon-pause')
|
||||
button(type="button" v-if="removeBtn" :title="$t('material.flow_btn.remove')" @click.stop="handleClick('remove')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 212.982 212.982' space='preserve')
|
||||
use(xlink:href='#icon-delete')
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props: {
|
||||
removeBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
startBtn: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
pauseBtn: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
downloadBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
addBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
playBtn: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleClick(action) {
|
||||
this.$emit('btn-click', action)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="less" module>
|
||||
@import '../../assets/styles/layout.less';
|
||||
|
||||
.btns {
|
||||
position: fixed;
|
||||
bottom: 80px;
|
||||
right: 30px;
|
||||
// transform: translateX(-25%);
|
||||
background-color: @color-theme_2-background_2;
|
||||
border-radius: 5px;
|
||||
// padding: 3px 5px;
|
||||
box-shadow: 0 1px 8px 0 rgba(0,0,0,.2);
|
||||
button {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
border-radius: @form-radius;
|
||||
margin-right: 2px;
|
||||
cursor: pointer;
|
||||
padding: 6px 10px;
|
||||
color: @color-btn;
|
||||
outline: none;
|
||||
transition: background-color 0.2s ease;
|
||||
line-height: 0;
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
svg {
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: @color-theme_2-hover;
|
||||
}
|
||||
&:active {
|
||||
background-color: @color-theme_2-active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
each(@themes, {
|
||||
:global(#container.@{value}) {
|
||||
.btns {
|
||||
background-color: ~'@{color-@{value}-theme_2-background_2}';
|
||||
button {
|
||||
color: ~'@{color-@{value}-btn}';
|
||||
&:hover {
|
||||
background-color: ~'@{color-@{value}-theme_2-hover}';
|
||||
}
|
||||
&:active {
|
||||
background-color: ~'@{color-@{value}-theme_2-active}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
</style>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template lang="pug">
|
||||
input(:class="$style.input" :type="type" :placeholder="placeholder" v-model.trim="text" :disabled="disabled"
|
||||
@focus="$emit('focus', $event)" @blur="$emit('blur', $event)" @input="$emit('input', text)" @change="$emit('change', text)"
|
||||
@keyup.enter="$emit('submit', text)")
|
||||
input(:class="$style.input" :type="type" :placeholder="placeholder" :value="value" :disabled="disabled"
|
||||
@focus="$emit('focus', $event)" @blur="$emit('blur', $event)" @input="$emit('input', $event.target.value.trim())" @change="$emit('change', $event.target.value.trim())"
|
||||
@keyup.enter="$emit('submit', $event.target.value.trim())")
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -24,21 +24,6 @@ export default {
|
||||
default: 'text',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
text: '',
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value(n) {
|
||||
this.text = n
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleInput() {
|
||||
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
<template lang="pug">
|
||||
input(type="range" :class="[$style.range, min ? $style.min : '']" :disabled="disabled" v-model="val" input="handleInput" @change="handleChange")
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
min: {
|
||||
type: Boolean,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
value: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
val: 0,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.val = this.value
|
||||
},
|
||||
methods: {
|
||||
handleChange(e) {
|
||||
this.$emit('input', this.val)
|
||||
this.$emit('change', e)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="less" module>
|
||||
@import '../../assets/styles/layout.less';
|
||||
|
||||
.range {
|
||||
display: inline-block;
|
||||
border-radius: .25em;
|
||||
cursor: pointer;
|
||||
color: @color-btn;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
// background-color: @color-btn-background;
|
||||
&[disabled] {
|
||||
opacity: .4;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: @color-theme_2-hover;
|
||||
}
|
||||
&:active {
|
||||
background-color: @color-theme_2-active;
|
||||
}
|
||||
}
|
||||
|
||||
.min {
|
||||
|
||||
}
|
||||
|
||||
// each(@themes, {
|
||||
// :global(#container.@{value}) {
|
||||
// .btn {
|
||||
// color: ~'@{color-@{value}-btn}';
|
||||
// background-color: ~'@{color-@{value}-btn-background}';
|
||||
// &:hover {
|
||||
// background-color: ~'@{color-@{value}-theme_2-hover}';
|
||||
// }
|
||||
// &:active {
|
||||
// background-color: ~'@{color-@{value}-theme_2-active}';
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
</style>
|
||||
@@ -1,31 +1,31 @@
|
||||
<template lang="pug">
|
||||
div(:class="$style.btns")
|
||||
button(type="button" v-if="playBtn" @contextmenu.capture.stop :title="$t('material.list_buttons.play')" @click.stop="handleClick('play')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 287.386 287.386' space='preserve')
|
||||
button(type="button" v-if="playBtn" @contextmenu.capture.stop :tips="$t('material.list_buttons.play')" @click.stop="handleClick('play')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 287.386 287.386' space='preserve' v-once)
|
||||
use(xlink:href='#icon-testPlay')
|
||||
button(type="button" v-if="listAddBtn" @contextmenu.capture.stop :title="$t('material.list_buttons.add_to')" @click.stop="handleClick('listAdd')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 42 42' space='preserve')
|
||||
button(type="button" v-if="listAddBtn" @contextmenu.capture.stop :tips="$t('material.list_buttons.add_to')" @click.stop="handleClick('listAdd')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 42 42' space='preserve' v-once)
|
||||
use(xlink:href='#icon-addTo')
|
||||
button(type="button" v-if="downloadBtn && setting.download.enable" @contextmenu.capture.stop :title="$t('material.list_buttons.download')" @click.stop="handleClick('download')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 475.078 475.077' space='preserve')
|
||||
button(type="button" v-if="downloadBtn && setting.download.enable" @contextmenu.capture.stop :tips="$t('material.list_buttons.download')" @click.stop="handleClick('download')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 475.078 475.077' space='preserve' v-once)
|
||||
use(xlink:href='#icon-download')
|
||||
//- button(type="button" :title="$t('material.list_buttons.add')" v-if="userInfo" @click.stop="handleClick('add')")
|
||||
//- button(type="button" :tips="$t('material.list_buttons.add')" v-if="userInfo" @click.stop="handleClick('add')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 42 42' space='preserve')
|
||||
use(xlink:href='#icon-addTo')
|
||||
button(type="button" v-if="startBtn" @contextmenu.capture.stop :title="$t('material.list_buttons.start')" @click.stop="handleClick('start')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 170 170' space='preserve')
|
||||
button(type="button" v-if="startBtn" @contextmenu.capture.stop :tips="$t('material.list_buttons.start')" @click.stop="handleClick('start')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 170 170' space='preserve' v-once)
|
||||
use(xlink:href='#icon-play')
|
||||
button(type="button" v-if="pauseBtn" @contextmenu.capture.stop :title="$t('material.list_buttons.pause')" @click.stop="handleClick('pause')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 277.338 277.338' space='preserve')
|
||||
button(type="button" v-if="pauseBtn" @contextmenu.capture.stop :tips="$t('material.list_buttons.pause')" @click.stop="handleClick('pause')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 277.338 277.338' space='preserve' v-once)
|
||||
use(xlink:href='#icon-pause')
|
||||
button(type="button" v-if="fileBtn" @contextmenu.capture.stop :title="$t('material.list_buttons.file')" @click.stop="handleClick('file')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='-61 0 512 512' space='preserve')
|
||||
button(type="button" v-if="fileBtn" @contextmenu.capture.stop :tips="$t('material.list_buttons.file')" @click.stop="handleClick('file')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='-61 0 512 512' space='preserve' v-once)
|
||||
use(xlink:href='#icon-musicFile')
|
||||
button(type="button" v-if="searchBtn" @contextmenu.capture.stop :title="$t('material.list_buttons.search')" @click.stop="handleClick('search')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 30.239 30.239' space='preserve')
|
||||
button(type="button" v-if="searchBtn" @contextmenu.capture.stop :tips="$t('material.list_buttons.search')" @click.stop="handleClick('search')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 30.239 30.239' space='preserve' v-once)
|
||||
use(xlink:href='#icon-search')
|
||||
button(type="button" v-if="removeBtn" :title="$t('material.list_buttons.remove')" @click.stop="handleClick('remove')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 212.982 212.982' space='preserve')
|
||||
button(type="button" v-if="removeBtn" :tips="$t('material.list_buttons.remove')" @click.stop="handleClick('remove')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 212.982 212.982' space='preserve' v-once)
|
||||
use(xlink:href='#icon-delete')
|
||||
|
||||
</template>
|
||||
|
||||
270
src/renderer/components/material/MusicComment.vue
Normal file
270
src/renderer/components/material/MusicComment.vue
Normal file
@@ -0,0 +1,270 @@
|
||||
<template lang="pug">
|
||||
div(:class="$style.comment")
|
||||
div(:class="$style.commentHeader")
|
||||
h3 {{$t('core.player.comment_title', { name: title })}}
|
||||
div(:class="$style.commentHeaderBtns")
|
||||
div(:class="$style.commentHeaderBtn" @click="handleShowComment" :tips="$t('core.player.comment_refresh')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' style='transform: rotate(45deg);' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-refresh')
|
||||
div(:class="$style.commentHeaderBtn" @click="$emit('input', false)")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' viewBox='0 0 24 24' space='preserve')
|
||||
use(xlink:href='#icon-close')
|
||||
|
||||
div.scroll(:class="$style.commentMain" ref="dom_comment")
|
||||
div(v-if="page == 1")
|
||||
h2(:class="$style.commentType") {{$t('core.player.comment_hot_title')}}
|
||||
p(:class="$style.commentLabel" style="cursor: pointer;" v-if="isHotLoadError" @click="handleGetHotComment(currentMusicInfo)") {{$t('core.player.comment_hot_load_error')}}
|
||||
p(:class="$style.commentLabel" v-else-if="isHotLoading && !hotComments.length") {{$t('core.player.comment_hot_loading')}}
|
||||
material-comment-floor(v-if="!isHotLoadError && hotComments.length" :class="[$style.commentFloor, isHotLoading ? $style.loading : null]" :comments="hotComments")
|
||||
p(:class="$style.commentLabel" v-else-if="!isHotLoadError && !isHotLoading") {{$t('core.player.comment_no_content')}}
|
||||
div
|
||||
h2(:class="$style.commentType") {{$t('core.player.comment_new_title')}} ({{total}})
|
||||
p(:class="$style.commentLabel" style="cursor: pointer;" v-if="isNewLoadError" @click="handleGetNewComment(currentMusicInfo, nextPage, limit)") {{$t('core.player.comment_new_load_error')}}
|
||||
p(:class="$style.commentLabel" v-else-if="isNewLoading && !newComments.length") {{$t('core.player.comment_new_loading')}}
|
||||
material-comment-floor(v-if="!isNewLoadError && newComments.length" :class="[$style.commentFloor, isNewLoading ? $style.loading : null]" :comments="newComments")
|
||||
p(:class="$style.commentLabel" v-else-if="!isNewLoadError && !isNewLoading") {{$t('core.player.comment_no_content')}}
|
||||
div(:class="$style.pagination")
|
||||
material-pagination(:count="total" :btnLength="5" :limit="limit" :page="page" @btn-click="handleToggleCommentPage")
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { scrollTo } from '../../utils'
|
||||
import music from '../../utils/music'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: Boolean,
|
||||
titleFormat: {
|
||||
type: String,
|
||||
default: '歌名 - 歌手',
|
||||
},
|
||||
musicInfo: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentMusicInfo: {
|
||||
name: '',
|
||||
singer: '',
|
||||
},
|
||||
page: 1,
|
||||
total: 10,
|
||||
maxPage: 1,
|
||||
limit: 20,
|
||||
isHotLoading: true,
|
||||
isNewLoading: false,
|
||||
isHotLoadError: true,
|
||||
isNewLoadError: false,
|
||||
nextPage: 1,
|
||||
newComments: [
|
||||
// {
|
||||
// text: ['123123hhh'],
|
||||
// userName: 'dsads',
|
||||
// avatar: 'http://img4.kuwo.cn/star/userhead/39/52/1602393411654_512039239s.jpg',
|
||||
// time: '2020-10-22 22:14:17',
|
||||
// timeStr: '2020-10-22 22:14:17',
|
||||
// likedCount: 100,
|
||||
// reply: [],
|
||||
// },
|
||||
],
|
||||
hotComments: [
|
||||
// {
|
||||
// text: ['123123hhh'],
|
||||
// userName: 'dsads',
|
||||
// avatar: 'http://img4.kuwo.cn/star/userhead/39/52/1602393411654_512039239s.jpg',
|
||||
// time: '2020-10-22 22:14:17',
|
||||
// timeStr: '2020-10-22 22:14:17',
|
||||
// likedCount: 100,
|
||||
// reply: [
|
||||
// {
|
||||
// text: ['123123hhh'],
|
||||
// userName: 'dsads',
|
||||
// avatar: 'http://img4.kuwo.cn/star/userhead/39/52/1602393411654_512039239s.jpg',
|
||||
// time: '2020-10-22 22:14:17',
|
||||
// timeStr: '2020-10-22 22:14:17',
|
||||
// likedCount: 100,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
title() {
|
||||
return this.currentMusicInfo.name
|
||||
? this.titleFormat.replace('歌名', this.currentMusicInfo.name).replace('歌手', this.currentMusicInfo.singer)
|
||||
: '^-^'
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value(n) {
|
||||
if (n) this.handleShowComment()
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
async getComment(musicInfo, page, limit, retryNum = 0) {
|
||||
let resp
|
||||
try {
|
||||
resp = await music[musicInfo.source].comment.getComment(musicInfo, page, limit)
|
||||
} catch (error) {
|
||||
if (error.message == '取消请求' || ++retryNum > 2) throw error
|
||||
resp = await this.getComment(musicInfo, page, limit, retryNum)
|
||||
}
|
||||
return resp
|
||||
},
|
||||
async getHotComment(musicInfo, retryNum = 0) {
|
||||
let resp
|
||||
try {
|
||||
resp = await music[musicInfo.source].comment.getHotComment(musicInfo)
|
||||
} catch (error) {
|
||||
if (error.message == '取消请求' || ++retryNum > 2) throw error
|
||||
resp = await this.getHotComment(musicInfo, retryNum)
|
||||
}
|
||||
return resp
|
||||
},
|
||||
handleGetNewComment(musicInfo, page, limit) {
|
||||
this.isNewLoadError = false
|
||||
this.isNewLoading = true
|
||||
this.getComment(musicInfo, page, limit).then(comment => {
|
||||
this.isNewLoading = false
|
||||
this.total = comment.total
|
||||
this.maxPage = comment.maxPage
|
||||
this.page = page
|
||||
this.newComments = comment.comments
|
||||
this.$nextTick(() => {
|
||||
scrollTo(this.$refs.dom_comment, 0, 300)
|
||||
})
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
if (err.message == '取消请求') return
|
||||
this.isNewLoadError = true
|
||||
this.isNewLoading = false
|
||||
})
|
||||
},
|
||||
handleGetHotComment(musicInfo) {
|
||||
this.isHotLoadError = false
|
||||
this.isHotLoading = true
|
||||
this.getHotComment(musicInfo).then(hotComment => {
|
||||
this.isHotLoading = false
|
||||
this.hotComments = hotComment.comments
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
if (err.message == '取消请求') return
|
||||
this.isHotLoadError = true
|
||||
this.isHotLoading = false
|
||||
})
|
||||
},
|
||||
handleShowComment() {
|
||||
if (!this.musicInfo.songmid || !music[this.musicInfo.source].comment) return
|
||||
// if (this.musicInfo.songmid != this.currentMusicInfo.songmid) {
|
||||
this.page = 1
|
||||
this.total = 0
|
||||
this.maxPage = 1
|
||||
this.nextPage = 1
|
||||
// }
|
||||
this.isShowComment = true
|
||||
this.currentMusicInfo = this.musicInfo
|
||||
|
||||
if (this.page == 1) this.handleGetHotComment(this.currentMusicInfo)
|
||||
this.handleGetNewComment(this.currentMusicInfo, this.page, this.limit)
|
||||
},
|
||||
handleToggleCommentPage(page) {
|
||||
this.nextPage = page
|
||||
this.handleGetNewComment(this.currentMusicInfo, page, this.limit)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" module>
|
||||
@import '../../assets/styles/layout.less';
|
||||
|
||||
.comment {
|
||||
display: flex;
|
||||
flex-flow: column nowrap;
|
||||
transition: @transition-theme;
|
||||
transition-property: flex-basis opacity;
|
||||
overflow: hidden;
|
||||
}
|
||||
.commentHeader {
|
||||
flex: none;
|
||||
padding-bottom: 5px;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
align-items: center;
|
||||
// border-bottom: 1px solid #eee;
|
||||
h3 {
|
||||
font-size: 14px;
|
||||
.mixin-ellipsis-1;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
.commentHeaderBtns {
|
||||
flex: 1 0 auto;
|
||||
display: flex;
|
||||
flex-flow: row nowrap;
|
||||
justify-content: flex-end;
|
||||
color: @color-theme;
|
||||
}
|
||||
.commentHeaderBtn {
|
||||
height: 22px;
|
||||
width: 22px;
|
||||
cursor: pointer;
|
||||
transition: opacity @transition-theme;
|
||||
|
||||
+.commentHeaderBtn {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
opacity: .7;
|
||||
}
|
||||
}
|
||||
.commentMain {
|
||||
flex: auto;
|
||||
padding-left: 15px;
|
||||
padding-right: 10px;
|
||||
background-color: @color-reply-floor;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.commentLabel {
|
||||
padding: 15px;
|
||||
color: @color-theme_2-font-label;
|
||||
font-size: 14px;
|
||||
}
|
||||
.commentType {
|
||||
padding: 10px 0;
|
||||
font-size: 13px;
|
||||
color: @color-theme;
|
||||
}
|
||||
.commentFloor {
|
||||
opacity: 1;
|
||||
transition: opacity @transition-theme;
|
||||
|
||||
&.loading {
|
||||
opacity: .4;
|
||||
}
|
||||
}
|
||||
.pagination {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
each(@themes, {
|
||||
:global(#container.@{value}) {
|
||||
.commentHeaderBtns {
|
||||
color: ~'@{color-@{value}-theme}';
|
||||
}
|
||||
.commentMain {
|
||||
background-color: ~'@{color-@{value}-reply-floor}';
|
||||
}
|
||||
.commentLabel {
|
||||
color: ~'@{color-@{value}-theme_2-font-label}';
|
||||
}
|
||||
.commentType {
|
||||
color: ~'@{color-@{value}-theme}';
|
||||
}
|
||||
}
|
||||
})
|
||||
</style>
|
||||
@@ -6,20 +6,20 @@ div(:class="$style.pagination" v-if="allPage > 1")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.846 451.847' space='preserve')
|
||||
use(xlink:href='#icon-left')
|
||||
li(v-else)
|
||||
button(type="button" @click="handleClick(page - 1)" :title="$t('material.pagination.prev')")
|
||||
button(type="button" @click="handleClick(page - 1)" :tips="$t('material.pagination.prev')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.846 451.847' space='preserve')
|
||||
use(xlink:href='#icon-left')
|
||||
li(v-if="allPage > btnLength && page > pageEvg+1" :class="$style.first")
|
||||
button(type="button" @click="handleClick(1)" :title="$t('material.pagination.page', { num: 1 })")
|
||||
button(type="button" @click="handleClick(1)" :tips="$t('material.pagination.page', { num: 1 })")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.846 451.847' space='preserve')
|
||||
use(xlink:href='#icon-first')
|
||||
|
||||
li(v-for="(p, index) in pages" :key="index" :class="{[$style.active] : p == page}")
|
||||
span(v-if="p === page" v-text="page")
|
||||
button(v-else type="button" @click="handleClick(p)" v-text="p" :title="$t('material.pagination.page', { num: p })")
|
||||
button(v-else type="button" @click="handleClick(p)" v-text="p" :tips="$t('material.pagination.page', { num: p })")
|
||||
|
||||
li(v-if="allPage > btnLength && allPage - page > pageEvg" :class="$style.last")
|
||||
button(type="button" @click="handleClick(allPage)" :title="$t('material.pagination.page', { num: allPage })")
|
||||
button(type="button" @click="handleClick(allPage)" :tips="$t('material.pagination.page', { num: allPage })")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.846 451.847' space='preserve')
|
||||
use(xlink:href='#icon-last')
|
||||
|
||||
@@ -29,7 +29,7 @@ div(:class="$style.pagination" v-if="allPage > 1")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.846 451.847' space='preserve')
|
||||
use(xlink:href='#icon-right')
|
||||
li(v-else)
|
||||
button(type="button" @click="handleClick(page + 1)" :title="$t('material.pagination.next')")
|
||||
button(type="button" @click="handleClick(page + 1)" :tips="$t('material.pagination.next')")
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.846 451.847' space='preserve')
|
||||
use(xlink:href='#icon-right')
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ export default {
|
||||
this.$refs.dom_input.focus()
|
||||
},
|
||||
handleTemplistClick(index) {
|
||||
console.log(index)
|
||||
this.sendEvent('listClick', index)
|
||||
},
|
||||
handleFocus() {
|
||||
@@ -101,8 +102,10 @@ export default {
|
||||
this.sendEvent('focus')
|
||||
},
|
||||
handleBlur() {
|
||||
this.focus = false
|
||||
this.sendEvent('blur')
|
||||
setTimeout(() => {
|
||||
this.focus = false
|
||||
this.sendEvent('blur')
|
||||
}, 80)
|
||||
},
|
||||
handleSearch() {
|
||||
this.hideList()
|
||||
|
||||
@@ -239,7 +239,7 @@ export default {
|
||||
handleSearch() {
|
||||
if (!this.text.length) return this.resultList = []
|
||||
let list = []
|
||||
let rxp = new RegExp(this.text.split('').join('.*'), 'i')
|
||||
let rxp = new RegExp(this.text.split('').join('.*') + '.*', 'i')
|
||||
for (const item of this.list) {
|
||||
if (rxp.test(`${item.name}${item.singer}${item.albumName ? item.albumName : ''}`)) list.push(item)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
svg(version='1.1' xmlns='http://www.w3.org/2000/svg' xlink='http://www.w3.org/1999/xlink' height='100%' viewBox='0 0 451.847 451.847' space='preserve')
|
||||
use(xlink:href='#icon-down')
|
||||
ul.list.scroll(:class="$style.list" :style="listStyles" ref="dom_list")
|
||||
li(v-for="item in list" :class="(itemKey ? item[itemKey] : item) == value ? $style.active : null" @click="handleClick(item)" :title="itemName ? item[itemName] : item") {{itemName ? item[itemName] : item}}
|
||||
li(v-for="item in list" :class="(itemKey ? item[itemKey] : item) == value ? $style.active : null" @click="handleClick(item)" :tips="itemName ? item[itemName] : item") {{itemName ? item[itemName] : item}}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
@@ -44,11 +44,11 @@ material-modal(:show="version.showModal" @close="handleClose" v-if="version.newV
|
||||
p 发现有新版本啦,但是自动更新功能出问题了,
|
||||
p
|
||||
| 你可以去
|
||||
strong.hover.underline(@click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" title="点击打开") 软件发布页
|
||||
strong.hover.underline(@click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" tips="点击打开") 软件发布页
|
||||
| 或
|
||||
strong.hover.underline(@click="handleOpenUrl('https://www.lanzous.com/b906260/')" title="点击打开") 网盘
|
||||
strong.hover.underline(@click="handleOpenUrl('https://www.lanzoux.com/b0bf2cfa/')" tips="点击打开") 网盘
|
||||
| (密码:
|
||||
strong.hover(@click="handleCopy('glqw')" title="点击复制") glqw
|
||||
strong.hover(@click="handleCopy('glqw')" tips="点击复制") glqw
|
||||
| ) 下载新版本,
|
||||
p
|
||||
| 国内Windows/MAC用户推荐到
|
||||
@@ -61,11 +61,11 @@ material-modal(:show="version.showModal" @close="handleClose" v-if="version.newV
|
||||
p 你当前所在网络访问GitHub较慢,导致新版本下载超时(已经下了半个钟了😳),建议手动更新版本!
|
||||
p
|
||||
| 你可以去
|
||||
material-btn(min @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" title="点击打开") 软件发布页
|
||||
material-btn(min @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" tips="点击打开") 软件发布页
|
||||
| 或
|
||||
material-btn(min @click="handleOpenUrl('https://www.lanzous.com/b906260/')" title="点击打开") 网盘
|
||||
material-btn(min @click="handleOpenUrl('https://www.lanzoux.com/b0bf2cfa/')" tips="点击打开") 网盘
|
||||
| (密码:
|
||||
strong.hover(@click="handleCopy('glqw')" title="点击复制") glqw
|
||||
strong.hover(@click="handleCopy('glqw')" tips="点击复制") glqw
|
||||
| )下载新版本,
|
||||
p
|
||||
| 国内Windows/MAC用户推荐到
|
||||
@@ -82,11 +82,11 @@ material-modal(:show="version.showModal" @close="handleClose" v-if="version.newV
|
||||
p 更新信息获取失败,可能是无法访问Github导致的,请手动检查更新!
|
||||
p
|
||||
| 检查方法:打开
|
||||
material-btn(min @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" title="点击打开") 软件发布页
|
||||
material-btn(min @click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" tips="点击打开") 软件发布页
|
||||
| 或
|
||||
material-btn(min @click="handleOpenUrl('https://www.lanzous.com/b906260/')" title="点击打开") 网盘
|
||||
material-btn(min @click="handleOpenUrl('https://www.lanzoux.com/b0bf2cfa/')" tips="点击打开") 网盘
|
||||
| (密码:
|
||||
strong.hover(@click="handleCopy('glqw')" title="点击复制") glqw
|
||||
strong.hover(@click="handleCopy('glqw')" tips="点击复制") glqw
|
||||
| )查看它们的
|
||||
strong 版本号
|
||||
| 与当前版本({{version.version}})对比是否一样,
|
||||
@@ -115,11 +115,11 @@ material-modal(:show="version.showModal" @close="handleClose" v-if="version.newV
|
||||
| 重新打开本弹窗。
|
||||
p
|
||||
| 手动更新可以去
|
||||
strong.hover.underline(@click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" title="点击打开") 软件发布页
|
||||
strong.hover.underline(@click="handleOpenUrl('https://github.com/lyswhut/lx-music-desktop/releases')" tips="点击打开") 软件发布页
|
||||
| 或
|
||||
strong.hover.underline(@click="handleOpenUrl('https://www.lanzous.com/b906260/')" title="点击打开") 网盘
|
||||
strong.hover.underline(@click="handleOpenUrl('https://www.lanzoux.com/b0bf2cfa/')" tips="点击打开") 网盘
|
||||
| (密码:
|
||||
strong.hover(@click="handleCopy('glqw')" title="点击复制") glqw
|
||||
strong.hover(@click="handleCopy('glqw')" tips="点击复制") glqw
|
||||
| ) 下载,
|
||||
p 国内Windows/MAC用户推荐到网盘下载。
|
||||
p 当前下载进度:{{progress}}
|
||||
|
||||
@@ -6,8 +6,8 @@ material-modal(:show="show" :bg-close="bgClose" @close="handleClose")
|
||||
span(:class="$style.name") {{this.musicInfo && `${musicInfo.name}`}}
|
||||
| {{$t('material.list_add_modal.title_last')}}
|
||||
div.scroll(:class="$style.btnContent")
|
||||
material-btn(:class="$style.btn" :title="$t('material.list_add_modal.btn_title', { name: item.name })" :key="item.id" @click="handleClick(index)" v-for="(item, index) in lists") {{item.name}}
|
||||
material-btn(:class="[$style.btn, $style.newList, isEditing ? $style.editing : null]" @click="handleEditing($event)" :title="$t('view.list.lists_new_list_btn')")
|
||||
material-btn(:class="$style.btn" :tips="$t('material.list_add_modal.btn_title', { name: item.name })" :key="item.id" @click="handleClick(index)" v-for="(item, index) in lists") {{item.name}}
|
||||
material-btn(:class="[$style.btn, $style.newList, isEditing ? $style.editing : null]" @click="handleEditing($event)" :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' viewBox='0 0 42 42' space='preserve')
|
||||
use(xlink:href='#icon-addTo')
|
||||
input.key-bind(:class="$style.newListInput" :value="newListName" type="text" :placeholder="$t('view.list.lists_new_list_input')" @keyup.enter="handleSaveList($event)" @blur="handleSaveList($event)")
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
this.defaultList,
|
||||
this.loveList,
|
||||
...this.userList,
|
||||
].filter(l => l.id != this.excludeListId)
|
||||
].filter(l => l.id != this.excludeListId.includes(l.id))
|
||||
},
|
||||
spaceNum() {
|
||||
return this.lists.length < 2 ? 0 : (3 - this.lists.length % 3 - 1)
|
||||
@@ -91,7 +91,7 @@ export default {
|
||||
this.newListName = event.target.value = ''
|
||||
this.isEditing = false
|
||||
if (!name) return
|
||||
this.createUserList(name)
|
||||
this.createUserList({ name })
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ material-modal(:show="show" :bg-close="bgClose" @close="handleClose")
|
||||
main(:class="$style.main")
|
||||
h2 {{$t('material.list_add_multiple_modal.' + (isMove ? 'title_move' : 'title_add'), { num: musicList.length })}}
|
||||
div.scroll(:class="$style.btnContent")
|
||||
material-btn(:class="$style.btn" :title="$t('material.list_add_multiple_modal.btn_title', { name: item.name })" :key="item.id" @click="handleClick(index)" v-for="(item, index) in lists") {{item.name}}
|
||||
material-btn(:class="[$style.btn, $style.newList, isEditing ? $style.editing : null]" @click="handleEditing($event)" :title="$t('view.list.lists_new_list_btn')")
|
||||
material-btn(:class="$style.btn" :tips="$t('material.list_add_multiple_modal.btn_title', { name: item.name })" :key="item.id" @click="handleClick(index)" v-for="(item, index) in lists") {{item.name}}
|
||||
material-btn(:class="[$style.btn, $style.newList, isEditing ? $style.editing : null]" @click="handleEditing($event)" :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' viewBox='0 0 42 42' space='preserve')
|
||||
use(xlink:href='#icon-addTo')
|
||||
input.key-bind(:class="$style.newListInput" :value="newListName" type="text" :placeholder="$t('view.list.lists_new_list_input')" @keyup.enter="handleSaveList($event)" @blur="handleSaveList($event)")
|
||||
@@ -62,7 +62,7 @@ export default {
|
||||
this.defaultList,
|
||||
this.loveList,
|
||||
...this.userList,
|
||||
].filter(l => l.id != this.excludeListId)
|
||||
].filter(l => l.id != this.excludeListId.includes(l.id))
|
||||
},
|
||||
spaceNum() {
|
||||
return this.lists.length < 2 ? 0 : (3 - this.lists.length % 3 - 1)
|
||||
@@ -92,7 +92,7 @@ export default {
|
||||
this.newListName = event.target.value = ''
|
||||
this.isEditing = false
|
||||
if (!name) return
|
||||
this.createUserList(name)
|
||||
this.createUserList({ name })
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import Vue from 'vue'
|
||||
import keyBind from '../utils/keyBind'
|
||||
import { rendererOn, rendererSend, NAMES } from '../../common/ipc'
|
||||
import { rendererOn, rendererSend, NAMES, rendererInvoke } from '../../common/ipc'
|
||||
import { base as baseName } from './names'
|
||||
import Store from 'electron-store'
|
||||
import { common as hotKeyNamesCommon } from '../../common/hotKey'
|
||||
|
||||
const eventHub = window.eventHub = new Vue()
|
||||
|
||||
const electronStore_hotKey = window.electronStore_hotKey = new Store({
|
||||
name: 'hotKey',
|
||||
})
|
||||
|
||||
window.isEditingHotKey = false
|
||||
const appHotKeyConfig = window.appHotKeyConfig = {
|
||||
local: electronStore_hotKey.get('local'),
|
||||
global: electronStore_hotKey.get('global'),
|
||||
let appHotKeyConfig = {
|
||||
local: {},
|
||||
global: {},
|
||||
}
|
||||
rendererInvoke(NAMES.mainWindow.get_hot_key).then(({ local, global }) => {
|
||||
appHotKeyConfig = window.appHotKeyConfig = {
|
||||
local,
|
||||
global,
|
||||
}
|
||||
})
|
||||
|
||||
eventHub.$on(baseName.bindKey, () => {
|
||||
keyBind.bindKey((key, type, event, keys) => {
|
||||
|
||||
5
src/renderer/lang/en-us/base.json
Normal file
5
src/renderer/lang/en-us/base.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"date_format_second": "{num} seconds ago",
|
||||
"date_format_minute": "{num} minutes ago",
|
||||
"date_format_hour": "{num} hours ago"
|
||||
}
|
||||
@@ -17,5 +17,26 @@
|
||||
"hide_detail": "Hide detail page",
|
||||
"name": "Name: ",
|
||||
"singer": "Artist: ",
|
||||
"album": "Album: "
|
||||
"album": "Album: ",
|
||||
"add_music_to": "Add the current song to...",
|
||||
"desktop_lyric_on": "Open Desktop Lyrics",
|
||||
"desktop_lyric_off": "Close Desktop Lyrics",
|
||||
"desktop_lyric_lock": "Right click to lock lyrics",
|
||||
"desktop_lyric_unlock": "Right click to unlock lyrics",
|
||||
"play_toggle_mode_list_loop": "List Loop",
|
||||
"play_toggle_mode_random": "List Random",
|
||||
"play_toggle_mode_list": "Play in order",
|
||||
"play_toggle_mode_single_loop": "Single Loop",
|
||||
"play_toggle_mode_off": "Disable",
|
||||
|
||||
"comment_show": "Song comments",
|
||||
"comment_hot_loading": "Hot comments are loading",
|
||||
"comment_new_loading": "Latest comments are loading",
|
||||
"comment_hot_load_error": "Hot comments failed to load, click to try to reload",
|
||||
"comment_new_load_error": "The latest comment failed to load, click to try to reload",
|
||||
"comment_refresh": "Refresh comments",
|
||||
"comment_no_content": "No comments yet",
|
||||
"comment_hot_title": "Hot Comment",
|
||||
"comment_new_title": "Latest comment",
|
||||
"comment_title": "{name} comment"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"basic": "General",
|
||||
"basic_theme": "Theme",
|
||||
"basic_show_animation": "Show switching animation",
|
||||
"basic_animation_title": "Animation effect of the pop-up layer",
|
||||
"basic_animation": "Random pop-up animation",
|
||||
"basic_source_title": "Choose a music source",
|
||||
@@ -35,6 +36,7 @@
|
||||
"play_toggle_random": "Playlist shuffle",
|
||||
"play_toggle_list": "Play in order",
|
||||
"play_toggle_single_loop": "Single repeat",
|
||||
"play_lyric_transition": "Show lyrics translation",
|
||||
"play_quality_title": "The 320k quality is preferred for playing",
|
||||
"play_quality": "Prefer High Quality 320k",
|
||||
"play_task_bar_title": "Show playing progress on the taskbar",
|
||||
@@ -48,6 +50,7 @@
|
||||
"desktop_lyric_enable": "Display lyrics",
|
||||
"desktop_lyric_lock": "Lock lyrics",
|
||||
"desktop_lyric_always_on_top": "Make the lyrics always above other windows",
|
||||
"desktop_lyric_lock_screen": "It is not allowed to drag the lyrics window out of the main screen",
|
||||
|
||||
"search": "Search",
|
||||
"search_hot_title": "Select whether to show popular searches",
|
||||
@@ -103,7 +106,7 @@
|
||||
"hot_key_desktop_lyric_toggle_always_top": "Top Desktop Lyrics Switch",
|
||||
|
||||
"network": "Network",
|
||||
"network_proxy_title": "Proxy (False setting would block Internet connections)",
|
||||
"network_proxy_title": "HTTP Proxy (False setting would block Internet connections)",
|
||||
"network_proxy_host": "Host",
|
||||
"network_proxy_port": "Port",
|
||||
"network_proxy_username": "Username",
|
||||
@@ -114,12 +117,12 @@
|
||||
"odc_clear_search_list": "Clear the search list when you are not searching",
|
||||
|
||||
"backup": "Backup and restore",
|
||||
"backup_part": "Partially",
|
||||
"backup_part": "Partial data (list data includes audition list, favorite list, user-defined list, setting data does not include shortcut key settings)",
|
||||
"backup_part_import_list": "Import lists",
|
||||
"backup_part_export_list": "Export lists",
|
||||
"backup_part_import_setting": "Import settings",
|
||||
"backup_part_export_setting": "Export settings",
|
||||
"backup_all": "All (Settings and Recently Played)",
|
||||
"backup_all": "All data (list data and setting data)",
|
||||
"backup_all_import": "Import",
|
||||
"backup_all_export": "Export",
|
||||
"backup_all_import_desc": "Select a backup file",
|
||||
|
||||
@@ -6,5 +6,7 @@
|
||||
"input_text": "Enter songlist link or songlist ID",
|
||||
"tip_1": "Cross-source playlists are not supported, please confirm whether the playlist to be opened corresponds to the current playlist source",
|
||||
"tip_2": "If you encounter a link to a playlist that cannot be opened, welcome feedback",
|
||||
"tip_3": "Kugou source does not support opening with playlist ID, but supports Kugou code opening"
|
||||
"tip_3": "Kugou source does not support opening with playlist ID, but supports Kugou code opening",
|
||||
"play_all": "Play",
|
||||
"add_all": "Collect"
|
||||
}
|
||||
|
||||
5
src/renderer/lang/zh-cn/base.json
Normal file
5
src/renderer/lang/zh-cn/base.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"date_format_second": "{num}秒前",
|
||||
"date_format_minute": "{num}分钟前",
|
||||
"date_format_hour": "{num}小时前"
|
||||
}
|
||||
@@ -17,5 +17,26 @@
|
||||
"hide_detail": "隐藏详情页",
|
||||
"name": "歌曲名:",
|
||||
"singer": "艺术家:",
|
||||
"album": "专辑名:"
|
||||
"album": "专辑名:",
|
||||
"add_music_to": "添加当前歌曲到...",
|
||||
"desktop_lyric_on": "开启桌面歌词",
|
||||
"desktop_lyric_off": "关闭桌面歌词",
|
||||
"desktop_lyric_lock": "右击锁定歌词",
|
||||
"desktop_lyric_unlock": "右击解锁歌词",
|
||||
"play_toggle_mode_list_loop": "列表循环",
|
||||
"play_toggle_mode_random": "列表随机",
|
||||
"play_toggle_mode_list": "顺序播放",
|
||||
"play_toggle_mode_single_loop": "单曲循环",
|
||||
"play_toggle_mode_off": "禁用",
|
||||
|
||||
"comment_show": "歌曲评论",
|
||||
"comment_hot_loading": "热门评论加载中",
|
||||
"comment_new_loading": "最新评论加载中",
|
||||
"comment_hot_load_error": "热门评论加载失败,点击尝试重新加载",
|
||||
"comment_new_load_error": "最新评论加载失败,点击尝试重新加载",
|
||||
"comment_refresh": "刷新评论",
|
||||
"comment_no_content": "暂无评论",
|
||||
"comment_hot_title": "热门评论",
|
||||
"comment_new_title": "最新评论",
|
||||
"comment_title": "{name} 的评论"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"basic_theme": "主题颜色",
|
||||
"basic_animation_title": "弹出层的动画效果",
|
||||
"basic_animation": "弹出层随机动画",
|
||||
"basic_show_animation": "显示切换动画",
|
||||
"basic_source_title": "选择音乐来源",
|
||||
"basic_source_test": "测试接口(几乎软件的所有功能都可用)",
|
||||
"basic_source_temp": "临时接口(软件的某些功能不可用,建议测试接口不可用再使用本接口)",
|
||||
@@ -35,6 +36,7 @@
|
||||
"play_toggle_random": "列表随机",
|
||||
"play_toggle_list": "顺序播放",
|
||||
"play_toggle_single_loop": "单曲循环",
|
||||
"play_lyric_transition": "显示歌词翻译",
|
||||
"play_quality_title": "启用时将优先播放320K品质的歌曲",
|
||||
"play_quality": "优先播放高品质音乐",
|
||||
"play_task_bar_title": "在任务栏上显示当前歌曲播放进度",
|
||||
@@ -48,6 +50,7 @@
|
||||
"desktop_lyric_enable": "显示歌词",
|
||||
"desktop_lyric_lock": "锁定歌词",
|
||||
"desktop_lyric_always_on_top": "使歌词总是在其他窗口之上",
|
||||
"desktop_lyric_lock_screen": "不允许歌词窗口拖出主屏幕之外",
|
||||
|
||||
"search": "搜索设置",
|
||||
"search_hot_title": "是否显示热门搜索",
|
||||
@@ -103,7 +106,7 @@
|
||||
"hot_key_desktop_lyric_toggle_always_top": "桌面歌词置顶切换",
|
||||
|
||||
"network": "网络设置",
|
||||
"network_proxy_title": "代理设置(乱设置软件将无法联网)",
|
||||
"network_proxy_title": "HTTP代理设置(乱设置软件将无法联网)",
|
||||
"network_proxy_host": "主机",
|
||||
"network_proxy_port": "端口",
|
||||
"network_proxy_username": "用户名",
|
||||
@@ -114,12 +117,12 @@
|
||||
"odc_clear_search_list": "离开搜索界面时清空搜索列表",
|
||||
|
||||
"backup": "备份与恢复",
|
||||
"backup_part": "部分数据",
|
||||
"backup_part": "部分数据(列表数据包括试听列表、收藏列表、用户自定义列表,设置数据不包括快捷键设置)",
|
||||
"backup_part_import_list": "导入列表",
|
||||
"backup_part_export_list": "导出列表",
|
||||
"backup_part_import_setting": "导入设置",
|
||||
"backup_part_export_setting": "导出设置",
|
||||
"backup_all": "所有数据(设置与试听列表)",
|
||||
"backup_all": "所有数据(列表数据与设置数据)",
|
||||
"backup_all_import": "导入",
|
||||
"backup_all_export": "导出",
|
||||
"backup_all_import_desc": "选择备份文件",
|
||||
|
||||
@@ -6,5 +6,7 @@
|
||||
"input_text": "输入歌单链接或歌单ID",
|
||||
"tip_1": "不支持跨源打开歌单,请确认要打开的歌单与当前歌单源是否对应",
|
||||
"tip_2": "若遇到无法打开的歌单链接,欢迎反馈",
|
||||
"tip_3": "酷狗源不支持用歌单ID打开,但支持酷狗码打开"
|
||||
"tip_3": "酷狗源不支持用歌单ID打开,但支持酷狗码打开",
|
||||
"play_all": "播放",
|
||||
"add_all": "收藏"
|
||||
}
|
||||
|
||||
5
src/renderer/lang/zh-tw/base.json
Normal file
5
src/renderer/lang/zh-tw/base.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"date_format_second": "{num}秒前",
|
||||
"date_format_minute": "{num}分鐘前",
|
||||
"date_format_hour": "{num}小時前"
|
||||
}
|
||||
@@ -17,5 +17,26 @@
|
||||
"hide_detail": "隱藏詳情頁",
|
||||
"name": "歌曲名:",
|
||||
"singer": "藝術家:",
|
||||
"album": "專輯名:"
|
||||
"album": "專輯名:",
|
||||
"add_music_to": "添加當前歌曲到...",
|
||||
"desktop_lyric_on": "開啟桌面歌詞",
|
||||
"desktop_lyric_off": "關閉桌面歌詞",
|
||||
"desktop_lyric_lock": "右擊鎖定歌詞",
|
||||
"desktop_lyric_unlock": "右擊解鎖歌詞",
|
||||
"play_toggle_mode_list_loop": "列表循環",
|
||||
"play_toggle_mode_random": "列表隨機",
|
||||
"play_toggle_mode_list": "順序播放",
|
||||
"play_toggle_mode_single_loop": "單曲循環",
|
||||
"play_toggle_mode_off": "禁用",
|
||||
|
||||
"comment_show": "歌曲評論",
|
||||
"comment_hot_loading": "熱門評論加載中",
|
||||
"comment_new_loading": "最新評論加載中",
|
||||
"comment_hot_load_error": "熱門評論加載失敗,點擊嘗試重新加載",
|
||||
"comment_new_load_error": "最新評論加載失敗,點擊嘗試重新加載",
|
||||
"comment_refresh": "刷新評論",
|
||||
"comment_no_content": "暫無評論",
|
||||
"comment_hot_title": "熱門評論",
|
||||
"comment_new_title": "最新評論",
|
||||
"comment_title": "{name} 的評論"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"basic_theme": "主題顏色",
|
||||
"basic_animation_title": "彈出層的動畫效果",
|
||||
"basic_animation": "彈出層隨機動畫",
|
||||
"basic_show_animation": "顯示切換動畫",
|
||||
"basic_source_title": "選擇音樂來源",
|
||||
"basic_source_test": "測試接口(幾乎軟件的所有功能都可用)",
|
||||
"basic_source_temp": "臨時接口(軟件的某些功能不可用,建議測試接口不可用再使用本接口)",
|
||||
@@ -34,6 +35,7 @@
|
||||
"play_toggle_random": "列表隨機",
|
||||
"play_toggle_list": "順序播放",
|
||||
"play_toggle_single_loop": "單曲循環",
|
||||
"play_lyric_transition": "顯示歌詞翻譯",
|
||||
"play_quality_title": "啟用時將優先播放320K品質的歌曲",
|
||||
"play_quality": "優先播放高品質音樂",
|
||||
"play_task_bar_title": "在任務欄上顯示當前歌曲播放進度",
|
||||
@@ -46,6 +48,7 @@
|
||||
"desktop_lyric_enable": "顯示歌詞",
|
||||
"desktop_lyric_lock": "鎖定歌詞",
|
||||
"desktop_lyric_always_on_top": "使歌詞總是在其他窗口之上",
|
||||
"desktop_lyric_lock_screen": "不允許歌詞窗口拖出主屏幕之外",
|
||||
"search": "搜索設置",
|
||||
"search_hot_title": "是否顯示熱門搜索",
|
||||
"search_hot": "熱門搜索",
|
||||
@@ -96,7 +99,7 @@
|
||||
"hot_key_desktop_lyric_toggle_lock": "桌面歌詞鎖定切換",
|
||||
"hot_key_desktop_lyric_toggle_always_top": "桌面歌詞置頂切換",
|
||||
"network": "網絡設置",
|
||||
"network_proxy_title": "代理設置(亂設置軟件將無法聯網)",
|
||||
"network_proxy_title": "HTTP代理設置(亂設置軟件將無法聯網)",
|
||||
"network_proxy_host": "主機",
|
||||
"network_proxy_port": "端口",
|
||||
"network_proxy_username": "用戶名",
|
||||
@@ -105,12 +108,12 @@
|
||||
"odc_clear_search_input": "離開搜索界面時清空搜索框",
|
||||
"odc_clear_search_list": "離開搜索界面時清空搜索列表",
|
||||
"backup": "備份與恢復",
|
||||
"backup_part": "部分數據",
|
||||
"backup_part": "部分數據(列表數據包括試聽列表、收藏列表、用戶自定義列表,設置數據不包括快捷鍵設置)",
|
||||
"backup_part_import_list": "導入列表",
|
||||
"backup_part_export_list": "導出列表",
|
||||
"backup_part_import_setting": "導入設置",
|
||||
"backup_part_export_setting": "導出設置",
|
||||
"backup_all": "所有數據(設置與試聽列表)",
|
||||
"backup_all": "所有數據(列表數據與設置數據)",
|
||||
"backup_all_import": "導入",
|
||||
"backup_all_export": "導出",
|
||||
"backup_all_import_desc": "選擇備份文件",
|
||||
|
||||
@@ -6,5 +6,7 @@
|
||||
"input_text": "輸入歌單鏈接或歌單ID",
|
||||
"tip_1": "不支持跨源打開歌單,請確認要打開的歌單與當前歌單源是否對應",
|
||||
"tip_2": "若遇到無法打開的歌單鏈接,歡迎反饋",
|
||||
"tip_3": "酷狗源不支持用歌單ID打開,但支持酷狗碼打開"
|
||||
"tip_3": "酷狗源不支持用歌單ID打開,但支持酷狗碼打開",
|
||||
"play_all": "播放",
|
||||
"add_all": "收藏"
|
||||
}
|
||||
|
||||
@@ -16,14 +16,45 @@ import store from './store'
|
||||
|
||||
import '../common/error'
|
||||
|
||||
import { getSetting } from './utils'
|
||||
import languageList from '@/lang/languages.json'
|
||||
import { rendererSend, NAMES } from '../common/ipc'
|
||||
|
||||
sync(store, router)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
el: '#root',
|
||||
render: h => h(App),
|
||||
|
||||
getSetting().then(({ setting, version }) => {
|
||||
// Set language automatically
|
||||
if (!window.i18n.availableLocales.includes(setting.langId)) {
|
||||
let langId = null
|
||||
let locale = window.navigator.language.toLocaleLowerCase()
|
||||
if (window.i18n.availableLocales.includes(locale)) {
|
||||
langId = locale
|
||||
} else {
|
||||
for (const lang of languageList) {
|
||||
if (lang.alternate == locale) {
|
||||
langId = lang.locale
|
||||
break
|
||||
}
|
||||
}
|
||||
if (langId == null) langId = 'en-us'
|
||||
}
|
||||
setting.langId = langId
|
||||
rendererSend(NAMES.mainWindow.set_app_setting, setting)
|
||||
console.log('Set lang', setting.langId)
|
||||
}
|
||||
window.i18n.locale = setting.langId
|
||||
store.commit('setSetting', setting)
|
||||
store.commit('setSettingVersion', version)
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
i18n,
|
||||
el: '#root',
|
||||
render: h => h(App),
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
30
src/renderer/plugins/Tips/Tips.js
Normal file
30
src/renderer/plugins/Tips/Tips.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import Tips from './Tips.vue'
|
||||
import Vue from 'vue'
|
||||
|
||||
const TipsConstructor = Vue.extend(Tips)
|
||||
export default ({ position, message } = {}) => {
|
||||
if (!position) return
|
||||
let instance = new TipsConstructor().$mount(document.createElement('div'))
|
||||
|
||||
// Tips实例挂载到刚创建的div
|
||||
// 属性设置
|
||||
instance.visible = true
|
||||
instance.message = message
|
||||
instance.position.top = position.top
|
||||
instance.position.left = position.left
|
||||
|
||||
// 将Tips的DOM挂载到body上
|
||||
document.body.appendChild(instance.$el)
|
||||
|
||||
instance.cancel = () => {
|
||||
instance.visible = false
|
||||
instance = null
|
||||
}
|
||||
|
||||
instance.setTips = tips => {
|
||||
instance.message = tips
|
||||
}
|
||||
|
||||
return instance
|
||||
}
|
||||
|
||||
93
src/renderer/plugins/Tips/Tips.vue
Normal file
93
src/renderer/plugins/Tips/Tips.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<transition name="tips-fade" @after-leave="afterLeave">
|
||||
<div v-show="visible" :style="{ left: position.left + 'px' , top: position.top + 'px', transform: transform }" ref="dom_tips" :class="$style.tips">{{message}}</div>
|
||||
</transition>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
message: '',
|
||||
position: {
|
||||
top: 0,
|
||||
left: 0,
|
||||
},
|
||||
transform: 'translate(0, 0)',
|
||||
cancel: null,
|
||||
setTips: null,
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
message() {
|
||||
this.$nextTick(() => {
|
||||
this.transform = `translate(${this.handleGetOffsetXY(this.position.left, this.position.top)})`
|
||||
})
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
afterLeave(el, done) {
|
||||
el.parentNode.removeChild(el)
|
||||
},
|
||||
handleGetOffsetXY(left, top) {
|
||||
const tipsWidth = this.$refs.dom_tips.clientWidth
|
||||
const tipsHeight = this.$refs.dom_tips.clientHeight
|
||||
const dom_container = document.body
|
||||
const containerWidth = dom_container.clientWidth
|
||||
const containerHeight = dom_container.clientHeight
|
||||
const offsetWidth = containerWidth - left - tipsWidth
|
||||
const offsetHeight = containerHeight - top - tipsHeight
|
||||
let x = 0
|
||||
let y = 0
|
||||
if (tipsWidth < left && containerWidth > tipsWidth && offsetWidth < 5) {
|
||||
x = -tipsWidth - 12
|
||||
}
|
||||
if (tipsHeight < top && containerHeight > tipsHeight && offsetHeight < 5) {
|
||||
y = -tipsHeight - 8
|
||||
}
|
||||
return `${x}px, ${y}px`
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" module>
|
||||
@import '../../assets/styles/layout.less';
|
||||
|
||||
.tips {
|
||||
position: fixed;
|
||||
// transform: scale(1);
|
||||
line-height: 1.2;
|
||||
word-wrap: break-word;
|
||||
padding: 4px 5px;
|
||||
z-index: 999;
|
||||
font-size: 12px;
|
||||
max-width: 80%;
|
||||
color: @color-theme_2-font;
|
||||
border-radius: 3px;
|
||||
background: @color-green-theme_2-background_1;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
// text-align: justify;
|
||||
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
:global(.tips-fade-enter-active), :global(.tips-fade-leave-active) {
|
||||
transition: opacity .2s;
|
||||
}
|
||||
:global(.tips-fade-enter), :global(.tips-fade-leave-to) {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
each(@themes, {
|
||||
:global(#container.@{value}) {
|
||||
~.tips {
|
||||
color: ~'@{color-@{value}-theme_2-font}';
|
||||
background: ~'@{color-@{value}-theme_2-background_1}';
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
</style>
|
||||
55
src/renderer/plugins/Tips/index.js
Normal file
55
src/renderer/plugins/Tips/index.js
Normal file
@@ -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)
|
||||
@@ -1 +1,2 @@
|
||||
// import './axios'
|
||||
import './Tips'
|
||||
|
||||
@@ -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
|
||||
@@ -177,20 +180,21 @@ const saveMeta = (downloadInfo, filePath, isEmbedPic, isEmbedLyric) => {
|
||||
: Promise.resolve(),
|
||||
isEmbedLyric
|
||||
? downloadInfo.musicInfo.lrc
|
||||
? Promise.resolve(downloadInfo.musicInfo.lrc)
|
||||
? Promise.resolve({ lyric: downloadInfo.musicInfo.lrc, tlyric: downloadInfo.musicInfo.tlrc || '' })
|
||||
: music[downloadInfo.musicInfo.source].getLyric(downloadInfo.musicInfo).promise.catch(err => {
|
||||
console.log(err)
|
||||
return null
|
||||
})
|
||||
: 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,
|
||||
album: downloadInfo.musicInfo.albumName,
|
||||
APIC: imgUrl,
|
||||
lyrics,
|
||||
lyrics: lyrics.lyric,
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -202,10 +206,13 @@ const saveMeta = (downloadInfo, filePath, isEmbedPic, isEmbedLyric) => {
|
||||
*/
|
||||
const downloadLyric = (downloadInfo, filePath) => {
|
||||
const promise = downloadInfo.musicInfo.lrc
|
||||
? Promise.resolve(downloadInfo.musicInfo.lrc)
|
||||
? Promise.resolve({ lyric: downloadInfo.musicInfo.lrc, tlyric: downloadInfo.musicInfo.tlrc || '' })
|
||||
: music[downloadInfo.musicInfo.source].getLyric(downloadInfo.musicInfo).promise
|
||||
promise.then(lrc => {
|
||||
if (lrc) saveLrc(filePath.replace(/(mp3|flac|ape|wav)$/, 'lrc'), lrc)
|
||||
promise.then(lrcs => {
|
||||
if (lrcs.lyric) {
|
||||
lrcs.lyric = fixKgLyric(lrcs.lyric)
|
||||
saveLrc(filePath.replace(/(mp3|flac|ape|wav)$/, 'lrc'), lrcs.lyric)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -218,13 +225,13 @@ const refreshUrl = function(commit, downloadInfo) {
|
||||
if (!dl) return
|
||||
dl.refreshUrl(result.url)
|
||||
dl.start().catch(err => {
|
||||
commit('onError', downloadInfo)
|
||||
commit('onError', { downloadInfo, errorMsg: err.message })
|
||||
commit('setStatusText', { downloadInfo, text: err.message })
|
||||
this.dispatch('download/startTask')
|
||||
})
|
||||
}).catch(err => {
|
||||
// console.log(err)
|
||||
commit('onError', downloadInfo)
|
||||
commit('onError', { downloadInfo, errorMsg: err.message })
|
||||
commit('setStatusText', { downloadInfo, text: err.message })
|
||||
this.dispatch('download/startTask')
|
||||
})
|
||||
@@ -299,7 +306,7 @@ const actions = {
|
||||
try {
|
||||
await checkPath(rootState.setting.download.savePath)
|
||||
} catch (error) {
|
||||
commit('onError', downloadInfo)
|
||||
commit('onError', { downloadInfo, errorMsg: error.message })
|
||||
commit('setStatusText', '检查下载目录出错: ' + error.message)
|
||||
await dispatch('startTask')
|
||||
return
|
||||
@@ -324,9 +331,14 @@ const actions = {
|
||||
console.log('on complate')
|
||||
},
|
||||
onError(err) {
|
||||
// console.log(err)
|
||||
if (err.code == 'EPERM') {
|
||||
commit('onError', { downloadInfo, errorMsg: '歌曲下载目录没有写入权限,请尝试更改歌曲保存路径' })
|
||||
return
|
||||
}
|
||||
// console.log(tryNum[downloadInfo.key])
|
||||
if (++tryNum[downloadInfo.key] > 2) {
|
||||
commit('onError', downloadInfo)
|
||||
commit('onError', { downloadInfo, errorMsg: err.message })
|
||||
dispatch('startTask')
|
||||
return
|
||||
}
|
||||
@@ -365,17 +377,19 @@ const actions = {
|
||||
},
|
||||
}
|
||||
commit('setStatusText', { downloadInfo, text: '获取URL中...' })
|
||||
let p = options.url ? Promise.resolve() : getUrl(downloadInfo).then(result => {
|
||||
commit('updateUrl', { downloadInfo, url: result.url })
|
||||
if (!result.url) return Promise.reject(new Error('获取URL失败'))
|
||||
options.url = result.url
|
||||
})
|
||||
let p = options.url
|
||||
? Promise.resolve()
|
||||
: getUrl(downloadInfo).then(result => {
|
||||
commit('updateUrl', { downloadInfo, url: result.url })
|
||||
if (!result.url) return Promise.reject(new Error('获取URL失败'))
|
||||
options.url = result.url
|
||||
})
|
||||
p.then(() => {
|
||||
tryNum[downloadInfo.key] = 0
|
||||
dls[downloadInfo.key] = download(options)
|
||||
}).catch(err => {
|
||||
// console.log(err.message)
|
||||
commit('onError', downloadInfo)
|
||||
commit('onError', { downloadInfo, errorMsg: err.message })
|
||||
commit('setStatusText', { downloadInfo, text: err.message })
|
||||
dispatch('startTask')
|
||||
})
|
||||
@@ -437,7 +451,7 @@ const actions = {
|
||||
try {
|
||||
await dl.start()
|
||||
} catch (error) {
|
||||
commit('onError', downloadInfo)
|
||||
commit('onError', { downloadInfo, errorMsg: error.message })
|
||||
commit('setStatusText', error.message)
|
||||
await dispatch('startTask')
|
||||
}
|
||||
@@ -448,7 +462,7 @@ const actions = {
|
||||
startTasks(store, list) {
|
||||
if (isRuningActionTask) return
|
||||
isRuningActionTask = true
|
||||
return startTasks(store, [...list]).finally(() => {
|
||||
return startTasks(store, list.filter(item => !(item.isComplate || item.status == state.downloadStatus.RUN || item.status == state.downloadStatus.WAITING))).finally(() => {
|
||||
isRuningActionTask = false
|
||||
})
|
||||
},
|
||||
@@ -522,9 +536,9 @@ const mutations = {
|
||||
downloadInfo.status = state.downloadStatus.COMPLETED
|
||||
downloadInfo.statusText = '下载完成'
|
||||
},
|
||||
onError(state, downloadInfo) {
|
||||
onError(state, { downloadInfo, errorMsg }) {
|
||||
downloadInfo.status = state.downloadStatus.ERROR
|
||||
downloadInfo.statusText = '任务出错'
|
||||
downloadInfo.statusText = errorMsg || '任务出错'
|
||||
},
|
||||
onStart(state, downloadInfo) {
|
||||
downloadInfo.status = state.downloadStatus.RUN
|
||||
|
||||
@@ -28,6 +28,12 @@ const state = {
|
||||
list: [],
|
||||
location: 0,
|
||||
},
|
||||
tempList: {
|
||||
id: 'temp',
|
||||
name: '临时列表',
|
||||
list: [],
|
||||
location: 0,
|
||||
},
|
||||
userList: [],
|
||||
}
|
||||
|
||||
@@ -48,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
|
||||
@@ -86,8 +92,7 @@ const mutations = {
|
||||
if (!fromList || !toList) return
|
||||
fromList.list.splice(fromList.list.indexOf(musicInfo), 1)
|
||||
let index = toList.list.findIndex(s => s.songmid === musicInfo.songmid)
|
||||
if (index > -1) return toList.list.splice(index, 1)
|
||||
toList.list.push(musicInfo)
|
||||
if (index < 0) toList.list.push(musicInfo)
|
||||
},
|
||||
listAddMultiple(state, { id, list }) {
|
||||
let targetList = allList[id]
|
||||
@@ -104,7 +109,7 @@ const mutations = {
|
||||
},
|
||||
// { fromId, toId, list }
|
||||
listMoveMultiple(state, { fromId, toId, list }) {
|
||||
console.log(state.commit)
|
||||
// console.log(state.commit)
|
||||
this.commit('list/listRemoveMultiple', { id: fromId, list })
|
||||
this.commit('list/listAddMultiple', { id: toId, list })
|
||||
},
|
||||
@@ -140,15 +145,19 @@ const mutations = {
|
||||
if (!targetList) return
|
||||
Object.assign(targetList.list[index], data)
|
||||
},
|
||||
createUserList(state, name) {
|
||||
let newList = {
|
||||
name,
|
||||
id: `userlist_${Date.now()}`,
|
||||
list: [],
|
||||
location: 0,
|
||||
createUserList(state, { name, id = `userlist_${Date.now()}`, list = [] }) {
|
||||
let newList = state.userList.find(item => item.id === id)
|
||||
if (!newList) {
|
||||
newList = {
|
||||
name,
|
||||
id,
|
||||
list: [],
|
||||
location: 0,
|
||||
}
|
||||
state.userList.push(newList)
|
||||
allListUpdate(newList)
|
||||
}
|
||||
state.userList.push(newList)
|
||||
allListUpdate(newList)
|
||||
this.commit('list/listAddMultiple', { id, list })
|
||||
},
|
||||
removeUserList(state, index) {
|
||||
let list = state.userList.splice(index, 1)[0]
|
||||
|
||||
@@ -9,6 +9,7 @@ const state = {
|
||||
playIndex: -1,
|
||||
changePlay: false,
|
||||
isShowPlayerDetail: false,
|
||||
playedList: [],
|
||||
}
|
||||
|
||||
let urlRequest
|
||||
@@ -22,6 +23,7 @@ const getters = {
|
||||
changePlay: satte => satte.changePlay,
|
||||
playIndex: state => state.playIndex,
|
||||
isShowPlayerDetail: state => state.isShowPlayerDetail,
|
||||
playedList: state => state.playedList,
|
||||
}
|
||||
|
||||
// actions
|
||||
@@ -57,10 +59,19 @@ const actions = {
|
||||
},
|
||||
getLrc({ commit, state }, musicInfo) {
|
||||
if (lrcRequest && lrcRequest.cancelHttp) lrcRequest.cancelHttp()
|
||||
if (musicInfo.lrc && musicInfo.tlrc != null) {
|
||||
if (musicInfo.lrc.startsWith('\ufeff[id:$00000000]')) {
|
||||
let str = musicInfo.lrc.replace('\ufeff[id:$00000000]\n', '')
|
||||
commit('setLrc', { musicInfo, lyric: str, tlyric: musicInfo.tlrc })
|
||||
}
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
|
||||
lrcRequest = music[musicInfo.source].getLyric(musicInfo)
|
||||
return lrcRequest.promise.then(lrc => {
|
||||
return lrcRequest.promise.then(({ lyric, tlyric }) => {
|
||||
lrcRequest = null
|
||||
commit('setLrc', { musicInfo, lrc })
|
||||
commit('setLrc', { musicInfo, lyric, tlyric })
|
||||
}).catch(err => {
|
||||
lrcRequest = null
|
||||
return Promise.reject(err)
|
||||
@@ -78,12 +89,14 @@ const mutations = {
|
||||
datas.musicInfo.img = datas.url
|
||||
},
|
||||
setLrc(state, datas) {
|
||||
datas.musicInfo.lrc = datas.lrc
|
||||
datas.musicInfo.lrc = datas.lyric
|
||||
datas.musicInfo.tlrc = datas.tlyric
|
||||
},
|
||||
setList(state, { list, index }) {
|
||||
state.listInfo = list
|
||||
state.playIndex = index
|
||||
state.changePlay = true
|
||||
if (state.playedList.length) this.commit('player/clearPlayedList')
|
||||
},
|
||||
setPlayIndex(state, index) {
|
||||
state.playIndex = index
|
||||
@@ -96,6 +109,16 @@ const mutations = {
|
||||
resetChangePlay(state) {
|
||||
state.changePlay = false
|
||||
},
|
||||
setPlayedList(state, item) {
|
||||
if (state.playedList.includes(item)) return
|
||||
state.playedList.push(item)
|
||||
},
|
||||
removePlayedList(state, index) {
|
||||
state.playedList.splice(index, 1)
|
||||
},
|
||||
clearPlayedList(state) {
|
||||
state.playedList = []
|
||||
},
|
||||
visiblePlayerDetail(state, visible) {
|
||||
state.isShowPlayerDetail = visible
|
||||
},
|
||||
|
||||
@@ -1,15 +1,5 @@
|
||||
import Store from 'electron-store'
|
||||
import music from '../../utils/music'
|
||||
|
||||
const electronStore_data = window.electronStore_data = new Store({
|
||||
name: 'data',
|
||||
})
|
||||
let historyList = electronStore_data.get('searchHistoryList')
|
||||
if (historyList == null) {
|
||||
historyList = []
|
||||
electronStore_data.set('searchHistoryList', historyList)
|
||||
}
|
||||
|
||||
const sources = []
|
||||
const sourceList = {}
|
||||
const sourceMaxPage = {}
|
||||
@@ -103,7 +93,7 @@ const state = {
|
||||
allPage: 1,
|
||||
total: 0,
|
||||
sourceMaxPage,
|
||||
historyList,
|
||||
historyList: [],
|
||||
}
|
||||
|
||||
// getters
|
||||
@@ -211,6 +201,9 @@ const mutations = {
|
||||
clearHistory(state) {
|
||||
state.historyList = []
|
||||
},
|
||||
setHistory(state, list) {
|
||||
state.historyList = list
|
||||
},
|
||||
}
|
||||
|
||||
export default {
|
||||
|
||||
@@ -79,37 +79,31 @@ const actions = {
|
||||
cache.has(key)
|
||||
? Promise.resolve(cache.get(key))
|
||||
: music[source].songList.getListDetail(id, page)
|
||||
).then(result => commit('setListDetail', { result, key, page }))
|
||||
).then(result => commit('setListDetail', { result, key, source, id, page }))
|
||||
},
|
||||
/* getListDetailAll({ state, rootState }, id) {
|
||||
getListDetailAll({ state, rootState }, id) {
|
||||
let source = rootState.setting.songList.source
|
||||
let key = `sdetail__${source}__${id}__all`
|
||||
if (cache.has(key)) return Promise.resolve(cache.get(key))
|
||||
music[source].songList.getListDetail(id, 1).then(result => {
|
||||
let data = { list: result.list, id }
|
||||
if (result.total <= result.limit) {
|
||||
data = { list: result.list, id }
|
||||
cache.set(key, data)
|
||||
return data
|
||||
}
|
||||
const loadData = (id, page) => {
|
||||
let key = `sdetail__${source}__${id}__${page}`
|
||||
return cache.has(key)
|
||||
? Promise.resolve(cache.get(key))
|
||||
: music[source].songList.getListDetail(id, page).then(result => {
|
||||
cache.set(key, result)
|
||||
return result
|
||||
})
|
||||
}
|
||||
return loadData(id, 1).then(result => {
|
||||
if (result.total <= result.limit) return result.list
|
||||
|
||||
let maxPage = Math.ceil(result.total / result.limit)
|
||||
const loadDetail = (loadPage = 1) => {
|
||||
let task = []
|
||||
let loadNum = 0
|
||||
while (loadPage <= maxPage && loadNum < 3) {
|
||||
task.push(music[source].songList.getListDetail(id, ++loadPage))
|
||||
loadNum++
|
||||
}
|
||||
return loadPage == maxPage
|
||||
? Promise.all(task)
|
||||
: Promise.all(task).then(result => loadDetail(loadPage).then(result2 => [...result, ...result2]))
|
||||
? loadData(id, ++loadPage).then(result => result.list)
|
||||
: loadData(id, ++loadPage).then(result1 => loadDetail(loadPage).then(result2 => [...result1.list, ...result2]))
|
||||
}
|
||||
return loadDetail().then(result2 => {
|
||||
console.log(result2)
|
||||
})
|
||||
return loadDetail().then(result2 => [...result.list, ...result2])
|
||||
})
|
||||
}, */
|
||||
},
|
||||
}
|
||||
|
||||
// mitations
|
||||
@@ -129,8 +123,10 @@ const mutations = {
|
||||
state.list.key = key
|
||||
cache.set(key, result)
|
||||
},
|
||||
setListDetail(state, { result, key, page }) {
|
||||
setListDetail(state, { result, key, source, id, page }) {
|
||||
state.listDetail.list = result.list
|
||||
state.listDetail.id = id
|
||||
state.listDetail.source = source
|
||||
state.listDetail.total = result.total
|
||||
state.listDetail.limit = result.limit
|
||||
state.listDetail.page = page
|
||||
@@ -153,6 +149,8 @@ const mutations = {
|
||||
},
|
||||
clearListDetail(state) {
|
||||
state.listDetail = {
|
||||
id: null,
|
||||
source: null,
|
||||
list: [],
|
||||
desc: null,
|
||||
total: 0,
|
||||
|
||||
@@ -9,12 +9,12 @@ export default {
|
||||
setSetting(state, val) {
|
||||
state.setting = val
|
||||
},
|
||||
setAgreePact(state) {
|
||||
state.setting.isAgreePact = true
|
||||
},
|
||||
setSettingVersion(state, val) {
|
||||
state.settingVersion = val
|
||||
},
|
||||
setAgreePact(state) {
|
||||
state.setting.isAgreePact = true
|
||||
},
|
||||
setLeaderboard(state, { tabId, source }) {
|
||||
if (tabId != null) state.setting.leaderboard.tabId = tabId
|
||||
if (source != null) state.setting.leaderboard.source = source
|
||||
@@ -49,6 +49,15 @@ export default {
|
||||
state.setting.player.volume = val
|
||||
}
|
||||
},
|
||||
setPlayNextMode(state, val) {
|
||||
state.setting.player.togglePlayMethod = val
|
||||
},
|
||||
setVisibleDesktopLyric(state, val) {
|
||||
state.setting.desktopLyric.enable = val
|
||||
},
|
||||
setLockDesktopLyric(state, val) {
|
||||
state.setting.desktopLyric.isLock = val
|
||||
},
|
||||
setMediaDeviceId(state, val) {
|
||||
state.setting.player.mediaDeviceId = val
|
||||
},
|
||||
|
||||
@@ -1,67 +1,9 @@
|
||||
|
||||
// const isDev = process.env.NODE_ENV === 'development'
|
||||
import Store from 'electron-store'
|
||||
import { windowSizeList } from '../../common/config'
|
||||
import { version } from '../../../package.json'
|
||||
import { rendererSend, rendererInvoke, NAMES } from '../../common/ipc'
|
||||
import languageList from '@/lang/languages.json'
|
||||
import path from 'path'
|
||||
import { openDirInExplorer } from '../utils'
|
||||
|
||||
|
||||
const electronStore_config = window.electronStore_config = new Store({
|
||||
name: 'config',
|
||||
})
|
||||
let setting = electronStore_config.get('setting')
|
||||
let settingVersion = electronStore_config.get('version')
|
||||
|
||||
process.versions.app = version
|
||||
|
||||
// Set language automatically
|
||||
if (!window.i18n.availableLocales.includes(setting.langId)) {
|
||||
let langId = null
|
||||
let locale = window.navigator.language.toLocaleLowerCase()
|
||||
if (window.i18n.availableLocales.includes(locale)) {
|
||||
langId = locale
|
||||
} else {
|
||||
for (const lang of languageList) {
|
||||
if (lang.alternate == locale) {
|
||||
langId = lang.locale
|
||||
break
|
||||
}
|
||||
}
|
||||
if (langId == null) langId = 'en-us'
|
||||
}
|
||||
setting.langId = langId
|
||||
electronStore_config.set('setting', setting)
|
||||
rendererSend(NAMES.mainWindow.set_app_setting, setting)
|
||||
console.log('Set lang', setting.langId)
|
||||
}
|
||||
|
||||
window.i18n.locale = setting.langId
|
||||
|
||||
try {
|
||||
window.electronStore_list = new Store({
|
||||
name: 'playList',
|
||||
clearInvalidConfig: false,
|
||||
})
|
||||
} catch (error) {
|
||||
rendererInvoke(NAMES.mainWindow.get_data_path).then(dataPath => {
|
||||
let filePath = path.join(dataPath, 'playList.json.bak')
|
||||
rendererInvoke(NAMES.mainWindow.show_dialog, {
|
||||
type: 'error',
|
||||
message: window.i18n.t('store.state.load_list_file_error_title'),
|
||||
detail: window.i18n.t('store.state.load_list_file_error_detail', {
|
||||
path: filePath,
|
||||
detail: error.message,
|
||||
}),
|
||||
}).then(() => openDirInExplorer(filePath))
|
||||
})
|
||||
window.electronStore_list = new Store({
|
||||
name: 'playList',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
themes: [
|
||||
@@ -144,8 +86,8 @@ export default {
|
||||
downloadProgress: null,
|
||||
},
|
||||
userInfo: null,
|
||||
setting,
|
||||
settingVersion,
|
||||
setting: null,
|
||||
settingVersion: null,
|
||||
|
||||
windowSizeList,
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class Task extends EventEmitter {
|
||||
this.chunkInfo.startByte = 0
|
||||
this.resumeLastChunk = null
|
||||
this.progress.downloaded = 0
|
||||
if (unlinkErr) this.__handleError(unlinkErr)
|
||||
if (unlinkErr && unlinkErr.code !== 'ENOENT') this.__handleError(unlinkErr)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import { shell, clipboard } from 'electron'
|
||||
import crypto from 'crypto'
|
||||
import { rendererSend, rendererInvoke, NAMES } from '../../common/ipc'
|
||||
@@ -19,6 +20,39 @@ export const sizeFormate = size => {
|
||||
return `${(size / Math.pow(1024, Math.floor(number))).toFixed(2)} ${units[number]}`
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期格式化
|
||||
* @param {*} date 时间
|
||||
* @param {String} format 时间格式,默认YYYY-MM-DD hh:mm:ss
|
||||
*/
|
||||
export const dateFormat = (date = new Date(), format = 'YYYY-MM-DD hh:mm:ss') => {
|
||||
if (typeof date != 'object') date = new Date(date)
|
||||
const munFix = (n) => n < 10 ? ('0' + n) : n
|
||||
return format
|
||||
.replace('YYYY', date.getFullYear())
|
||||
.replace('MM', munFix(date.getMonth() + 1))
|
||||
.replace('DD', munFix(date.getDate()))
|
||||
.replace('hh', munFix(date.getHours()))
|
||||
.replace('mm', munFix(date.getMinutes()))
|
||||
.replace('ss', munFix(date.getSeconds()))
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间格式化
|
||||
*/
|
||||
export const dateFormat2 = time => {
|
||||
let differ = parseInt((Date.now() - time) / 1000)
|
||||
if (differ < 60) {
|
||||
return window.i18n.t('base.date_format_second', { num: differ })
|
||||
} else if (differ < 3600) {
|
||||
return window.i18n.t('base.date_format_minute', { num: parseInt(differ / 60) })
|
||||
} else if (differ < 86400) {
|
||||
return window.i18n.t('base.date_format_hour', { num: parseInt(differ / 3600) })
|
||||
} else {
|
||||
return dateFormat(time)
|
||||
}
|
||||
}
|
||||
|
||||
export const formatPlayTime = time => {
|
||||
let m = parseInt(time / 60)
|
||||
let s = parseInt(time % 60)
|
||||
@@ -44,8 +78,9 @@ const encodeNames = {
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
''': "'",
|
||||
''': "'",
|
||||
}
|
||||
export const decodeName = str => str.replace(/(?:&|<|>|"|')/g, s => encodeNames[s])
|
||||
export const decodeName = str => str.replace(/(?:&|<|>|"|'|')/gm, s => encodeNames[s])
|
||||
|
||||
const easeInOutQuad = (t, b, c, d) => {
|
||||
t /= d / 2
|
||||
@@ -98,7 +133,7 @@ const handleScroll = (element, to, duration = 300, fn = () => {}) => {
|
||||
* @param {*} fn 滚动完成后的回调
|
||||
* @param {*} delay 延迟执行时间
|
||||
*/
|
||||
export const scrollTo = (element, to, duration = 300, fn = () => {}, delay) => {
|
||||
export const scrollTo = (element, to, duration = 300, fn = () => {}, delay = 0) => {
|
||||
let cancelFn
|
||||
let timeout
|
||||
if (delay) {
|
||||
@@ -341,3 +376,22 @@ export const getProxyInfo = () => window.globalObj.proxy.enable
|
||||
|
||||
|
||||
export const assertApiSupport = source => window.globalObj.qualityList[source] != undefined
|
||||
|
||||
export const getSetting = () => rendererInvoke(NAMES.mainWindow.get_setting)
|
||||
export const saveSetting = () => rendererInvoke(NAMES.mainWindow.set_app_setting)
|
||||
|
||||
export const getPlayList = () => rendererInvoke(NAMES.mainWindow.get_playlist).catch(error => {
|
||||
rendererInvoke(NAMES.mainWindow.get_data_path).then(dataPath => {
|
||||
let filePath = path.join(dataPath, 'playList.json.bak')
|
||||
rendererInvoke(NAMES.mainWindow.show_dialog, {
|
||||
type: 'error',
|
||||
message: window.i18n.t('store.state.load_list_file_error_title'),
|
||||
detail: window.i18n.t('store.state.load_list_file_error_detail', {
|
||||
path: filePath,
|
||||
detail: error.message,
|
||||
}),
|
||||
}).then(() => openDirInExplorer(filePath))
|
||||
})
|
||||
return rendererInvoke(NAMES.mainWindow.get_playlist, true)
|
||||
})
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = [
|
||||
wy: ['128k'],
|
||||
mg: ['128k'],
|
||||
xm: ['128k'],
|
||||
bd: ['128k'],
|
||||
// bd: ['128k'],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ const bd = {
|
||||
},
|
||||
getLyric(songInfo) {
|
||||
const requestObj = this.getMusicInfo(songInfo)
|
||||
requestObj.promise = requestObj.promise.then(info => httpFetch(info.lrclink).promise.then(resp => resp.body))
|
||||
requestObj.promise = requestObj.promise.then(info => httpFetch(info.lrclink).promise.then(resp => ({ lyric: resp.body, tlyric: '' })))
|
||||
return requestObj
|
||||
},
|
||||
// getLyric(songInfo) {
|
||||
|
||||
@@ -34,10 +34,10 @@ const sources = {
|
||||
name: '虾米音乐',
|
||||
id: 'xm',
|
||||
},
|
||||
{
|
||||
name: '百度音乐',
|
||||
id: 'bd',
|
||||
},
|
||||
// {
|
||||
// name: '百度音乐',
|
||||
// id: 'bd',
|
||||
// },
|
||||
],
|
||||
kw,
|
||||
kg,
|
||||
|
||||
75
src/renderer/utils/music/kg/comment.js
Normal file
75
src/renderer/utils/music/kg/comment.js
Normal file
@@ -0,0 +1,75 @@
|
||||
import { httpFetch } from '../../request'
|
||||
import { decodeName, dateFormat2 } from '../../'
|
||||
|
||||
export default {
|
||||
_requestObj: null,
|
||||
_requestObj2: null,
|
||||
async getComment({ hash }, page = 1, limit = 20) {
|
||||
if (this._requestObj) this._requestObj.cancelHttp()
|
||||
|
||||
const _requestObj = httpFetch(`http://comment.service.kugou.com/index.php?r=commentsv2/getCommentWithLike&code=fc4be23b4e972707f36b8a828a93ba8a&extdata=${hash}&p=${page}&pagesize=${limit}&ver=1.01&clientver=8373&appid=1001&kugouid=687373022`, {
|
||||
headers: {
|
||||
'User-Agent': 'Android712-AndroidPhone-8983-18-0-COMMENT-wifi',
|
||||
},
|
||||
})
|
||||
const { body, statusCode } = await _requestObj.promise
|
||||
// console.log(body)
|
||||
if (statusCode != 200 || body.err_code !== 0) throw new Error('获取评论失败')
|
||||
return { source: 'kg', comments: this.filterComment(body.list || []), total: body.count, page, limit, maxPage: Math.ceil(body.count / limit) || 1 }
|
||||
},
|
||||
async getHotComment({ hash, songmid }, page = 1, limit = 100) {
|
||||
// console.log(songmid)
|
||||
if (this._requestObj2) this._requestObj2.cancelHttp()
|
||||
|
||||
const _requestObj2 = httpFetch(`http://comment.service.kugou.com/index.php?r=commentsv2/getCommentWithLike&code=fc4be23b4e972707f36b8a828a93ba8a&extdata=${hash}&p=${page}&pagesize=${limit}&ver=1.01&clientver=8373&appid=1001&kugouid=687373022`, {
|
||||
headers: {
|
||||
'User-Agent': 'Android712-AndroidPhone-8983-18-0-COMMENT-wifi',
|
||||
},
|
||||
})
|
||||
const { body, statusCode } = await _requestObj2.promise
|
||||
// console.log(body)
|
||||
if (statusCode != 200 || body.err_code !== 0) throw new Error('获取热门评论失败')
|
||||
return { source: 'kg', comments: this.filterComment(body.weightList || []) }
|
||||
},
|
||||
async getReplyComment({ songmid }, replyId, page = 1, limit = 100) {
|
||||
if (this._requestObj2) this._requestObj2.cancelHttp()
|
||||
|
||||
const _requestObj2 = httpFetch(`http://comment.service.kugou.com/index.php?r=commentsv2/getReplyWithLike&code=fc4be23b4e972707f36b8a828a93ba8a&p=${page}&pagesize=${limit}&ver=1.01&clientver=8373&kugouid=687373022&appid=1001&childrenid=${songmid}&tid=${replyId}`, {
|
||||
headers: {
|
||||
'User-Agent': 'Android712-AndroidPhone-8983-18-0-COMMENT-wifi',
|
||||
},
|
||||
})
|
||||
const { body, statusCode } = await _requestObj2.promise
|
||||
// console.log(body)
|
||||
if (statusCode != 200 || body.err_code !== 0) throw new Error('获取回复评论失败')
|
||||
return { source: 'kg', comments: this.filterComment(body.list || []) }
|
||||
},
|
||||
filterComment(rawList) {
|
||||
return rawList.map(item => {
|
||||
let data = {
|
||||
id: item.id,
|
||||
text: decodeName(item.content || '').split('\n'),
|
||||
time: item.addtime,
|
||||
timeStr: dateFormat2(new Date(item.addtime).getTime()),
|
||||
userName: item.user_name,
|
||||
avatar: item.user_pic,
|
||||
userId: item.user_id,
|
||||
likedCount: item.like.likenum,
|
||||
replyNum: item.reply_num,
|
||||
reply: [],
|
||||
}
|
||||
|
||||
return item.pcontent ? {
|
||||
id: item.id,
|
||||
text: decodeName(item.pcontent).split('\n'),
|
||||
time: null,
|
||||
userName: item.puser,
|
||||
avatar: null,
|
||||
userId: item.puser_id,
|
||||
likedCount: null,
|
||||
replyNum: null,
|
||||
reply: [data],
|
||||
} : data
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { httpFetch } from '../../request'
|
||||
import { decodeName } from '../..'
|
||||
|
||||
export default {
|
||||
_requestObj: null,
|
||||
@@ -25,7 +26,7 @@ export default {
|
||||
filterList(rawList) {
|
||||
const list = []
|
||||
rawList.forEach(item => {
|
||||
item.keywords.map(k => list.push(k.keyword))
|
||||
item.keywords.map(k => list.push(decodeName(k.keyword)))
|
||||
})
|
||||
return list
|
||||
},
|
||||
|
||||
@@ -5,12 +5,14 @@ import musicSearch from './musicSearch'
|
||||
import pic from './pic'
|
||||
import lyric from './lyric'
|
||||
import hotSearch from './hotSearch'
|
||||
import comment from './comment'
|
||||
|
||||
const kg = {
|
||||
leaderboard,
|
||||
songList,
|
||||
musicSearch,
|
||||
hotSearch,
|
||||
comment,
|
||||
getMusicUrl(songInfo, type) {
|
||||
return apis('kg').getMusicUrl(songInfo, type)
|
||||
},
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user