index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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"
  12. v-for="item in list"
  13. :key="item.id"
  14. @click="toDetail(item)"
  15. @mouseover="onMouseover(item)"
  16. @mouseleave="onMouselevel(item)"
  17. >
  18. <div class="icon-image" :class="'item' + item.id"></div>
  19. <div class="name mt-4" v-text="item.name"></div>
  20. </div>
  21. </div>
  22. </keep-alive>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import { mapGetters } from 'vuex'
  28. import { toAuthorization } from '~/utils'
  29. import { isWeChat } from '~/utils/validator'
  30. export default {
  31. layout: 'app-ph',
  32. data() {
  33. return {
  34. list: [],
  35. }
  36. },
  37. computed: {
  38. ...mapGetters([
  39. 'supplierInfo',
  40. 'authUserId',
  41. 'appId',
  42. 'routePrefix',
  43. 'accountType',
  44. ]),
  45. },
  46. created() {
  47. this.initEntryItems()
  48. },
  49. beforeDestroy() {
  50. this.$removeStorage(this.routePrefix, 'login_redicret')
  51. },
  52. methods: {
  53. // 初始化入口图标
  54. initEntryItems() {
  55. this.list = [
  56. {
  57. id: 0,
  58. name: '正品授权申请入口',
  59. path: '/form/club-register',
  60. active: false,
  61. },
  62. {
  63. id: 1,
  64. name: '正品授权',
  65. path: '/approve',
  66. active: false,
  67. },
  68. {
  69. id: 2,
  70. name: '资料库',
  71. path: '/docs/0',
  72. active: false,
  73. },
  74. {
  75. id: 3,
  76. name: '意见反馈',
  77. path: '/feedback',
  78. active: false,
  79. },
  80. ]
  81. },
  82. toDetail(item) {
  83. const hasLogin = this.$store.getters.accessToken
  84. // 保存登录重定向路由
  85. this.$setStorage(
  86. this.routePrefix,
  87. 'login_redicret',
  88. this.routePrefix + item.path
  89. )
  90. if (item.id > 2 && !hasLogin) {
  91. // 在微信浏览器中使用微信授权登录
  92. if (isWeChat() && this.appId && this.accountType === 2) {
  93. const payload = {
  94. authUserId: this.authUserId,
  95. routePrefix: this.routePrefix,
  96. }
  97. return toAuthorization(this.appId, payload)
  98. }
  99. this.$toast({ message: '请先登录', duration: 1000 })
  100. this.$store.commit('app/SHOW_LOGIN')
  101. return
  102. }
  103. if (item.id === 0) {
  104. const url = this.routePrefix + item.path
  105. this.$router.push(url)
  106. } else {
  107. const url = this.routePrefix + item.path
  108. this.$router.push(url)
  109. }
  110. },
  111. onMouseover(item) {
  112. const isPc = this.$store.getters.isPc
  113. if (!isPc) return
  114. item.active = true
  115. },
  116. onMouselevel(item) {
  117. const isPc = this.$store.getters.isPc
  118. if (!isPc) return
  119. item.active = false
  120. },
  121. },
  122. }
  123. </script>
  124. <style scoped lang="scss">
  125. // pc 端
  126. @media screen and (min-width: 768px) {
  127. .page {
  128. @include useTheme() {
  129. .page-top {
  130. height: 360px;
  131. background: fetch('pc-banner-home');
  132. background-size: auto 360px;
  133. .logo {
  134. display: block;
  135. width: 120px;
  136. height: 120px;
  137. border-radius: 50%;
  138. background: #fff;
  139. }
  140. .name {
  141. font-size: 30px;
  142. color: #fff;
  143. }
  144. }
  145. .page-content {
  146. width: 1200px;
  147. margin: 0 auto;
  148. overflow: hidden;
  149. .list {
  150. display: flex;
  151. justify-content: space-between;
  152. align-items: center;
  153. }
  154. .section {
  155. width: 284px;
  156. height: 260px;
  157. margin-left: auto;
  158. margin-right: auto;
  159. background-color: #fff;
  160. transition: all 0.4s;
  161. cursor: pointer;
  162. border-radius: 4px;
  163. .icon-image {
  164. width: 86px;
  165. height: 86px;
  166. background-size: 86px 86px;
  167. background-repeat: no-repeat;
  168. background-position: center;
  169. &.item0 {
  170. background-image: fetch('pc-icon-home-edit');
  171. }
  172. &.item1 {
  173. background-image: fetch('pc-icon-home-approve');
  174. }
  175. &.item2 {
  176. background-image: fetch('pc-icon-home-doc');
  177. }
  178. &.item3 {
  179. background-image: fetch('pc-icon-home-feedback');
  180. }
  181. }
  182. &:hover {
  183. transform: translateY(-10px);
  184. background-color: fetch('color');
  185. .icon-image {
  186. &.item0 {
  187. background-image: url(~assets/theme-images/common/pc-icon-edit-active.png) !important;
  188. }
  189. &.item1 {
  190. background-image: url(~assets/theme-images/common/pc-icon-approve-active.png) !important;
  191. }
  192. &.item2 {
  193. background-image: url(~assets/theme-images/common/pc-icon-doc-active.png) !important;
  194. }
  195. &.item3 {
  196. background-image: url(~assets/theme-images/common/pc-icon-feedback-active.png) !important;
  197. }
  198. }
  199. .name {
  200. color: #fff;
  201. }
  202. }
  203. .icon {
  204. width: 86px;
  205. height: 86px;
  206. }
  207. .name {
  208. font-size: 24px;
  209. color: #404040;
  210. }
  211. }
  212. }
  213. }
  214. }
  215. }
  216. // 移动 端
  217. @media screen and (max-width: 768px) {
  218. .page {
  219. @include useTheme() {
  220. .page-top {
  221. height: 46vw;
  222. background: fetch('h5-banner-home');
  223. background-size: auto 46vw;
  224. .logo {
  225. display: block;
  226. width: 14.8vw;
  227. height: 14.8vw;
  228. border-radius: 50%;
  229. background: #fff;
  230. }
  231. .name {
  232. font-size: 4vw;
  233. color: #fff;
  234. }
  235. }
  236. .page-content {
  237. .section {
  238. width: 85.6vw;
  239. height: 58vw;
  240. margin-left: auto;
  241. margin-right: auto;
  242. box-shadow: 0px 0.4vw 2vw rgba(0, 6, 32, 0.08);
  243. border-radius: 4px;
  244. .icon {
  245. width: 20vw;
  246. height: 20vw;
  247. }
  248. .name {
  249. font-size: 4.8vw;
  250. color: #404040;
  251. }
  252. .icon-image {
  253. width: 86px;
  254. height: 86px;
  255. background-size: 86px 86px;
  256. background-repeat: no-repeat;
  257. background-position: center;
  258. &.item0 {
  259. background-image: fetch('h5-icon-home-edit');
  260. }
  261. &.item1 {
  262. background-image: fetch('h5-icon-home-approve');
  263. }
  264. &.item2 {
  265. background-image: fetch('h5-icon-home-doc');
  266. }
  267. &.item3 {
  268. background-image: fetch('h5-icon-home-feedback');
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. }
  276. </style>