mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
fix: set cookie when login with phone
This commit is contained in:
parent
2998e52427
commit
c1c379098f
1 changed files with 16 additions and 16 deletions
|
|
@ -160,12 +160,7 @@ export default {
|
||||||
password: "fakePassword",
|
password: "fakePassword",
|
||||||
md5_password: md5(this.password).toString(),
|
md5_password: md5(this.password).toString(),
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then(this.handleLoginResponse)
|
||||||
if (data.code !== 502) {
|
|
||||||
this.updateData({ key: "user", value: data.profile });
|
|
||||||
this.afterLogin();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
alert(error);
|
alert(error);
|
||||||
|
|
@ -177,22 +172,27 @@ export default {
|
||||||
password: "fakePassword",
|
password: "fakePassword",
|
||||||
md5_password: md5(this.password).toString(),
|
md5_password: md5(this.password).toString(),
|
||||||
})
|
})
|
||||||
.then((data) => {
|
.then(this.handleLoginResponse)
|
||||||
// 获取接口返回的 MUSIC_U 写进本地 cookie 解决登录时跳转的问题
|
|
||||||
// 但是仍然无法完全模拟登录状态,像喜欢歌曲和喜欢列表都会遇到 301 需要登录问题
|
|
||||||
const MUSIC_U = getMusicU(data.cookie);
|
|
||||||
setMusicU("MUSIC_U", MUSIC_U);
|
|
||||||
if (data.code !== 502) {
|
|
||||||
this.updateData({ key: "user", value: data.profile });
|
|
||||||
this.afterLogin();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.processing = false;
|
this.processing = false;
|
||||||
alert(error);
|
alert(error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
handleLoginResponse(data) {
|
||||||
|
if (!data) {
|
||||||
|
this.processing = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 获取接口返回的 MUSIC_U 写进本地 cookie 解决登录时跳转的问题
|
||||||
|
// 但是仍然无法完全模拟登录状态,像喜欢歌曲和喜欢列表都会遇到 301 需要登录问题
|
||||||
|
const MUSIC_U = getMusicU(data.cookie);
|
||||||
|
setMusicU("MUSIC_U", MUSIC_U);
|
||||||
|
if (data.code !== 502) {
|
||||||
|
this.updateData({ key: "user", value: data.profile });
|
||||||
|
this.afterLogin();
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue