<template>
  <div class="debugApi-box">
    <div class="apiBox-head">
      <div class="api-title">API市场</div>
      <div class="seek-input">
        <el-input placeholder="搜索接口连接/方法名/接口中文名"> </el-input>
        <span class="seek-slod">搜索</span>
      </div>
    </div>

    <div class="debug-html">
      <div class="flex-left">
        <el-form
          :model="ruleForm"
          :rules="rules"
          ref="ruleForm"
          label-width="100px"
          class="demo-ruleForm"
          label-position="top"
        >
          <div class="left-title">接口测试</div>

          <el-form-item label="接口" prop="name">
            <span class="left-float">查看该接口文档</span>

            <el-select v-model="ruleForm.name" filterable placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="请求方式" prop="name">
            <el-select v-model="ruleForm.name" filterable placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </el-form-item>
          <div class="left-title" style="margin-top: 30px">请求参数</div>
          <el-form-item label="APIKEY" prop="name">
            <el-input placeholder="请输入内容"></el-input>
          </el-form-item>

          <div class="key-for">
            <el-form-item label="KEY" style="margin-right: 20px">
              <el-input placeholder="请输入内容"></el-input>
            </el-form-item>
            <el-form-item label="value" style="margin-right: 20px">
              <el-input placeholder="请输入内容"></el-input>
            </el-form-item>
            <div
              class="span-icon el-icon-remove"
              style="margin-right: 12px"
            ></div>
            <div class="span-icon el-icon-circle-plus"></div>
          </div>

          <el-button class="onSubmit" type="primary" @click="onSubmit"
            >提交测试</el-button
          >
        </el-form>
      </div>

      <div class="flex-right">
        <div class="rigth-title">输出参数</div>
        <div>
          <json-viewer
            v-if="jsonData"
            :value="jsonData"
            :expand-depth="5"
            expanded
            copyable
            boxed
            sort
          ></json-viewer>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ruleForm: {
        name: "",
      },
      options: [
        {
          value: "选项1",
          label: "黄金糕",
        },
        {
          value: "选项2",
          label: "双皮奶",
        },
        {
          value: "选项3",
          label: "蚵仔煎",
        },
        {
          value: "选项4",
          label: "龙须面",
        },
        {
          value: "选项5",
          label: "北京烤鸭",
        },
      ],
      rules: {
        name: [
          { required: true, message: "请输入活动名称", trigger: "blur" },
          { min: 3, max: 5, message: "长度在 3 到 5 个字符", trigger: "blur" },
        ],
      },
      jsonData: {
        total: 25,
        limit: 10,
        skip: 0,
        links: {
          previous: undefined,
          next: function () {},
        },
        data: [
          {
            id: "5968fcad629fa84ab65a5247",
            firstname: "Ada",
            lastname: "Lovelace",
            awards: null,
            known: ["mathematics", "computing"],
            position: {
              lat: 44.563836,
              lng: 6.495139,
            },
            description: `Augusta Ada King, Countess of Lovelace (née Byron; 10 December 1815 – 27 November 1852) was an English mathematician and writer,
            chiefly known for her work on Charles Babbage's proposed mechanical general-purpose computer,
            the Analytical Engine. She was the first to recognise that the machine had applications beyond pure calculation,
            and published the first algorithm intended to be carried out by such a machine.
            As a result, she is sometimes regarded as the first to recognise the full potential of a "computing machine" and the first computer programmer.`,
            bornAt: "1815-12-10T00:00:00.000Z",
            diedAt: "1852-11-27T00:00:00.000Z",
          },
          {
            id: "5968fcad629fa84ab65a5246",
            firstname: "Grace",
            lastname: "Hopper",
            awards: [
              "Defense Distinguished Service Medal",
              "Legion of Merit",
              "Meritorious Service Medal",
              "American Campaign Medal",
              "World War II Victory Medal",
              "National Defense Service Medal",
              "Armed Forces Reserve Medal",
              "Naval Reserve Medal",
              "Presidential Medal of Freedom",
            ],
            known: null,
            position: {
              lat: 43.614624,
              lng: 3.879995,
            },
            description: `Grace Brewster Murray Hopper (née Murray; December 9, 1906 – January 1, 1992)
            was an American computer scientist and United States Navy rear admiral.
            One of the first programmers of the Harvard Mark I computer,
            she was a pioneer of computer programming who invented one of the first compiler related tools.
            She popularized the idea of machine-independent programming languages, which led to the development of COBOL,
            an early high-level programming language still in use today.`,
            bornAt: "1815-12-10T00:00:00.000Z",
            diedAt: "1852-11-27T00:00:00.000Z",
          },
        ],
      },
    };
  },
  methods: {
    onSubmit: function () {},
  },
};
</script>


<style lang="scss" scoped>
.debugApi-box {
  width: 1200px;
  border-radius: 14px;
  overflow: hidden;
  .apiBox-head {
    height: 184px;
    width: 100%;
    background: url("../../static/img/index-bar.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    flex-direction: column;
    .api-title {
      color: #fff;
      font-weight: bold;
      font-size: 40px;
      margin-top: 40px;
    }
    .seek-input {
      width: 350px;
      height: 34px;
      display: flex;
      background: #fff;
      border-radius: 17px;
      margin-top: 18px;
      overflow: hidden;
      .seek-slod {
        background: #1890ff;
        color: #fff;
        width: 70px;
        height: 34px;
        text-align: center;
        line-height: 34px;
        border-radius: 17px;
        padding: 0;
        margin: 0;
        cursor: pointer;
      }
    }
  }

  .debug-html {
    display: flex;
    margin-top: 20px;
    width: 100%;
    align-items: baseline;
    .flex-left {
      width: 468px;
      min-height: 585px;
      background: #ffffff;
      border-radius: 14px;
      box-sizing: border-box;
      padding: 20px;
      .left-title {
        color: #333333;
        font-size: 20px;
        height: 20px;
        line-height: 20px;
        padding-left: 12px;
        border-left: 4px solid #1890ff;
        margin-bottom: 20px;
      }
      .left-float {
        position: absolute;
        z-index: 99;
        right: 0;
        top: -40px;
        color: #1890ff;
        font-size: 14px;
        cursor: pointer;
      }
    }
    .flex-right {
      width: 712px;
      min-height: 710px;
      background: #ffffff;
      border-radius: 14px;
      margin-left: auto;
      box-sizing: border-box;
      padding: 20px;
      .rigth-title {
        color: #333333;
        font-size: 20px;
        height: 20px;
        line-height: 20px;
        padding-left: 12px;
        border-left: 4px solid #1890ff;
        margin-bottom: 20px;
      }
    }
    .key-for {
      display: flex;
      .span-icon {
        color: #1890ff;
        cursor: pointer;
        line-height: 11px;
        margin-top: 53px;
        font-size: 16px;
      }
    }

    .onSubmit {
      margin: 20px auto 0;
      display: block;
    }
  }
}


</style>