index.vue 4.4 KB

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