<template>
  <div id="detail">
    <el-row>
      <el-col :span="24" class="index">
        <el-col :span="24" class="top">
          <topInfo :topTitle="pageTitle"></topInfo>
        </el-col>
        <el-col :span="24" class="main">
          <detailMeetInfo :roomInfo="roomInfo"></detailMeetInfo>
        </el-col>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import topInfo from '@/layout/public/top.vue';
import { mapState, createNamespacedHelpers } from 'vuex';
import detailMeetInfo from '@/layout/live/detailmetting.vue';
const { mapActions: room } = createNamespacedHelpers('room');
export default {
  name: 'detail',
  props: {},
  components: {
    topInfo,
    detailMeetInfo,
  },
  data: function() {
    return {
      roomInfo: {},
    };
  },
  created() {
    this.searchInfo();
  },
  methods: {
    ...room(['query', 'delete', 'update', 'fetch']),
    async searchInfo() {
      let res = await this.fetch(this.id);
      if (this.$checkRes(res)) {
        this.$set(this, `roomInfo`, res.data);
      }
    },
  },
  computed: {
    ...mapState(['user']),
    id() {
      return this.$route.query.id;
    },
    name() {
      return this.$route.query.name;
    },
    pageTitle() {
      return `${this.$route.meta.title}`;
    },
    mainTitle() {
      let meta = this.$route.meta;
      let main = meta.title || '';
      let sub = meta.sub || '';
      return `${main}${sub}`;
    },
    keyWord() {
      let meta = this.$route.meta;
      let main = meta.title || '';
      return main;
    },
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
};
</script>

<style lang="less" scoped></style>
