新版梦工厂手机端官网
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.

199 lines
4.1 KiB

2 years ago
  1. <template>
  2. <div class="new_track_container">
  3. <img :src="getActiveImg()" class="track_img" alt="" />
  4. <div class="btn1" @click="changeCardIndex('1')"></div>
  5. <div class="btn2" @click="changeCardIndex('2')"></div>
  6. <div class="btn3" @click="changeCardIndex('3')"></div>
  7. <div class="btn4" @click="changeCardIndex('4')"></div>
  8. <div class="btn5" @click="changeCardIndex('5')"></div>
  9. <div class="btn6" @click="changeCardIndex('6')"></div>
  10. <div class="btn7" @click="changeCardIndex('7')"></div>
  11. <div class="btn8" @click="changeCardIndex('8')"></div>
  12. <div class="btn9" @click="changeCardIndex('9')"></div>
  13. </div>
  14. </template>
  15. <script setup>
  16. import Def1 from '@/static/img/newtrack/industry/def.png'
  17. import A1 from '@/static/img/newtrack/industry/1.png'
  18. import A2 from '@/static/img/newtrack/industry/2.png'
  19. import A3 from '@/static/img/newtrack/industry/3.png'
  20. import A4 from '@/static/img/newtrack/industry/4.png'
  21. import A5 from '@/static/img/newtrack/industry/5.png'
  22. import A6 from '@/static/img/newtrack/industry/6.png'
  23. import A7 from '@/static/img/newtrack/industry/7.png'
  24. import A8 from '@/static/img/newtrack/industry/8.png'
  25. import A9 from '@/static/img/newtrack/industry/9.png'
  26. import Def2 from '@/static/img/newtrack/hardware/def.png'
  27. import B1 from '@/static/img/newtrack/hardware/1.png'
  28. import B2 from '@/static/img/newtrack/hardware/2.png'
  29. import B3 from '@/static/img/newtrack/hardware/3.png'
  30. import B4 from '@/static/img/newtrack/hardware/4.png'
  31. import B5 from '@/static/img/newtrack/hardware/5.png'
  32. import B6 from '@/static/img/newtrack/hardware/6.png'
  33. import B7 from '@/static/img/newtrack/hardware/7.png'
  34. import B8 from '@/static/img/newtrack/hardware/8.png'
  35. import B9 from '@/static/img/newtrack/hardware/9.png'
  36. import { ref } from 'vue'
  37. import { useTrackStore } from '@/store'
  38. const props = defineProps({
  39. hard: {
  40. type: Boolean,
  41. },
  42. })
  43. const trackStore = useTrackStore()
  44. const changeCardIndex = index => {
  45. if (props.hard) {
  46. trackStore.updateHardwareTab(index)
  47. } else {
  48. trackStore.updateIndustryTab(index)
  49. }
  50. }
  51. const getActiveImg = () => {
  52. let val = '0'
  53. if (props.hard) {
  54. val = trackStore.hardwareTab
  55. if (val == '0') {
  56. return Def2
  57. }
  58. if (val == '1') {
  59. return B1
  60. }
  61. if (val == '2') {
  62. return B2
  63. }
  64. if (val == '3') {
  65. return B3
  66. }
  67. if (val == '4') {
  68. return B4
  69. }
  70. if (val == '5') {
  71. return B5
  72. }
  73. if (val == '6') {
  74. return B6
  75. }
  76. if (val == '7') {
  77. return B7
  78. }
  79. if (val == '8') {
  80. return B8
  81. }
  82. if (val == '9') {
  83. return B9
  84. }
  85. } else {
  86. val = trackStore.industryTab
  87. if (val == '0') {
  88. return Def1
  89. }
  90. if (val == '1') {
  91. return A1
  92. }
  93. if (val == '2') {
  94. return A2
  95. }
  96. if (val == '3') {
  97. return A3
  98. }
  99. if (val == '4') {
  100. return A4
  101. }
  102. if (val == '5') {
  103. return A5
  104. }
  105. if (val == '6') {
  106. return A6
  107. }
  108. if (val == '7') {
  109. return A7
  110. }
  111. if (val == '8') {
  112. return A8
  113. }
  114. if (val == '9') {
  115. return A9
  116. }
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .new_track_container {
  122. margin-bottom: 10px;
  123. position: relative;
  124. .track_img {
  125. width: 100vw;
  126. height: auto;
  127. }
  128. .btn1 {
  129. position: absolute;
  130. left: 1vw;
  131. top: 18vw;
  132. width: 9vw;
  133. height: 12vw;
  134. }
  135. .btn2 {
  136. position: absolute;
  137. left: 12vw;
  138. top: 18vw;
  139. width: 9vw;
  140. height: 12vw;
  141. }
  142. .btn3 {
  143. position: absolute;
  144. left: 23vw;
  145. top: 18vw;
  146. width: 9vw;
  147. height: 12vw;
  148. }
  149. .btn4 {
  150. position: absolute;
  151. left: 34vw;
  152. top: 18vw;
  153. width: 9vw;
  154. height: 12vw;
  155. }
  156. .btn5 {
  157. position: absolute;
  158. left: 45vw;
  159. top: 18vw;
  160. width: 9vw;
  161. height: 12vw;
  162. }
  163. .btn6 {
  164. position: absolute;
  165. left: 56vw;
  166. top: 18vw;
  167. width: 9vw;
  168. height: 12vw;
  169. }
  170. .btn7 {
  171. position: absolute;
  172. left: 67vw;
  173. top: 18vw;
  174. width: 9vw;
  175. height: 12vw;
  176. }
  177. .btn8 {
  178. position: absolute;
  179. left: 78vw;
  180. top: 18vw;
  181. width: 9vw;
  182. height: 12vw;
  183. }
  184. .btn9 {
  185. position: absolute;
  186. left: 89vw;
  187. top: 18vw;
  188. width: 9vw;
  189. height: 12vw;
  190. }
  191. }
  192. </style>