index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <div class="home">
  3. <Header :showClose="false" :showTool="true" type="home" logoClass="logo2"></Header>
  4. <div class="menu">
  5. <div class="left">
  6. <div class="li" @click="getJump('/train', '自助锻炼')"><img src="@/assets/images/home/train.png" /></div>
  7. </div>
  8. <div class="right">
  9. <div class="right-top">
  10. <div class="li" @click="getJump('/test', '测试')">
  11. <img src="@/assets/images/home/test.png" />
  12. <i></i>
  13. </div>
  14. <div class="li" @click="getJump('/ranking', '排行榜')"><img src="@/assets/images/home/ranking.png" /></div>
  15. </div>
  16. <div class="right-bottom">
  17. <div class="li" @click="getJump('/game', '游戏')"><img src="@/assets/images/home/game.png" /></div>
  18. <div class="li" @click="getJump('/course', '课程')"><img src="@/assets/images/home/course.png" /></div>
  19. <div class="li" @click="getJump('/set', '设置')"><img src="@/assets/images/home/set.png" /></div>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script setup name="Home" lang="ts">
  26. import { initSpeech, speckText, playMusic, controlMusic, speckCancel, chineseNumber } from '@/utils/speech';
  27. const { proxy } = getCurrentInstance() as any;
  28. const router = useRouter();
  29. //跳转
  30. const getJump = (url: string, name: string) => {
  31. if (url == undefined || !url) {
  32. proxy?.$modal.msgWarning(`正在开发,敬请期待!`);
  33. return false;
  34. }
  35. if (url == '/set') {
  36. if (import.meta.env.DEV) {
  37. proxy?.$modal.msgSuccess('测试环境免密进入');
  38. router.push({ path: url });
  39. } else {
  40. let myInfo: any = localStorage.getItem('userInfo');
  41. let userInfo = JSON.parse(myInfo);
  42. proxy?.$modal
  43. .prompt(`【${userInfo.login_name}】,请输入密码`, 'password')
  44. .then((e: any) => {
  45. // console.log("e", e)
  46. if (e.action == 'confirm' && e.value) {
  47. let params = {
  48. password: e.value
  49. };
  50. proxy?.$http.common.checkPassword(params).then((res: any) => {
  51. if (res.status === 200 || res.status === 1) {
  52. router.push({ path: url });
  53. } else {
  54. proxy?.$modal.msgError(res.message);
  55. }
  56. });
  57. }
  58. })
  59. .finally(() => { });
  60. }
  61. } else if (url == '/test') {
  62. if (import.meta.env.DEV) {
  63. proxy?.$modal.msgSuccess('测试环境免密进入');
  64. router.push({ path: url });
  65. } else {
  66. proxy?.$modal
  67. .prompt('请输入密码')
  68. .then((e: any) => {
  69. // console.log("e", e)
  70. if (e.action == 'confirm' && e.value == '160713') {
  71. let deviceid = e.value;
  72. localStorage.setItem('deviceid', deviceid);
  73. router.push({ path: url });
  74. }
  75. })
  76. .finally(() => { });
  77. }
  78. } else if (url == '/gesture') {
  79. proxy?.$modal
  80. .prompt('请输入设备码')
  81. .then((e: any) => {
  82. // console.log("e", e)
  83. if (e.action == 'confirm' && e.value) {
  84. let deviceid = e.value;
  85. localStorage.setItem('deviceid', deviceid);
  86. router.push({ path: url });
  87. }
  88. })
  89. .finally(() => { });
  90. } else if (url == '/game') {
  91. // proxy?.$modal.msgWarning('暂不开放使用,敬请期待!');
  92. // proxy?.$modal
  93. // .prompt('请输入密码')
  94. // .then((e: any) => {
  95. // if (e.action == 'confirm' && e.value == 'trops') {
  96. // router.push({ path: url });
  97. // }
  98. // })
  99. // .finally(() => { });
  100. if (import.meta.env.DEV) {
  101. proxy?.$modal.msgSuccess('测试环境直接进入');
  102. router.push({ path: url });
  103. } else {
  104. proxy?.$modal.msgWarning('暂不开放使用,敬请期待!');
  105. }
  106. }
  107. else {
  108. router.push({ path: url });
  109. }
  110. };
  111. onMounted(() => {
  112. //停止播报;
  113. speckCancel();
  114. });
  115. </script>
  116. <style lang="scss" scoped>
  117. $waiPadding: 6.51rem;
  118. .home {
  119. width: 100vw;
  120. height: 100vh;
  121. }
  122. .menu {
  123. width: calc(100% - ($waiPadding * 2));
  124. padding-top: 10rem;
  125. margin: 0 auto;
  126. display: flex;
  127. justify-content: space-between;
  128. line-height: 0;
  129. .li {
  130. cursor: pointer;
  131. &:hover {
  132. img,
  133. i {
  134. transform: scale(1.06);
  135. }
  136. }
  137. }
  138. img {
  139. width: 100%;
  140. transition: all 0.5s;
  141. }
  142. .left {
  143. width: 32.6%;
  144. .li {
  145. width: 100%;
  146. }
  147. }
  148. .right {
  149. width: calc(100% - 32.6%);
  150. $myPadding: 1.22rem;
  151. .right-top {
  152. display: flex;
  153. justify-content: space-between;
  154. padding-left: $myPadding;
  155. margin-bottom: $myPadding;
  156. .li {
  157. width: calc(50% - $myPadding / 2);
  158. }
  159. .li:nth-child(1) {
  160. position: relative;
  161. i {
  162. width: 6vw;
  163. height: 6vw;
  164. display: block;
  165. position: absolute;
  166. top: calc(6vw / -6.4);
  167. left: 50%;
  168. margin-left: calc(6vw * -0.15);
  169. background-image: url('@/assets/images/home/test_icon.png');
  170. background-position: center;
  171. background-repeat: no-repeat;
  172. background-size: 100% 100%;
  173. flex-shrink: 0;
  174. transition: all 0.5s;
  175. }
  176. }
  177. }
  178. .right-bottom {
  179. display: flex;
  180. justify-content: space-between;
  181. padding-left: $myPadding;
  182. .li:nth-child(1) {
  183. width: calc(50% - $myPadding / 2);
  184. }
  185. .li:nth-child(2) {
  186. width: calc((50% - $myPadding / 2) / 2 - $myPadding / 2 + 0.05rem);
  187. }
  188. .li:nth-child(3) {
  189. width: calc((50% - $myPadding / 2) / 2 - $myPadding / 2 - 0.05rem);
  190. }
  191. }
  192. }
  193. }
  194. @media screen and (max-width: 1450px) {
  195. $waiPadding: 13rem;
  196. .menu {
  197. width: calc(100% - ($waiPadding * 2));
  198. }
  199. }
  200. </style>