<template>
  <div class="page_container">
    <bg-breadcrumb></bg-breadcrumb>
    <div class="parent_container">
      <div class="left_container bgc_white">
        <el-menu default-active="1" @select="switchMenu">
          <el-menu-item index="1">
            <span>授权信息</span>
          </el-menu-item>
          <el-menu-item index="2">
            <span>安全相关</span>
          </el-menu-item>
          <el-menu-item index="3">
            <span>登录注册配置</span>
          </el-menu-item>
        </el-menu>
      </div>
      <div class="right_container bgc_white">
        <!-- 授权信息表单 -->
        <el-form
          v-if="activeIndex == 1"
          ref="authorizeFormRef"
          :model="authorizeFormData"
          :rules="authorizeRules"
          label-width="110px"
          class="authorizeForm">
          <el-form-item label="当前版本号" prop="ability_name">
            <el-input disabled placeholder="当前版本号" maxlength="20" />
          </el-form-item>
          <el-form-item label="User" prop="synopsis">
            <el-input placeholder="统一管理用户认证平台" maxlength="20" />
          </el-form-item>
          <el-form-item label="Key" prop="synopsis">
            <el-input placeholder="safjsaf23423sdkafsafja" rows="5" maxlength="200" show-word-limit type="textarea" />
            <el-tooltip placement="top-start" effect="light">
              <template #content> 支持中文、英文（区分大小写）、数字、_、/、-、.,最多不超过64个字 </template>
              <div class="tip-image"></div>
            </el-tooltip>
          </el-form-item>
          <el-form-item label="有效期至" prop="synopsis">
            <el-input placeholder="2022-08-23" maxlength="20" />
          </el-form-item>
          <el-form-item label="剩余有效期提醒" prop="synopsis">
            <el-input placeholder="请输入" maxlength="20">
              <template #append>天</template>
            </el-input>
            <el-tooltip placement="top-start" effect="light">
              <template #content> 支持中文、英文（区分大小写）、数字、_、/、-、.,最多不超过64个字 </template>
              <div class="tip-image"></div>
            </el-tooltip>
          </el-form-item>
        </el-form>
        <!-- 安全相关表单 -->
        <el-form
          v-if="activeIndex == 2"
          ref="secureFormRef"
          :model="secureFormData"
          :rules="secureRules"
          label-width="110px"
          class="secureForm">
          <div class="passwordItem">
            <el-form-item label="最低密码强度" prop="synopsis">
              <el-select placeholder="请选择">
                <el-option label="低" value="1"> </el-option>
                <el-option label="高" value="2"> </el-option>
              </el-select>
              <el-tooltip placement="top-start" effect="light">
                <template #content> 支持中文、英文（区分大小写）、数字、_、/、-、.,最多不超过64个字 </template>
                <div class="tip-image"></div>
              </el-tooltip>
            </el-form-item>
            <el-form-item label="是否强制修改" prop="force">
              <el-switch></el-switch>
            </el-form-item>
          </div>
          <el-form-item label="密码有效期" prop="synopsis">
            <el-input placeholder="请输入" maxlength="20">
              <template #append>天</template>
            </el-input>
            <el-tooltip placement="top-start" effect="light">
              <template #content> 支持中文、英文（区分大小写）、数字、_、/、-、.,最多不超过64个字 </template>
              <div class="tip-image"></div>
            </el-tooltip>
          </el-form-item>
          <el-form-item label="会话有效期" prop="synopsis">
            <el-input placeholder="请输入" maxlength="20">
              <template #append>分钟</template>
            </el-input>
            <el-tooltip placement="top-start" effect="light">
              <template #content> 支持中文、英文（区分大小写）、数字、_、/、-、.,最多不超过64个字 </template>
              <div class="tip-image"></div>
            </el-tooltip>
          </el-form-item>
          <el-form-item label="访问规则模式" prop="synopsis">
            <el-select placeholder="请选择">
              <el-option label="关闭" value="1"> </el-option>
              <el-option label="打开" value="2"> </el-option>
            </el-select>
            <el-tooltip placement="top-start" effect="light">
              <template #content> 支持中文、英文（区分大小写）、数字、_、/、-、.,最多不超过64个字 </template>
              <div class="tip-image"></div>
            </el-tooltip>
          </el-form-item>
        </el-form>
        <!-- 登录注册配置表单 -->
        <el-form
          v-if="activeIndex == 3"
          ref="registerFormRef"
          :model="registerFormData"
          :rules="registerRules"
          label-width="125px"
          class="registerForm">
          <bg-form-gap title="登录受限配置"></bg-form-gap>
          <el-form-item label="登录受限是否启用" prop="force">
            <el-switch></el-switch>
          </el-form-item>
          <div class="input_password_config">
            <span>在</span>
            <el-form-item prop="minutes" label-width="0">
              <el-input placeholder="请输入小时数" maxlength="3"></el-input>
            </el-form-item>
            <span>小时内</span>
            <el-form-item prop="times" label-width="0">
              <el-input placeholder="请输入密码输错次数" maxlength="3"></el-input>
            </el-form-item>
            <span>次输错密码，自动锁定</span>
            <el-form-item prop="times" label-width="0">
              <el-input placeholder="请输入分钟数" maxlength="3"></el-input>
            </el-form-item>
            <span>分钟</span>
            <el-button type="primary"> 一键还原受限 </el-button>
            <el-tooltip placement="top-start" effect="light">
              <template #content> 支持中文、英文（区分大小写）、数字、_、/、-、.,最多不超过64个字 </template>
              <div class="tip-image"></div>
            </el-tooltip>
          </div>
          <bg-form-gap title="注册配置"></bg-form-gap>

          <el-form-item label="允许注册" prop="times">
            <el-radio-group>
              <el-radio label="1"> 是 </el-radio>
              <el-radio label="1"> 否 </el-radio>
            </el-radio-group>
          </el-form-item>
        </el-form>
        <div class="operate_btns">
          <el-button type="primary" @click="save"> 保存 </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { reactive, ref } from "@vue/runtime-core";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
//授权信息表单
const authorizeFormData = reactive({});
//授权表单校验规则
const authorizeRules = reactive({});

//安全相关信息表单
const secureFormData = reactive({});

//安全相关表单校验规则
const secureRules = reactive({});
//登录注册配置表单
const registerFormData = reactive({});

const registerRules = reactive({});
//登录注册配置表单校验规则
let activeIndex = ref("1");
//切换菜单选项
const switchMenu = (index) => {
  activeIndex.value = index;
};
//保存表单项
const save = () => {};
</script>

<style lang="scss" scoped>
.parent_container {
  display: flex;
  justify-content: space-between;
  height: calc(100% - 46px - 20px);
  .left_container {
    width: 240px;
    height: 100%;
    padding: 24px 16px 0;
    .el-menu {
      border: none;
      .el-menu-item {
        justify-content: center;
        height: 36px;
        color: #404a62 !important;
        &.is-active,
        &:hover {
          background-color: #f2f3f7;
          border-radius: 4px;
        }
      }
    }
  }
  .right_container {
    position: relative;
    width: calc(100% - 256px);
    height: 100%;
    padding: 32px 0 68px 24px;

    .authorizeForm,
    .secureForm,
    .registerForm {
      ::v-deep .el-form-item {
        margin-bottom: 24px;
        width: 750px;
        font-size: 14px;
        .el-form-item__label,
        .el-radio__label {
          color: var(--el-text-color-primary);
        }
        .el-select {
          width: 100%;
        }
        .el-input-group__append {
          width: 60px;
          color: #404a62;
          border-radius: 0 6px 6px 0;
          background: #f7f7f9;
        }
      }
    }
    .secureForm {
      .passwordItem {
        display: flex;
        align-items: center;
        .el-form-item:nth-of-type(1) {
          flex-shrink: 0;
          margin-right: 56px;
        }
      }
    }

    .registerForm {
      .input_password_config {
        position: relative;
        display: flex;
        align-items: center;
        width: 798px;
        margin-bottom: 24px;
        font-size: 14px;
        color: var(--el-text-color-primary);
        .el-form-item {
          margin: 0px 8px;
          &:nth-of-type(1),
          &:nth-of-type(3) {
            width: 120px;
          }
          &:nth-of-type(2) {
            width: 150px;
          }
        }
        .el-button {
          margin-left: 18px;
        }
      }
      .el-radio {
        margin-right: 54px;
      }
    }

    .operate_btns {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 100%;
      height: 68px;
      padding-right: 16px;
      line-height: 68px;
      text-align: right;
      border-top: solid 1px #e6e9ef;
      .el-button {
        width: 92px;
      }
    }
  }
}
</style>
