闫增涛
2024-07-01 34f53c3ca69833ddf0649700d26da9ed91c5f1c3
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<template>
  <div class="homePage">
    <webHome v-if="!homeBoxHide" />
    <mobileHome v-if="homeBoxHide" />
  </div>
  <div class="pdfDialog">
    <el-dialog
      v-model="dialogState.dialogVisible"
      width="60vw"
      top="2vh"
      lock-scroll
      :show-close="false"
      class="custom-dialog"
    >
      <template #header>
        <div class="header_title">
          <span>{{ dialogState.pdfTitle }}</span>
          <span @click="dialogState.dialogVisible = false"> x </span>
        </div>
      </template>
      <div class="pdfModal" v-if="dialogState.dialogVisible">
        <preView :isClear="dialogState.dialogVisible" :md5="dialogState.p_md5"></preView>
      </div>
    </el-dialog>
  </div>
</template>
<script setup lang="ts">
import { ref, onMounted, reactive, inject } from 'vue'
import webHome from '@/views//readerPages/webHome.vue'
import mobileHome from '@/views//readerPages/mobileHome.vue'
import preView from '../components/pdfview.vue'
// import { da } from 'element-plus/es/locale'
const qiankunActions = inject('qiankunActions')
const screenWidth = ref(
  window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
)
const homeBoxHide = ref(false)
const dialogState = reactive({
  dialogVisible: false,
  pdfTitle: '',
  isClear: false,
  p_md5: ''
})
onMounted(() => {
  if (screenWidth.value < 420) {
    homeBoxHide.value = true
  } else {
    homeBoxHide.value = false
  }
  window.qiankunActions.setGlobalState({
    openPDF: (data) => {
      console.log('父应用', data)
      if (data.data.md5) {
        const { md5, title } = data.data
        dialogState.p_md5 = md5
        dialogState.pdfTitle = title
      }
      dialogState.dialogVisible = true
    }
  })
})
</script>
 
<style lang="less">
.homePage {
  width: 100%;
  height: 100%;
}
 
.pdfDialog {
  .el-overlay {
    z-index: 2004 !important;
  }
}
.pdfModal {
  width: 100%;
  height: 90vh;
}
 
.custom-dialog {
  overflow: hidden !important;
  padding: 0;
 
  .el-dialog__body {
    padding: 0;
  }
 
  .el-dialog__header {
    background-color: rgba(0, 0, 0, 0.8);
    padding: 0;
    padding: 10px 0;
 
    .header_title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      color: #fff;
      font-weight: 900;
      font-size: 16px;
      font-family: 'FZLTXIHJW';
      padding: 5px 20px;
      box-sizing: border-box;
 
      span:nth-child(2):hover {
        cursor: pointer;
      }
    }
 
    .el-dialog__title,
    .el-dialog__headerbtn .el-dialog__close {
      color: #fff;
      font-weight: 900;
      font-size: 16px;
      font-family: 'FZLTXIHJW';
    }
  }
}
 
@media screen and (max-width: 1070px) {
  .pdfModal {
    width: 100%;
    height: 80vh;
  }
 
  .custom-dialog {
    .el-dialog {
      width: 90vw !important;
    }
  }
}
 
@media screen and (max-width: 800px) {
  .pdfModal {
    width: 100%;
    height: 60vh;
  }
 
  .custom-dialog {
    .el-dialog {
      width: 90vw !important;
    }
  }
}
</style>