| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -2,27 +2,33 @@ import Cookies from 'js-cookie';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import { logout } from '@/api/auth';
 | 
					 | 
					 | 
					 | 
					import { logout } from '@/api/auth';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import store from '@/store';
 | 
					 | 
					 | 
					 | 
					import store from '@/store';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					export function doLogout() {
 | 
					 | 
					 | 
					 | 
					export function setCookies(string) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  logout();
 | 
					 | 
					 | 
					 | 
					  const cookies = string.split(';;');
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // 网易云的接口会自动移除该 cookies
 | 
					 | 
					 | 
					 | 
					  cookies.map(cookie => {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Cookies.remove('MUSIC_U');
 | 
					 | 
					 | 
					 | 
					    document.cookie = cookie;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // 更新状态仓库中的用户信息
 | 
					 | 
					 | 
					 | 
					    const cookieKeyValue = cookie.split(';')[0].split('=');
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  store.commit('updateData', { key: 'user', value: {} });
 | 
					 | 
					 | 
					 | 
					    localStorage.setItem(`cookie-${cookieKeyValue[0]}`, cookieKeyValue[1]);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // 更新状态仓库中的登录状态
 | 
					 | 
					 | 
					 | 
					  });
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  store.commit('updateData', { key: 'loginMode', value: null });
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // 更新状态仓库中的喜欢列表
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  store.commit('updateData', { key: 'likedSongPlaylistID', value: undefined });
 | 
					 | 
					 | 
					 | 
					export function getCookie(key) {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  return Cookies.get(key) ?? localStorage.getItem(`cookie-${key}`);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					export function removeCookie(key) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  Cookies.remove(key);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  localStorage.removeItem(`cookie-${key}`);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// MUSIC_U 只有在账户登录的情况下才有
 | 
					 | 
					 | 
					 | 
					// MUSIC_U 只有在账户登录的情况下才有
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					export function isLoggedIn() {
 | 
					 | 
					 | 
					 | 
					export function isLoggedIn() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return Cookies.get('MUSIC_U') !== undefined ? true : false;
 | 
					 | 
					 | 
					 | 
					  return getCookie('MUSIC_U') !== undefined;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// 账号登录
 | 
					 | 
					 | 
					 | 
					// 账号登录
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					export function isAccountLoggedIn() {
 | 
					 | 
					 | 
					 | 
					export function isAccountLoggedIn() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return (
 | 
					 | 
					 | 
					 | 
					  return (
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    Cookies.get('MUSIC_U') !== undefined &&
 | 
					 | 
					 | 
					 | 
					    getCookie('MUSIC_U') !== undefined &&
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    store.state.data.loginMode === 'account'
 | 
					 | 
					 | 
					 | 
					    store.state.data.loginMode === 'account'
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  );
 | 
					 | 
					 | 
					 | 
					  );
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -37,25 +43,14 @@ export function isLooseLoggedIn() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return isAccountLoggedIn() || isUsernameLoggedIn();
 | 
					 | 
					 | 
					 | 
					  return isAccountLoggedIn() || isUsernameLoggedIn();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					export function getMusicU(string) {
 | 
					 | 
					 | 
					 | 
					export function doLogout() {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const temp = string.split(';');
 | 
					 | 
					 | 
					 | 
					  logout();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (!temp.length) {
 | 
					 | 
					 | 
					 | 
					  removeCookie('MUSIC_U');
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return undefined;
 | 
					 | 
					 | 
					 | 
					  removeCookie('__csrf');
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  // 更新状态仓库中的用户信息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const MUSIC_U = temp.find(item => item.includes('MUSIC_U'));
 | 
					 | 
					 | 
					 | 
					  store.commit('updateData', { key: 'user', value: {} });
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  if (MUSIC_U) {
 | 
					 | 
					 | 
					 | 
					  // 更新状态仓库中的登录状态
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    return MUSIC_U.split('=')[1];
 | 
					 | 
					 | 
					 | 
					  store.commit('updateData', { key: 'loginMode', value: null });
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  }
 | 
					 | 
					 | 
					 | 
					  // 更新状态仓库中的喜欢列表
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return '';
 | 
					 | 
					 | 
					 | 
					  store.commit('updateData', { key: 'likedSongPlaylistID', value: undefined });
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					export function setMusicU(key, value) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return Cookies.set(key, value);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					export function setCookies(string) {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const cookies = string.split(';;');
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  cookies.map(cookie => {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    document.cookie = cookie;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  });
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
 
 |