index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="page">
  3. <div class="page-top flex flex-col justify-center items-center">
  4. <img class="logo" src="https://picsum.photos/200/200" />
  5. <span class="name mt-2">上海品辉医疗科技有限公司</span>
  6. </div>
  7. <div class="page-content">
  8. <keep-alive>
  9. <div class="list">
  10. <div
  11. class="section flex flex-col justify-center items-center mt-6 mb-6 rounded-md"
  12. v-for="item in list"
  13. :key="item.id"
  14. @click="toDetail(item)"
  15. @mouseover="onMouseover(item)"
  16. @mouseleave="onMouselevel(item)"
  17. >
  18. <icon-image
  19. class="icon"
  20. :name="item.image"
  21. v-if="!item.active"
  22. ></icon-image>
  23. <icon-image class="icon" :name="item.hover" v-else></icon-image>
  24. <div class="name mt-4" v-text="item.name"></div>
  25. </div>
  26. </div>
  27. </keep-alive>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. export default {
  33. layout: 'app',
  34. data() {
  35. return {
  36. list: [],
  37. }
  38. },
  39. asyncData() {
  40. return {
  41. list: [
  42. {
  43. id: 0,
  44. name: '授权认证',
  45. image: 'icon-approve.png',
  46. hover: 'icon-approve-active.png',
  47. path: '/ph/approve',
  48. active: false,
  49. },
  50. {
  51. id: 1,
  52. name: '资料库',
  53. image: 'icon-doc.png',
  54. hover: 'icon-doc-active.png',
  55. path: '/ph/database/article',
  56. active: false,
  57. },
  58. {
  59. id: 2,
  60. name: '意见反馈',
  61. image: 'icon-feedback.png',
  62. hover: 'icon-feedback-active.png',
  63. path: '/ph/feedback',
  64. active: false,
  65. },
  66. ],
  67. }
  68. },
  69. created() {},
  70. methods: {
  71. toDetail(item) {
  72. this.$router.push(item.path)
  73. },
  74. onMouseover(item) {
  75. const isPc = this.$store.getters.isPc
  76. if (!isPc) return
  77. item.active = true
  78. },
  79. onMouselevel(item) {
  80. const isPc = this.$store.getters.isPc
  81. if (!isPc) return
  82. item.active = false
  83. },
  84. },
  85. }
  86. </script>
  87. <style scoped lang="scss">
  88. // pc 端
  89. @media screen and (min-width: 768px) {
  90. .page-top {
  91. height: 360px;
  92. background: url(https://static.caimei365.com/www/authentic/pc/bg-home.png);
  93. background-size: auto 360px;
  94. .logo {
  95. display: block;
  96. width: 120px;
  97. height: 120px;
  98. border-radius: 50%;
  99. }
  100. .name {
  101. font-size: 30px;
  102. color: #fff;
  103. }
  104. }
  105. .page-content {
  106. width: 1200px;
  107. margin: 0 auto;
  108. overflow: hidden;
  109. .list {
  110. display: flex;
  111. justify-content: space-between;
  112. align-items: center;
  113. }
  114. .section {
  115. width: 380px;
  116. height: 260px;
  117. margin-left: auto;
  118. margin-right: auto;
  119. background-color: #fff;
  120. transition: all 0.4s;
  121. cursor: pointer;
  122. &:hover {
  123. background-color: #bc1724;
  124. transform: translateY(-10px);
  125. .name {
  126. color: #fff;
  127. }
  128. }
  129. .icon {
  130. width: 86px;
  131. height: 86px;
  132. }
  133. .name {
  134. font-size: 24px;
  135. color: #404040;
  136. }
  137. }
  138. }
  139. }
  140. // 移动 端
  141. @media screen and (max-width: 768px) {
  142. .page-top {
  143. height: 46vw;
  144. background: url(https://static.caimei365.com/www/authentic/h5/bg-home.png);
  145. background-size: auto 46vw;
  146. .logo {
  147. display: block;
  148. width: 14.8vw;
  149. height: 14.8vw;
  150. border-radius: 50%;
  151. }
  152. .name {
  153. font-size: 4vw;
  154. color: #fff;
  155. }
  156. }
  157. .page-content {
  158. .section {
  159. width: 85.6vw;
  160. height: 58vw;
  161. margin-left: auto;
  162. margin-right: auto;
  163. box-shadow: 0px 0.4vw 2vw rgba(0, 6, 32, 0.08);
  164. .icon {
  165. width: 20vw;
  166. height: 20vw;
  167. }
  168. .name {
  169. font-size: 4.8vw;
  170. color: #404040;
  171. }
  172. }
  173. }
  174. }
  175. </style>