index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div class="page">
  3. <div class="page-top flex flex-col justify-center items-center">
  4. <img class="logo" :src="supplierInfo.logo" />
  5. <div class="name mt-2" v-text="supplierInfo.shopName"></div>
  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. import { mapGetters } from 'vuex'
  33. export default {
  34. layout: 'app',
  35. data() {
  36. return {
  37. list: [],
  38. }
  39. },
  40. asyncData() {
  41. return {
  42. list: [
  43. {
  44. id: 0,
  45. name: '授权认证',
  46. image: 'icon-approve.png',
  47. hover: 'icon-approve-active.png',
  48. path: '/ph/approve',
  49. active: false,
  50. },
  51. {
  52. id: 1,
  53. name: '资料库',
  54. image: 'icon-doc.png',
  55. hover: 'icon-doc-active.png',
  56. path: '/ph/database/article',
  57. active: false,
  58. },
  59. {
  60. id: 2,
  61. name: '意见反馈',
  62. image: 'icon-feedback.png',
  63. hover: 'icon-feedback-active.png',
  64. path: '/ph/feedback',
  65. active: false,
  66. },
  67. ],
  68. }
  69. },
  70. computed: {
  71. ...mapGetters(['supplierInfo']),
  72. },
  73. created() {},
  74. methods: {
  75. toDetail(item) {
  76. const hasLogin = this.$store.getters.accessToken
  77. if (item.id > 0 && !hasLogin) {
  78. this.$toast({ message: '请先登录', duration: 1000 })
  79. this.$store.commit('app/SHOW_LOGIN')
  80. return
  81. }
  82. this.$router.push(item.path)
  83. },
  84. onMouseover(item) {
  85. const isPc = this.$store.getters.isPc
  86. if (!isPc) return
  87. item.active = true
  88. },
  89. onMouselevel(item) {
  90. const isPc = this.$store.getters.isPc
  91. if (!isPc) return
  92. item.active = false
  93. },
  94. },
  95. }
  96. </script>
  97. <style scoped lang="scss">
  98. // pc 端
  99. @media screen and (min-width: 768px) {
  100. .page-top {
  101. height: 360px;
  102. background: url(https://static.caimei365.com/www/authentic/pc/bg-home.png);
  103. background-size: auto 360px;
  104. .logo {
  105. display: block;
  106. width: 120px;
  107. height: 120px;
  108. border-radius: 50%;
  109. }
  110. .name {
  111. font-size: 30px;
  112. color: #fff;
  113. }
  114. }
  115. .page-content {
  116. width: 1200px;
  117. margin: 0 auto;
  118. overflow: hidden;
  119. .list {
  120. display: flex;
  121. justify-content: space-between;
  122. align-items: center;
  123. }
  124. .section {
  125. width: 380px;
  126. height: 260px;
  127. margin-left: auto;
  128. margin-right: auto;
  129. background-color: #fff;
  130. transition: all 0.4s;
  131. cursor: pointer;
  132. &:hover {
  133. background-color: #bc1724;
  134. transform: translateY(-10px);
  135. .name {
  136. color: #fff;
  137. }
  138. }
  139. .icon {
  140. width: 86px;
  141. height: 86px;
  142. }
  143. .name {
  144. font-size: 24px;
  145. color: #404040;
  146. }
  147. }
  148. }
  149. }
  150. // 移动 端
  151. @media screen and (max-width: 768px) {
  152. .page-top {
  153. height: 46vw;
  154. background: url(https://static.caimei365.com/www/authentic/h5/bg-home.png);
  155. background-size: auto 46vw;
  156. .logo {
  157. display: block;
  158. width: 14.8vw;
  159. height: 14.8vw;
  160. border-radius: 50%;
  161. }
  162. .name {
  163. font-size: 4vw;
  164. color: #fff;
  165. }
  166. }
  167. .page-content {
  168. .section {
  169. width: 85.6vw;
  170. height: 58vw;
  171. margin-left: auto;
  172. margin-right: auto;
  173. box-shadow: 0px 0.4vw 2vw rgba(0, 6, 32, 0.08);
  174. .icon {
  175. width: 20vw;
  176. height: 20vw;
  177. }
  178. .name {
  179. font-size: 4.8vw;
  180. color: #404040;
  181. }
  182. }
  183. }
  184. }
  185. </style>