content.vue 2.64 KB
<template>
  <div class="content-wrap">
    <div class="container edit-container" style="min-height: 520px !important">
      <p class="edit-title" id="basic">{{ contentTitle }}</p>
      <component :is="currentComponent" ref="componentRef" :merchantChannelId="merchantChannelId" :topicId="topicId" :channelType="channelType"></component>
    </div>
    <GLFooter>
      <el-button @click="handleCancel">取消</el-button>
      <el-button type="primary" @click="handleSave">确定</el-button>
    </GLFooter>
  </div>
</template>
<script>
import { mapActions, mapMutations } from 'vuex'
import carChannel from './components/carChannel.vue'
import membrane from './components/membrane.vue'
import activity from './components/activity.vue'
import certificate from './components/certificate.vue'
export default {
  name: 'content',
  components: {
    carChannel,
    membrane,
    activity,
    certificate
  },
  data() {
    return {
      contentTitle: '',
      merchantChannelId: this.$route.query.merchantChannelId ? this.$route.query.merchantChannelId : '', //门店频道id
      topicId: this.$route.query.topicId ? this.$route.query.topicId : '', //频道主题ID
      channelType: this.$route.query.channelType ? this.$route.query.channelType : '', //频道类型
      currentComponent: 'carChannel',
      relateStoreVisible: false // 选择门店
    }
  },
  created() {
    let { $title } = this.$route.query
    this.contentTitle = $title ? $title : '新增内容'
    //判断显示模块
    this.judgeModule()
    //获取视频
    this.getTencentcloudmedialist()
    //编辑获取详情
    if (this.topicId) {
      this.getTopicDetail({ topicId: this.topicId })
    } else {
      this.SET_TOPIC_DETAIL({ topicDetail: '' })
    }
  },
  methods: {
    ...mapActions({
      getTencentcloudmedialist: 'channel/getTencentcloudmedialist',
      getTopicDetail: 'channel/getTopicDetail'
    }),
    ...mapMutations({
      SET_TOPIC_DETAIL: 'channel/SET_TOPIC_DETAIL'
    }),
    judgeModule() {
      let arr = {
        '-1': 'certificate',
        1: 'carChannel',
        2: 'membrane',
        3: 'activity',
        4: 'activity'
      }
      this.currentComponent = arr[this.channelType]
    },
    handleCancel() {
      this.$router.go(-1)
    },
    handleSave() {
      this.$refs.componentRef.handleSave()
    }
  }
}
</script>
<style scoped lang='scss'>
.content-wrap {
  .container {
    min-height: 680px;
    padding: 0px 0px 20px;
    margin-bottom: 16px;
  }
  .edit-title {
    font-size: 16px;
    font-weight: 600;
    height: 58px;
    line-height: 58px;
    border-bottom: 1px solid #e7eaec;
    margin: 0 0 32px 0;
    padding: 0 0 0 20px;
  }
}
</style>