MobileFooter.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <div class="mobile-footer">
  3. <span :class="activeType=='home'?'active':''">
  4. <nuxt-link to="/">
  5. <i :class="activeType=='home'?'iconfont icon-shouye':'iconfont icon-shouye1'"></i><p>首页</p>
  6. </nuxt-link>
  7. </span>
  8. <!--<span :class="activeType=='shops'?'active':''">
  9. <nuxt-link to="/mobile/shop">
  10. <i :class="activeType=='shops'?'iconfont icon-dianpu':'iconfont icon-dianpu1'"></i><p>店铺</p>
  11. </nuxt-link>
  12. </span>-->
  13. <span class="seek" @click="goSayPrice">
  14. <a>
  15. <img src="/images/mobile/@2x/applyPurchase/home/seek-footer.png" alt="">
  16. <p>发布求购</p>
  17. </a>
  18. </span>
  19. <span :class="activeType=='user'?'active':''">
  20. <a @click="goCollect">
  21. <i :class="activeType=='user'?'iconfont icon-icon':'iconfont icon-wo'"></i><p>我</p>
  22. </a>
  23. </span>
  24. <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
  25. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  26. <publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload()"></publish-seek>
  27. </div>
  28. </template>
  29. <script>
  30. import { scrollTo } from '~utils/scroll'
  31. import {LoginBox} from '~components/mobile/common'
  32. import PublishSeek from './applyPurchase/PublishSeek.vue'
  33. export default{
  34. name: 'MobileFooter',
  35. data () {
  36. return {
  37. hideToTop: true,
  38. showLoginBox: false,
  39. showSayPriceBox: false
  40. }
  41. },
  42. components: {
  43. LoginBox,
  44. PublishSeek
  45. },
  46. computed: {
  47. activeType () {
  48. return this.$route.path === '/' ? 'home' : this.$route.path === '/mobile/shop' ? 'shops' : this.$route.path === '/mobile/user' ? 'user' : ''
  49. },
  50. user () {
  51. return this.$store.state.option.user
  52. }
  53. },
  54. mounted: function () {
  55. this.$nextTick(function () {
  56. window.addEventListener('scroll', this.onScroll)
  57. })
  58. },
  59. methods: {
  60. onScroll () {
  61. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  62. if (scrolled > window.screen.availHeight) {
  63. this.hideToTop = false
  64. } else {
  65. this.hideToTop = true
  66. }
  67. },
  68. toTop () {
  69. scrollTo('body', 300)
  70. },
  71. goCollect: function () {
  72. if (this.user.logged) {
  73. this.$router.push('/mobile/user')
  74. } else {
  75. this.showLoginBox = true
  76. }
  77. },
  78. onReload: function () {
  79. const path = this.$route.path
  80. if (path === '/') {
  81. this.$store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: 1, pageSize: 5, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  82. } else if (path === '/mobile/applyPurchase/list') {
  83. this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  84. }
  85. },
  86. goSayPrice: function () {
  87. if (this.user.logged) {
  88. this.showSayPriceBox = true
  89. } else {
  90. this.showLoginBox = true
  91. }
  92. }
  93. }
  94. }
  95. </script>
  96. <style scoped lang="scss">
  97. .mobile-footer{
  98. position:fixed;
  99. bottom:0;
  100. width:100%;
  101. height:.98rem;
  102. text-align: center;
  103. border-top:.04rem solid #ccc;
  104. background: #ffffff;
  105. z-index: 10;
  106. }
  107. .mobile-footer > span{
  108. display: inline-block;
  109. width: 2rem;
  110. font-size:.32rem;
  111. color:#b0b0b0;
  112. padding-top:.1rem;
  113. }
  114. .mobile-footer > span a{
  115. color:#b0b0b0;
  116. }
  117. .mobile-footer > span a i{
  118. font-size:.45rem;
  119. }
  120. .mobile-footer > span a p{
  121. font-size:.22rem;
  122. }
  123. .mobile-footer > span.active a{
  124. color:#3976f4;
  125. }
  126. .mobile-footer > a {
  127. position: absolute;
  128. right: .1rem;
  129. top: -1rem;
  130. background: rgba(0,0,0,.4);
  131. color: #fff;
  132. width: .88rem;
  133. height: .88rem;
  134. line-height: .88rem;
  135. border-radius: 100%;
  136. }
  137. .mobile-footer >a i{
  138. font-size: .46rem;
  139. }
  140. .mobile-footer > span.seek {
  141. width: 3.5rem;
  142. position: relative;
  143. }
  144. .mobile-footer > span.seek img {
  145. position: absolute;
  146. width: 1.3rem;
  147. height: 1.3rem;
  148. top: -1.3rem;
  149. right: 1.1rem;
  150. }
  151. </style>