<template>
  <!-- 登录 -->
  <div>
    <div class="login" v-if="projectType == 'common'">
      <div class="title flex">
        <div class="title_l flex2">
          <img
            v-if="systemInfo.loginLogo"
            :src="systemInfo.loginLogo"
            class="logo"
          />
          <img
            v-else-if="LOGO"
            :src="'./img/logo/' + LOGO + '.png'"
            class="logo"
          />
          <span v-if="systemInfo.platformName && company != 'nanchang'">{{
            systemInfo.platformName
          }}</span
          ><!--智慧工地云平台-->
          <span v-if="!systemInfo.platformName && company != 'nanchang'">{{
            $t("message.login.title")
          }}</span
          ><!--智慧工地云平台-->

          <!-- 南昌地铁登录页不显示智慧工地云平台字样 -->
          <span v-if="company == 'nanchang'"></span>
        </div>
        <div class="title_r">
          <el-button
            type="primary"
            plain
            size="small"
            class="backBtn"
            @click="goBackBtn"
            >返回到首页</el-button
          >
        </div>
      </div>
      <div class="content flex2">
        <img
          class="contentBG"
          v-if="systemInfo.loginBackgroundImage"
          :src="systemInfo.loginBackgroundImage"
          alt=""
        />
        <img
          class="contentBG"
          v-else
          src="../../assets/images/login_bg.webp"
          alt=""
        />
        <div class="loginContent" v-if="COMPANY == 'hengtong'">
          <div>
            <span style="font-size: 3.8vw">欢</span>迎进入<span
              style="color: orange"
              >智建宝</span
            >云平台
          </div>
        </div>
        <div class="login_info" v-if="isLogin">
          <div class="info_title flex">
            <p
              :class="loginType == 1 ? 'border_bottom' : 'placeholder'"
              @click="
                () => {
                  loginType = 1;
                }
              "
            >
              用户登录
            </p>
            <p
              :class="loginType == 2 ? 'border_bottom' : 'placeholder'"
              @click="
                () => {
                  loginType = 2;
                }
              "
            >
              供应商登录
            </p>
          </div>
          <div class="info_content">
            <el-form :model="form" :rules="rules" ref="form" label-width="0px" 
              key="form">
              <el-form-item label="" prop="account">
                <el-input
                  v-model="form.account"
                  style="height: 53px; font-size: 16px"
                  :placeholder="$t('message.login.account_placeholder')"
                >
                  <img
                    slot="prefix"
                    src="../../assets/images/accountNumber.png"
                    class="inputIcon"
                  />
                </el-input>
              </el-form-item>
              <el-form-item style="margin-top: 25px" label="" prop="password">
                <!--  @keyup.enter.native="loginFn" -->
                <el-input
                  v-model="form.password"
                  style="height: 53px; font-size: 16px"
                  type="password"
                  show-password
                  :placeholder="$t('message.login.password_placeholder')"
                >
                  <img
                    slot="prefix"
                    src="../../assets/images/password.png"
                    class="inputIcon"
                  />
                </el-input>
              </el-form-item>
            </el-form>
          </div>
          <div style="margin-top: 25px">
            <!-- <el-button type="success" plain class="logo_btn" :disabled="verificateBtn"  @click="verificateFn"
              >{{ verificateBtn==false?'立即点击验证':'验证成功'}}
            </el-button> -->
            <el-button
              type="success"
              v-if="verificateBtn == false"
              plain
              class="logo_btn"
              :disabled="verificateBtn"
              @click="verificateFn"
            >
              <div class="point"></div>
              立即点击验证
            </el-button>
            <el-button
              type="success"
              v-else
              plain
              class="logo_btn"
              :disabled="verificateBtn"
              ><i class="el-icon-success"></i> 验证成功
            </el-button>
          </div>
          <div style="margin-top: 25px">
            <el-button
              type="primary"
              :disabled="pass"
              class="logo_btn"
              @click="loginFn"
              >{{ $t("message.login.login") }}
            </el-button>
          </div>
          <div class="register-btn">
            <el-button type="text" @click="goRegister">{{
              loginType == 1 ? "用户账号注册" : "供应商账号注册"
            }}</el-button>
          </div>
          <div class="info_bottom">
            友情提示：win7以上操作系统，浏览器使用Chrome；电脑屏幕分辩率>=1440X900达到最佳浏览视觉
          </div>
          <!-- <div class="info_bottom">为了平台效果展示更好，请使用屏幕分辩率>=1440X900</div> -->
          <div class="info_bottom flex" style="display: none">
            <div
              class="flex2"
              @click="
                () => {
                  automaticLogin = !this.automaticLogin;
                }
              "
            >
              <img
                src="../../assets/images/no_checked.png"
                v-if="!automaticLogin"
              />
              <img
                src="../../assets/images/checked.png"
                v-if="automaticLogin"
              />
              <span style="margin-left: 12px">{{
                $t("message.login.automaticLogon")
              }}</span>
            </div>
            <div>
              <span style="margin-right: 5px">{{
                $t("message.login.forgetThePassword")
              }}</span>
              <span class="span_placeholder"></span>
              <el-button type="text" style="margin-left: 5px" @click="goSignIn">
                {{ $t("message.login.clickRegister") }}
              </el-button>
            </div>
          </div>
        </div>
        <div class="login_info-register" v-if="!isLogin">
          <div class="info_title flex">
            <p
              :class="registerType == 1 ? 'border_bottom' : 'placeholder'"
              @click="
                () => {
                  registerType = 1;
                }
              "
            >
              新用户注册
            </p>
            <p
              :class="registerType == 2 ? 'border_bottom' : 'placeholder'"
              @click="
                () => {
                  registerType = 2;
                }
              "
            >
              供应商注册
            </p>
          </div>
          <div class="info_content">
            <el-form
              :model="registerForm"
              :rules="registerRules"
              ref="registerForm"
              key="registerForm"
              label-width="0px"
            >
              <el-form-item label="" prop="account">
                <el-input
                  v-model="registerForm.account"
                  style="height: 53px; font-size: 16px"
                  placeholder="请输入您的账号"
                >
                  <img
                    slot="prefix"
                    src="../../assets/images/userNameIcon.png"
                    class="inputIcon"
                  />
                </el-input>
              </el-form-item>
              <el-form-item label="" prop="pw">
                <!--  @keyup.enter.native="loginFn" -->
                <el-input
                  v-model="registerForm.pw"
                  style="height: 53px; font-size: 16px"
                  type="password"
                  show-password
                  placeholder="请输入您的密码"
                >
                  <img
                    slot="prefix"
                    src="../../assets/images/password.png"
                    class="inputIcon"
                  />
                </el-input>
              </el-form-item>
              <el-form-item
                label=""
                prop="companyName"
                v-if="registerType == 2"
              >
                <!--  @keyup.enter.native="loginFn" -->
                <el-input
                  v-model="registerForm.companyName"
                  style="height: 53px; font-size: 16px"
                  placeholder="请输入您的企业名称"
                >
                  <img
                    slot="prefix"
                    src="../../assets/images/enterpriseIcon.png"
                    class="inputIcon"
                  />
                </el-input>
              </el-form-item>
              <el-form-item label="" prop="email">
                <!--  @keyup.enter.native="loginFn" -->
                <el-input
                  v-model="registerForm.email"
                  style="height: 53px; font-size: 16px"
                  placeholder="请输入您的电子邮箱"
                >
                  <img
                    slot="prefix"
                    src="../../assets/images/emailIcon.png"
                    class="inputIcon"
                  />
                </el-input>
              </el-form-item>
            </el-form>
          </div>
          <div>
            <el-button type="primary" class="logo_btn" @click="registerFn"
              >提交
            </el-button>
          </div>
          <div class="register-btn">
            <el-button type="text" @click="goLogin">返回登录</el-button>
          </div>
        </div>
        <!-- 滑动验证 -->
        <div class="mask" v-if="showVerify" @click.self="showVerify = false">
          <div class="slideContainer">
            <slide-verify
              :l="42"
              :r="10"
              :w="330"
              :h="175"
              :imgs="imageList"
              slider-text="向右滑动滑块填充拼图"
              ref="slideverify"
              @success="onSuccess"
              @fail="onFail"
              @refresh="onRefresh"
            ></slide-verify>
          </div>
        </div>
      </div>
    </div>
    <div class="zjsjLogin" v-if="projectType == 'zjsj'">
      <div class="zjsjcontent">
        <img
          class="contentBGI"
          src="../../assets/images/zjsj/zjsj_loginBgc.jpg"
          alt=""
        />
        <LoginInfo
          class="leftContent"
          ref="LoginInfo"
          :form="form"
          :rules="rules"
          @loginFn="loginFn"
        ></LoginInfo>
      </div>
    </div>
    <!-- 修改密码弹框 -->
    <el-dialog
      :modal-append-to-body="false"
      title="提示"
      :visible.sync="addPasswordDialog"
      width="667px"
      @close="close"
    >
      <div class="dialog_content">
        <div class="questionText">
          <i
            style="color: #e1a439; margin-right: 1%"
            class="el-icon-question"
          ></i
          >密码有效期已超过90天，为确保您的账号安全，请重新修改密码！
        </div>
        <el-form
          size="medium"
          :model="passwordForm"
          ref="passwordForm"
          :rules="passwordFormRules"
          label-width="120px"
          class="dialogFormBox"
          style="margin-left: 20px"
        >
          <el-form-item
            style="margin-bottom: 40px"
            label="新密码"
            prop="passWord"
          >
            <el-input
              v-model="passwordForm.passWord"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <el-form-item label="确认密码" prop="showPassword">
            <el-input
              type="password"
              show-password
              v-model="passwordForm.showPassword"
              placeholder="请输入"
            ></el-input>
          </el-form-item>
          <div class="dialog-footer" style="text-align: center">
            <el-button
              style="margin-left: 90px"
              type="primary"
              icon="el-icon-circle-check"
              @click="savePasswordBtn"
              size="medium"
              >确定
            </el-button>
          </div>
        </el-form>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import vueMatomo from "vue-matomo";
import {
  loginPhoneApi,
  loginApi,
  loginApiMD5,
  getUserByUidApi,
  companyLoginApi,
  projectLoginApi,
  newRegisterApi
} from "@/assets/js/api/loginSign";
import { selectSystemLogoConfigApi } from "@/assets/js/api/jxjadmin";
import getcode from "@/components/getMsgCode";
import { getOneComputerAuthApi } from "@/assets/js/api/loginSign";
import { selectNoticeRemindSoundApi } from "@/assets/js/api/configManage";
import LoginInfo from "./components/loginInfo.vue";
import axios from "axios";
import { MD5 } from "crypto-js";

export default {
  name: "login",
  components: { getcode, LoginInfo },
  data() {
    return {
      addPasswordDialog: false,
      passwordForm: {
        passWord: "",
        showPassword: "",
        token: "",
      },
      passwordFormRules: {
        passWord: [
          { required: true, message: "请输入新密码", trigger: "blur" },
          {
            pattern: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[!@#$%^&*()_+~`\-={}[\]:";'<>?,./])[a-zA-Z\d!@#$%^&*()_+~`\-={}[\]:";'<>?,./]{8,}$/,
            message:
              "密码必须包含至少一个字母、一个数字、一个特殊字符以及长度至少为8位数",
            trigger: "blur",
          },
        ],
        showPassword: [
          { required: true, message: "请确认密码", trigger: "blur" },
          { validator: this.validateConfirmPassword, trigger: "blur" },
        ],
      },
      COMPANY: COMPANY,
      msg: "",
      oldVal: "",
      show: false,
      showVerify: false, // 滑动验证
      verificateBtn: false, //验证按钮
      pass: true, // 登录按钮
      input: "",
      radio: "",
      projectType: "",
      LOGO: LOGO,
      loginType: 1,
      registerType: 1,
      automaticLogin: false,
      form: {
        account: "",
        password: "",
      },
      registerForm: {
        account: "",
        pw: "",
        email: "",
        companyName: "",
      },
      rules: {
        account: [
          {
            required: true,
            message: this.$t("message.login.rules.account_message"),
            trigger: "blur",
          },
        ],
        password: [
          {
            required: true,
            message: this.$t("message.login.rules.password_message"),
            trigger: "blur",
          },
        ],
      },
      registerRules: {
        account: [
          {
            required: true,
            message: "请输入",
            trigger: "blur",
          },
        ],
        pw: [
          {
            required: true,
            message: "请输入正确的密码格式",
            trigger: "blur",
            pattern: /(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^0-9a-zA-Z]).{8,30}/
          },
        ],
        companyName: [
          {
            required: true,
            message: "请输入",
            trigger: "blur",
          },
        ],
        email: [
          {
            type: "email",
            required: true,
            message: "请输入正确的邮箱格式",
            trigger: "blur",
          },
        ]
      },
      systemInfo: {
        loginBackgroundImage: "",
        loginLogo: "",
        platformLogo: "",
        platformName: "",
      },
      imageList: [
        require("../../assets/images/login/p1.jpg"),
        require("../../assets/images/login/p2.jpg"),
        require("../../assets/images/login/p3.jpg"),
        require("../../assets/images/login/p4.jpg"),
        require("../../assets/images/login/p5.jpg"),
        require("../../assets/images/login/p6.jpg"),
        require("../../assets/images/login/p7.jpg"),
        require("../../assets/images/login/p8.jpg"),
      ],
      headquartersSnData: "",
      isLogin: true, // 默认是登录态
    };
  },
  watch: {
    loginType(newDate, oldDate) {
      console.log(newDate);
      console.log(oldDate);
      if (newDate === 1) {
        window._paq.push(["trackEvent", "点击", "登录", "使用密码登录"]);
      } else {
        window._paq.push(["trackEvent", "点击", "登录", "使用账号登录"]);
      }
    },
    // oldVal:{
    //   handler(n,o){
    //     console.log(n,o);
    //       if(n!= o){
    //       console.log('====监听不一样')
    //       this.showVerify = true,
    //       this.pass = false
    //      }
    //   },
    //   deep:true,
    //   immediate:false
    // }
  },
  created() {
    this.company = COMPANY;
    this.projectType = PROJECT_TYPE;
    setTimeout(() => {
      //删除401标识
      sessionStorage.setItem("errorResponse", null);
    }, 3000);
    if (this.$route.query.headquartersSn) {
      this.headquartersSnData = this.$route.query.headquartersSn;
    } else {
      this.headquartersSnData = this.$store.state.userInfo?.headquartersSn
        ? this.$store.state.userInfo?.headquartersSn
        : "";
    }
  },
  mounted() {
    // this.$bus.$on('resetSlideVerify',this.onReset)
    delete this.$http.defaults.headers.common["Authorization"];
    if (window.location.href.indexOf("type=lgzbdp") != -1) {
      window.localStorage.setItem("isIframe", "1");
    } else {
      if (window.localStorage.getItem("isIframe")) {
        window.localStorage.removeItem("isIframe");
      }
    }
    //兼容第三方平台接入 ---做免码登录
    if (window.location.href.indexOf("UID") != -1) {
      // debugger;
      this.$store.commit("setUid", true);
      // let str = window.location.href.split("UID=")[1];
      let uid = window.location.href.split("UID=")[1];
      // let uid = str.substring(0, str.length - 7);
      let data = {
        uid,
      };
      //获取到用户信息
      getUserByUidApi(data).then((res) => {
        if (res.code == 200) {
          //赋值
          this.parseLoginData(res.result);
        } else {
          this.$message.error(res.message);
        }
      });
    }
    // else if(){}
    else {
      this.$store.commit("setUid", false);
      this.getDetail(this.headquartersSnData);
      this.getData();
    }
  },
  methods: {
    // 去登录
    goLogin() {
      this.isLogin = true;
    },
    // 去注册
    goRegister() {
      this.isLogin = false;
      this.registerForm = {
        account: "",
        pw: "",
        email: "",
        companyName: "",
      }
    },
    //修改密码提交
    savePasswordBtn() {
      this.$refs["passwordForm"].validate((valid) => {
        if (valid) {
          axios({
            method: "post",
            headers: {
              Authorization: "Bearer " + this.passwordForm.token,
              "Content-Type": "application/json", // 设置请求头的 Content-Type
            },
            url:
              this.$http.defaults.baseURL +
              "xmgl/systemUser/updateUserPassWord",
            data: {
              passWord: this.passwordForm.passWord,
            },
          }).then((res) => {
            if (res.data.code == 200) {
              this.$message.success("密码修改成功，请重新登录");
              this.addPasswordDialog = false;
            }
          });
        }
      });
    },
    validateConfirmPassword(rule, value, callback) {
      if (value !== this.passwordForm.passWord) {
        callback(new Error("两次输入密码不一致"));
      } else {
        callback();
      }
    },
    close() {
      this.passwordForm = {};
      this.$nextTick(() => {
        this.$refs.passwordForm.clearValidate();
      });
    },
    onReset() {
      //重置图片验证组件
      this.$refs.slideverify.reset();
    },
    onSuccess() {
      this.oldVal = this.form.account;
      this.verificateBtn = true;
      this.showVerify = false;
      this.pass = false;
    },
    onFail() {
      this.msg = "验证失败";
    },
    onRefresh() {},
    getData() {
      getOneComputerAuthApi().then((res) => {
        if (res.result) {
        } else {
          this.$router.push({ path: "/authorization" });
        }
      });
    },
    getDetail(val) {
      selectSystemLogoConfigApi({
        headquartersSn: val,
      }).then((res) => {
        if (res.result) {
          console.log("查看有没有背景图", res);
          console.log(window.location.protocol);
          this.systemInfo = res.result;
          if (this.systemInfo.loginLogo) {
            this.systemInfo.loginLogo =
              window.location.protocol +
              "//" +
              res.result.loginLogo.split("//")[1];
          }
          localStorage.setItem("systemInfo", JSON.stringify(res.result));
          if (res.result.fileStorageType !== "0") {
            this.$store.commit("setFILEURL", "");
          }
        }
      });
    },
    goBackBtn() {
      this.$store.commit("setUserInfo", null);
      this.$store.commit("setMapBackArr", []);
      this.$store.commit("setMoudle", null);
      this.$store.commit("setProDetail", null);
      window.localStorage.removeItem("isIframe");
      window.localStorage.removeItem("soundList");

      this.$router.push({ path: "/" });
    },
    goSignIn() {
      this.$router.push({ path: "/sign" });
    },
    // 立即验证
    verificateFn() {
      this.showVerify = true;
      // this.$bus.$emit('resetSlideVerify')
    },
    loginFn() {
      // 1系统管理员，2企业管理员账号，3企业区账号，4企业市账号，5项目账号  6项目子账号   7项目部账号
      if (this.loginType == 1 || this.loginType == 2) {
        this.$nextTick(() => {
          if (this.projectType == "zjsj") {
            this.$refs["LoginInfo"].$refs["form"].validate((valid) => {
              // console.log("this.$refs['LoginInfo']:", this.$refs["LoginInfo"]);
              if (valid) {
                if (LOGINTYPE == 1) {
                  loginApi(this.form).then((res) => {
                    console.log("--------------------么么儿们10");
                    console.log(res.result);
                    this.parseLoginData(res.result);
                    this.getDetail(this.headquartersSnData);
                  });
                } else if (LOGINTYPE == 2) {
                  console.log(2222222222222);
                  companyLoginApi(this.form).then((res) => {
                    this.parseLoginData(res.result);
                    this.getDetail(this.headquartersSnData);
                  });
                } else if (LOGINTYPE == 5) {
                  console.log("中建四局项目账号");
                } else if (LOGINTYPE == 3) {
                  console.log(333333333);

                  projectLoginApi(this.form).then((res) => {
                    this.parseLoginData(res.result);
                    this.getDetail(this.headquartersSnData);
                  });
                }
              } else {
                console.log("error submit!!");
                return false;
              }
            });
          } else if (this.projectType == "common") {
            this.$refs["form"].validate((valid) => {
              if (valid) {
                if (LOGINTYPE == 1) {
                  let timestamp = Date.now();
                  let md5Password = MD5(
                    MD5(this.form.password).toString() + timestamp
                  ).toString();
                  let dataMD5 = {
                    account: this.form.account,
                    md5Password: md5Password,
                    timestamp: timestamp,
                  };
                  // console.log("加密前",this.form);
                  // console.log("加密后",dataMD5);
                  loginApiMD5(dataMD5).then((res) => {
                    //用户登录安全等保
                    if (res.result.expire) {
                      this.addPasswordDialog = true;
                      this.passwordForm.token = res.result.token;
                    } else {
                      this.parseLoginData(res.result);
                      this.getDetail(this.headquartersSnData);
                    }
                  });
                } else if (LOGINTYPE == 2) {
                  console.log(2222222222222);

                  companyLoginApi(this.form).then((res) => {
                    this.parseLoginData(res.result);
                    this.getDetail(this.headquartersSnData);
                  });
                } else if (LOGINTYPE == 3) {
                  console.log(333333333);

                  projectLoginApi(this.form).then((res) => {
                    this.parseLoginData(res.result);
                    this.getDetail(this.headquartersSnData);
                  });
                }
              } else {
                console.log("error submit!!");
                return false;
              }
            });
          }
        });
      } else {
        this.$refs["form2"].validate((valid) => {
          if (valid) {
            loginPhoneApi(this.form2).then((res) => {
              this.parseLoginData(res.result);
            });
          } else {
            console.log("error submit!!");
            return false;
          }
        });
      }
    },
    registerFn() {
      this.$refs["registerForm"].validate((valid) => {
          // console.log("this.$refs['LoginInfo']:", this.$refs["LoginInfo"]);
          let requestData = {...this.registerForm}
          requestData.accountType = this.registerType;
          if(this.registerType == 1){
            delete requestData.enterpriseName
          }
          if (valid) {
            newRegisterApi({...this.registerForm, headquartersSn: this.headquartersSnData, accountType:this.registerType}).then((res) => {
              this.$message.success('注册成功');
              this.goLogin();
            });
          } else {
            console.log("error submit!!");
            return false;
          }
        });
    },
    selectMp3FileList() {
      selectNoticeRemindSoundApi({
        projectSn: this.$store.state.projectSn,
      }).then((res) => {
        console.log(res);
        if (res.code == 200) {
          // this.MP4FileList = res.result
          localStorage.setItem("soundList", JSON.stringify(res.result));
          console.log(localStorage.getItem("soundList"));
        }
      });
    },
    parseLoginData(data) {
      if (this.projectType == "zjsj") {
        this.$store.commit("setProjectSn", data.sn);
      }
      window._paq.push(["trackEvent", "点击", "登录", "登录账号"]);
      this.$message.success(this.$t("message.login.login_success_msg")); //登录成功！
      this.$http.defaults.headers.common["Authorization"] =
        "Bearer" + " " + data.token;
      this.$http.defaults.headers.common["operateId"] = data.userId;
      this.$store.commit("setUserInfo", data);
      localStorage.setItem("jumpToken", data.token); //储存token到本地

      var moduleList = data.menuAuthority.moduleList
        ? data.menuAuthority.moduleList
        : [];
      var companyModule = [];
      var projectModule = [];
      if (moduleList.length == 0 && data.accountType != 1) {
        this.$message.warning("当前账号还没分配权限");
        return false;
      }
      moduleList.forEach((element) => {
        if (element.moduleType == 1) {
          companyModule.push(element);
        }
        if (element.moduleType == 5) {
          projectModule.push(element);
        }
      });
      var menu2 = [
        {
          menuName: "企业管理",
          id: 9199,
          path: "/registerAudit",
        },
        {
          menuName: "模块菜单管理",
          id: 9299,
          path: "/moduleMenuManage",
        },
        {
          menuName: "app版本管理",
          id: 9297,
          path: "/operateManage",
        },
        {
          menuName: "字典管理",
          id: 9298,
          path: "/dictionaryManaged",
        },
        {
          menuName: "系统设置",
          id: 9299,
          path: "/systemSettings",
        },
        // {
        //   menuName: '塔吊模型管理',
        //   id: 9300,
        //   path: '/brand'
        // }
      ];
      console.log(data.accountType, "777888");
      switch (data.accountType) {
        case 1:
          this.$store.commit("setMenuList", menu2);
          this.$store.commit("setProjectManageMenuList", menu2);
          console.log("-----------", menu2);
          this.$store.commit("setIsShowBackIndex", false);
          this.$router.push("/registerAudit");
          break;
        case 2:
          this.$store.commit("setMenuList", companyModule);
          this.$store.commit("setProjectManageMenuList", companyModule);
          this.$store.commit("setIsShowBackIndex", false);
          this.$router.push(companyModule[0].modulePath);
          break;
        case 3:
          this.$store.commit("setMenuList", companyModule);
          this.$store.commit("setProjectManageMenuList", companyModule);
          this.$store.commit("setIsShowBackIndex", false);
          this.$router.push(companyModule[0].modulePath);
          break;
        case 4:
          this.$store.commit("setMenuList", companyModule);
          this.$store.commit("setProjectManageMenuList", companyModule);
          this.$store.commit("setIsShowBackIndex", false);
          this.$router.push(companyModule[0].modulePath);
          break;
        case 7:
          this.$store.commit("setMenuList", companyModule);
          this.$store.commit("setProjectManageMenuList", companyModule);
          this.$store.commit("setIsShowBackIndex", false);
          this.$router.push(companyModule[0].modulePath);
          break;
        case 5:
        case 6:
        case 11:
          // 中建四局
          this.$store.commit("setMenuList", projectModule);
          this.$store.commit("setProjectManageMenuList", projectModule);
          this.$store.commit("setIsShowBackIndex", false);
          if (this.projectType == "zjsj") {
            console.log("是这里吗", data);
            //看看项目看板内有没有菜单
            let arr = data.menuAuthority.moduleList;
            let arr2 = [];
            arr.forEach((element) => {
              if (element.moduleType == 4) {
                arr2.push(element);
                return;
              }
            });
            console.log("arr2", arr2);
            // 如果数组为空表示该用户没有权限访问
            if (!arr2.length) {
              if(this.loginType == 1){
                // this.$router.push("/projectIndex");
                this.$router.push("/workSpace");
              } else {
                this.$router.push("/supplierIndex");
              }
            } else {
              this.$router.push(arr2[0].modulePath);
            }
          } else {
            // styleType == 3 衢州版
            if (
              (data.styleType != 2 && data.styleType != 3) ||
              !data.styleType
            ) {
              if(this.loginType == 1){
                // this.$router.push("/projectIndex");
                this.$router.push("/workSpace");
              } else {
                this.$router.push("/supplierIndex");
              }
            } else if (data.styleType == 2) {
              this.$router.push("/projectV2/taskList");
            } else {
              this.$router.push("/projectV3/taskList");
            }
            this.$store.commit("setProjectSn", data.sn);
            break;
          }
      }
      this.selectMp3FileList();
    },
  },
};
</script>
<style lang="less" scoped>
.zjsjLogin {
  width: 100%;
  height: 100%;

  .zjsjcontent {
    width: 100%;
    height: 100%;
    position: relative;

    .contentBGI {
      width: 100%;
      height: 100%;
    }
  }
}

.flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex2 {
  display: flex;
  align-items: center;
}

.contentBG {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
}

.login {
  width: 100%;
  height: 100%;
  background: #fff;

  .title {
    padding: 42px 35px 0;
    font-family: PingFangSC-Semibold;
    font-size: 24px;
    color: @--color-black;
    letter-spacing: 0;

    .logo {
      // width: 25px;
      height: 37px;
      margin-right: 20px;
    }

    .backBtn {
      width: 114px;
      font-size: 14px;
    }
  }

  .content {
    width: 100%;
    height: 652px;
    margin-top: 90px;
    // background-image: url("../../assets/images/login_bg.png");
    flex-direction: row-reverse;
    position: relative;

    .mask {
      position: fixed;
      left: 0%;
      top: 0%;
      width: 100%;
      height: 100%;
      z-index: 100;
      overflow: hidden;
      background-color: rgba(0, 0, 0, 0.3);
    }

    .mask .slideContainer {
      display: flex;
      justify-content: center;
      align-items: center;
      position: absolute;
      left: 55%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: 380px;
      height: 250px;
      background-color: rgb(255, 255, 255);
    }

    .login_info,
    .login_info-register {
      width: 444px;
      height: 475px;
      background: #ffffff;
      box-shadow: 0 0 31px 0 rgba(13, 28, 91, 0.28);
      border-radius: 5px;
      margin-right: 123px;
      box-sizing: border-box;
      padding: 37px 33.5px 0;
      position: relative;
      z-index: 2;

      p {
        width: 50%;
        margin: 0;
        box-sizing: border-box;
        padding-bottom: 13px;
        font-weight: 600;
      }

      .border_bottom {
        border-bottom: 2px solid @--color-primary;
        color: @--color-primary;
      }

      .placeholder {
        padding: 0 0 15px;
      }

      .info_title {
        justify-content: space-around;
        font-family: PingFangSC-Medium;
        font-size: 16px;
        color: #aeafb9;
        text-align: center;
        cursor: pointer;
        border-bottom: 1px solid #edeff2;
      }

      .info_content {
        margin-top: 25px;

        img {
          width: 16.8px;
          height: 24px;
        }
      }
      .register-btn {
        display: flex;
        align-items: center;
        justify-content: flex-end;
      }
      .logo_btn {
        height: 53px;
        width: 100%;
        font-family: PingFangSC-Regular;
        font-size: 20px;
        // .point::after{
        //   -webkit-animation-delay: .4s;
        //   animation-delay: .4s;
        // }

        // .point::before{
        //   content: "";
        //   display: block;
        //   width: 20px;
        //   height: 20px;
        //   background: #67c23a;
        //   position: absolute;
        //   left: 30%;
        //   // -webkit-animation: shield-breathing 1.4s ease infinite;
        //   // animation: shield-breathing 1.4s ease infinite;
        //   border-radius: 50%;
        // }
      }

      .info_bottom {
        font-family: PingFangSC-Regular;
        font-size: 14px;
        color: #8e8e8e;
        cursor: pointer;
      }

      .span_placeholder {
        display: inline-block;
        width: 1px;
        height: 15px;
        margin-bottom: -3px;
        background: rgba(142, 142, 142, 0.8);
      }

      /deep/ .el-input__inner {
        height: 53px;
        height: 53px;
        padding-left: 45px;
      }
    }
    .login_info-register {
      width: 444px;
      height: 500px;
      /deep/.el-form-item {
        margin-bottom: 20px !important;
      }
    }
  }
}

.inputIcon {
  margin-top: 14px;
  margin-left: 10px;
}

.tipsBox {
  text-align: center;
  padding: 20px 0;
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}

.loginContent {
  width: 44%;
  height: 300px;
  /* background-color: palevioletred; */
  position: absolute;
  right: 42%;
  /* font-weight: bold; */
  font-size: 3.6vw;
  color: #fff;
  top: 40%;
}
</style>
