<template>
  <div class="login-ways h-full">
    <div class="flex flex-col h-full justify-between">
      <div class="level1">
        <div class="title">登录</div>
        <div class="tip">选择登录身份</div>
        <div class="flex items-center justify-between">
          <div
            class="card"
            @click="activeName = 'scan'"
            :class="{ active: activeName === 'scan' }"
          >
            <img src="../../assets/imgs/scan_login_icon.png" />
            <p class="way-name">扫描员登录</p>
            <p class="way-desc">Scanner login</p>
          </div>
          <div
            class="card"
            @click="activeName = 'admin'"
            :class="{ active: activeName === 'admin' }"
          >
            <img src="../../assets/imgs/admin_login_icon.png" />
            <p class="way-name">管理员登录</p>
            <p class="way-desc">Administrator login</p>
          </div>
        </div>
      </div>
      <div class="level2">
        <div class="text-right">
          <qm-button type="primary" @click="nextStep"
            >下一步 <template #icon> <SwapRightOutlined /> </template
          ></qm-button>
        </div>
        <footer-info></footer-info>
      </div>
    </div>
  </div>
</template>
<script name="LoginWays" lang="ts" setup>
import { ref } from "vue";
import {
  CheckCircleFilled,
  CloseCircleFilled,
  SwapRightOutlined,
} from "@ant-design/icons-vue";
import FooterInfo from "@/components/FooterInfo";

const emit = defineEmits(["next"]);
const activeName = ref("scan");

const nextStep = () => {
  if (activeName.value === "scan") {
    //todo,拉起本地扫描端exe程序，隐藏本browserWindow
    window.electronApi.startScanExe();
  } else {
    emit("next");
  }
};
</script>
<style lang="less" scoped>
.login-ways {
  padding-top: 120px;
  .level2 {
    .text-right {
      padding-right: 24px;
      padding-bottom: 24px;
    }
  }
  .level1 {
    padding: 0 24px;
    .card {
      border-radius: 6px;
      border: 1px solid @border-color1;
      height: 140px;
      width: calc(50% - 12px);
      text-align: center;
      cursor: pointer;
      transition: all 0.3s;
      &.active {
        background: #f3f4f6;
      }
      img {
        height: 35px;
        margin-top: 26px;
      }
      .way-name {
        font-size: 16px;
        font-weight: bold;
        color: #14161a;
        margin-top: 12px;
      }
      .way-desc {
        font-size: 12px;
        color: @text-color3;
        margin-top: 10px;
      }
    }
    .title {
      color: @text-color1;
      font-weight: bold;
      line-height: 32px;
      font-size: 24px;
    }
    .tip {
      color: @text-color3;
      line-height: 26px;
      font-size: 18px;
      margin-top: 4px;
      margin-bottom: 24px;
    }
  }
}
</style>
