|
@@ -1,13 +1,13 @@
|
|
|
<template>
|
|
<template>
|
|
|
<teleport to="body">
|
|
<teleport to="body">
|
|
|
<div v-show="visibleProxy" class="order-operate-local-layer" @click.self="visibleProxy = false">
|
|
<div v-show="visibleProxy" class="order-operate-local-layer" @click.self="visibleProxy = false">
|
|
|
- <iframe ref="frameRef" class="order-operate-local-frame" :src="frameSrc" frameborder="0" />
|
|
|
|
|
|
|
+ <iframe class="order-operate-local-frame" :src="frameSrc" frameborder="0" allowtransparency="true" />
|
|
|
</div>
|
|
</div>
|
|
|
</teleport>
|
|
</teleport>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
- import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
|
|
|
|
|
+ import { computed, onBeforeUnmount, onMounted } from 'vue'
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
const props = defineProps<{
|
|
|
modelValue: boolean
|
|
modelValue: boolean
|
|
@@ -23,8 +23,10 @@
|
|
|
set: (value: boolean) => emit('update:modelValue', value)
|
|
set: (value: boolean) => emit('update:modelValue', value)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- const frameSrc = '#/order/order?bridge=1'
|
|
|
|
|
- const frameRef = ref<HTMLIFrameElement | null>(null)
|
|
|
|
|
|
|
+ const frameSrc = computed(() => {
|
|
|
|
|
+ const id = encodeURIComponent((props.orderId || '').trim())
|
|
|
|
|
+ return id ? `#/order/order?bridge=1&viewOrderId=${id}` : '#/order/order?bridge=1'
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
const handleMessage = (ev: MessageEvent) => {
|
|
const handleMessage = (ev: MessageEvent) => {
|
|
|
const data = ev?.data as any
|
|
const data = ev?.data as any
|
|
@@ -34,12 +36,6 @@
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const postOpen = (id: string) => {
|
|
|
|
|
- const win = frameRef.value?.contentWindow
|
|
|
|
|
- if (!win) return
|
|
|
|
|
- win.postMessage({ type: 'sqxp-order-operate-open', orderId: id }, '*')
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
window.addEventListener('message', handleMessage)
|
|
window.addEventListener('message', handleMessage)
|
|
|
})
|
|
})
|
|
@@ -47,18 +43,6 @@
|
|
|
onBeforeUnmount(() => {
|
|
onBeforeUnmount(() => {
|
|
|
window.removeEventListener('message', handleMessage)
|
|
window.removeEventListener('message', handleMessage)
|
|
|
})
|
|
})
|
|
|
-
|
|
|
|
|
- watch(
|
|
|
|
|
- () => [visibleProxy.value, props.orderId] as const,
|
|
|
|
|
- async ([vis, id]) => {
|
|
|
|
|
- if (!vis) return
|
|
|
|
|
- const orderId = (id || '').trim()
|
|
|
|
|
- if (!orderId) return
|
|
|
|
|
- await nextTick()
|
|
|
|
|
- requestAnimationFrame(() => postOpen(orderId))
|
|
|
|
|
- },
|
|
|
|
|
- { immediate: true }
|
|
|
|
|
- )
|
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -68,7 +52,7 @@
|
|
|
z-index: 4000;
|
|
z-index: 4000;
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
|
- background: rgba(0, 0, 0, 0.28);
|
|
|
|
|
|
|
+ background: transparent;
|
|
|
overflow: hidden;
|
|
overflow: hidden;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -79,6 +63,5 @@
|
|
|
display: block;
|
|
display: block;
|
|
|
background: transparent;
|
|
background: transparent;
|
|
|
border: 0;
|
|
border: 0;
|
|
|
- flex: 1 1 auto;
|
|
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|