sex.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <template>
  2. <div class="sex" :style="'background-image: url(' + bgimg + ')'">
  3. <img
  4. :src="kuangimg"
  5. :style="
  6. step === 2
  7. ? 'opacity: 1'
  8. : step === 3
  9. ? 'width: 25%;transform: translate(0, 0);opacity: 1; top: 1em; left: 1em'
  10. : 'opacity: 0'
  11. "
  12. class="firstImg"
  13. />
  14. <transition name="sex_step_1">
  15. <img :src="textimg" v-if="step === 1" class="sImg" />
  16. </transition>
  17. <img
  18. :src="text2img"
  19. :style="step === 3 ? 'opacity: 1' : 'opacity: 0'"
  20. class="tImg"
  21. />
  22. <div class="btns">
  23. <div class="btn" style="margin-left: 0">下载壁纸</div>
  24. <div class="btn">生成海报</div>
  25. </div>
  26. </div>
  27. </template>
  28. <script setup>
  29. import { ref } from "vue";
  30. // import { onMounted, reactive } from "vue";
  31. // import { isIpad, isIpod, isIphone } from "../../utils/isTerminal";
  32. /**
  33. * window.$originData.orginParames.title 页面标题
  34. * window.$originData.orginParames.parameters 固定参数值
  35. * window.$originData.urlParames url参数
  36. */
  37. const step = ref(1);
  38. let t = setInterval(() => {
  39. step.value += 1;
  40. if (step.value === 3) clearInterval(t);
  41. }, 2000);
  42. const type = Math.floor(Math.random() * 13 + 1);
  43. const url = {
  44. bg: require("@/assets/img/12/" + type + "-1.png"),
  45. kuang: require("@/assets/img/12/" + type + ".kuang.png"),
  46. text: require("@/assets/img/12/" + type + ".text.png"),
  47. text2: require("@/assets/img/12/" + type + ".text2.png"),
  48. };
  49. const bgimg = ref(url.bg);
  50. const kuangimg = ref(url.kuang);
  51. const textimg = ref(url.text);
  52. const text2img = ref(url.text2);
  53. </script>
  54. <style lang="scss" scoped>
  55. .sex {
  56. width: 100%;
  57. height: 100%;
  58. background-size: 100% 100%;
  59. position: relative;
  60. img {
  61. width: 50%;
  62. transition: all 4s;
  63. }
  64. .firstImg {
  65. position: absolute;
  66. top: 50%;
  67. left: 50%;
  68. transform: translate(-50%, -50%);
  69. }
  70. .sImg {
  71. position: absolute;
  72. top: 50%;
  73. left: 50%;
  74. width: 70%;
  75. transform: translate(-50%, -50%);
  76. }
  77. .tImg {
  78. position: absolute;
  79. top: 50%;
  80. width: 90%;
  81. left: 50%;
  82. transform: translate(-50%, -50%);
  83. }
  84. .btns {
  85. position: absolute;
  86. text-align: center;
  87. bottom: 5vh;
  88. width: 100%;
  89. > div {
  90. display: inline-block;
  91. border: 1px solid #fff;
  92. border-radius: 2em;
  93. font-weight: 600;
  94. color: #fff;
  95. padding: 5px 15px;
  96. margin-left: 2em;
  97. }
  98. }
  99. .sex_step_1-enter-from,
  100. .sex_step_1-leave-to {
  101. opacity: 0;
  102. }
  103. .sex_step_1-enter-active,
  104. .sex_step_1-leave-active {
  105. transition: opacity 1s ease;
  106. }
  107. .sex_step_1-enter-to,
  108. .sex_step_1-leave-from {
  109. opacity: 1;
  110. }
  111. }
  112. </style>