祁阳图书馆智慧大屏
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

146 lines
3.7 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <div id="screen-container">
  3. <div v-if="isLoading" class="loading">
  4. <dv-loading>Loading...</dv-loading>
  5. </div>
  6. <Header :header-title="headerTitle" />
  7. <div style="position: fixed; right: .14rem; top: .14rem; font-size: .14rem; background: rgba(82,146,255,0.2);border: 1px solid #5292FF; padding: .03rem .06rem; line-height: .25rem;">{{ active +' / '+ pageData.length }}</div>
  8. <section ref="sectionRef">
  9. <keep-alive>
  10. <PageOne
  11. v-if="active === 1"
  12. ref="user"
  13. :height="height"
  14. :fullscreen="fullscreen"
  15. />
  16. </keep-alive>
  17. <Map
  18. v-if="active === 2"
  19. :height="height"
  20. :fullscreen="fullscreen"
  21. />
  22. <div v-if="active === 3">第三屏</div>
  23. <div v-if="active === 4">第四屏</div>
  24. </section>
  25. <div class="bottom-bg" />
  26. </div>
  27. </template>
  28. <script>
  29. import Header from '@/views/header/index.vue'
  30. import PageOne from '@/views/pageOne/index.vue'
  31. import Map from '@/views/map/index.vue'
  32. export default {
  33. name: 'Home',
  34. components: {
  35. Header,
  36. PageOne,
  37. Map
  38. },
  39. data() {
  40. return {
  41. active: 1,
  42. isLoading: false,
  43. fullscreen: false,
  44. height: '',
  45. headerTitle: '祁阳陶铸图书馆智慧大屏馆情数据总览',
  46. pageData: [
  47. {
  48. id: 1, title: 'page1', delayed: 10
  49. },
  50. {
  51. id: 2, title: 'page2', delayed: 0
  52. },
  53. {
  54. id: 3, title: 'page3', delayed: 10
  55. },
  56. {
  57. id: 4, title: 'page4', delayed: 0
  58. }
  59. ],
  60. swiperOption: null,
  61. pageIndex: 0,
  62. timer: null,
  63. timer2: null
  64. }
  65. },
  66. computed: {
  67. },
  68. created() {
  69. // const METAWA = require('../assets/js/META.common.min.js')
  70. // const meta = new METAWA('665e845538d68')
  71. // meta.callback = (r) => {
  72. // console.log(r, '回调')
  73. // }
  74. },
  75. beforeDestroy() {
  76. clearInterval(this.timer2)
  77. window.removeEventListener('resize', this.setElementHeight)
  78. },
  79. mounted() {
  80. this.showLoading()
  81. this.setElementHeight()
  82. window.addEventListener('resize', this.setElementHeight)
  83. this.$once('hook:beforeDestroy', () => {
  84. clearInterval(this.timer2)
  85. window.removeEventListener('resize', this.setElementHeight)
  86. })
  87. // this.autoPagination()
  88. },
  89. methods: {
  90. autoPagination() {
  91. clearInterval(this.timer2)
  92. this.timer2 = setInterval(() => {
  93. setTimeout(() => {
  94. if (this.active >= this.pageData.length) {
  95. this.active = 1
  96. } else {
  97. this.active++
  98. }
  99. // this.showLoading()
  100. }, 0)
  101. }, 6000)
  102. this.$once('hook:beforeDestroy', () => {
  103. clearInterval(this.timer2)
  104. })
  105. },
  106. showLoading() {
  107. this.isLoading = true
  108. this.timer = setTimeout(() => {
  109. this.isLoading = false
  110. window.clearTimeout(this.timer)
  111. }, 1500)
  112. },
  113. // 设置DOM高度
  114. setElementHeight() {
  115. clearTimeout(this.timer)
  116. this.timer = setTimeout(() => {
  117. this.showLoading()
  118. this.height = `${(this.$refs.sectionRef.offsetHeight - 30) / 3}px`
  119. }, 100)
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. @import "~@/assets/styles/index.scss";
  126. .swiper-home{
  127. .swiper-wrapper{
  128. transition-timing-function: ease-in-out !important;
  129. }
  130. .swiper-slide{
  131. position: relative;
  132. width: 100%;
  133. // height: calc(100vh - 1.125rem) !important;
  134. overflow: hidden;
  135. }
  136. .swiper-pagination-home{
  137. position: fixed;
  138. top: .2rem;
  139. left: calc( 100% - 2rem);
  140. font-size: .4rem;
  141. }
  142. }
  143. </style>