infodialog.vue
2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<template>
<div class="info-dialog" v-if="infoDialogShow">
<iframe
:src="iframeSrc"
ref="infoIframe"
frameborder="0"
class="info-iframe"
></iframe>
</div>
</template>
<script>
import Vue from "vue";
export default {
data() {
return {
infoDialogShow: false,
iframeSrc: "",
visiableTimer: null,
};
},
methods: {
showInfo(info, isVisible, type) {
this.infoDialogShow = true;
window.infoDialogVm = this;
if (arguments.length > 1) {
this.infoDialogShow = isVisible;
switch (type) {
case "info":
this.iframeSrc = "static/infoDialog.html";
break;
case "picDetail":
this.iframeSrc = "static/picDetailDialog.html";
break;
case "paramSetting":
this.iframeSrc = "static/paramSettingDialog.html";
break;
default:
break;
}
} else if (arguments.length == 1) {
this.iframeSrc = "static/infoDialog.html";
} else {
return;
}
if (this.infoDialogShow) {
let self = this;
if (self && !self._isDestroyed) {
self.visiableTimer = setTimeout(() => {
try {
this.$refs.infoIframe.contentWindow.globalVm = this;
} catch (error) {}
if (type == undefined) {
try {
if (this.$refs.infoIframe.contentWindow) {
this.$refs.infoIframe.contentWindow.changeText(info, this);
}
} catch (err) {
this.infoDialogShow = false;
eval("console.log('自定义弹窗changeText异常:', err.message)");
}
} else {
try {
if (this.$refs.infoIframe.contentWindow) {
this.$refs.infoIframe.contentWindow.filterType(info);
}
} catch (err) {
this.infoDialogShow = false;
eval("console.log('自定义弹窗filterType异常:', err.message)");
}
}
}, 500);
}
}
},
hide() {
this.infoDialogShow = false;
window.clearTimeout(this.visiableTimer);
},
},
};
</script>
<style scoped>
.info-dialog {
width: 100%;
height: 100%;
position: relative;
z-index: 99990;
}
.info-iframe {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* z-index: 99990; */
}
</style>