<template>
  <div style="height: 100%">
    <Container :needPadding="true">
      <template v-slot:header>
        <WlHeader :needBottomBorder="true">EnSearchEnterprise 企业搜索</WlHeader>
      </template>
      <template v-slot:main>
        <Title>基础使用</Title>
        <WlButton @onClick="onOpen">
          打开搜索弹窗
        </WlButton>
        <Title>推荐列表</Title>
        <WlButton @onClick="onOpen('recommend')">
          打开搜索弹窗
        </WlButton>
        <Title>隐藏标签</Title>
        <WlButton @onClick="onOpen('match_type')">
          打开搜索弹窗
        </WlButton>
        <Title>默认搜索内容</Title>
        <WlButton @onClick="onOpen('default')">
          打开搜索弹窗
        </WlButton>
        <Title>免费图标隐藏</Title>
        <WlButton @onClick="onOpen('free')">
          打开搜索弹窗
        </WlButton>
      </template>
    </Container>
    <EnSearchEnterprise
      v-model="visible"
      :node_env="env"
      corp_id="ww90b1ab33636e7da5"
      sid="e9b02fd6b8ad3dae64ff42e7cf0972b8"
      :recommendList="recommendList"
      :hidden_mathch_type="hidden_mathch_type"
      :needFreeTag="needFreeTag"
      :defaultSearchVal="defaultSearchVal"
    ></EnSearchEnterprise>
  </div>
</template>

<script>
import Title from "../components/Title";
import Container from "../components/Container";
const dict = {
  development: "dev_uat",
  doc: "uat",
}
export default {
  name: "EnSearchEnterprise-Example",
  components: { Title, Container },
  data() {
    return {
      visible: false,
      recommendList: [],
      hidden_mathch_type: [],
      needFreeTag: true,
      defaultSearchVal: "",
      env: dict[process.env.NODE_ENV] || "uat"
    };
  },
  methods: {
    onOpen(type) {
      this.defaultSearchVal = "";
      this.recommendList = [];
      if (type === "recommend") {
        this.recommendList = ["推荐1", "推荐2"];
      } else if (type === "match_type") {
        this.hidden_mathch_type = ["公司名称匹配"];
      } else if (type === "free") {
        this.needFreeTag = false;
      } else if (type === "default") {
        this.defaultSearchVal = "默认搜索内容";
      }
      this.visible = true;
    },
  },
};
</script>
