my-guide.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <uni-popup ref="popup" :mask-click="false" maskBackgroundColor="rgba(0, 0, 0, 0.6)">
  3. <view class="body">
  4. <view class="content content-bg" :style="getGuideStyle('bg')">
  5. <view class="mask uni-column" :style="getGuideStyle('mask')">
  6. <view class="btnBox uni-column">
  7. <button v-if="guideSn < guide.length-1" class="btn btnNext" @click="btnNext"></button>
  8. <button v-if="guideSn == guide.length-1" class="btn btnReplay" @click="btnReplay"></button>
  9. <button v-if="guideSn == guide.length-1" class="btn btnClose" @click="btnClose"></button>
  10. </view>
  11. </view>
  12. </view>
  13. </view>
  14. </uni-popup>
  15. </template>
  16. <script>
  17. export default {
  18. name: "my-guide",
  19. emits: ['popup-close'],
  20. data() {
  21. return {
  22. isOpen: false,
  23. guideSn: 0,
  24. guide: [
  25. {
  26. bg: "static/help/guide1_bg.png",
  27. mask: "static/help/guide1_1.png"
  28. },
  29. {
  30. bg: "static/help/guide1_bg.png",
  31. mask: "static/help/guide1_2.png"
  32. },
  33. {
  34. bg: "static/help/guide1_bg.png",
  35. mask: "static/help/guide1_3.png"
  36. },
  37. {
  38. bg: "static/help/guide1_bg.png",
  39. mask: "static/help/guide1_4.png"
  40. },
  41. {
  42. bg: "static/help/guide1_bg.png",
  43. mask: "static/help/guide1_5.png"
  44. },
  45. ]
  46. };
  47. },
  48. methods: {
  49. getGuideStyle(item) {
  50. const bgurl = this.guide[this.guideSn][item]
  51. return `background-image: url("${bgurl}")`;
  52. },
  53. btnNext() {
  54. if (this.guideSn < this.guide.length-1) {
  55. this.guideSn++;
  56. }
  57. },
  58. btnReplay() {
  59. this.guideSn = 0;
  60. },
  61. btnClose() {
  62. this.popupClose();
  63. },
  64. popupOpen() {
  65. this.$refs.popup.open();
  66. this.isOpen = true;
  67. },
  68. popupClose() {
  69. this.$refs.popup.close();
  70. this.guideSn = 0;
  71. this.isOpen = false;
  72. this.$emit('popup-close');
  73. }
  74. }
  75. }
  76. </script>
  77. <style>
  78. .content {
  79. width: 100vw;
  80. height: 100vh;
  81. background: #000000;
  82. }
  83. .content-bg {
  84. /* background: url('../../static/help/guide1_bg.png'); */
  85. background-repeat: no-repeat;
  86. background-position-x: center;
  87. background-position-y: center;
  88. background-size: contain;
  89. }
  90. .mask {
  91. position: relative;
  92. width: 100%;
  93. height: 100%;
  94. /* background: url('../../static/help/guide1_4.png'); */
  95. background-repeat: no-repeat;
  96. background-position-x: center;
  97. background-position-y: center;
  98. background-size: contain;
  99. }
  100. .btnBox {
  101. position: absolute;
  102. left: 16%;
  103. bottom: 13.6%;
  104. }
  105. .btn {
  106. width: 200rpx;
  107. height: 60rpx;
  108. margin-top: 20px;
  109. }
  110. .btnNext {
  111. background: url('../../static/help/btn_next.png') no-repeat center;
  112. background-size: contain;
  113. }
  114. .btnReplay {
  115. background: url('../../static/help/btn_replay.png') no-repeat center;
  116. background-size: contain;
  117. }
  118. .btnClose {
  119. background: url('../../static/help/btn_close.png') no-repeat center;
  120. background-size: contain;
  121. }
  122. </style>