RossHomePage.vue 7.9 KB

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