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