App.vue 2.2 KB

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