import { VueLikePage } from '../../utils/page' import { isPhoneX } from './../../utils/tools' import Router from '../../utils/routes' import Api from '../../apis/index' const app = getApp(); VueLikePage([], { data: { images: [], detail: {}, categoryList: [], companyList: [], tabList: [{ label: '科技珠海', route: 'exhibitionDetail', icon: '/image/4Dage/index/img_tags_situation.svg' }, { label: '企业名录', route: 'exhibitionEnterprise', icon: '/image/4Dage/index/img_tags_directories.svg' }, { label: '联系我们', route: 'exhibitionRegister', icon: '/image/4Dage/index/img_tags_register.svg' }, ] }, methods: { onLoad: function (options) { this.getActivityDetail() this.getCategoryList() this.getCompanyList() isPhoneX().then(res => { this.setData({ isIphoneX: res }) }) }, onShareAppMessage: function (res) { var path = '/pages/index/index' return { title: '四维看看,海量复刻真房源', path: path, imageUrl: 'https://4d-tjw.oss-cn-shenzhen.aliyuncs.com/4dHouse/share.png', // 分享的封面图 } }, toGoodsTab(e) { const { index } = e.currentTarget.dataset Router.push({ url: 'goodsTabs', query: { active: index } }) }, toExhibitionList () { Router.push('exhibitionEnterprise') }, toTabDetail (e) { const { route } = e.currentTarget.dataset Router.push(route) }, toSearch () { Router.push('search') }, getActivityDetail () { Api.getActivityDetail().then(res => { let detail = res.data detail.firstPageContent = JSON.parse(res.data.firstPageContent) this.setData({ detail }) }) }, getCategoryList () { Api.getCategoryList().then(res => { this.setData({ categoryList: res.data.list }) }) }, getCompanyList () { Api.getCompanyList().then(res => { this.setData({ companyList: res.data.list }) }) }, toScene (e) { const { vr_link, companyid } = e.currentTarget.dataset Api.postApiData({ companyId: companyid }).then((res) => { console.log(res) }) Router.push({ url: 'scene', query: { vr_link } }) }, imageLoad: function(e) { var $width=e.detail.width, //获取图片真实宽度 $height=e.detail.height, ratio=$width/$height; //图片的真实宽高比例 var viewWidth=e.detail.width, //设置图片显示宽度,左右留有16rpx边距 viewHeight=e.detail.height; //计算的高度值 var image=this.data.images; //将图片的datadata-index作为image对象的key,然后存储图片的宽高值 image[e.target.dataset.index]={ width:viewWidth, height:viewHeight } this.setData({ images:image }) } } })