<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="素材组" name="first">
        <materialGroup v-if="isFirst"> </materialGroup>
      </el-tab-pane>
      <el-tab-pane label="视图素材" name="second">
        <materiallibrary v-if="isSecond"></materiallibrary>
      </el-tab-pane>
      <el-tab-pane label="文案素材" name="copywriting">
        <copywritinglibrary v-if="isCopywriting"></copywritinglibrary>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
// import { getUrlKey } from "../uti";
import { getEnums, getSelectApps } from "@/api/cloud";
import materialGroup from "./common/materialGroup";
import copywritinglibrary from "./common/copywritinglibrary";
import materiallibrary from "./common/materiallibrary";
import TryPlayMaterial from "./common/TryPlayMaterial";
import MaterialRecommend from "./common/MaterialRecommend";
export default {
  components: {
    materialGroup,
    copywritinglibrary,
    materiallibrary,
  },
  data() {
    return {
      checkList: false,
      checkAll: false,
      activeName: "first",
      isFirst: true,
      isSecond: false,
      isCopywriting: false,
      isRecommend: false,
      /* 提取任务*/
      options2: [],
      value: "必填",
      dialogFormVideo: false,
      selectApps: [],
      message: "",
    };
  },
  created() {
    this.APIGetEnums();
    this.APIgetSelectApps();
  },

  methods: {
    APIGetEnums() {
      getEnums().then((res) => {
        // console.log(res);
        this.options2 = res.result.data.materialType;
      });
    },
    /* 创意素材组获取列表*/
    APIgetSelectApps() {
      let params = {
        platformId: 4,
        menuCode: "putin.apps",
        isGroup: "group",
      };
      getSelectApps(params).then((res) => {
        // console.log(res)
        this.selectApps = res.result.data;
        // console.log( this.selectApps)
      });
    },
    /* 切换 */
    handleClick(tab) {
      // console.log(tab.name);
      if (tab.name === "first") {
        this.isFirst = true;
        this.isSecond = false;
        this.isCopywriting = false;
        this.isRecommend = false;
      } else if (tab.name === "second") {
        this.isFirst = false;
        this.isSecond = true;
        this.isCopywriting = false;
        this.isRecommend = false;
      } else if (tab.name === "copywriting") {
        this.isFirst = false;
        this.isSecond = false;
        this.isCopywriting = true;
        this.isRecommend = false;
      } else if (tab.name === "tryplaymaterial") {
        this.isFirst = false;
        this.isSecond = false;
        this.isCopywriting = false;
        this.isRecommend = false;
      } else if (tab.name == "materialRecommend") {
        this.isFirst = false;
        this.isSecond = false;
        this.isCopywriting = false;
        this.isRecommend = true;
      }
    },
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped></style>
