add弹窗登录

This commit is contained in:
2025-12-26 14:26:54 +08:00
parent 87aac154cf
commit c0fc989c8f
4 changed files with 352 additions and 5 deletions

View File

@@ -265,6 +265,7 @@
<!-- 支付组件 -->
<Payment v-model="showPayment" :data="featureData" :id="queryId" type="query" @close="showPayment = false" />
<BindPhoneDialog @bind-success="handleBindSuccess" />
<LoginDialog @login-success="handleLoginSuccess" />
<!-- 历史查询按钮 - 仅推广查询显示 -->
<div v-if="props.type === 'promotion'" @click="toHistory"
@@ -285,6 +286,7 @@ import { showConfirmDialog } from "vant";
import Payment from "@/components/Payment.vue";
import BindPhoneDialog from "@/components/BindPhoneDialog.vue";
import LoginDialog from "@/components/LoginDialog.vue";
import SectionTitle from "@/components/SectionTitle.vue";
// Props
@@ -504,19 +506,27 @@ function handleBindSuccess() {
}
}
// 处理登录成功的回调
function handleLoginSuccess() {
if (pendingPayment.value) {
pendingPayment.value = false;
submitRequest();
}
}
// 处理输入框点击事件
const handleInputClick = async () => {
if (!isLoggedIn.value) {
// 非微信浏览器环境:未登录用户提示跳转到登录页
// 非微信浏览器环境:未登录用户提示打开登录弹窗
if (!isWeChat.value) {
try {
await showConfirmDialog({
title: '提示',
message: '您需要登录后才能进行查询,是否前往登录?',
confirmButtonText: '前往登录',
message: '您需要登录后才能进行查询,是否立即登录?',
confirmButtonText: '立即登录',
cancelButtonText: '取消',
});
router.push('/login');
dialogStore.openLogin();
} catch {
// 用户点击取消,什么都不做
}
@@ -532,7 +542,7 @@ const handleInputClick = async () => {
function handleSubmit() {
// 非微信浏览器环境:检查登录状态
if (!isWeChat.value && !isLoggedIn.value) {
router.push('/login');
dialogStore.openLogin();
return;
}