index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. beforeDestroy() {
  61. this.$removeStorage(this.routePrefix, 'login_redicret')
  62. },
  63. methods: {
  64. toDetail(item) {
  65. // 保存登录重定向路由
  66. this.$setStorage(
  67. this.routePrefix,
  68. 'login_redicret',
  69. this.routePrefix + item.path
  70. )
  71. const hasLogin = this.$store.getters.accessToken
  72. if (item.id > 0 && !hasLogin) {
  73. // 在微信浏览器中使用微信授权登录
  74. if (isWeChat() && this.appId && this.accountType === 2) {
  75. const payload = { authUserId: this.authUserId, routePrefix: this.routePrefix }
  76. return toAuthorization(this.appId, payload)
  77. }
  78. this.$toast({ message: '请先登录', duration: 1000 })
  79. this.$store.commit('app/SHOW_LOGIN')
  80. return
  81. }
  82. const url = this.routePrefix + item.path
  83. this.$router.push(url)
  84. },
  85. },
  86. }
  87. </script>
  88. <style scoped lang="scss">
  89. @media screen and (min-width: 768px) {
  90. .page-top {
  91. height: 596px;
  92. background: url(https://static.caimei365.com/www/authentic/pc/ldm-bg-home.png)
  93. no-repeat center;
  94. background-size: auto 596px;
  95. }
  96. .page-content {
  97. width: 700px;
  98. margin: 0 auto;
  99. min-height: calc(100vh - 596px - 100px);
  100. overflow: hidden;
  101. .list {
  102. display: flex;
  103. align-items: center;
  104. justify-content: space-between;
  105. margin-top: 124px;
  106. margin-bottom: 314px;
  107. .section {
  108. .icon {
  109. width: 120px;
  110. height: 120px;
  111. }
  112. .name {
  113. width: 241px;
  114. height: 73px;
  115. background: #000;
  116. text-align: center;
  117. line-height: 73px;
  118. color: #fff;
  119. font-size: 22px;
  120. cursor: pointer;
  121. }
  122. }
  123. }
  124. }
  125. .page-footer {
  126. position: relative;
  127. height: 100px;
  128. padding-left: 194px;
  129. background: linear-gradient(to bottom, #f1f1f1, #fdfdfd, #f1f1f1);
  130. .name {
  131. font-size: 24px;
  132. color: #9d9d9d;
  133. }
  134. .contact {
  135. font-size: 19px;
  136. color: #9d9d9d;
  137. }
  138. &::before {
  139. position: absolute;
  140. left: 120px;
  141. top: 50%;
  142. transform: translateY(-50%);
  143. content: '';
  144. display: block;
  145. width: 56px;
  146. height: 56px;
  147. background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-contact1.png)
  148. no-repeat center;
  149. background-size: 56px auto;
  150. }
  151. }
  152. }
  153. @media screen and (max-width: 768px) {
  154. .page-top {
  155. height: 59.6vw;
  156. background: url(https://static.caimei365.com/www/authentic/h5/ldm-bg-home.png);
  157. background-size: auto 59.6vw;
  158. }
  159. .page-content {
  160. min-height: calc(100vh - 59.6vw - 15.4vw);
  161. overflow: hidden;
  162. .list {
  163. display: flex;
  164. flex-direction: column;
  165. align-items: center;
  166. margin-top: 10.9vw;
  167. .section {
  168. width: 80vw;
  169. height: 48vw;
  170. background: #f8f8f8;
  171. border: 0.1vw solid #bfbfbf;
  172. margin-bottom: 5.8vw;
  173. .icon {
  174. width: 18.9vw;
  175. height: 18.9vw;
  176. }
  177. .name {
  178. width: 37.8vw;
  179. height: 11.4vw;
  180. background: #000;
  181. text-align: center;
  182. line-height: 11.4vw;
  183. color: #fff;
  184. }
  185. }
  186. }
  187. }
  188. .page-footer {
  189. position: relative;
  190. height: 15.4vw;
  191. padding-left: 12.5vw;
  192. background: linear-gradient(to bottom, #f1f1f1, #fdfdfd, #f1f1f1);
  193. .name {
  194. font-size: 3.2vw;
  195. color: #9d9d9d;
  196. }
  197. .contact {
  198. font-size: 2.6vw;
  199. color: #9d9d9d;
  200. }
  201. &::before {
  202. position: absolute;
  203. left: 2.4vw;
  204. top: 50%;
  205. transform: translateY(-50%);
  206. content: '';
  207. display: block;
  208. width: 7.5vw;
  209. height: 7.5vw;
  210. background: url(https://static.caimei365.com/www/authentic/h5/ldm-icon-contact1.png)
  211. no-repeat center;
  212. background-size: 7.4vw auto;
  213. }
  214. }
  215. }
  216. </style>