index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <div class="page">
  3. <div class="page-top"></div>
  4. <div class="page-content">
  5. <keep-alive>
  6. <div class="list">
  7. <div
  8. class="section flex flex-col justify-center items-center rounded-md"
  9. v-for="item in list"
  10. :key="item.id"
  11. >
  12. <icon-image class="icon" :name="item.image"></icon-image>
  13. <div
  14. class="name mt-4"
  15. v-text="item.name"
  16. @click="toDetail(item)"
  17. ></div>
  18. </div>
  19. </div>
  20. </keep-alive>
  21. </div>
  22. <div class="page-footer flex flex-col justify-center">
  23. <div class="name mb-1">需要帮助吗?</div>
  24. <div class="contact">联系我们 +86 1382160616</div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. import { toAuthorization } from '~/utils'
  30. import { isWeChat } from '~/utils/validator'
  31. import { mapGetters } from 'vuex'
  32. export default {
  33. layout: 'app-ldm',
  34. data() {
  35. return {
  36. list: [],
  37. }
  38. },
  39. asyncData() {
  40. return {
  41. list: [
  42. {
  43. id: 0,
  44. name: '正品授权',
  45. image: 'ldm-icon-approve.png',
  46. path: '/approve',
  47. },
  48. {
  49. id: 1,
  50. name: '官方产品资料',
  51. image: 'ldm-icon-database.png',
  52. path: '/database/package',
  53. },
  54. ],
  55. }
  56. },
  57. computed: {
  58. ...mapGetters(['authUserId', 'appId', 'routePrefix', 'accountType']),
  59. },
  60. methods: {
  61. toDetail(item) {
  62. const hasLogin = this.$store.getters.accessToken
  63. if (item.id > 0 && !hasLogin) {
  64. // 在微信浏览器中使用微信授权登录
  65. if (isWeChat() && this.appId && this.accountType === 2) {
  66. const payload = { authUserId: this.authUserId, type: this.type }
  67. return toAuthorization(this.appId, payload)
  68. }
  69. this.$toast({ message: '请先登录', duration: 1000 })
  70. this.$store.commit('app/SHOW_LOGIN')
  71. return
  72. }
  73. const url = this.routePrefix + item.path
  74. this.$router.push(url)
  75. },
  76. },
  77. }
  78. </script>
  79. <style scoped lang="scss">
  80. @media screen and (min-width: 768px) {
  81. .page-top {
  82. height: 596px;
  83. background: url(https://static.caimei365.com/www/authentic/pc/ldm-bg-home.png)
  84. no-repeat center;
  85. background-size: auto 596px;
  86. }
  87. .page-content {
  88. width: 700px;
  89. margin: 0 auto;
  90. min-height: calc(100vh - 596px - 100px);
  91. overflow: hidden;
  92. .list {
  93. display: flex;
  94. align-items: center;
  95. justify-content: space-between;
  96. margin-top: 124px;
  97. margin-bottom: 314px;
  98. .section {
  99. .icon {
  100. width: 120px;
  101. height: 120px;
  102. }
  103. .name {
  104. width: 241px;
  105. height: 73px;
  106. background: #000;
  107. text-align: center;
  108. line-height: 73px;
  109. color: #fff;
  110. font-size: 22px;
  111. cursor: pointer;
  112. }
  113. }
  114. }
  115. }
  116. .page-footer {
  117. position: relative;
  118. height: 100px;
  119. padding-left: 194px;
  120. background: linear-gradient(to bottom, #f1f1f1, #fdfdfd, #f1f1f1);
  121. .name {
  122. font-size: 24px;
  123. color: #9d9d9d;
  124. }
  125. .contact {
  126. font-size: 19px;
  127. color: #9d9d9d;
  128. }
  129. &::before {
  130. position: absolute;
  131. left: 120px;
  132. top: 50%;
  133. transform: translateY(-50%);
  134. content: '';
  135. display: block;
  136. width: 56px;
  137. height: 56px;
  138. background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-contact1.png)
  139. no-repeat center;
  140. background-size: 56px auto;
  141. }
  142. }
  143. }
  144. @media screen and (max-width: 768px) {
  145. .page-top {
  146. height: 59.6vw;
  147. background: url(https://static.caimei365.com/www/authentic/h5/ldm-bg-home.png);
  148. background-size: auto 59.6vw;
  149. }
  150. .page-content {
  151. min-height: calc(100vh - 59.6vw - 15.4vw);
  152. overflow: hidden;
  153. .list {
  154. display: flex;
  155. flex-direction: column;
  156. align-items: center;
  157. margin-top: 10.9vw;
  158. .section {
  159. width: 80vw;
  160. height: 48vw;
  161. background: #f8f8f8;
  162. border: 0.1vw solid #bfbfbf;
  163. margin-bottom: 5.8vw;
  164. .icon {
  165. width: 18.9vw;
  166. height: 18.9vw;
  167. }
  168. .name {
  169. width: 37.8vw;
  170. height: 11.4vw;
  171. background: #000;
  172. text-align: center;
  173. line-height: 11.4vw;
  174. color: #fff;
  175. }
  176. }
  177. }
  178. }
  179. .page-footer {
  180. position: relative;
  181. height: 15.4vw;
  182. padding-left: 12.5vw;
  183. background: linear-gradient(to bottom, #f1f1f1, #fdfdfd, #f1f1f1);
  184. .name {
  185. font-size: 3.2vw;
  186. color: #9d9d9d;
  187. }
  188. .contact {
  189. font-size: 2.6vw;
  190. color: #9d9d9d;
  191. }
  192. &::before {
  193. position: absolute;
  194. left: 2.4vw;
  195. top: 50%;
  196. transform: translateY(-50%);
  197. content: '';
  198. display: block;
  199. width: 7.5vw;
  200. height: 7.5vw;
  201. background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-contact1.png)
  202. no-repeat center;
  203. background-size: 7.4vw auto;
  204. }
  205. }
  206. }
  207. </style>