Compare commits

...

1 Commits
main ... v3.9.1

Author SHA1 Message Date
alger
7b18d9eba3 🐞 fix: 修复登录状态问题 修复播放退出登录的问题 2025-01-23 11:42:03 +08:00
6 changed files with 23 additions and 27 deletions

View File

@@ -1,18 +1,9 @@
# 更新日志
## v3.9.0
### ✨ 新功能
- 添加歌曲右键菜单功能,支持添加到歌单、创建歌单、取消收藏等操作
- 添加下一首播放功能(右键歌曲)
- 添加自动播放和自动保存正在播放列表功能(设置->播放设置->自动播放)
- 优化歌词滚动体验
### ⚡ 优化
- 升级 Electron 版本和相关依赖包
- 优化播放体验和代码结构
## v3.9.1
### 🐞 修复
- 修复我的收藏查看更多跳转空白页的问题
- 修复登录状态问题 修复播放退出登录的问题
## 咖啡☕️

View File

@@ -1,6 +1,6 @@
{
"name": "AlgerMusicPlayer",
"version": "3.9.0",
"version": "3.9.1",
"description": "Alger Music Player",
"author": "Alger <algerkc@qq.com>",
"main": "./out/main/index.js",

View File

@@ -14,15 +14,19 @@ export const getMusicQualityDetail = (id: number) => {
// 根据音乐Id获取音乐播放URl
export const getMusicUrl = async (id: number) => {
const res = await request.get('/song/download/url/v1', {
params: {
id,
level: store.state.setData.musicQuality || 'higher'
}
});
// 判断是否登录
if (store.state.user) {
const res = await request.get('/song/download/url/v1', {
params: {
id,
level: store.state.setData.musicQuality || 'higher',
cookie: `${localStorage.getItem('token')} os=pc;`
}
});
if (res.data.data.url) {
return { data: { data: [{ ...res.data.data }] } };
if (res.data.data.url) {
return { data: { data: [{ ...res.data.data }] } };
}
}
return await request.get('/song/url/v1', {

View File

@@ -27,14 +27,11 @@ declare module 'vue' {
NInput: typeof import('naive-ui')['NInput']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLayout: typeof import('naive-ui')['NLayout']
NList: typeof import('naive-ui')['NList']
NListItem: typeof import('naive-ui')['NListItem']
NMessageProvider: typeof import('naive-ui')['NMessageProvider']
NModal: typeof import('naive-ui')['NModal']
NPopover: typeof import('naive-ui')['NPopover']
NProgress: typeof import('naive-ui')['NProgress']
NRadio: typeof import('naive-ui')['NRadio']
NRadioButton: typeof import('naive-ui')['NRadioButton']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
NScrollbar: typeof import('naive-ui')['NScrollbar']
NSelect: typeof import('naive-ui')['NSelect']
@@ -46,7 +43,6 @@ declare module 'vue' {
NTabs: typeof import('naive-ui')['NTabs']
NTag: typeof import('naive-ui')['NTag']
NTooltip: typeof import('naive-ui')['NTooltip']
NTransfer: typeof import('naive-ui')['NTransfer']
NVirtualList: typeof import('naive-ui')['NVirtualList']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']

View File

@@ -50,7 +50,7 @@ request.interceptors.request.use(
};
const token = localStorage.getItem('token');
if (token) {
config.params.cookie = `${token} os=pc;`;
config.params.cookie = config.params.cookie || token;
}
if (isElectron) {
const proxyConfig = setData?.proxyConfig;

View File

@@ -132,6 +132,7 @@ onBeforeUnmount(() => {
const checkLoginStatus = () => {
const token = localStorage.getItem('token');
const userData = localStorage.getItem('user');
console.log('触发了', token, userData);
if (!token || !userData) {
router.push('/login');
@@ -152,6 +153,10 @@ const loadPage = async () => {
// 检查登录状态
if (!checkLoginStatus()) return;
await loadData();
};
const loadData = async () => {
try {
infoLoading.value = true;
@@ -188,10 +193,10 @@ const loadPage = async () => {
watch(
() => router.currentRoute.value.path,
(newPath) => {
console.log('newPath', newPath);
if (newPath === '/user') {
checkLoginStatus();
} else {
loadPage();
loadData();
}
}
);