activity-topic.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <view class="container floor clearfix">
  3. <!-- top -->
  4. <view class="container-top" v-if="isRequest && headImage!==''"><image :src="headImage" mode="widthFix"></image></view>
  5. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  6. <!-- 楼层 -->
  7. <view class="container-section tui-skeleton">
  8. <page-floor :list="pageList" :userIdentity="userIdentity" :pageType="2" v-if="isRequest"></page-floor>
  9. </view>
  10. <!-- 侧边 -->
  11. <scroll-top :isScrollTop="isScrollTop" :bottom="50"></scroll-top>
  12. </view>
  13. </template>
  14. <script>
  15. import { mapState,mapMutations} from 'vuex';
  16. import customFloor from '@/components/cm-custom/custom-floor' //自定义导航
  17. import templateNav from '@/components/cm-module/pageTemplate/templateNav.vue'
  18. import pageFloor from '@/components/cm-module/activity/pageFloor.vue'
  19. import authorize from '@/common/config/authorize.js'
  20. import wxLogin from "@/common/config/wxLogin.js"
  21. export default{
  22. components:{
  23. customFloor,
  24. templateNav,
  25. pageFloor
  26. },
  27. data(){
  28. return{
  29. userID:0,
  30. shopId:0,
  31. userIdentity:0,
  32. skeletonShow:true,
  33. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  34. systeminfo: this.setSysteminfo(), //获取设备信息
  35. CustomBar:this.CustomBar,// 顶部导航栏高度
  36. navBarsList:[],
  37. pageList:[],//楼层
  38. isRequest:false,
  39. isScrollTop:false,
  40. pageId:'',
  41. typeSort:'',
  42. headImage:''
  43. }
  44. },
  45. onLoad(option) {
  46. if(option.type =='share'){
  47. authorize.checkLogin()
  48. .then(res => {
  49. wxLogin.wxLoginAuthorize()
  50. })
  51. .catch(err => {
  52. console.log(new Date +'用户未授权微信信息')
  53. })
  54. }
  55. this.pageId = option.linkId
  56. this.$api.getComStorage('userInfo').then((resolve) =>{
  57. this.userID = resolve.userId ? resolve.userId : 0;
  58. this.shopId = resolve.shopId ? resolve.shopId : 0;
  59. this.userIdentity = resolve.userIdentity
  60. this.GetInstrumentPageData();
  61. }).catch(error =>{
  62. this.GetInstrumentPageData();
  63. })
  64. setTimeout(()=>{
  65. this.skeletonShow = false
  66. },2000)
  67. },
  68. computed: {
  69. ...mapState(['hasLogin','userInfo','identity'])
  70. },
  71. methods:{
  72. GetInstrumentPageData(){//获取楼层数据
  73. this.CommonService.GetActivityFloorData({pageId:this.pageId,userId:this.userID,source:2}).then(response =>{
  74. let data = response.data
  75. console.log(data);
  76. this.typeSort = data.page.typeSort
  77. this.pageList = data.floorList
  78. this.headImage = data.page.crmHeadImage
  79. this.isRequest =true
  80. // this.GetHomeInit()
  81. }).catch(error =>{
  82. this.$util.msg(error.msg,2000)
  83. })
  84. },
  85. GetHomeInit(){//金刚区分类
  86. this.CommonService.GetFirstClassly({typeSort:this.typeSort,source:'crm'}).then(response =>{
  87. this.navBarsList = response.data
  88. this.isRequest =true
  89. }).catch(error =>{
  90. this.$util.msg(error.msg,2000)
  91. })
  92. },
  93. setHeaderBtnPosi(){
  94. // 获得胶囊按钮位置信息
  95. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  96. return headerBtnPosi
  97. },
  98. setSysteminfo(){
  99. let systeminfo;
  100. uni.getSystemInfo({ // 获取设备信息
  101. success: (res) => {
  102. systeminfo = res
  103. },
  104. })
  105. return systeminfo
  106. },
  107. },
  108. onPageScroll(e){//实时获取到滚动的值
  109. if(e.scrollTop>400){
  110. this.isScrollTop = true
  111. }else{
  112. this.isScrollTop = false
  113. }
  114. },
  115. onPullDownRefresh() {
  116. setTimeout(() => {
  117. uni.stopPullDownRefresh()
  118. }, 200)
  119. },
  120. onShareAppMessage(res){//分享转发
  121. if (res.from === 'button') {
  122. // 来自页面内转发按钮
  123. }
  124. return {
  125. title: '采美-一站式生/医美采购服务平台',
  126. path: `pages/goods/good-floor?type=share&linkId=${this.pageId}`
  127. }
  128. },
  129. onShow() {
  130. }
  131. }
  132. </script>
  133. <style lang="scss">
  134. page{
  135. background-color: #FFFFFF;
  136. }
  137. .container-home{
  138. width: 100%;
  139. height: auto;
  140. }
  141. .container-section{
  142. width: 100%;
  143. height: auto;
  144. background-color: #F7F7F7;
  145. }
  146. .container-top{
  147. width: 100%;
  148. height: 500rpx;
  149. float: left;
  150. image{
  151. width: 100%;
  152. height: 100%;
  153. display: block;
  154. }
  155. }
  156. .container-activ{
  157. width: 100%;
  158. height: 240rpx;
  159. box-sizing: border-box;
  160. padding: 0 24rpx;
  161. margin: 24rpx 0;
  162. float: left;
  163. image{
  164. width: 100%;
  165. height: 240rpx;
  166. display: block;
  167. }
  168. }
  169. </style>