App.vue 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <div>
  3. <keep-alive>
  4. <router-view v-if="$route.meta.keepAlive"/>
  5. </keep-alive>
  6. <router-view v-if="!$route.meta.keepAlive"/>
  7. <van-tabbar
  8. :placeholder="true"
  9. z-index="50"
  10. v-model="active"
  11. v-if="$route.meta.showTabbar">
  12. <van-tabbar-item replace to="/" icon="wap-home-o" name="MarketingSave">首页</van-tabbar-item>
  13. <van-tabbar-item to="/category" icon="shop-o" name="CategoryIndex">购物</van-tabbar-item>
  14. <van-tabbar-item replace to="/invite" icon="gold-coin-o" name="Invite">分享赚钱</van-tabbar-item>
  15. <van-tabbar-item replace to="/mine" icon="user-o" name="Mine">我的</van-tabbar-item>
  16. </van-tabbar>
  17. </div>
  18. </template>
  19. <script>
  20. import { Tabbar, TabbarItem } from 'vant'
  21. import { platform } from './utils/platform'
  22. import funWxShare from './utils/wxShare0.0'
  23. export default {
  24. name: 'App',
  25. components: {
  26. 'van-tabbar': Tabbar,
  27. 'van-tabbar-item': TabbarItem
  28. },
  29. data () {
  30. return {
  31. shareImg: require('./views/recommend/image/share.png'),
  32. active: 'MarketingSave'
  33. }
  34. },
  35. watch: {
  36. '$route.name': {
  37. handler: function (newVal) {
  38. const condition = ['PaymentCode', 'ShareMiddle', 'CategoryIndex', 'CategoryDetail', 'Search'].findIndex(item => item === newVal) === -1
  39. if (!newVal) {
  40. return
  41. }
  42. if (['MarketingReturn', 'MarketingMake'].findIndex(item => item === newVal) > -1) {
  43. this.active = 'MarketingSave'
  44. } else {
  45. this.active = newVal
  46. }
  47. // 为中转页的时候不调用
  48. if (!this.$store.getters['common/isInit'] && condition) {
  49. this.$store.dispatch('common/getUserInfo')
  50. this.$store.dispatch('common/getOrdertype')
  51. this.$store.commit('common/UPDATE_ISINIT', true)
  52. }
  53. },
  54. immediate: true
  55. }
  56. },
  57. created () {
  58. platform.isWeixin && funWxShare('返不停', '一个省钱、赚钱又返钱的生活平台', `${location.origin}/img/share.png`, `${location.origin}`)
  59. }
  60. }
  61. </script>
  62. <style lang="scss">
  63. @import "./assets/styles/reset";
  64. @import "./assets/styles/shop.css";
  65. body {
  66. background: #F7F6F9;
  67. }
  68. .clearfix {
  69. display: inline-block;
  70. &:after {
  71. display: block;
  72. content: ".";
  73. height: 0;
  74. line-height: 0;
  75. clear: both;
  76. visibility: hidden;
  77. }
  78. }
  79. </style>