HomeView.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <template>
  2. <div class="home">
  3. <video
  4. src="@/assets/videos/startup.mp4"
  5. autoplay
  6. playsinline
  7. webkit-playsinline="true"
  8. muted
  9. />
  10. <Transition name="fade-in">
  11. <div
  12. v-show="isShowBtnGroup"
  13. class="btn-group"
  14. >
  15. <button @click="onClickBegin">
  16. 开始探索
  17. </button>
  18. <button
  19. id="copy-text"
  20. :data-clipboard-text="shareUrl"
  21. data-clipboard-action="copy"
  22. @click="onClickCopy"
  23. >
  24. 分享
  25. </button>
  26. </div>
  27. </Transition>
  28. </div>
  29. </template>
  30. <script setup>
  31. import Clipboard from "clipboard"
  32. import { showToast } from "@/store/index.js"
  33. import { useRoute, useRouter } from "vue-router"
  34. import { ref } from "vue"
  35. const {
  36. windowSizeInCssForRef,
  37. windowSizeWhenDesignForRef,
  38. } = useSizeAdapt(724, 375)
  39. const route = useRoute()
  40. const router = useRouter()
  41. const isShowBtnGroup = ref(false)
  42. setTimeout(() => {
  43. isShowBtnGroup.value = true
  44. }, 2500)
  45. const shareUrl = location.origin + location.pathname
  46. function onClickBegin() {
  47. router.push({
  48. name: 'EntryList'
  49. })
  50. }
  51. function onClickCopy() {
  52. let clipboard = new Clipboard("#copy-text")
  53. clipboard.on("success", function() {
  54. showToast('地址已复制到剪贴板')
  55. })
  56. }
  57. </script>
  58. <style lang="less" scoped>
  59. .home{
  60. position: absolute;
  61. left: 0;
  62. top: 0;
  63. width: 100%;
  64. height: 100%;
  65. // background-image: url(@/assets/images/cover-bg.jpg);
  66. // background-size: cover;
  67. // background-repeat: no-repeat;
  68. // background-position: center center;
  69. >video{
  70. position: absolute;
  71. left: 0;
  72. top: 0;
  73. width: 100%;
  74. height: 100%;
  75. object-fit: cover;
  76. }
  77. >.btn-group{
  78. position: absolute;
  79. bottom: calc(40 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  80. width: 100%;
  81. display: flex;
  82. justify-content: center;
  83. align-items: center;
  84. >button{
  85. flex: 0 0 auto;
  86. font-size: calc(20 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  87. font-family: Source Han Serif CN-Bold, Source Han Serif CN;
  88. font-weight: bold;
  89. color: #484238;
  90. line-height: calc(23 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  91. height: calc(55 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));;
  92. }
  93. >button:first-of-type{
  94. background-image: url(@/assets/images/btn-long-bright.png);
  95. background-size: contain;
  96. background-repeat: no-repeat;
  97. background-position: center center;
  98. width: calc(186 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  99. margin-right: calc(17 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));
  100. }
  101. >button:last-of-type{
  102. background-image: url(@/assets/images/btn-short-dark.png);
  103. background-size: contain;
  104. background-repeat: no-repeat;
  105. background-position: center center;
  106. width: calc(144 / v-bind('windowSizeWhenDesignForRef') * v-bind('windowSizeInCssForRef'));;
  107. }
  108. }
  109. }
  110. </style>