Home.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <div
  3. class="home"
  4. >
  5. <div class="containers">
  6. <h1 class="title">
  7. {{ $gConfigInfo.title }}
  8. </h1>
  9. <ul>
  10. <li
  11. v-for="item in Object.entries($gConfigInfo.objInfo).slice(pageSize * (currentPage - 1), pageSize * currentPage)"
  12. :key="item[0]"
  13. @click="onClickItem"
  14. >
  15. <img
  16. class=""
  17. :src="`${$env.BASE_URL}user-config/images/${item[0]}.jpg`"
  18. alt=""
  19. draggable="false"
  20. >
  21. <div class="title">
  22. {{ item[1] }}
  23. </div>
  24. </li>
  25. </ul>
  26. <el-pagination
  27. v-model:current-page="currentPage"
  28. v-model:page-size="pageSize"
  29. class="pagination"
  30. :page-sizes="[10, 20, 50, 100]"
  31. background
  32. layout="total, sizes, prev, pager, next, jumper"
  33. :total="Object.keys($gConfigInfo.objInfo).length"
  34. />
  35. </div>
  36. </div>
  37. </template>
  38. <script>
  39. export default {
  40. name: 'HomeView',
  41. data() {
  42. return {
  43. currentPage: 1,
  44. pageSize: 10,
  45. }
  46. },
  47. computed: {
  48. ...mapState([
  49. ]),
  50. },
  51. mounted() {
  52. console.log(process.env)
  53. this.$mitt.emit('test', { msg: 'home mounted' })
  54. },
  55. unmounted() {
  56. },
  57. methods: {
  58. ...mapMutations([
  59. ]),
  60. onClickItem(item) {
  61. this.$router.push({ name: 'RelicDetail' })
  62. }
  63. },
  64. }
  65. </script>
  66. <style lang="less" scoped>
  67. .home {
  68. width: 100%;
  69. height: 100%;
  70. .containers {
  71. padding-top: 40px;
  72. width: 100vw;
  73. max-width: 1080px;
  74. /* height: 100vh; */
  75. background-color: #285b5e;
  76. /* overflow: hidden; */
  77. height: 100%;
  78. margin: 0 auto;
  79. padding-bottom: 50px;
  80. position: relative;
  81. > .title {
  82. letter-spacing: 4px;
  83. margin: 0 auto;
  84. color: #fff;
  85. display: flex;
  86. justify-content: center;
  87. align-items: center;
  88. width: 270px;
  89. height: 50px;
  90. background: url('@/assets/images/titleBac.png') no-repeat center;
  91. background-size: 100% 100%;
  92. }
  93. > ul {
  94. width: 100%;
  95. height: calc(100% - 80px);
  96. padding-top: 30px;
  97. padding-left: 20px;
  98. display: flex;
  99. flex-wrap: wrap;
  100. align-content: start;
  101. overflow: auto;
  102. > li {
  103. display: inline-block;
  104. width: calc((100% - 20px * 4) / 3 - 1px);
  105. margin-right: 20px;
  106. margin-bottom: 20px;
  107. cursor: pointer;
  108. transition: all 0.3s;
  109. &:hover {
  110. transform: translateY(-10px);
  111. }
  112. > img {
  113. width: 100%;
  114. padding: 10px;
  115. background: url(@/assets/images/divBac.png);
  116. background-size: 100% 100%;
  117. box-shadow: 1px 1px 5px rgba(0, 0, 0, 0.4);
  118. }
  119. > .title {
  120. color: #fff;
  121. margin-top: 10px;
  122. font-size: 16px;
  123. font-weight: 100;
  124. text-align: center;
  125. }
  126. }
  127. }
  128. .pagination {
  129. position: absolute;
  130. left: 50%;
  131. bottom: 10px;
  132. transform: translateX(-50%);
  133. }
  134. }
  135. }
  136. @media screen and (max-width: 600px) {
  137. }
  138. </style>