good-floor.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="container floor clearfix" :style="{paddingTop:CustomBar+'px'}">
  3. <custom-floor :systeminfo='systeminfo'
  4. :navbar-data='nvabarData'
  5. :headerBtnPosi ="headerBtnPosi">
  6. </custom-floor>
  7. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  8. <view class="container-home tui-skeleton">
  9. <!-- 金刚区菜单 -->
  10. <templateNav :list="navBarsList" v-if="isRequest"></templateNav>
  11. </view>
  12. <!-- 楼层 -->
  13. <view class="container-section tui-skeleton">
  14. <page-floor :list="pageList" :userIdentity="userIdentity" :pageType="2" v-if="isRequest"></page-floor>
  15. </view>
  16. <!-- 侧边 -->
  17. <scroll-top :isScrollTop="isScrollTop" :bottom="50"></scroll-top>
  18. </view>
  19. </template>
  20. <script>
  21. import { mapState,mapMutations} from 'vuex';
  22. import customFloor from '@/components/cm-custom/custom-floor' //自定义导航
  23. import templateNav from '@/components/cm-module/pageTemplate/templateNav.vue'
  24. import pageFloor from '@/components/cm-module/homeIndex/pageFloor.vue'
  25. export default{
  26. components:{
  27. customFloor,
  28. templateNav,
  29. pageFloor
  30. },
  31. data(){
  32. return{
  33. userID:0,
  34. shopId:0,
  35. userIdentity:0,
  36. skeletonShow:true,
  37. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  38. systeminfo: this.setSysteminfo(), //获取设备信息
  39. CustomBar:this.CustomBar,// 顶部导航栏高度
  40. navBarsList:[],
  41. pageList:[],//楼层
  42. isRequest:false,
  43. isScrollTop:false,
  44. pageId:'',
  45. typeSort:'',
  46. }
  47. },
  48. onLoad(option) {
  49. console.log(option)
  50. this.pageId = option.linkId
  51. this.$api.getComStorage('userInfo').then((resolve) =>{
  52. this.userID = resolve.userID ? resolve.userID : 0;
  53. this.shopId = resolve.shopID ? resolve.shopID : 0;
  54. this.userIdentity = resolve.userIdentity
  55. this.GetInstrumentPageData();
  56. }).catch(error =>{
  57. this.GetInstrumentPageData();
  58. })
  59. setTimeout(()=>{
  60. this.skeletonShow = false
  61. },2000)
  62. },
  63. computed: {
  64. ...mapState(['hasLogin','userInfo','identity'])
  65. },
  66. methods:{
  67. GetInstrumentPageData(){//获取楼层数据
  68. this.CommonService.GetInstrumentPageData({pageId:this.pageId,userId:this.userID,source:2}).then(response =>{
  69. let data = response.data
  70. this.typeSort = data.page.typeSort
  71. this.pageList = data.floorList
  72. this.GetHomeInit()
  73. }).catch(error =>{
  74. this.$util.msg(error.msg,2000)
  75. })
  76. },
  77. GetHomeInit(){//金刚区分类
  78. this.CommonService.GetFirstClassly({typeSort:this.typeSort,source:'crm'}).then(response =>{
  79. this.navBarsList = response.data
  80. this.isRequest =true
  81. }).catch(error =>{
  82. this.$util.msg(error.msg,2000)
  83. })
  84. },
  85. setHeaderBtnPosi(){
  86. // 获得胶囊按钮位置信息
  87. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  88. return headerBtnPosi
  89. },
  90. setSysteminfo(){
  91. let systeminfo;
  92. uni.getSystemInfo({ // 获取设备信息
  93. success: (res) => {
  94. systeminfo = res
  95. },
  96. })
  97. return systeminfo
  98. },
  99. },
  100. onPageScroll(e){//实时获取到滚动的值
  101. if(e.scrollTop>400){
  102. this.isScrollTop = true
  103. }else{
  104. this.isScrollTop = false
  105. }
  106. },
  107. onPullDownRefresh() {
  108. setTimeout(() => {
  109. uni.stopPullDownRefresh()
  110. }, 200)
  111. },
  112. onShow() {
  113. }
  114. }
  115. </script>
  116. <style lang="scss">
  117. page{
  118. background-color: #FFFFFF;
  119. }
  120. .container-home{
  121. width: 100%;
  122. height: auto;
  123. }
  124. .container-section{
  125. width: 100%;
  126. height: auto;
  127. background-color: #F7F7F7;
  128. }
  129. </style>