/* eslint-disable */
/* eslint-disable no-undef,no-param-reassign */
import React, { Component } from "react";
import { LockOutlined, UserOutlined } from "@ant-design/icons";
import { Form } from "@ant-design/compatible";
// import '@ant-design/compatible/assets/index.css';
import { Input, Button, Select, message, Radio } from 'antd-v4';
import commonConfig from "@/utils/config";
// import * as commonUtils from '../../utils/utils';
import * as commonServices from "@/services/services";
import * as commonFunc from "@/components/Common/commonFunc";
import logo from "@/assets/foot_logo.png";
import * as commonUtils from "@/utils/utils";
import styles from "./Login.css";
import FaceDetect from "../FaceDetect";
import UserRegistration from "../UserRegistration";

const FormItem = Form.Item;
const { Option } = Select;

class LoginForm extends Component {
  constructor(props) {
    let ssoLoginParams = {};
    const urlParams = new URLSearchParams(location.search);
    const params = {};
    urlParams.forEach((value, key) => {
      params[key] = value;
    });
    const { sUserNo, token, sSubsidiaryId: sId, sBrandsId: sParentId } = params;
    if (sUserNo && token && sId && sParentId) {
      ssoLoginParams = { sUserNo, token, sId, sParentId };
    }

    super(props);
    this.state = {
      companys: [],
      sParentId: JSON.parse(localStorage.getItem(`${commonConfig.prefix}companysParentId`)) || "",
      sId: JSON.parse(localStorage.getItem(`${commonConfig.prefix}companyId`)) || "",
      loginInfo: [],
      loginType: "normal",
      sEmployeeNo: "",
      ssoLoginParams,
      logoImageInfo: [],
    };
    this.loginSRMC = props.baseInfo?.flag === "loginSRMC";
    this.erpBaseWord = this.loginSRMC ? this.props.baseInfo.word : "ERP";
  }

  componentWillMount() {
    this.handleGetLogoImage();
    this.props.onClearModelCenter();
    if (commonUtils.isNotEmptyObject(this.state.ssoLoginParams)) {
      this.handleLogin(this.state.ssoLoginParams, true);
    } else {
      this.handleInit();
    }
  }

  handleInit = async () => {
    const configUrl = `${commonConfig.server_host}sysbrands/getSysbrands`;
    const configReturn = (await commonServices.getService(null, configUrl)).data;
    if (configReturn.code === 1) {
      const companys = configReturn.dataset.rows;
      const sParentId = commonUtils.isNotEmptyObject(this.state.sParentId) ? this.state.sParentId : companys[0].sParentId;
      const sId = commonUtils.isNotEmptyObject(this.state.sId) ? this.state.sId : companys[0].sId;
      const footer = commonUtils.isNotEmptyObject(this.state.footer) ? this.state.footer : companys[0].footer;
      const sLanguage = commonUtils.isNotEmptyArr(companys) ?  companys[0].sLanguage : '';
      console.log('sLanguage', sLanguage);
      if(commonUtils.isEmptyObject(sLanguage)) {
        message.error('未获取到系统设置语言！');
      }
      this.setState({ companys, sParentId, sId, footer }, () => {
        this.handleGetLoginInfo(sLanguage);/* 根据后台配置获取公司信息 */
      });
    } else {
      message.error(configReturn.msg);
    }
  }

  // 获取自定义logo
  handleGetLogoImage = () => {
    for (let index = 0; index < 4; index++) {
      const imgUrl = `${commonConfig.file_host}file/downloadLogo?sLogoName=logo${index + 1}&date=${new Date().getTime()}`;
      const ImgObj = new Image();
      ImgObj.src = imgUrl;
      ImgObj.onload = () => {
        if (ImgObj.fileSize > 0 || (ImgObj.width > 0 && ImgObj.height > 0)) {
          this.setState(({ logoImageInfo }) => {
            const logoImageInfoNew = [...logoImageInfo];
            logoImageInfoNew[index] = imgUrl;
            return { logoImageInfo: logoImageInfoNew };
          });
        } else {
          this.setState(({ logoImageInfo }) => {
            const logoImageInfoNew = [...logoImageInfo];
            logoImageInfoNew[index] = "";
            return { logoImageInfo: logoImageInfoNew };
          });
        }
      };
      ImgObj.onerror = () => {
        this.setState(({ logoImageInfo }) => {
          const logoImageInfoNew = [...logoImageInfo];
          logoImageInfoNew[index] = "";
          return { logoImageInfo: logoImageInfoNew };
        });
      };
    }
  };

  /* 获取登录窗体配置文字 */
  handleGetLoginInfo = async (sLanguage) => {
    const sModelsId = '16148217740007696998039471379000';
    const configUrl = `${commonConfig.server_host}business/getModelBysId/${sModelsId}?sLanguage=${sLanguage}&sModelsId=${sModelsId}&sName=/commonAuto`;
    const configReturn = (await commonServices.getService('', configUrl)).data;
    if (configReturn.code === 1) {
      const dataReturn = configReturn.dataset.rows;
      if (commonUtils.isNotEmptyArr(dataReturn)) {
        const { formData } = dataReturn[0];
        if (commonUtils.isNotEmptyArr(formData)) {
          const { gdsconfigformslave } = formData[0];
          if (commonUtils.isNotEmptyArr(gdsconfigformslave)) {
            this.setState({
              loginInfo: gdsconfigformslave,
            });
          }
        }
      }
    } else {
      message.error(configReturn.msg);
    }
  }

  handleSelect = (value, option) => {
    const sParentId = option.props["data-parentid"];
    this.setState({
      sParentId,
      sId: value,
    });
  };

  handleSubmit = e => {
    e.preventDefault();
    this.props.form.validateFields(async (err, values) => {
      if (!err) {
        this.handleLogin(values);
      }
    });
  };

  handleLogin = async (values = {}, bSsoLogin = false) => {
    this.setState({ loginLoading: true });
    /* 点击登录按钮时 清空localStorage，保留左侧树定位 */
    const xlybusinessActiveTreeArr = [];
    for (let i = 0; i < localStorage.length; i++) {
      const key = localStorage.key(i);
      if (key && key.includes("xlybusinessActiveTree")) {
        xlybusinessActiveTreeArr.push([key, localStorage.getItem(key)]);
      }
    }
    localStorage.clear();
    xlybusinessActiveTreeArr.forEach(item => {
      localStorage.setItem(item[0], item[1]);
    });
    const value = values;
    if (!bSsoLogin) {
      value.sParentId = this.state.sParentId;
      value.sId = this.state.sId;
      if (this.state.loginType === "face") {
        value.sEmployeeNo = this.sEmployeeNo;
      }
    }
    const url = `${commonConfig.server_host}userlogin/${value.sParentId}/${value.sId}`;
    const dataReturn = (await commonServices.postValueService(null, value, url)).data;
    if (dataReturn.code === 1) {
      if (commonUtils.isNotEmptyObject(dataReturn.msg)) {
        message.warning(dataReturn.msg, 6);
      }
      const { token, gdslogininfo: userinfo, systemData, commonConst, rxtx, passworIsOld, auxiliaryQty } = dataReturn.dataset.rows[0];
      // commonUtils.setSystemSettings(systemData);
      // commonUtils.setCommonConst(commonConst);
      const decimals = {};
      if (systemData !== undefined) {
        const dNetPrice = systemData.filter(item => item.sName === "NetPrice")[0];
        const dNetMoney = systemData.filter(item => item.sName === "NetMoney")[0];
        const dNumAlign = systemData.filter(item => item.sName === "CkxNumAlign")[0];
        /* 20230628老孟提的需求：单价设置6位，金额设置2位，不根据配置走 */
        // decimals.dNetPrice = 12;
        decimals.dNetPrice = Number(dNetPrice.sValue); // 20240528晚上杨昌辉提-钱豹要求改；
        decimals.dNetMoney = 2;
        // decimals.dNetPrice = dNetPrice !== undefined && dNetPrice.sValue !== undefined ? (dNetPrice.sValue) * 1 : 6;
        // decimals.dNetMoney = dNetMoney !== undefined && dNetMoney.sValue !== undefined ? (dNetMoney.sValue) * 1 : 6;
        decimals.dNumAlign = dNumAlign !== undefined && dNumAlign.sValue !== undefined ? dNumAlign.sValue : 0;
        // commonUtils.setNetPrice(decimals.dNetPrice);
        // commonUtils.setNetMoney(decimals.dNetMoney);
        // commonUtils.setDateFormat(commonFunc.getDateFormat(systemData));
      }
      // 判断是否是初始密码
      if (values.username !== "zhangz") {
        localStorage.setItem(`${commonConfig.prefix}changePwd`, passworIsOld === true || passworIsOld === "true" ? "true" : "false");
      }
      /* 登录记住公司信息 */
      localStorage.setItem(`${commonConfig.prefix}companysParentId`, JSON.stringify(this.state.sParentId));
      localStorage.setItem(`${commonConfig.prefix}companyId`, JSON.stringify(this.state.sId));
      const companyName = commonUtils.isNotEmptyArr(this.state.companys)
        ? this.state.companys.filter(item => item.sId === userinfo.sSubsidiaryId)[0].sName
        : "";
      userinfo.companyName = companyName;
      const { footer, logoImageInfo } = this.state;
      const isInitPassword = passworIsOld === true || passworIsOld === "true";
      await this.props.onLogin({
        token,
        systemData,
        rxtx,
        commonConst,
        userinfo,
        decimals,
        dateFormat: commonFunc.getDateFormat(systemData),
        footer,
        logoImageInfo,
        auxiliaryQty,
        isInitPassword,
      });
    } else {
      message.error(dataReturn.msg);
      this.setState({ loginLoading: false, ssoLoginParams: {} }, () => {
        this.handleInit();
      });
    }
  };

  onLoginTypeChange = e => {
    this.setState({
      loginType: e.target.value,
    });
  };

  //人脸验证登录
  onIdentifySuccess = async e => {
    this.sEmployeeNo = e.dataset.rows[0].sEmployeeNo;
    const value = {};
    value.sEmployeeNo = this.sEmployeeNo;
    value.sParentId = e.dataset.rows[0].sBrandsId;
    value.sId = e.dataset.rows[0].sSubsidiaryId;
    await this.handleLogin(value);
  };

  render() {
    const { getFieldDecorator } = this.props.form;
    const { companys, sId, loginInfo, ssoLoginParams, footer } = this.state;
    if (commonUtils.isNotEmptyObject(ssoLoginParams)) {
      return "";
    }

    const companysId = commonUtils.isNotEmptyObject(sId) ? sId : commonUtils.isNotEmptyArr(companys) ? companys[0].sId : chooseBranchCompany;
    const options = companys.map(com => (
      <Option key={com.sId} data-parentid={com.sParentId} className={styles.loginOption}>
        {com.sName}
      </Option>
    ));
    let sLanguage = "sChinese";
    if (companys !== null && companys.length > 0) {
      sLanguage = companys[0].sLanguage !== null ? companys[0].sLanguage.toString() : sLanguage;
    }
    const { loginLoading, logoImageInfo } = this.state;
    let XiaoLingYang = sLanguage === "sChinese" ? "小羚羊" : sLanguage === "sEnglish" ? "XiaoLingYang" : "小羚羊"; /* 小羚羊 */
    let WelcometoERP =
      sLanguage === "sChinese"
        ? `欢迎登录${this.erpBaseWord}`
        : sLanguage === "sEnglish"
        ? `Welcometo${this.erpBaseWord}`
        : `歡迎登錄${this.erpBaseWord}`; /* 欢迎登录ERP */
    let companyName =
      sLanguage === "sChinese" ? "上海小羚羊软件" : sLanguage === "sEnglish" ? "ShangHaiXiaoLingYangSoft" : "上海小羚羊軟件"; /* 上海小羚羊软件 */
    let printAllFlow =
      sLanguage === "sChinese" ? "智能印刷全流程" : sLanguage === "sEnglish" ? "IntelligentPrintAllFlow" : "智能印刷全流程"; /* 智能印刷全流程 */
    let ERP = this.erpBaseWord; /* ERP */
    let UserLogin = sLanguage === "sChinese" ? "用户登录" : sLanguage === "sEnglish" ? "UserLogin" : "用戶登錄"; /* 用户登录 */
    let pleaseInputUserName =
      sLanguage === "sChinese" ? "请输入你的用户名" : sLanguage === "sEnglish" ? "pleaseInputUserName" : "請輸入妳的用戶名"; /* 请选择分公司名称 */
    let pleaseInputPassword =
      sLanguage === "sChinese" ? "请输入你的密码" : sLanguage === "sEnglish" ? "请输入你的密码" : "請輸入妳的用戶名"; /* 请选择分公司名称 */
    let chooseBranchCompany =
      sLanguage === "sChinese"
        ? "请选择分公司名称"
        : sLanguage === "sEnglish"
        ? "Please select branch name"
        : "請選擇分公司名稱"; /* 请选择分公司名称 */
    let btnLogin = sLanguage === "sChinese" ? "登 录" : sLanguage === "sEnglish" ? "Login" : "登 錄"; /* 登 陆 */
    let Copyright = "Copyright"; /* Copyright */
    let AddrOne = sLanguage === "sChinese" ? "小羚羊软件" : sLanguage === "sEnglish" ? "XiaoLingYangSoft" : "小羚羊軟件"; /* 小羚羊软件 */
    let AddrTwo = sLanguage === "sChinese" ? "印刷智慧工厂" : sLanguage === "sEnglish" ? "PrintingSmartFactory" : "印刷智慧工廠"; /*  印刷智慧工厂 */
    let AddrThree = sLanguage === "sChinese" ? "印刷MES" : sLanguage === "sEnglish" ? "WelcometoMes" : "印刷MES"; /*  印刷MES */
    let AddrFour = sLanguage === "sChinese" ? "印刷ERP" : sLanguage === "sEnglish" ? "PrintingErp" : "印刷ERP"; /* 印刷ERP */
    let AddrFive =
      sLanguage === "sChinese" ? "印刷电商平台" : sLanguage === "sEnglish" ? "PrintingE-commercePlatform" : "印刷電商平台"; /* 印刷电商平台 */
    let AddrSix = sLanguage === "sChinese" ? "文件智能处理" : sLanguage === "sEnglish" ? "FileIntelligenceHandle" : "文件智能處理"; /* 文件智能处理 */
    let AddrSeven = sLanguage === "sChinese" ? "印前自动化" : sLanguage === "sEnglish" ? "PrepressAutomation" : "印前自動化"; /* 印前自动化 */
    let AddrEight = "400-880-6237"; /*  400-880-6237 */
    const AddrIcp = "沪ICP备14034791号-1"; /* 粤ICP备2022093080号-1 */
    if (commonUtils.isNotEmptyArr(loginInfo)) {
      const CompanyNameData = loginInfo.filter(item => item.sControlName === "CompanyName");
      XiaoLingYang = commonUtils.isNotEmptyArr(CompanyNameData) ? CompanyNameData[0].showName : XiaoLingYang;

      if (!this.loginSRMC) {
        const filterDataLoginERP = loginInfo.filter(item => item.sControlName === "LoginERP");
        WelcometoERP = commonUtils.isNotEmptyArr(filterDataLoginERP) ? filterDataLoginERP[0].showName : WelcometoERP;
      }

      const CompanyAllNameData = loginInfo.filter(item => item.sControlName === "CompanyAllName");
      companyName = commonUtils.isNotEmptyArr(CompanyAllNameData) ? CompanyAllNameData[0].showName : companyName;

      const PrintAllFlowData = loginInfo.filter(item => item.sControlName === "PrintAllFlow");
      printAllFlow = commonUtils.isNotEmptyArr(PrintAllFlowData) ? PrintAllFlowData[0].showName : printAllFlow;

      if (!this.loginSRMC) {
        const ERPData = loginInfo.filter(item => item.sControlName === "ERP");
        ERP = commonUtils.isNotEmptyArr(ERPData) ? ERPData[0].showName : ERP;
      }

      const UserLoginData = loginInfo.filter(item => item.sControlName === "UserLogin");
      UserLogin = commonUtils.isNotEmptyArr(UserLoginData) ? UserLoginData[0].showName : "UserLogin";

      const PleaseInputUserNameData = loginInfo.filter(item => item.sControlName === "PleaseInputUserName");
      pleaseInputUserName = commonUtils.isNotEmptyArr(PleaseInputUserNameData) ? PleaseInputUserNameData[0].showName : pleaseInputUserName;

      const PasswordData = loginInfo.filter(item => item.sControlName === "PleaseInputPassword");
      pleaseInputPassword = commonUtils.isNotEmptyArr(PasswordData) ? PasswordData[0].showName : "PleaseInputPassword";

      const ChooseBranchCompanyData = loginInfo.filter(item => item.sControlName === "ChooseBranchCompany");
      chooseBranchCompany = commonUtils.isNotEmptyArr(ChooseBranchCompanyData) ? ChooseBranchCompanyData[0].showName : chooseBranchCompany;

      const BtnLoginData = loginInfo.filter(item => item.sControlName === "BtnLogin");
      btnLogin = commonUtils.isNotEmptyArr(BtnLoginData) ? BtnLoginData[0].showName : btnLogin;

      const CopyrightData = loginInfo.filter(item => item.sControlName === "Copyright");
      Copyright = commonUtils.isNotEmptyArr(CopyrightData) ? CopyrightData[0].showName : Copyright;

      const AddrOneData = loginInfo.filter(item => item.sControlName === "AddrOne");
      AddrOne = commonUtils.isNotEmptyArr(AddrOneData) ? AddrOneData[0].showName : AddrOne;

      const AddrTwoData = loginInfo.filter(item => item.sControlName === "AddrTwo");
      AddrTwo = commonUtils.isNotEmptyArr(AddrTwoData) ? AddrTwoData[0].showName : AddrTwo;

      const AddrThreeData = loginInfo.filter(item => item.sControlName === "AddrThree");
      AddrThree = commonUtils.isNotEmptyArr(AddrThreeData) ? AddrThreeData[0].showName : AddrThree;

      const AddrFourData = loginInfo.filter(item => item.sControlName === "AddrFour");
      AddrFour = commonUtils.isNotEmptyArr(AddrFourData) ? AddrFourData[0].showName : AddrFour;

      const AddrFiveData = loginInfo.filter(item => item.sControlName === "AddrFive");
      AddrFive = commonUtils.isNotEmptyArr(AddrFiveData) ? AddrFiveData[0].showName : AddrFive;

      const AddrSixData = loginInfo.filter(item => item.sControlName === "AddrSix");
      AddrSix = commonUtils.isNotEmptyArr(AddrSixData) ? AddrSixData[0].showName : AddrSix;

      const AddrSevenData = loginInfo.filter(item => item.sControlName === "AddrSeven");
      AddrSeven = commonUtils.isNotEmptyArr(AddrSevenData) ? AddrSevenData[0].showName : AddrSeven;

      const AddrEightData = loginInfo.filter(item => item.sControlName === "AddrEight");
      AddrEight = commonUtils.isNotEmptyArr(AddrEightData) ? AddrEightData[0].showName : AddrEight;
    }

    const dropdownStyle = {
      fontSize: "14px",
    };

    // 修改favicon
    const favicon = logoImageInfo[0];
    if (favicon) {
      let $favicon = document.querySelector('link[rel="icon"]');
      if ($favicon) {
        $favicon.href = favicon;
      } else {
        $favicon = document.createElement("link");
        $favicon.rel = "icon";
        $favicon.href = favicon;
        document.head.appendChild($favicon);
      }
    }

    // 修改左上角logo
    const xlyHeaderLogo = logoImageInfo[1];
    const root = document.querySelector("#root");
    root.style.removeProperty("--xly-header-logo-opacity");
    root.style.removeProperty("--xly-header-logo");
    if (xlyHeaderLogo !== undefined) {
      root.style.setProperty("--xly-header-logo-opacity", 1);
      if (xlyHeaderLogo !== "") {
        root.style.setProperty("--xly-header-logo", `url(${xlyHeaderLogo})`);
      }
    }

    // 修改foot的logo
    const xlyFootLogo = logoImageInfo[3] === "" ? logo : logoImageInfo[3];

    return (
      <div className={styles.wraper}>
        <div className={styles.header}>
          <div className={styles.logo}>
            <h1>
              {XiaoLingYang}
              <span>{WelcometoERP}</span>
            </h1>
          </div>
        </div>
        <div className={styles.login}>
          <div className={styles.loginFormCenter}>
            <div className={styles.leftCon}>
              <h1>{companyName}</h1>
              <h2>{printAllFlow}</h2>
              <h3>{ERP}</h3>
            </div>
            <Form onSubmit={this.handleSubmit} className={`${styles.loginForm_mode} ${this.state.loginType === "face" ? styles.loginForm_face : ""}`}>
              <div className={styles.loginTitle}>{UserLogin}</div>
              <div className={styles.loginMiddle}>
                {this.state.loginType === "face" ? (
                  <div style={{ marginBottom: "22px" }}>
                    <FaceDetect loginAfterInit={true} onIdentifySuccess={this.onIdentifySuccess} actionType={"identifyFace"}></FaceDetect>
                  </div>
                ) : (
                  <>
                    <FormItem className={styles.loginTip}>
                      {getFieldDecorator("username", {
                        rules: [{ required: true, message: pleaseInputUserName }],
                      })(
                        <Input
                          className={styles.loginInput}
                          size="large"
                          prefix={<UserOutlined className={styles.loginIcon} />}
                          placeholder={pleaseInputUserName}
                        />
                      )}
                    </FormItem>
                    <FormItem className={styles.loginTip}>
                      {getFieldDecorator("password", {
                        rules: [{ required: true, message: pleaseInputPassword }],
                      })(
                        <Input
                          className={styles.loginInput}
                          size="large"
                          prefix={<LockOutlined className={styles.loginIcon} />}
                          type="password"
                          placeholder={pleaseInputPassword}
                        />
                      )}
                    </FormItem>
                  </>
                )}
                {/*<FormItem className={styles.loginTip}>*/}
                {/*  {getFieldDecorator('username', {*/}
                {/*    rules: [{ required: true, message: pleaseInputUserName }],*/}
                {/*  })(<Input className={styles.loginInput} size="large" prefix={<UserOutlined className={styles.loginIcon} />} placeholder={pleaseInputUserName} />)}*/}
                {/*</FormItem>*/}
                {/*<FormItem className={styles.loginTip}>*/}
                {/*  {getFieldDecorator('password', {*/}
                {/*    rules: [{ required: true, message: pleaseInputPassword }],*/}
                {/*  })(<Input className={styles.loginInput} size="large" prefix={<LockOutlined className={styles.loginIcon} />} type="password" placeholder={pleaseInputPassword} />)}*/}
                {/*</FormItem>*/}
                {/* <FormItem className={styles.loginTip}>
                  <div className={styles.loginSelect}>
                    {getFieldDecorator('companys', {
                      initialValue: companysId,
                      rules: [{ required: true, message: chooseBranchCompany }],
                    })(<Select placeholder={chooseBranchCompany} size="large" dropdownStyle={dropdownStyle} onSelect={this.handleSelect}>{options}</Select>)}
                  </div>
                </FormItem> */}
              </div>
              <FormItem className={styles.loginBottom}>
                <Button type="primary" htmlType="submit" className={styles.loginButton} loading={loginLoading}>
                  {btnLogin}
                </Button>
              </FormItem>
              {/*屏蔽人脸*/}
              <div style={{ textAlign: "right", position: "relative" }}>
                { ['project.xlyprint.cn', 'localhost'].includes(location.hostname) ? (
                  <Button type="link" size="large" className={styles.userRegister} onClick={() => { this.setState({ userRegisterMode: true }); }}>
                    用户注册
                  </Button>
                ) : "" }
                <Radio.Group onChange={this.onLoginTypeChange} value={this.state.loginType} buttonStyle="solid">
                  <Radio.Button value="normal">普通登录</Radio.Button>
                  <Radio.Button value="face">扫脸登录</Radio.Button>
                </Radio.Group>
              </div>
            </Form>
            <UserRegistration _this={this} />
          </div>
        </div>
        <div className={styles.footer}>
          {xlyFootLogo && <img alt="logo" src={xlyFootLogo} style={{ maxWidth: 20, maxHeight: 20 }} />}©{Copyright}{" "}
          <span className={styles.linkStyle}>
            <a href="http://www.xlyprint.com/" target="_blank" rel="noopener noreferrer">
              {AddrOne}
            </a>{" "}
          </span>
          {commonUtils.isNotEmptyArr(footer) ? (
            <>
              {footer.map(item => {
                const { sIcon, sLink, sName } = item;
                let sPart = "";
                const sIconPart = sIcon ? <img src={sIcon} alt="" /> : "";
                if (sLink) {
                  sPart = (
                    <>
                      {" "}
                      |{" "}
                      <span className={styles.linkStyle}>
                        <a href={sLink} target="_blank" rel="noopener noreferrer">
                          {" "}
                          {sIconPart} {sName}
                        </a>
                      </span>
                    </>
                  );
                } else {
                  sPart = (
                    <>
                      {" "}
                      |{" "}
                      <span>
                        {sIconPart}
                        {sName}
                      </span>
                    </>
                  );
                }
                return sPart;
              })}
            </>
          ) : (
            <>
              {" "}
              |{" "}
              <span className={styles.linkStyle}>
                <a href="http://www.xlyprint.com/zngc.html" target="_blank" rel="noopener noreferrer">
                  {AddrTwo}
                </a>{" "}
              </span>{" "}
              |{" "}
              <span className={styles.linkStyle}>
                <a href="http://www.xlyprint.com/znwl.html" target="_blank" rel="noopener noreferrer">
                  {AddrThree}
                </a>
              </span>{" "}
              |{" "}
              <span className={styles.linkStyle}>
                <a href="http://www.xlyprint.com/yb.html" target="_blank" rel="noopener noreferrer">
                  {AddrFour}
                </a>
              </span>{" "}
              |{" "}
              <span className={styles.linkStyle}>
                <a href="http://www.xlyprint.com/yshlw.html" target="_blank" rel="noopener noreferrer">
                  {AddrFive}
                </a>
              </span>{" "}
              |{" "}
              <span className={styles.linkStyle}>
                <a href="http://www.xlyprint.com/znwj.html" target="_blank" rel="noopener noreferrer">
                  {AddrSix}
                </a>
              </span>{" "}
              |{" "}
              <span className={styles.linkStyle}>
                <a href="http://www.xlyprint.com/yqzdh.html" target="_blank" rel="noopener noreferrer">
                  {AddrSeven}
                </a>
              </span>{" "}
              | {AddrEight} |{" "}
              <span className={styles.linkStyle}>
                <a href="http://beian.miit.gov.cn" target="_blank" rel="noopener noreferrer">
                  {" "}
                  <img src="//gw.alicdn.com/tfs/TB1jwakrbH1gK0jSZFwXXc7aXXa-20-20.png" alt="" /> {AddrIcp}
                </a>
              </span>
            </>
          )}
          {/* ©{Copyright} <span className={styles.linkStyle}><a href="http://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer">{AddrOne}</a> </span> | <span className={styles.linkStyle}><a href="http://www.xlyprint.com/zngc.html" target="_blank" rel="noopener noreferrer">{AddrTwo}</a> </span> | <span className={styles.linkStyle}><a href="http://www.xlyprint.com/znwl.html" target="_blank" rel="noopener noreferrer">{AddrThree}</a></span> | <span className={styles.linkStyle}><a href="http://www.xlyprint.com/yb.html" target="_blank" rel="noopener noreferrer" >{AddrFour}</a></span> |  <span className={styles.linkStyle}><a href="http://www.xlyprint.com/yshlw.html" target="_blank" rel="noopener noreferrer">{AddrFive}</a></span> | <span className={styles.linkStyle}><a href="http://www.xlyprint.com/znwj.html" target="_blank" rel="noopener noreferrer">{AddrSix}</a></span> | <span className={styles.linkStyle}><a href="http://www.xlyprint.com/yqzdh.html" target="_blank" rel="noopener noreferrer">{AddrSeven}</a></span> | {AddrEight} | <span className={styles.linkStyle}><a href="http://beian.miit.gov.cn"> <img src="//gw.alicdn.com/tfs/TB1jwakrbH1gK0jSZFwXXc7aXXa-20-20.png" alt="" /> {AddrIcp}</a></span> */}
        </div>
      </div>
    );
  }
}

const LoginFormComponent = Form.create()(LoginForm);

export default LoginFormComponent;
