NormalHomePage.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. name: 'NormalHomePage',
  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: '/database/article',
  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 > 1 && !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-top {
  128. height: 360px;
  129. @include themify($themes) {
  130. background: themed('pc-banner-home');
  131. background-size: auto 360px;
  132. }
  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. @include themify($themes) {
  171. background-image: themed('pc-icon-home-edit');
  172. }
  173. }
  174. &.item1 {
  175. @include themify($themes) {
  176. background-image: themed('pc-icon-home-approve');
  177. }
  178. }
  179. &.item2 {
  180. @include themify($themes) {
  181. background-image: themed('pc-icon-home-doc');
  182. }
  183. }
  184. &.item3 {
  185. @include themify($themes) {
  186. background-image: themed('pc-icon-home-feedback');
  187. }
  188. }
  189. }
  190. &:hover {
  191. transform: translateY(-10px);
  192. @include themify($themes) {
  193. background-color: themed('color');
  194. }
  195. .icon-image {
  196. &.item0 {
  197. background-image: url(~assets/theme-images/common/pc-icon-edit-active.png) !important;
  198. }
  199. &.item1 {
  200. background-image: url(~assets/theme-images/common/pc-icon-approve-active.png) !important;
  201. }
  202. &.item2 {
  203. background-image: url(~assets/theme-images/common/pc-icon-doc-active.png) !important;
  204. }
  205. &.item3 {
  206. background-image: url(~assets/theme-images/common/pc-icon-feedback-active.png) !important;
  207. }
  208. }
  209. .name {
  210. color: #fff;
  211. }
  212. }
  213. .icon {
  214. width: 86px;
  215. height: 86px;
  216. }
  217. .name {
  218. font-size: 24px;
  219. color: #404040;
  220. }
  221. }
  222. }
  223. }
  224. // 移动 端
  225. @media screen and (max-width: 768px) {
  226. .page-top {
  227. height: 46vw;
  228. @include themify($themes) {
  229. background: themed('h5-banner-home');
  230. background-size: auto 46vw;
  231. }
  232. .logo {
  233. display: block;
  234. width: 14.8vw;
  235. height: 14.8vw;
  236. border-radius: 50%;
  237. background: #fff;
  238. }
  239. .name {
  240. font-size: 4vw;
  241. color: #fff;
  242. }
  243. }
  244. .page-content {
  245. .section {
  246. width: 85.6vw;
  247. height: 58vw;
  248. margin-left: auto;
  249. margin-right: auto;
  250. box-shadow: 0px 0.4vw 2vw rgba(0, 6, 32, 0.08);
  251. border-radius: 4px;
  252. .icon {
  253. width: 20vw;
  254. height: 20vw;
  255. }
  256. .name {
  257. font-size: 4.8vw;
  258. color: #404040;
  259. }
  260. .icon-image {
  261. width: 86px;
  262. height: 86px;
  263. background-size: 86px 86px;
  264. background-repeat: no-repeat;
  265. background-position: center;
  266. &.item0 {
  267. @include themify($themes) {
  268. background-image: themed('h5-icon-home-edit');
  269. }
  270. }
  271. &.item1 {
  272. @include themify($themes) {
  273. background-image: themed('h5-icon-home-approve');
  274. }
  275. }
  276. &.item2 {
  277. @include themify($themes) {
  278. background-image: themed('h5-icon-home-doc');
  279. }
  280. }
  281. &.item3 {
  282. @include themify($themes) {
  283. background-image: themed('h5-icon-home-feedback');
  284. }
  285. }
  286. }
  287. }
  288. }
  289. }
  290. </style>