pdfreaderpro.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="context">
  3. <Banner :platform="platform" />
  4. <div ref="features">
  5. <Features :platform="platform" :showBanner="showBanner" />
  6. </div>
  7. <div ref="solution">
  8. <Solution :platform="platform" />
  9. </div>
  10. <Believe />
  11. <Product :platform="platform" />
  12. </div>
  13. </template>
  14. <script>
  15. import Banner from '~/components/PDFReaderPro/banner.vue'
  16. import Features from '~/components/PDFReaderPro/features.vue'
  17. import Solution from '~/components/PDFReaderPro/solution.vue'
  18. import Believe from '~/components/PDFReaderPro/believe.vue'
  19. import Product from '~/components/PDFReaderPro/product.vue'
  20. export default {
  21. middleware: 'user',
  22. layout: 'downnav',
  23. components: {
  24. Banner,
  25. Features,
  26. Solution,
  27. Believe,
  28. Product
  29. },
  30. async asyncData ({ req }) {
  31. let userAgent = ''
  32. if (typeof req !== 'undefined') {
  33. userAgent = req.headers && req.headers['user-agent']
  34. } else if (typeof navigator !== 'undefined') {
  35. userAgent = navigator.userAgent
  36. }
  37. const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent)
  38. const isMac = !isIOS && /macintosh|mac os x/i.test(userAgent)
  39. const isAndroid = /Android/.test(userAgent)
  40. const isWindows = /Windows/.test(userAgent)
  41. return {
  42. platform: {
  43. isWindows: isWindows || isAndroid,
  44. isMac: isMac || isIOS
  45. }
  46. }
  47. },
  48. data() {
  49. return {
  50. platform: {
  51. isWindows: false,
  52. isMac: false
  53. },
  54. showBanner: true
  55. }
  56. },
  57. head() {
  58. return {
  59. title: 'PDF Reader Pro - 真正轻量级一站式的PDF编辑神器',
  60. meta: [
  61. {
  62. hid: 'description',
  63. name: 'description',
  64. content: '一款强大的PDF阅读器,支持PDF阅读、注释、填写表单&签名、多种格式转换、OCR、合并拆分页面、编辑PDF、文件保护、压缩合并文件等。支持多平台使用,不论Mac或是Windows,如果你只需要一款PDF软件,PDF Reader Pro会是你最好的选择。'
  65. }
  66. ]
  67. }
  68. },
  69. mounted() {
  70. this.handleScroll()
  71. window.addEventListener('scroll', this.handleScroll)
  72. },
  73. destroyed() {
  74. window.removeEventListener('scroll', this.handleScroll)
  75. },
  76. methods: {
  77. handleScroll() {
  78. const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
  79. let elementCompare = this.$refs.solution.offsetTop
  80. // 获取可视窗口的高度
  81. const screenHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
  82. // 获取元素偏移的高度。就是距离可视窗口的偏移量。
  83. const offsetTop = this.$refs.features.offsetTop
  84. // tool模块轮播与否
  85. if (offsetTop - scrollTop <= screenHeight && scrollTop < elementCompare) {
  86. this.showBanner = true
  87. } else {
  88. this.showBanner = false
  89. }
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="scss" scoped>
  95. * {
  96. font-family: "Helvetica", Arial, "PingFang-SC-Regular", "ArialMT", "微软雅黑", "Microsoft YaHei", "Helvetica Neue", Helvetica, sans-serif;
  97. }
  98. ::v-deep .container {
  99. width: 100%;
  100. margin-right: auto;
  101. margin-left: auto;
  102. padding-left: 20px;
  103. padding-right: 20px;
  104. }
  105. ::v-deep .container {
  106. width: 100%;
  107. margin-right: auto;
  108. margin-left: auto;
  109. padding-left: 20px;
  110. padding-right: 20px;
  111. }
  112. @media (max-width: 360px) {
  113. ::v-deep .container {
  114. padding-left: 10px;
  115. padding-right: 10px;
  116. }
  117. }
  118. @media (min-width: 360px) and (max-width: 575px) {
  119. ::v-deep .container {
  120. padding-left: 16px;
  121. padding-right: 16px;
  122. }
  123. }
  124. @media (min-width: 576px) {
  125. ::v-deep .container {
  126. max-width: 540px;
  127. padding-left: 10px;
  128. padding-right: 10px;
  129. }
  130. }
  131. @media (min-width: 768px) {
  132. ::v-deep .container {
  133. max-width: 720px;
  134. }
  135. }
  136. @media (min-width: 930px) {
  137. ::v-deep .container {
  138. max-width: 960px;
  139. min-width: 900px;
  140. }
  141. }
  142. @media (min-width: 1280px) {
  143. ::v-deep .container {
  144. max-width: 1240px;
  145. }
  146. }
  147. @media screen and (max-width: 959px) {
  148. ::v-deep .container {
  149. margin-top: 10px;
  150. }
  151. }
  152. </style>