index.vue 5.6 KB

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