收紧未登录场景下首页二维码弹窗展示规则
This commit is contained in:
@@ -124,12 +124,13 @@
|
|||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
title="微信登录二维码"
|
title="微信登录二维码"
|
||||||
:visible.sync="loginQrDialog.visible"
|
:visible="shouldShowLoginQrDialog"
|
||||||
width="760px"
|
width="760px"
|
||||||
class="login-qr-dialog"
|
class="login-qr-dialog"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:close-on-press-escape="false">
|
:close-on-press-escape="false"
|
||||||
|
@update:visible="handleLoginQrDialogVisibleChange">
|
||||||
<div class="login-qr-dialog__body" v-loading="loginQrDialog.loading">
|
<div class="login-qr-dialog__body" v-loading="loginQrDialog.loading">
|
||||||
<div class="login-qr-dialog__hero">
|
<div class="login-qr-dialog__hero">
|
||||||
<div class="login-qr-dialog__preview">
|
<div class="login-qr-dialog__preview">
|
||||||
@@ -620,6 +621,16 @@
|
|||||||
showLoginQrBanner() {
|
showLoginQrBanner() {
|
||||||
return !this.loginQrDialog.logged_in;
|
return !this.loginQrDialog.logged_in;
|
||||||
},
|
},
|
||||||
|
shouldShowLoginQrDialog() {
|
||||||
|
// 首页登录弹窗的展示规则尽量简单且稳定:
|
||||||
|
// 1. 只要当前还没登录成功,就必须强制显示二维码弹窗,避免前端局部状态抖动把弹窗意外关掉;
|
||||||
|
// 2. 登录成功后再退回到本地 visible 控制,兼容后续如果需要保留“手动再次查看”的空间;
|
||||||
|
// 3. 这样能直接满足“没有可用账号,就一直要求扫码登录”的目标,不再依赖多处代码同步开关。
|
||||||
|
if (!this.loginQrDialog.logged_in) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !!this.loginQrDialog.visible;
|
||||||
|
},
|
||||||
loginQrStatusTone() {
|
loginQrStatusTone() {
|
||||||
if (this.loginQrDialog.provider_stage === 'connection_pending') {
|
if (this.loginQrDialog.provider_stage === 'connection_pending') {
|
||||||
return 'soft';
|
return 'soft';
|
||||||
@@ -882,6 +893,17 @@
|
|||||||
openLoginQrDialog() {
|
openLoginQrDialog() {
|
||||||
this.loginQrDialog.visible = true;
|
this.loginQrDialog.visible = true;
|
||||||
},
|
},
|
||||||
|
handleLoginQrDialogVisibleChange(nextVisible) {
|
||||||
|
// 未登录时弹窗不允许被真正关闭:
|
||||||
|
// 1. Element UI 仍可能在内部触发 `update:visible` 事件;
|
||||||
|
// 2. 如果这里直接接受 false,就会再次出现“业务要求必须常驻,但组件自己收起”的问题;
|
||||||
|
// 3. 因此只有在已登录成功后,才允许同步关闭状态。
|
||||||
|
if (!this.loginQrDialog.logged_in) {
|
||||||
|
this.loginQrDialog.visible = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.loginQrDialog.visible = !!nextVisible;
|
||||||
|
},
|
||||||
applyLoginQrState(state) {
|
applyLoginQrState(state) {
|
||||||
const nextState = state || {};
|
const nextState = state || {};
|
||||||
const current = nextState.current || {};
|
const current = nextState.current || {};
|
||||||
|
|||||||
Reference in New Issue
Block a user