activity-topic.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="container floor clearfix">
  3. <!-- top -->
  4. <view class="container-top" @click="BannerNavigateTo(pageInfo.linkType,pageInfo.linkParam.id,pageInfo.headLink,pageInfo.keyword)" v-if="isRequest && headImage!==''"><image :src="headImage" ></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. pageInfo:{}
  44. }
  45. },
  46. onLoad(option) {
  47. if(option.type =='share'){
  48. authorize.checkLogin()
  49. .then(res => {
  50. wxLogin.wxLoginAuthorize()
  51. })
  52. .catch(err => {
  53. console.log(new Date +'用户未授权微信信息')
  54. })
  55. }
  56. this.pageId = option.linkId
  57. this.$api.getComStorage('userInfo').then((resolve) =>{
  58. this.userID = resolve.userId ? resolve.userId : 0;
  59. this.shopId = resolve.shopId ? resolve.shopId : 0;
  60. this.userIdentity = resolve.userIdentity
  61. this.GetInstrumentPageData();
  62. }).catch(error =>{
  63. this.GetInstrumentPageData();
  64. })
  65. setTimeout(()=>{
  66. this.skeletonShow = false
  67. },2000)
  68. },
  69. computed: {
  70. ...mapState(['hasLogin','userInfo','identity'])
  71. },
  72. methods:{
  73. GetInstrumentPageData(){//获取楼层数据
  74. this.CommonService.GetActivityFloorData({pageId:this.pageId,userId:this.userID,source:2}).then(response =>{
  75. let data = response.data
  76. console.log(data);
  77. uni.setNavigationBarTitle({title:data.page.title});
  78. this.typeSort = data.page.typeSort
  79. this.pageList = data.floorList
  80. this.headImage = data.page.crmHeadImage
  81. this.pageInfo = data.page
  82. this.isRequest =true
  83. // this.GetHomeInit()
  84. }).catch(error =>{
  85. this.$util.msg(error.msg,2000)
  86. })
  87. },
  88. GetHomeInit(){//金刚区分类
  89. this.CommonService.GetFirstClassly({typeSort:this.typeSort,source:'crm'}).then(response =>{
  90. this.navBarsList = response.data
  91. this.isRequest =true
  92. }).catch(error =>{
  93. this.$util.msg(error.msg,2000)
  94. })
  95. },
  96. setHeaderBtnPosi(){
  97. // 获得胶囊按钮位置信息
  98. let headerBtnPosi = uni.getMenuButtonBoundingClientRect();
  99. return headerBtnPosi
  100. },
  101. setSysteminfo(){
  102. let systeminfo;
  103. uni.getSystemInfo({ // 获取设备信息
  104. success: (res) => {
  105. systeminfo = res
  106. },
  107. })
  108. return systeminfo
  109. },
  110. BannerNavigateTo(linkType,linkId,linkHref,keyword) {//跳转商品详情页
  111. console.log(linkType,linkId,linkHref,keyword);
  112. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  113. }
  114. },
  115. onPageScroll(e){//实时获取到滚动的值
  116. if(e.scrollTop>400){
  117. this.isScrollTop = true
  118. }else{
  119. this.isScrollTop = false
  120. }
  121. },
  122. onPullDownRefresh() {
  123. setTimeout(() => {
  124. uni.stopPullDownRefresh()
  125. }, 200)
  126. },
  127. onShareAppMessage(res){//分享转发
  128. if (res.from === 'button') {
  129. // 来自页面内转发按钮
  130. }
  131. return {
  132. title: '采美-一站式生/医美采购服务平台',
  133. path: `pages/goods/good-floor?type=share&linkId=${this.pageId}`
  134. }
  135. },
  136. onShow() {
  137. }
  138. }
  139. </script>
  140. <style lang="scss">
  141. page{
  142. background-color: #FFFFFF;
  143. }
  144. .container-home{
  145. width: 100%;
  146. height: auto;
  147. }
  148. .container-section{
  149. width: 100%;
  150. height: auto;
  151. background-color: #F7F7F7;
  152. }
  153. .container-top{
  154. width: 100%;
  155. height: 340rpx;
  156. float: left;
  157. image{
  158. width: 100%;
  159. height: 100%;
  160. display: block;
  161. }
  162. }
  163. .container-activ{
  164. width: 100%;
  165. height: 240rpx;
  166. box-sizing: border-box;
  167. padding: 0 24rpx;
  168. margin: 24rpx 0;
  169. float: left;
  170. image{
  171. width: 100%;
  172. height: 240rpx;
  173. display: block;
  174. }
  175. }
  176. </style>