index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import {
  2. VueLikePage
  3. } from '../../utils/page'
  4. import {
  5. isPhoneX
  6. } from './../../utils/tools'
  7. import Router from '../../utils/routes'
  8. import Api from '../../apis/index'
  9. const app = getApp();
  10. VueLikePage([], {
  11. data: {
  12. images: [],
  13. detail: {},
  14. categoryList: [],
  15. companyList: [],
  16. currentIndex: 0,
  17. tabList: [{
  18. label: '科技珠海',
  19. route: 'exhibitionDetail',
  20. icon: '/image/4Dage/index/img_tags_situation.svg'
  21. },
  22. {
  23. label: '企业名录',
  24. route: 'exhibitionEnterprise',
  25. icon: '/image/4Dage/index/img_tags_directories.svg'
  26. },
  27. {
  28. label: '联系我们',
  29. route: 'exhibitionRegister',
  30. icon: '/image/4Dage/index/img_tags_register.svg'
  31. },
  32. ]
  33. },
  34. methods: {
  35. onLoad: function (options) {
  36. this.getActivityDetail()
  37. this.getCategoryList()
  38. this.getCompanyList()
  39. isPhoneX().then(res => {
  40. this.setData({
  41. isIphoneX: res
  42. })
  43. })
  44. },
  45. onShareAppMessage: function (res) {
  46. var path = '/pages/index/index'
  47. return {
  48. title: '三维数字化技术助力内循环',
  49. path: path,
  50. imageUrl: 'https://houseoss.4dkankan.com/domain/exhibition/demo/hwzff.jpg', // 分享的封面图
  51. }
  52. },
  53. toGoodsTab(e) {
  54. const { index } = e.currentTarget.dataset
  55. Router.push({
  56. url: 'goodsTabs',
  57. query: {
  58. active: index
  59. }
  60. })
  61. },
  62. toExhibitionList () {
  63. Router.push('exhibitionEnterprise')
  64. },
  65. toTabDetail (e) {
  66. const { route } = e.currentTarget.dataset
  67. Router.push(route)
  68. },
  69. toSearch () {
  70. Router.push('search')
  71. },
  72. getActivityDetail () {
  73. Api.getActivityDetail().then(res => {
  74. let detail = res.data
  75. detail.firstPageContent = JSON.parse(res.data.firstPageContent)
  76. this.setData({
  77. detail
  78. })
  79. })
  80. },
  81. getCategoryList () {
  82. Api.getCategoryList().then(res => {
  83. this.setData({
  84. categoryList: res.data.list
  85. })
  86. })
  87. },
  88. getCompanyList () {
  89. Api.getCompanyList({ pageSize: 12 }).then(res => {
  90. this.setData({
  91. companyList: res.data.list
  92. })
  93. })
  94. },
  95. toScene (e) {
  96. const { vr_link, companyid } = e.currentTarget.dataset
  97. Api.postApiData({ companyId: companyid }).then((res) => {
  98. console.log(res)
  99. })
  100. Router.push({
  101. url: 'scene',
  102. query: {
  103. vr_link
  104. }
  105. })
  106. },
  107. imageLoad: function(e) {
  108. var $width=e.detail.width, //获取图片真实宽度
  109. $height=e.detail.height,
  110. ratio=$width/$height; //图片的真实宽高比例
  111. var viewWidth=88 * ratio, //设置图片显示宽度,左右留有16rpx边距
  112. viewHeight = 88; //计算的高度值
  113. var image=this.data.images;
  114. //将图片的datadata-index作为image对象的key,然后存储图片的宽高值
  115. image[e.target.dataset.index]={
  116. width:viewWidth,
  117. height:viewHeight
  118. }
  119. this.setData({
  120. images:image
  121. })
  122. },
  123. changeCurrentIndex (e) {
  124. this.setData({
  125. currentIndex: e.detail.current
  126. })
  127. }
  128. }
  129. })