index.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. tabList: [{
  17. label: '科技珠海',
  18. route: 'exhibitionDetail',
  19. icon: '/image/4Dage/index/img_tags_situation.svg'
  20. },
  21. {
  22. label: '企业名录',
  23. route: 'exhibitionEnterprise',
  24. icon: '/image/4Dage/index/img_tags_directories.svg'
  25. },
  26. {
  27. label: '联系我们',
  28. route: 'exhibitionRegister',
  29. icon: '/image/4Dage/index/img_tags_register.svg'
  30. },
  31. ]
  32. },
  33. methods: {
  34. onLoad: function (options) {
  35. this.getActivityDetail()
  36. this.getCategoryList()
  37. this.getCompanyList()
  38. isPhoneX().then(res => {
  39. this.setData({
  40. isIphoneX: res
  41. })
  42. })
  43. },
  44. onShareAppMessage: function (res) {
  45. var path = '/pages/index/index'
  46. return {
  47. title: '四维看看,海量复刻真房源',
  48. path: path,
  49. imageUrl: 'https://4d-tjw.oss-cn-shenzhen.aliyuncs.com/4dHouse/share.png', // 分享的封面图
  50. }
  51. },
  52. toGoodsTab(e) {
  53. const { index } = e.currentTarget.dataset
  54. Router.push({
  55. url: 'goodsTabs',
  56. query: {
  57. active: index
  58. }
  59. })
  60. },
  61. toExhibitionList () {
  62. Router.push('exhibitionEnterprise')
  63. },
  64. toTabDetail (e) {
  65. const { route } = e.currentTarget.dataset
  66. Router.push(route)
  67. },
  68. toSearch () {
  69. Router.push('search')
  70. },
  71. getActivityDetail () {
  72. Api.getActivityDetail().then(res => {
  73. let detail = res.data
  74. detail.firstPageContent = JSON.parse(res.data.firstPageContent)
  75. this.setData({
  76. detail
  77. })
  78. })
  79. },
  80. getCategoryList () {
  81. Api.getCategoryList().then(res => {
  82. this.setData({
  83. categoryList: res.data.list
  84. })
  85. })
  86. },
  87. getCompanyList () {
  88. Api.getCompanyList().then(res => {
  89. this.setData({
  90. companyList: res.data.list
  91. })
  92. })
  93. },
  94. toScene (e) {
  95. const { vr_link, companyid } = e.currentTarget.dataset
  96. Api.postApiData({ companyId: companyid }).then((res) => {
  97. console.log(res)
  98. })
  99. Router.push({
  100. url: 'scene',
  101. query: {
  102. vr_link
  103. }
  104. })
  105. },
  106. imageLoad: function(e) {
  107. var $width=e.detail.width, //获取图片真实宽度
  108. $height=e.detail.height,
  109. ratio=$width/$height; //图片的真实宽高比例
  110. var viewWidth=e.detail.width, //设置图片显示宽度,左右留有16rpx边距
  111. viewHeight=e.detail.height; //计算的高度值
  112. var image=this.data.images;
  113. //将图片的datadata-index作为image对象的key,然后存储图片的宽高值
  114. image[e.target.dataset.index]={
  115. width:viewWidth,
  116. height:viewHeight
  117. }
  118. this.setData({
  119. images:image
  120. })
  121. }
  122. }
  123. })