保安服务单位许可和备案申请系统
lin
2024-05-07 e047fc31f6d9c571b11a8c49072a34edb30176db
src/page/login/codelogin.vue
@@ -1,13 +1,6 @@
<template>
  <el-form
    class="login-form"
    status-icon
    :rules="loginRules"
    ref="loginForm"
    :model="loginForm"
    label-width="0"
  >
    <el-form-item prop="username">
  <el-form class="login-form" status-icon :rules="loginRules" ref="loginForm" :model="loginForm" label-width="0">
    <!-- <el-form-item prop="username">
      <el-input
        size="small"
        @keyup.enter.native="handleLogin"
@@ -17,61 +10,48 @@
      >
        <i slot="prefix" class="icon-yonghu" />
      </el-input>
    </el-form-item>
    </el-form-item> -->
    <el-form-item prop="phone">
      <el-input
        size="small"
        @keyup.enter.native="handleLogin"
        v-model="loginForm.phone"
        auto-complete="off"
        :placeholder="$t('login.phone')"
      >
      <el-input size="small" @keyup.enter.native="handleLogin" v-model="loginForm.phone" auto-complete="off"
        :placeholder="$t('login.phone')">
        <i slot="prefix" class="el-icon-phone-outline" />
      </el-input>
    </el-form-item>
    <el-form-item prop="password">
      <el-input
        size="small"
        @keyup.enter.native="handleLogin"
        v-model="loginForm.password"
        auto-complete="off"
        show-password
        :placeholder="$t('login.password')"
      >
      <el-input size="small" @keyup.enter.native="handleLogin" v-model="loginForm.password" auto-complete="off"
        show-password :placeholder="$t('login.password')">
        <i slot="prefix" class="icon-mima" />
      </el-input>
    </el-form-item>
    <el-form-item prop="password2">
      <el-input
        size="small"
        @keyup.enter.native="handleLogin"
        v-model="loginForm.password2"
        auto-complete="off"
        show-password
        :placeholder="$t('login.password2')"
      >
      <el-input size="small" @keyup.enter.native="handleLogin" v-model="loginForm.password2" auto-complete="off"
        show-password :placeholder="$t('login.password2')">
        <i slot="prefix" class="icon-mima" />
      </el-input>
    </el-form-item>
    <el-form-item class="z-login-submit-prv">
      <el-button
        size="small"
        type="primary"
        @click.native.prevent="handleLogin"
        class="z-login-submit"
        >{{ $t("login.zc") }}
      <el-button size="small" type="primary" @click.native.prevent="handleLogin"
        class="z-login-submit">{{ $t("login.zc") }}
      </el-button>
      <el-button size="small" @click.native.prevent="gbs" class="z-login-submit"
        >{{ $t("login.gb") }}
      <el-button size="small" @click.native.prevent="gbs" class="z-login-submit">{{ $t("login.gb") }}
      </el-button>
    </el-form-item>
  </el-form>
</template>
<script>
import { isvalidatemobile } from "@/util/validate";
import { mapGetters } from "vuex";
import { zc } from "@/api/system/user";
  import {
    isvalidatemobile
  } from "@/util/validate";
  import {
    mapGetters
  } from "vuex";
  import {
    zc
  } from "@/api/system/user";
export default {
  name: "codelogin",
@@ -113,6 +93,7 @@
      msgKey: false,
      loginForm: {
        username: "",
          account: "",
        phone: "",
        password: "",
        password2: "",
@@ -120,17 +101,31 @@
      value: "",
      options: [],
      loginRules: {
        phone: [{ required: true, trigger: "blur", validator: validatePhone }],
        code: [{ required: true, trigger: "blur", validator: validateCode }],
        password: [
          { required: true, validator: validatePass, trigger: "blur" },
        ],
        password2: [
          { required: true, validator: validatePass2, trigger: "blur" },
        ],
        username: [
          { required: true, message: "请输入用户名", trigger: "blur" },
        ],
          phone: [{
            required: true,
            trigger: "blur",
            validator: validatePhone
          }],
          code: [{
            required: true,
            trigger: "blur",
            validator: validateCode
          }],
          password: [{
            required: true,
            validator: validatePass,
            trigger: "blur"
          }, ],
          password2: [{
            required: true,
            validator: validatePass2,
            trigger: "blur"
          }, ],
          username: [{
            required: true,
            message: "请输入用户名",
            trigger: "blur"
          }, ],
      },
      passwordType: "password",
      passwordTypes: "password2",
@@ -208,7 +203,7 @@
      this.$refs[formName].clearValidate();
    },
    refreshCode(row) {
      zc(row.username, row.password, row.phone).then((res) => {
        zc(row).then((res) => {
        this.loginForm.username = "";
        this.loginForm.phone = "";
        this.loginForm.password = "";
@@ -247,19 +242,20 @@
      }, 1000);
    },
    showPassword() {
      this.passwordType === ""
        ? (this.passwordType = "password")
        : (this.passwordType = "");
        this.passwordType === "" ?
          (this.passwordType = "password") :
          (this.passwordType = "");
    },
    showPasswords() {
      this.passwordType === ""
        ? (this.passwordType = "password2")
        : (this.passwordType = "");
        this.passwordType === "" ?
          (this.passwordType = "password2") :
          (this.passwordType = "");
    },
    handleLogin() {
      this.$refs.loginForm.validate((valid) => {
        console.log(valid);
        if (valid) {
            this.loginForm.account = this.loginForm.phone
          this.refreshCode(this.loginForm);
          this.message("dahsiofhiusa");
          return Promise.reject(new Error("注册成功,待审核"));