mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 13:17:46 +00:00
feat: 使用svg输出登陆二维码 (#1568)
This commit is contained in:
parent
d87c4bad21
commit
3c798a5606
1 changed files with 10 additions and 7 deletions
|
|
@ -68,8 +68,8 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-show="mode == 'qrCode'">
|
<div v-show="mode == 'qrCode'">
|
||||||
<div v-show="qrCodeImage" class="qr-code-container">
|
<div v-show="qrCodeSvg" class="qr-code-container">
|
||||||
<img :src="qrCodeImage" width="192px" />
|
<img :src="qrCodeSvg" />
|
||||||
</div>
|
</div>
|
||||||
<div class="qr-code-info">
|
<div class="qr-code-info">
|
||||||
{{ qrCodeInformation }}
|
{{ qrCodeInformation }}
|
||||||
|
|
@ -135,7 +135,7 @@ export default {
|
||||||
smsCode: '',
|
smsCode: '',
|
||||||
inputFocus: '',
|
inputFocus: '',
|
||||||
qrCodeKey: '',
|
qrCodeKey: '',
|
||||||
qrCodeImage: '',
|
qrCodeSvg: '',
|
||||||
qrCodeCheckInterval: null,
|
qrCodeCheckInterval: null,
|
||||||
qrCodeInformation: '打开网易云音乐APP扫码登录',
|
qrCodeInformation: '打开网易云音乐APP扫码登录',
|
||||||
};
|
};
|
||||||
|
|
@ -233,19 +233,22 @@ export default {
|
||||||
return loginQrCodeKey().then(result => {
|
return loginQrCodeKey().then(result => {
|
||||||
if (result.code === 200) {
|
if (result.code === 200) {
|
||||||
this.qrCodeKey = result.data.unikey;
|
this.qrCodeKey = result.data.unikey;
|
||||||
QRCode.toDataURL(
|
QRCode.toString(
|
||||||
`https://music.163.com/login?codekey=${this.qrCodeKey}`,
|
`https://music.163.com/login?codekey=${this.qrCodeKey}`,
|
||||||
{
|
{
|
||||||
width: 384,
|
width: 192,
|
||||||
margin: 0,
|
margin: 0,
|
||||||
color: {
|
color: {
|
||||||
dark: '#335eea',
|
dark: '#335eea',
|
||||||
light: '#00000000',
|
light: '#00000000',
|
||||||
},
|
},
|
||||||
|
type: 'svg',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.then(url => {
|
.then(svg => {
|
||||||
this.qrCodeImage = url;
|
this.qrCodeSvg = `data:image/svg+xml;utf8,${encodeURIComponent(
|
||||||
|
svg
|
||||||
|
)}`;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue