index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="game">
  3. <Header @confirmExit="getExit" :showTool="false" closeClass="close2"></Header>
  4. <div class="menu" v-if="projectList.length" :class="projectList.length <= 12 ? 'menu1' : 'menu2'"
  5. :key="projectList.length">
  6. <swiper :slides-per-view="6" :modules="[Grid]" :grid="{
  7. fill: projectList.length <= 12 ? 'row' : 'column',
  8. rows: 2,
  9. }" :space-between="20" :slides-per-group="12">
  10. <swiper-slide v-for="(item, index) in projectList" :key="index" @click="getJump(item)">
  11. <div class="li">
  12. <div>
  13. <div class="pic"><img :src="'static/images/game/' + item.key + '.png'" /></div>
  14. <div class="name">
  15. {{ item.name }}
  16. </div>
  17. </div>
  18. </div>
  19. </swiper-slide>
  20. </swiper>
  21. </div>
  22. </div>
  23. </template>
  24. <script setup name="TrainIndex" lang="ts">
  25. import { initSpeech, speckText, playMusic, controlMusic, speckCancel, chineseNumber } from '@/utils/speech';
  26. import { Swiper, SwiperSlide } from 'swiper/vue';
  27. import { Grid } from 'swiper/modules';
  28. import 'swiper/css';
  29. import 'swiper/css/grid';
  30. const router = useRouter();
  31. const { proxy } = getCurrentInstance() as any;
  32. const data = reactive<any>({
  33. projectList: [],
  34. });
  35. const { projectList } = toRefs(data);
  36. //跳转
  37. const getJump = (data: any) => {
  38. router.push({
  39. path: `/game/${data.key}`, query: {
  40. project: 'jumprope',
  41. time: 60,
  42. area: 29,
  43. gesture: 'true',
  44. classes: '1'
  45. }
  46. });
  47. };
  48. /**
  49. * 退出
  50. */
  51. const getExit = () => {
  52. // router.go(-1);
  53. router.push({ path: '/home' });
  54. };
  55. onBeforeMount(async () => {
  56. });
  57. onMounted(() => {
  58. //停止播报;
  59. speckCancel();
  60. projectList.value = [{ name: "方块跳一跳", key: "square" }]
  61. });
  62. onBeforeUnmount(() => {
  63. });
  64. </script>
  65. <style lang="scss" scoped>
  66. $topPadding: 5.19rem;
  67. $waiPadding: 6.51rem;
  68. .menu {
  69. width: calc(100% - ($waiPadding * 2));
  70. height: 72vh;
  71. padding-top: 10rem;
  72. margin: 0 auto;
  73. display: flex;
  74. .li {
  75. // width: calc((100% / 6) - 1rem + (1rem/6));
  76. // margin-right: 1rem;
  77. // margin-bottom: 1rem;
  78. width: 100%;
  79. height: calc((72vh / 2) - 20px);
  80. padding: 2.2vh 0;
  81. border-radius: 1.6rem;
  82. box-sizing: border-box;
  83. box-shadow: inset 0px 1px 0px 2px rgba(255, 255, 255, 0.9046), inset 0px 3px 6px 0px rgba(0, 0, 0, 0.0851);
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. cursor: pointer;
  88. .pic {
  89. width: 11.36vw;
  90. height: 11.36vw;
  91. border-radius: 50%;
  92. background: radial-gradient(78% 78% at 53% 50%, #07121a 0%, #2a4256 49%, #5180a9 100%);
  93. box-shadow: 0px 0px 2px 2px #ffffff;
  94. margin-bottom: 2.5vh;
  95. overflow: hidden;
  96. display: flex;
  97. align-items: center;
  98. justify-content: center;
  99. flex-shrink: 0;
  100. img {
  101. max-width: 88%;
  102. max-height: 88%;
  103. transition: all 1s;
  104. }
  105. }
  106. .name {
  107. width: 100%;
  108. font-size: 2.48rem;
  109. color: #1a293a;
  110. text-align: center;
  111. }
  112. &:hover {
  113. img {
  114. transform: translateY(-0.5vw);
  115. }
  116. }
  117. }
  118. .swiper-slide {
  119. border-radius: 1.6rem;
  120. overflow: hidden;
  121. }
  122. }
  123. .menu1 {
  124. align-items: center;
  125. .swiper-slide {
  126. margin-bottom: 20px;
  127. .li {
  128. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  129. }
  130. &:nth-child(2),
  131. &:nth-child(4),
  132. &:nth-child(6),
  133. &:nth-child(7),
  134. &:nth-child(9),
  135. &:nth-child(11) {
  136. .li {
  137. background: radial-gradient(167% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
  138. }
  139. }
  140. }
  141. }
  142. .menu2 {
  143. display: flex;
  144. .swiper-slide {
  145. &:nth-child(1),
  146. &:nth-child(4),
  147. &:nth-child(5),
  148. &:nth-child(8),
  149. &:nth-child(9),
  150. &:nth-child(12),
  151. &:nth-child(13),
  152. &:nth-child(16),
  153. &:nth-child(17),
  154. &:nth-child(20),
  155. &:nth-child(21),
  156. &:nth-child(24),
  157. &:nth-child(25),
  158. &:nth-child(28),
  159. &:nth-child(29),
  160. &:nth-child(32),
  161. &:nth-child(33),
  162. &:nth-child(36),
  163. &:nth-child(37),
  164. &:nth-child(40),
  165. &:nth-child(41),
  166. &:nth-child(44) {
  167. .li {
  168. background: radial-gradient(96% 96% at 2% 32%, #ffffff 0%, #fcfdfd 54%, #e1e4e7 100%);
  169. }
  170. }
  171. &:nth-child(2),
  172. &:nth-child(3),
  173. &:nth-child(6),
  174. &:nth-child(7),
  175. &:nth-child(10),
  176. &:nth-child(11),
  177. &:nth-child(14),
  178. &:nth-child(15),
  179. &:nth-child(18),
  180. &:nth-child(19),
  181. &:nth-child(22),
  182. &:nth-child(23),
  183. &:nth-child(26),
  184. &:nth-child(27),
  185. &:nth-child(30),
  186. &:nth-child(31),
  187. &:nth-child(34),
  188. &:nth-child(35),
  189. &:nth-child(38),
  190. &:nth-child(39),
  191. &:nth-child(42),
  192. &:nth-child(43) {
  193. .li {
  194. background: radial-gradient(167% 126% at 97% 6%, #35ffc6 0%, #00ffe8 100%);
  195. }
  196. }
  197. }
  198. }
  199. ::v-deep(.menu) {
  200. .swiper-horizontal {
  201. width: 100%;
  202. }
  203. }
  204. @media screen and (max-width: 1450px) {
  205. .menu {
  206. .li {
  207. .name {
  208. font-size: 1.8rem;
  209. }
  210. .pic {
  211. width: 10vw;
  212. height: 10vw;
  213. }
  214. }
  215. }
  216. }
  217. </style>