This commit is contained in:
2025-12-16 19:27:20 +08:00
parent c85b46c18e
commit 430b8f12ba
89 changed files with 7166 additions and 4061 deletions

View File

@@ -72,7 +72,7 @@
</div> -->
<!-- 免责声明 -->
<div class="text-xs text-center text-gray-500 leading-relaxed mt-2">
为保证用户的隐私及数据安全查询结果生成30天后将自动删除
为保证用户的隐私及数据安全查询结果生成{{ appStore.queryRetentionDays || 30 }}天后将自动删除
</div>
</div>
@@ -108,14 +108,14 @@
v-html="featureData.description">
</div>
<div class="mb-2 text-xs italic text-danger">
为保证用户的隐私以及数据安全查询的结果生成30天之后将自动清除
为保证用户的隐私以及数据安全查询的结果生成{{ appStore.queryRetentionDays || 30 }}天之后将自动清除
</div>
</div>
</div>
<!-- 支付组件 -->
<Payment v-model="showPayment" :data="featureData" :id="queryId" type="query" @close="showPayment = false" />
<BindPhoneDialog @bind-success="handleBindSuccess" />
<BindPhoneOnlyDialog @bind-success="handleBindSuccess" />
<!-- 历史查询按钮 - 仅推广查询显示 -->
<div v-if="props.type === 'promotion'" @click="toHistory"
@@ -126,7 +126,7 @@
</template>
<script setup>
import { ref, reactive, computed, onMounted, onUnmounted, nextTick } from "vue";
import { ref, reactive, computed, onMounted, onUnmounted, nextTick, watch } from "vue";
import { aesEncrypt } from "@/utils/crypto";
import { useRoute, useRouter } from "vue-router";
import { useUserStore } from "@/stores/userStore";
@@ -135,9 +135,10 @@ import { useEnv } from "@/composables/useEnv";
import { showConfirmDialog } from "vant";
import Payment from "@/components/Payment.vue";
import BindPhoneDialog from "@/components/BindPhoneDialog.vue";
import BindPhoneOnlyDialog from "@/components/BindPhoneOnlyDialog.vue";
import SectionTitle from "@/components/SectionTitle.vue";
import ReportFeatures from "@/components/ReportFeatures.vue";
import { useAppStore } from "@/stores/appStore";
// Props
const props = defineProps({
@@ -174,7 +175,7 @@ const loadProductBackground = async (productType) => {
return (await import("@/assets/images/report/xwqy_inquire_bg.png")).default;
case 'preloanbackgroundcheck':
return (await import("@/assets/images/report/dqfx_inquire_bg.png")).default;
case 'personalData':
case 'riskassessment':
return (await import("@/assets/images/report/grdsj_inquire_bg.png")).default;
case 'marriage':
return (await import("@/assets/images/report/marriage_inquire_bg.png")).default;
@@ -198,6 +199,7 @@ const router = useRouter();
const dialogStore = useDialogStore();
const userStore = useUserStore();
const { isWeChat } = useEnv();
const appStore = useAppStore();
// 响应式数据
const showPayment = ref(false);
@@ -251,6 +253,9 @@ const backgroundStyle = computed(() => {
// 动态加载牌匾背景图片
const loadTrapezoidBackground = async () => {
if (!props.feature) {
return;
}
try {
let bgModule;
if (props.feature === 'marriage') {
@@ -318,8 +323,7 @@ function handleBindSuccess() {
// 处理输入框点击事件
const handleInputClick = async () => {
if (!isLoggedIn.value) {
// 非微信浏览器环境:未登录用户提示跳转到登录页
if (!isWeChat.value) {
if (!isWeChat.value && props.type !== 'promotion') {
try {
await showConfirmDialog({
title: '提示',
@@ -333,16 +337,14 @@ const handleInputClick = async () => {
}
}
} else {
// 微信浏览器环境:已登录但检查是否需要绑定手机号
if (isWeChat.value && !userStore.mobile) {
if (isWeChat.value && !userStore.mobile && props.type !== 'promotion') {
dialogStore.openBindPhone();
}
}
};
function handleSubmit() {
// 非微信浏览器环境:检查登录状态
if (!isWeChat.value && !isLoggedIn.value) {
if (!isWeChat.value && !isLoggedIn.value && props.type !== 'promotion') {
router.push('/login');
return;
}
@@ -378,7 +380,7 @@ function handleSubmit() {
}
// 检查是否需要绑定手机号
if (!userStore.mobile) {
if (!userStore.mobile && props.type !== 'promotion') {
pendingPayment.value = true;
dialogStore.openBindPhone();
} else {
@@ -421,6 +423,9 @@ async function submitRequest() {
localStorage.setItem("token", data.value.data.accessToken);
localStorage.setItem("refreshAfter", data.value.data.refreshAfter);
localStorage.setItem("accessExpire", data.value.data.accessExpire);
// ⚠️ 重要:保存 token 后立即设置 tokenVersion防止被 checkTokenVersion 清除
const tokenVersion = import.meta.env.VITE_TOKEN_VERSION || "1.1";
localStorage.setItem("tokenVersion", tokenVersion);
}
showPayment.value = true;
@@ -488,18 +493,29 @@ const toHistory = () => {
router.push("/historyQuery");
};
// 加载背景图片
const loadBackgroundImage = async () => {
if (!props.feature) {
return;
}
const background = await loadProductBackground(props.feature);
productBackground.value = background || '';
};
// 监听 feature 变化,重新加载背景图
watch(() => props.feature, async (newFeature) => {
if (newFeature) {
await loadBackgroundImage();
await loadTrapezoidBackground();
}
}, { immediate: true });
// 生命周期
onMounted(async () => {
await loadBackgroundImage();
await loadTrapezoidBackground();
});
// 加载背景图片
const loadBackgroundImage = async () => {
const background = await loadProductBackground(props.feature);
productBackground.value = background || '';
};
onUnmounted(() => {
if (timer) {
clearInterval(timer);
@@ -576,4 +592,4 @@ button:active {
border-radius: 50%;
margin-right: 8px;
}
</style>
</style>