<template>
  <page-layout>
    <nav-bar title="展商新闻" @init="onInitNavbar"></nav-bar>
    <u-scroll-view>
      <view class="main-container">
        <view class="title">
          {{ info.title }}
        </view>
        <view class="info_item">
          <text class="label">
            {{ info.create_time }}
          </text>
        </view>
        <view class="content">
          <u-content :content="info.content"></u-content>
        </view>
        <exhibitor-card :exhibit="exhibitorsInfo"></exhibitor-card>
        <disclaimer-text></disclaimer-text>
      </view>
    </u-scroll-view>
    <float-button></float-button>
    <van-dialog id="van-dialog" />
  </page-layout>
</template>

<script>
import exhibitorCard from "@/pages/exhibitor/components/exhibitor-card";
import {exhibitorsNewsInfo, exhibitorsInfo} from "@/api/exhibitor";
import NavBar from '@/components/layout/nav-bar'
import UScrollView from '@/components/common/u-scroll-view'
import UContent from '@/components/common/u-content'
import DisclaimerText from '@/components/disclaimer-text/index.vue'
import floatButton from "@/components/layout/float-button"
import ContactUs from '@/pages/index/components/contact-us.vue'
import PageLayout from "@/components/layout/page-layout";

export default {
  components: {
    PageLayout,
    exhibitorCard,
    NavBar,
    UScrollView,
    UContent,
    DisclaimerText,
		floatButton
  },
  onLoad(options) {
    this.id = options.id
    this.getInfoEvent()
  },
  data() {
    return {
      id: 0,
      info: {},
      shareInfo:{},
      exhibitorsInfo: {
        exhibitors_logo: '',
        exhibitors_name_zh_cn: '',
        exhibitors_name_en_us: '',
        exhibitors_hall: '',
        exhibitors_booth_no: '',
        exhibitors_id: '',
				showContactUs: false,
				q_url: ''
      }
    };
  },
  created() {

  },
  methods: {
    onShareAppMessage: function () {
      return this.shareInfo
    },
    onShareTimeline() {
      return this.shareInfo
    },
    getInfoEvent()  {
      exhibitorsNewsInfo({id:this.id}).then(res=>{
        this.info = res.data
        this.shareInfo = {
          title: this.info.title,
          path: `/pages/exhibitor/exhibitor-news?id=` + this.id,
          imageUrl: 'https://oss.productronicachina.com.cn/resources/common/up/0000001002/20250221/67b829f60c212.png'
        }
        // this.info.time = returnTimeFormat(this.info.start_time,this.info.end_time)
        this.getExhibitorsInfo(this.info.exhibitors_id)
      })
    },
    getExhibitorsInfo(id) {
      exhibitorsInfo({id:id}).then(res => {
        this.exhibitorsInfo.exhibitors_logo = res.data.logo
        this.exhibitorsInfo.exhibitors_name_zh_cn = res.data.name_zh_cn
        this.exhibitorsInfo.exhibitors_name_en_us = res.data.name_en_us
        this.exhibitorsInfo.exhibitors_hall = res.data.hall
        this.exhibitorsInfo.exhibitors_booth_no = res.data.booth_no
        this.exhibitorsInfo.exhibitors_id = res.data.id
      })
    }
  }
}
</script>

<style lang="scss">
.main-container {
  .title {
    font-size: $fontSize7;
    font-weight: bold;
    margin-bottom: 39rpx;
  }
  .content {
    margin-top: 25rpx;
  }
  .info_item {
    margin-top: 15rpx;
    font-weight: bold;
    font-size: $fontSize2;
    .label {
      font-weight: 400;
    }
  }
}
</style>
