fix: 验证码多次加载
This commit is contained in:
parent
d43b4b17e2
commit
b266f36ce2
@ -2,7 +2,7 @@
|
||||
<main class="login-mind">
|
||||
<div class="dlbox" style="font-size: 12px">
|
||||
<!-- PC端布局:左右横向平铺 -->
|
||||
<div class="bg-white rounded-2xl auth-card-shadow login-box pc-layout">
|
||||
<div v-if="!isMobile" class="bg-white rounded-2xl auth-card-shadow login-box pc-layout">
|
||||
<div class="left-login">
|
||||
<div class="left-login-text">DID扫码登录</div>
|
||||
<div class="qrcode-container" @click="Getnewqrcode()">
|
||||
@ -23,14 +23,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 移动端布局:Tab切换 -->
|
||||
<div class="bg-white rounded-2xl auth-card-shadow login-box mobile-layout">
|
||||
<div v-else class="bg-white rounded-2xl auth-card-shadow login-box mobile-layout">
|
||||
<div class="login-content">
|
||||
<t-tabs class="loginTabs" v-model="loginTab" size="large">
|
||||
<t-tab-panel value="account" label="账号登录" :destroyOnHide="false">
|
||||
<login />
|
||||
<login v-if="loginTab === 'account'" />
|
||||
</t-tab-panel>
|
||||
<t-tab-panel v-if="MH_REGISTRATION_ENABLED" value="register" label="注册" :destroyOnHide="false">
|
||||
<zhuce @zhucecg="onRegisterSuccess" />
|
||||
<zhuce v-if="loginTab === 'register'" @zhucecg="onRegisterSuccess" />
|
||||
</t-tab-panel>
|
||||
<t-tab-panel value="qrcode" label="扫码登录" :destroyOnHide="false">
|
||||
<div class="qrcode-login">
|
||||
@ -90,6 +90,7 @@ export default {
|
||||
type: 'login',
|
||||
loginTab: 'account',
|
||||
qrcodeTextPreview: '',
|
||||
isMobile: typeof window !== 'undefined' && window.innerWidth <= 768,
|
||||
|
||||
// 配置参数
|
||||
width: 200,
|
||||
@ -127,6 +128,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.Getqrcode();
|
||||
window.addEventListener('resize', this.handleResize);
|
||||
},
|
||||
deactivated() {
|
||||
this.stopPollLogin();
|
||||
@ -135,12 +137,19 @@ export default {
|
||||
this.stopPollLogin();
|
||||
clearInterval(this.intervalTimer);
|
||||
this.intervalTimer = null;
|
||||
window.removeEventListener('resize', this.handleResize);
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
this.stopPollLogin();
|
||||
next();
|
||||
},
|
||||
methods: {
|
||||
handleResize() {
|
||||
const next = window.innerWidth <= 768;
|
||||
if (next !== this.isMobile) {
|
||||
this.isMobile = next;
|
||||
}
|
||||
},
|
||||
stopPollLogin() {
|
||||
this.pollStopped = true;
|
||||
this.pollToken += 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user