activity.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="activity">
  3. <web-view :webview-styles="webviewStyles" :src="activityPath"></web-view>
  4. <!-- 侧边 -->
  5. <scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
  6. </view>
  7. </template>
  8. <script>
  9. export default {
  10. data() {
  11. return {
  12. webviewStyles: {
  13. progress: {
  14. color: '#FF3333'
  15. }
  16. },
  17. productID: '',
  18. activityPath: '',
  19. isScrollTop: false,
  20. }
  21. },
  22. onLoad(option) {
  23. this.initPageFree(option.linkId, option.link)
  24. },
  25. methods: {
  26. initPageFree(linkId, link) {
  27. this.CommonService.GetPageFree({ id: linkId })
  28. .then(response => {
  29. this.activityPath = link
  30. uni.setNavigationBarTitle({ title: response.data.title })
  31. uni.setStorageSync('pageLabel', `${response.data.contentLabel}`)
  32. console.log('activityPath',this.activityPath)
  33. })
  34. .catch(error => {
  35. console.log('获取活动专题页数据异常')
  36. })
  37. }
  38. },
  39. onPageScroll(e) {
  40. //实时获取到滚动的值
  41. if (e.scrollTop > 600) {
  42. this.isScrollTop = true
  43. } else {
  44. this.isScrollTop = false
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss">
  50. .activity {
  51. width: 100%;
  52. height: auto;
  53. image {
  54. width: 100%;
  55. height: auto;
  56. }
  57. }
  58. </style>