This commit is contained in:
xingyy 2025-02-26 11:11:29 +08:00
parent 9051088091
commit 4e6829af0b
8 changed files with 86 additions and 28 deletions

View File

@ -2,33 +2,63 @@ import { createApp } from 'vue'
import MinWindow from '@/components/floatingBubble/index.vue'
let minWindowInstance = null
let minWindowApp = null // 新增:保存应用实例
let minWindowApp = null
let container = null
// 创建悬浮窗
export const showMinWindow1 = ( props = {}) => {
if (process.client){
const container = document.createElement('div')
container.className = 'floating-bubble-container' // 添加类名
export const showMinWindow1 = (props = {}) => {
if (!process.client) return
// 如果在首页,不创建实例并销毁现有实例
if (window?.$nuxt?.$route?.path === '/') {
hideMinWindow1()
return null
}
// 如果已经存在实例,直接返回该实例
if (minWindowInstance) {
return minWindowInstance
}
// 确保清理旧的容器
const existingContainer = document.querySelector('.floating-bubble-container')
if (existingContainer) {
document.body.removeChild(existingContainer)
}
container = document.createElement('div')
container.className = 'floating-bubble-container'
document.body.appendChild(container)
const app = createApp(MinWindow, {
...props
})
minWindowApp = app // 保存应用实例
minWindowApp = app
minWindowInstance = app.mount(container)
return minWindowInstance
}
}
export const hideMinWindow1 = () => {
if (!minWindowApp) return
const cleanup = () => {
minWindowApp.unmount() // 使用应用实例的unmount方法
const container = document.querySelector('.floating-bubble-container') // 假设您的容器有这个类名
container && document.body.removeChild(container)
try {
minWindowApp.unmount()
if (container && document.body.contains(container)) {
document.body.removeChild(container)
}
} catch (e) {
console.error('清理浮动气泡时出错:', e)
} finally {
// 确保状态被重置
minWindowApp = null
minWindowInstance = null
}
container = null
cleanup()
// 额外清理可能残留的容器
const existingContainer = document.querySelector('.floating-bubble-container')
if (existingContainer) {
document.body.removeChild(existingContainer)
}
}
}

View File

@ -1,16 +1,31 @@
<script setup>
const props=defineProps({
onClick:{
type:Function,
import { watch, onUnmounted } from 'vue'
import { hideMinWindow1 } from './floating'
const props = defineProps({
onClick: {
type: Function,
}
})
const route = useRoute()
//
watch(() => route.path, (newPath) => {
if (newPath === '/') {
hideMinWindow1()
}
}, { immediate: true })
//
onUnmounted(() => {
hideMinWindow1()
})
</script>
<template>
<van-floating-bubble
v-if="route.path!=='/'"
v-if="route.path !== '/'"
axis="xy"
magnetic="x"
:offset="{ x: 300, y: 50 }"

View File

@ -1,6 +1,7 @@
<script setup>
import {authStore} from "@/stores/auth/index.js";
import {useI18n} from 'vue-i18n'
const {$t} = useI18n()
const props = defineProps({
type: {
type: Number,

View File

@ -4,7 +4,9 @@ import {onMounted, onUnmounted, ref} from 'vue';
import {signOffline, signOnline} from "~/api/goods/index.js";
import {VueSignaturePad} from "vue-signature-pad";
import {authStore} from "~/stores/auth/index.js";
import {useI18n} from "vue-i18n";
const router = useRouter();
const {$t} = useI18n()
definePageMeta({
layout: ''
})

View File

@ -6,6 +6,7 @@ definePageMeta({
name: 'personal-info',
})
const {t} = useI18n()
const {$t} = useI18n()
const showPicker = ref(false)
const showPicker1 = ref(false)
const onConfirm = () => {

View File

@ -2,13 +2,15 @@
import pdfView from './pdfView'
import { contractView } from "~/api/goods/index.js"
import { authStore } from "~/stores/auth/index.js"
import {useI18n} from "vue-i18n";
definePageMeta({
layout: 'default',
i18n: 'signature.title'
i18n: 'signature.protocol.title'
})
const { userInfo, payment } = authStore()
const $t=useI18n().t
const activeNames = ref([])
const router = useRouter()
const pmblUrl = ref('') // URL

View File

@ -167,16 +167,20 @@ export const liveStore = createGlobalState(() => {
[TIP_TYPES.OTHERS_BID]: () =>
message.error(createMessageConfig(t('live_room.text2'), '#CF3050', t('live_room.text3'))),
[TIP_TYPES.SUCCESS_BID]: () =>
message.success(createMessageConfig(t('live_room.text4'), '#18A058', t('live_room.text5'))),
[TIP_TYPES.ARTWORK_OVER]: () =>
[TIP_TYPES.SUCCESS_BID]: ()=>{
quoteStatus.value=false
message.success(createMessageConfig(t('live_room.text4'), '#18A058', t('live_room.text5')))
},
[TIP_TYPES.ARTWORK_OVER]: () =>{
quoteStatus.value=false
message.success(createMessageConfig(
t('live_room.text6'),
'#575757',
t('live_room.text7'),
{ backgroundColor: '#fff', borderColor: '#fff' }
)),
))
},
[TIP_TYPES.FAIL_BID]: () =>
message.error(createMessageConfig(

View File

@ -274,6 +274,9 @@
"fail": "签署失败",
"back": "返回"
},
"button": {
"agreeAndSign": "同意并签署"
},
"loading": "加载中...",
"agreement": {
"notice": "《拍卖公告》",