严智鑫
2024-07-05 c7093edbf1fb3c91107c457ea13935305e1a9458
UI-Project/src/views/RegisterView.vue
@@ -7,6 +7,10 @@
import { Lock,Avatar } from '@element-plus/icons-vue'
  // import {Avatar, UserFilled} from "@element-plus/icons-vue";
  import { useI18n } from 'vue-i18n'
  const { t } = useI18n()
  let language = ref(localStorage.getItem('lang') || 'zh')
  const router = useRouter()
  const route = useRoute()
  let loginLoadings= ref(false)
@@ -23,9 +27,9 @@
  /*方法*/
  const checkName = (rule: any, value: any, callback: any) => {
    if (value.trim() === '') {
      callback(new Error('姓名不能为空'))
      callback(new Error(t('login.namea')))
    }else if(value.length>16){
      callback(new Error('长度不能超过16'))
      callback(new Error(t('login.len')))
    }else{
      callback()
    }
@@ -33,9 +37,9 @@
  const checkPassword = (rule: any, value: any, callback: any) => {
    if (value.trim() === '') {
      callback(new Error('密码不能为空'))
      callback(new Error(t('login.passnull')))
    }else if(value.length>16 || value.length<6){
      callback(new Error('密码长度不能低于6或超过16'))
      callback(new Error(t('login.leng')))
    }else{
      callback()
    }
@@ -43,11 +47,11 @@
  const checkConfirmPassword = (rule: any, value: any, callback: any) => {
    if (value.trim() === '') {
      callback(new Error('确认密码不能为空'))
      callback(new Error(t('login.spwn')))
    }else if(value !== register.passWord){
      callback(new Error('两次密码不相同'))
      callback(new Error(t('login.depass')))
    }else if(value.length>16 || value.length<6){
      callback(new Error('密码长度不能低于6或超过16'))
      callback(new Error(t('login.leng')))
    }else{
      callback()
    }
@@ -88,14 +92,14 @@
              })
            })
            ElMessage.success(`注册成功`)
            ElMessage.success(t('register.registerSuccessful'))
            loginLoadings.value=false
          } else {
            ElMessage.error(res['msg'])
            return false
          }
        }).catch(error => {
          ElMessage.error("服务器连接失败")
          ElMessage.error(t('main.connectErr'))
          loginLoadings.value=false
          return false
        })
@@ -107,11 +111,6 @@
                path:'/login',
              })
  }
  // console.log(route.params)
</script>
<template>
@@ -123,7 +122,7 @@
        <img src="../../src/assets/3.png">
      </div> 
       <div style="position: absolute; left: 15vw; top: 22vw; font-size: 55px;color: rgba(29, 33, 41, 1);">
        北玻MES系统
        {{ $t('northglassMESsystem') }}
      </div>
    </div>
    <div id="div-login">
@@ -135,33 +134,33 @@
            :rules="rules"
            label-width="75px"
        >
          <div id="title">注册新用户</div>
          <div id="title">{{ $t('register.newuserregister') }}</div>
        <div id="center">
            <!-- <div style="color: rgba(78, 89, 105, 1);margin-bottom: 10px;">姓名</div> -->
          <el-form-item prop="userName" label="姓名:">
          <el-form-item prop="userName" :label="$t('register.name')">
            <el-input
            style="width: 200px;"
                v-model="register.userName"
                type="text"
                autocomplete="off"
                :prefix-icon="Avatar"
                placeholder="请输入姓名"
                :placeholder="$t('register.inputname')"
            />
          </el-form-item>
            <!-- <div style="color: rgba(78, 89, 105, 1);margin-bottom: 10px;">密码</div> -->
          <el-form-item prop="passWord" label="密码:">
          <el-form-item prop="passWord" :label="$t('register.password')">
            <el-input
            style="width: 200px;"
                v-model="register.passWord"
                type="password"
                autocomplete="off"
                :prefix-icon="Lock"
                placeholder="请输入密码"
                :placeholder="$t('register.pwErr')"
                show-password
            />
          </el-form-item>
            <!-- <div style="color: rgba(78, 89, 105, 1);margin-bottom: 10px;">确认密码</div> -->
          <el-form-item prop="confirmPassword" label="确认密码:">
          <el-form-item prop="confirmPassword" :label="$t('register.passwordation')">
            <el-input
            style="width: 200px;"
                v-model="register.confirmPassword" 
@@ -169,7 +168,7 @@
                :prefix-icon="Lock"
                autocomplete="off"
                show-password
                placeholder="请确认密码"
                :placeholder="$t('register.pwErration')"
            />
          </el-form-item>
          <el-form-item id="submitForm">
@@ -178,13 +177,13 @@
                type="primary"
                @click="submitForm(ruleFormRef)"
                plain
            >确认注册
            >{{ $t('register.registration') }}
            </el-button>
            <el-button
                type="primary"
                @click="toLogin"
                plain
            >取消
            >{{ $t('register.false') }}
            </el-button>
          </el-form-item>
@@ -196,25 +195,6 @@
</template>
<style scoped>
/* #main-div{
  position: absolute;
  left:75%;
  top:45%;
  transform: translate(-50%, -50%);
} */
/* #register{
  background-color: #fff;
  width: 32vw;
  height: 35vh;
  box-shadow: 0 8px 16px 0 rgba(0,0,0,0), 0 6px 5px 0 rgba(0,0,0,0.19);
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 280px;
} */
/* .el-form{
  max-width: 300px;
} */
#div-login{
  margin-top: 5%;
  /* margin-top: 20%; */