activity-topic.vue 6.7 KB

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