index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <div class="homePage" ref="homePage">
  3. <van-nav-bar class="navBar" left-arrow title="门店拜访" @click-left="onClickLeft" />
  4. <van-tabs class="myTab" type="card" v-model="tabVal" color="#0057ba" @click="onClickTabs">
  5. <van-tab title="提示类" name="-1">
  6. <hintTabPage :tabVal="tabVal" ref="hintTabPage"></hintTabPage
  7. ></van-tab>
  8. <van-tab title="A类指标" name="0"
  9. ><ABtarget :tabVal="tabVal" ref="Atarget"></ABtarget
  10. ></van-tab>
  11. <van-tab title="B类指标" name="1"
  12. ><ABtarget :tabVal="tabVal" ref="Btarget"></ABtarget
  13. ></van-tab>
  14. </van-tabs>
  15. <!-- <van-dialog v-model="shows" @confirm="titleconfirm">
  16. <div class="tipTitleBox" style="padding: 10px">
  17. <p class="p">系统提示</p>
  18. <p>各位好,因五一假期,汇报提交时间有调整。</p>
  19. <div style="font-size: 14px">
  20. <p style="margin-bottom: 6px; line-height: 20px">1、5月1-3日,销售员无需提交日报。</p>
  21. <p style="margin-bottom: 6px; line-height: 20px">
  22. 2、销售部主管周报提交时间改为4月27日-30日。
  23. </p>
  24. <p>3、大区主管半月报提交时间改为5月4日-7日。</p>
  25. </div>
  26. <br />
  27. <p style="text-align: right">祝大家假期愉快!</p>
  28. </div>
  29. </van-dialog> -->
  30. <tab-bar></tab-bar>
  31. </div>
  32. </template>
  33. <script>
  34. import hintTabPage from './hintTabPage/index.vue';
  35. import tabBar from '@/components/tabBar';
  36. import ABtarget from './ABtarget.vue';
  37. import { mapState } from 'vuex';
  38. export default {
  39. name: 'home',
  40. components: { tabBar, hintTabPage, ABtarget },
  41. computed: {
  42. ...mapState({
  43. userInfo: (state) => state.user.userInfo,
  44. }),
  45. },
  46. data() {
  47. return {
  48. tabVal: '-1',
  49. hintTabPageIndex: 0,
  50. };
  51. },
  52. watch: {
  53. // 监听切换用户
  54. 'userInfo.userName': {
  55. handler(val) {
  56. this.tabVal = '-1';
  57. },
  58. immediete: true,
  59. },
  60. },
  61. activated() {
  62. // 从其他页面跳转过来如果;要重新获取对应tab数据
  63. if (this.tabVal == '-1') {
  64. if (this.$refs.hintTabPage) this.$refs.hintTabPage.initData();
  65. } else if (this.tabVal == '0') {
  66. if (this.$refs.Atarget) this.$refs.Atarget.initData();
  67. } else if (this.tabVal == '1') {
  68. if (this.$refs.Btarget) this.$refs.Btarget.initData();
  69. }
  70. },
  71. mounted() {
  72. if (this.$refs.Atarget) this.$refs.Atarget.initData();
  73. },
  74. methods: {
  75. onClickTabs(val) {
  76. // this.$refs.homePage.scrollTop = 0;
  77. // document.getElementById('app').scrollTop = 0;
  78. },
  79. onClickLeft() {
  80. this.$router.go(-1);
  81. // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
  82. },
  83. },
  84. };
  85. </script>
  86. <style scoped lang="scss">
  87. #app {
  88. width: 100%;
  89. height: 100%;
  90. overflow: hidden;
  91. .bgcolor {
  92. width: 100%;
  93. height: 100%;
  94. .homePage {
  95. width: 100%;
  96. height: 100%;
  97. /* overflow-y: auto; */
  98. }
  99. }
  100. }
  101. </style>
  102. <style lang="scss">
  103. .homePage {
  104. display: flex;
  105. flex-direction: column;
  106. .myTab {
  107. flex: 1;
  108. display: flex;
  109. flex-direction: column;
  110. position: sticky;
  111. top: 0px;
  112. .van-tabs__wrap {
  113. position: sticky;
  114. top: 0px;
  115. z-index: 10;
  116. }
  117. .van-tabs__content {
  118. flex: 1;
  119. margin-bottom: 50px;
  120. }
  121. }
  122. .myTab .van-tabs__nav--card {
  123. margin: 0 !important;
  124. border-left: 0;
  125. border-right: 0;
  126. }
  127. .myTab .van-tabs__wrap,
  128. .van-tabs__nav--card {
  129. height: 39px;
  130. }
  131. .myTab .van-tab {
  132. line-height: 40px;
  133. }
  134. }
  135. </style>