diff --git a/src/components/InquireForm.vue b/src/components/InquireForm.vue index 5e1b5a1..95c5232 100644 --- a/src/components/InquireForm.vue +++ b/src/components/InquireForm.vue @@ -265,6 +265,7 @@ +
{ 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; } diff --git a/src/components/LoginDialog.vue b/src/components/LoginDialog.vue new file mode 100644 index 0000000..59cbbe1 --- /dev/null +++ b/src/components/LoginDialog.vue @@ -0,0 +1,321 @@ + + + + + diff --git a/src/stores/dialogStore.js b/src/stores/dialogStore.js index 3f90016..c12908f 100644 --- a/src/stores/dialogStore.js +++ b/src/stores/dialogStore.js @@ -4,6 +4,7 @@ import { ref } from 'vue' export const useDialogStore = defineStore('dialog', () => { const showBindPhone = ref(false) const showRealNameAuth = ref(false) + const showLogin = ref(false) function openBindPhone() { showBindPhone.value = true @@ -21,6 +22,14 @@ export const useDialogStore = defineStore('dialog', () => { showRealNameAuth.value = false } + function openLogin() { + showLogin.value = true + } + + function closeLogin() { + showLogin.value = false + } + return { showBindPhone, openBindPhone, @@ -28,5 +37,8 @@ export const useDialogStore = defineStore('dialog', () => { showRealNameAuth, openRealNameAuth, closeRealNameAuth, + showLogin, + openLogin, + closeLogin, } }) diff --git a/src/views/PromotionInquire.vue b/src/views/PromotionInquire.vue index 733968e..5843e8f 100644 --- a/src/views/PromotionInquire.vue +++ b/src/views/PromotionInquire.vue @@ -3,11 +3,14 @@ import { ref, onMounted, onBeforeMount } from "vue"; import { useRoute } from "vue-router"; import { storeToRefs } from 'pinia'; import { useUserStore } from '@/stores/userStore'; +import { useDialogStore } from '@/stores/dialogStore'; import InquireForm from "@/components/InquireForm.vue"; +import LoginDialog from "@/components/LoginDialog.vue"; const route = useRoute(); const router = useRouter(); const userStore = useUserStore(); +const dialogStore = useDialogStore(); const { mobile: userStoreMobile } = storeToRefs(userStore); const linkIdentifier = ref(""); @@ -59,4 +62,5 @@ async function getProduct() { \ No newline at end of file