index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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: '/app/approve',
  49. active: false,
  50. },
  51. {
  52. id: 1,
  53. name: '资料库',
  54. image: 'icon-doc.png',
  55. hover: 'icon-doc-active.png',
  56. path: '/app/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: '/app/feedback',
  65. active: false,
  66. },
  67. ],
  68. }
  69. },
  70. computed: {
  71. ...mapGetters(['supplierInfo', 'authUserId']),
  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. const url = `/${this.authUserId}${item.path}`
  83. this.$router.push(url)
  84. },
  85. onMouseover(item) {
  86. const isPc = this.$store.getters.isPc
  87. if (!isPc) return
  88. item.active = true
  89. },
  90. onMouselevel(item) {
  91. const isPc = this.$store.getters.isPc
  92. if (!isPc) return
  93. item.active = false
  94. },
  95. },
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. // pc 端
  100. @media screen and (min-width: 768px) {
  101. .page-top {
  102. height: 360px;
  103. background: url(https://static.caimei365.com/www/authentic/pc/bg-home.png);
  104. background-size: auto 360px;
  105. .logo {
  106. display: block;
  107. width: 120px;
  108. height: 120px;
  109. border-radius: 50%;
  110. }
  111. .name {
  112. font-size: 30px;
  113. color: #fff;
  114. }
  115. }
  116. .page-content {
  117. width: 1200px;
  118. margin: 0 auto;
  119. overflow: hidden;
  120. .list {
  121. display: flex;
  122. justify-content: space-between;
  123. align-items: center;
  124. }
  125. .section {
  126. width: 380px;
  127. height: 260px;
  128. margin-left: auto;
  129. margin-right: auto;
  130. background-color: #fff;
  131. transition: all 0.4s;
  132. cursor: pointer;
  133. &:hover {
  134. background-color: #bc1724;
  135. transform: translateY(-10px);
  136. .name {
  137. color: #fff;
  138. }
  139. }
  140. .icon {
  141. width: 86px;
  142. height: 86px;
  143. }
  144. .name {
  145. font-size: 24px;
  146. color: #404040;
  147. }
  148. }
  149. }
  150. }
  151. // 移动 端
  152. @media screen and (max-width: 768px) {
  153. .page-top {
  154. height: 46vw;
  155. background: url(https://static.caimei365.com/www/authentic/h5/bg-home.png);
  156. background-size: auto 46vw;
  157. .logo {
  158. display: block;
  159. width: 14.8vw;
  160. height: 14.8vw;
  161. border-radius: 50%;
  162. }
  163. .name {
  164. font-size: 4vw;
  165. color: #fff;
  166. }
  167. }
  168. .page-content {
  169. .section {
  170. width: 85.6vw;
  171. height: 58vw;
  172. margin-left: auto;
  173. margin-right: auto;
  174. box-shadow: 0px 0.4vw 2vw rgba(0, 6, 32, 0.08);
  175. .icon {
  176. width: 20vw;
  177. height: 20vw;
  178. }
  179. .name {
  180. font-size: 4.8vw;
  181. color: #404040;
  182. }
  183. }
  184. }
  185. }
  186. </style>