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
101
102
103
104
105
106
| <template>
| <flex-layout no-bg>
| <div class="iframe-container" v-loading="loading" element-loading-text="加载中..." element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.2)">
| <iframe ref="bigScreenIframe" v-if="src" scrolling="no" frameborder="0" :src="src"></iframe>
| </div>
| </flex-layout>
| </template>
|
| <script>
| import getScreenUrl from '@/assets/js/tools/getScreenUrl'
| import {Timeout} from "@/assets/js/tools";
| export default {
| data() {
| let url = getScreenUrl();
| return {
| loading: true,
| url: url,
| src: "",
| acTabs: 'index',
| timer: new Timeout(),
| };
| },
| methods: {
| startTimer() {
| this.timer.start(()=>{
| let bigScreenIframe = this.$refs.bigScreenIframe;
|
| if(!bigScreenIframe) {
| this.timer.open();
| return;
| }
| let name = sessionStorage.getItem('acTabs');
| if(this.acTabs=="index" && name != "index") {
| this.acTabs = name;
| bigScreenIframe.contentWindow.postMessage({
| source: "fg",
| state: 0,
| message: "关闭首页查询"
| }, "*");
| }else if(this.acTabs != "index" && name == "index") {
| this.acTabs = "index";
| bigScreenIframe.contentWindow.postMessage({
| source: "fg",
| state: 1,
| message: "启动首页查询"
| }, "*");
| }
| this.timer.open();
| }, 1000);
| },
| getActivePage(userId) {
| this.$axios({
| methods: "get",
| url: this.url + "application/active",
| params: {
| userId: userId,
| },
| }).then((res) => {
| let rs = res.data;
| if (rs.code == 1 && rs.data) {
| let id = rs.data.id;
| let name = rs.data.name;
| let screenUrl;
| if (process.env.NODE_ENV != "dev") {
| screenUrl = this.url + 'index.html'
| } else {
| screenUrl = 'http://localhost:8008/'
| }
| this.src =
| screenUrl +
| "#/exhibition?id="+id+
| "&name="+name+
| "&head=1"+
| "&userId="+userId;
| } else {
| this.$router.push("index");
| }
| this.loading = false;
| })
| .catch((error) => {
| this.$router.push("index");
| this.loading = false;
| console.log(error);
| });
| },
| },
| mounted() {
| this.startTimer();
| this.$nextTick(() => {
| let userId = sessionStorage.getItem('userId');
| this.getActivePage(userId);
| });
| },
| beforeDestroy() { },
| };
| </script>
|
| <style scoped>
| .iframe-container {
| height: 100%;
| }
| .iframe-container > iframe {
| width: 100%;
| height: 100%;
| }
| </style>
|
|