MobileFooter.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <div class="mobile-footer" :class="InputGetFocus ? 'active': ''">
  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="{'active': activeType == 'userCenter'}">
  20. <a @click="goWithLogin('/mobile/center?type=buyer')">
  21. <img :src="`/images/mobile/@2x/home/userCenter${activeType === 'userCenter' ? '-active' : ''}.png`" alt="">
  22. <p>买家中心</p>
  23. </a>
  24. </span>
  25. <span :class="{'active': activeType == 'vendorCenter'}">
  26. <a @click="goWithLogin('/mobile/center?type=saler')">
  27. <img :src="`/images/mobile/@2x/home/vendorCenter${activeType === 'vendorCenter' ? '-active' : ''}.png`" alt="">
  28. <p>卖家中心</p>
  29. </a>
  30. </span>
  31. <span :class="activeType=='user'?'active':''">
  32. <a @click="goWithLogin('/mobile/user?type=buyer')">
  33. <i :class="activeType=='user'?'iconfont icon-icon':'iconfont icon-wo'"></i><p>我</p>
  34. </a>
  35. </span>
  36. <a @click="toTop" v-show="!hideToTop"><i class="iconfont icon-arrow-up icon-xlg"></i></a>
  37. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  38. <!--<publish-seek :showSayPriceBox="showSayPriceBox" @cancelAction="showSayPriceBox = false" @reloadAction="onReload" @remindAction="onRemind"></publish-seek>-->
  39. <!--<remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>-->
  40. </div>
  41. </template>
  42. <script>
  43. import { scrollTo } from '~utils/scroll'
  44. import {LoginBox} from '~components/mobile/common'
  45. // import PublishSeek from './applyPurchase/PublishSeek.vue'
  46. export default{
  47. name: 'MobileFooter',
  48. data () {
  49. return {
  50. hideToTop: true,
  51. showLoginBox: false
  52. // showSayPriceBox: false,
  53. // remindText: '',
  54. // timeoutCount: 0
  55. }
  56. },
  57. components: {
  58. LoginBox
  59. // PublishSeek,
  60. // RemindBox
  61. },
  62. computed: {
  63. InputGetFocus() {
  64. return this.$store.state.mobile.InputGetFocus
  65. },
  66. activeType () {
  67. let path = this.$route.path
  68. if (path === '/') {
  69. return 'home'
  70. } else if (path === '/mobile/shop') {
  71. return 'shops'
  72. } else if (path === '/mobile/user') {
  73. return 'user'
  74. } else if (path === '/mobile/center') {
  75. if (this.$route.query.type === 'saler') {
  76. return 'vendorCenter'
  77. } else {
  78. return 'userCenter'
  79. }
  80. } else {
  81. return 'home'
  82. }
  83. },
  84. user () {
  85. return this.$store.state.option.user
  86. }
  87. },
  88. mounted: function () {
  89. this.$nextTick(function () {
  90. window.addEventListener('scroll', this.onScroll)
  91. })
  92. },
  93. methods: {
  94. onScroll () {
  95. let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
  96. if (scrolled > window.screen.availHeight) {
  97. this.hideToTop = false
  98. } else {
  99. this.hideToTop = true
  100. }
  101. },
  102. toTop () {
  103. scrollTo('body', 300)
  104. },
  105. goWithLogin: function (url) {
  106. if (this.user.logged) {
  107. this.$router.push(url)
  108. } else {
  109. this.showLoginBox = true
  110. }
  111. },
  112. // onReload: function () {
  113. // const path = this.$route.path
  114. // if (path === '/') {
  115. // this.$store.dispatch('applyPurchase/loadMobileHomeList', {pageNumber: 1, pageSize: 5, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  116. // } else if (path === '/mobile/applyPurchase/list') {
  117. // this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: 1, pageSize: 10, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  118. // }
  119. // },
  120. goSayPrice: function () {
  121. if (this.user.logged) {
  122. this.showSayPriceBox = true
  123. } else {
  124. this.showLoginBox = true
  125. }
  126. }
  127. // onRemind: function (str) {
  128. // this.remindText = str
  129. // this.timeoutCount ++
  130. // }
  131. }
  132. }
  133. </script>
  134. <style scoped lang="scss">
  135. .mobile-footer{
  136. position:fixed;
  137. bottom:0;
  138. width:100%;
  139. height:.98rem;
  140. text-align: center;
  141. border-top:.02rem solid #ccc;
  142. background: #ffffff;
  143. z-index: 10;
  144. &.active{
  145. position: relative;
  146. }
  147. }
  148. .mobile-footer > span{
  149. display: inline-block;
  150. width: 25%;
  151. font-size:.32rem;
  152. color:#b0b0b0;
  153. padding-top:.1rem;
  154. }
  155. .mobile-footer > span a{
  156. color:#b0b0b0;
  157. }
  158. .mobile-footer > span a i{
  159. font-size:.45rem;
  160. }
  161. .mobile-footer > span a p{
  162. font-size:.22rem;
  163. }
  164. .mobile-footer > span a img{
  165. width: .46rem;
  166. }
  167. .mobile-footer > span.active a{
  168. color:#3976f4;
  169. }
  170. .mobile-footer > a {
  171. position: absolute;
  172. right: .1rem;
  173. top: -1rem;
  174. background: rgba(0,0,0,.4);
  175. color: #fff;
  176. width: .88rem;
  177. height: .88rem;
  178. line-height: .88rem;
  179. border-radius: 100%;
  180. }
  181. .mobile-footer >a i{
  182. font-size: .46rem;
  183. }
  184. .mobile-footer > span.seek {
  185. width: 3.5rem;
  186. position: relative;
  187. }
  188. .mobile-footer > span.seek img {
  189. position: absolute;
  190. width: 1.3rem;
  191. height: 1.3rem;
  192. top: -1.3rem;
  193. right: 1.1rem;
  194. }
  195. </style>