quick-operation.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="floor clearfix" :style="{backgroundColor:pageInfo.backgroundColour ? pageInfo.backgroundColour : '#f7f7f7',backgroundImage:'url('+pageInfo.backgroundImage+')'}">
  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/active-floor.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. activityEntryVisiable:false
  45. }
  46. },
  47. onLoad(option) {
  48. if(option.type =='share'){
  49. authorize.checkLogin()
  50. .then(res => {
  51. wxLogin.wxLoginAuthorize()
  52. })
  53. .catch(err => {
  54. console.log(new Date +'用户未授权微信信息')
  55. })
  56. }
  57. this.pageId = option.linkId
  58. this.$api.getComStorage('userInfo').then((resolve) =>{
  59. this.userId = resolve.userId ? resolve.userId : 0
  60. this.shopId = resolve.shopId ? resolve.shopId : 0
  61. this.userIdentity = resolve.userIdentity
  62. this.GetActivityFloorData()
  63. }).catch(error =>{
  64. this.GetActivityFloorData()
  65. })
  66. },
  67. computed: {
  68. ...mapState(['hasLogin','userInfo','identity'])
  69. },
  70. methods:{
  71. GetActivityFloorData(){//获取楼层数据
  72. this.CommonService.GetActivityFloorData({pageId:this.pageId,userId:this.userId,source:2}).then(response =>{
  73. let data = response.data
  74. this.typeSort = data.page.typeSort
  75. this.pageList = data.floorList
  76. this.headImage = data.page.crmHeadImage
  77. this.pageInfo = data.page
  78. this.isRequest =true
  79. uni.setStorageSync('pageLabel',`${data.page.contentLabel}`)
  80. uni.setNavigationBarTitle({title:data.page.title})
  81. this.skeletonShow = false
  82. // this.GetHomeInit()
  83. }).catch(error =>{
  84. this.$util.msg(error.msg,2000)
  85. })
  86. },
  87. GetHomeInit(){//金刚区分类
  88. this.CommonService.GetFirstClassly({typeSort:this.typeSort,source:'crm'}).then(response =>{
  89. this.navBarsList = response.data
  90. this.isRequest =true
  91. }).catch(error =>{
  92. this.$util.msg(error.msg,2000)
  93. })
  94. },
  95. setHeaderBtnPosi(){
  96. // 获得胶囊按钮位置信息
  97. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  98. return headerBtnPosi
  99. },
  100. setSysteminfo(){
  101. let systeminfo
  102. uni.getSystemInfo({ // 获取设备信息
  103. success: (res) => {
  104. systeminfo = res
  105. },
  106. })
  107. return systeminfo
  108. },
  109. BannerNavigateTo(linkType,linkId,linkHref,keyword) {//跳转商品详情页
  110. console.log(linkType,linkId,linkHref,keyword)
  111. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  112. }
  113. },
  114. onPageScroll(e){//实时获取到滚动的值
  115. if(e.scrollTop>400){
  116. this.isScrollTop = true
  117. }else{
  118. this.isScrollTop = false
  119. }
  120. },
  121. onPullDownRefresh() {
  122. setTimeout(() => {
  123. uni.stopPullDownRefresh()
  124. }, 200)
  125. },
  126. onShareAppMessage(res){//分享转发
  127. if (res.from === 'button') {
  128. // 来自页面内转发按钮
  129. }
  130. return {
  131. title: '采美-一站式生/医美采购服务平台',
  132. path: `pages/h5/activity/quick-operation?type=share&linkId=${this.pageId}`
  133. }
  134. },
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .floor {
  139. min-height: 100vh;
  140. }
  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>