| | |
| | | <template>
|
| | | <div class="register">
|
| | | <el-form ref="registerRef" :model="registerForm" :rules="registerRules" class="register-form">
|
| | | <h3 class="title">若依后台管理系统</h3>
|
| | | <h3 class="title">{{ title }}</h3>
|
| | | <el-form-item prop="username">
|
| | | <el-input v-model="registerForm.username" type="text" auto-complete="off" placeholder="账号">
|
| | | <el-input |
| | | v-model="registerForm.username" |
| | | type="text" |
| | | size="large" |
| | | auto-complete="off" |
| | | placeholder="账号"
|
| | | >
|
| | | <template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
|
| | | </el-input>
|
| | | </el-form-item>
|
| | |
| | | <el-input
|
| | | v-model="registerForm.password"
|
| | | type="password"
|
| | | size="large" |
| | | auto-complete="off"
|
| | | placeholder="密码"
|
| | | @keyup.enter="handleRegister"
|
| | |
| | | <el-input
|
| | | v-model="registerForm.confirmPassword"
|
| | | type="password"
|
| | | size="large" |
| | | auto-complete="off"
|
| | | placeholder="确认密码"
|
| | | @keyup.enter="handleRegister"
|
| | |
| | | <template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
|
| | | </el-input>
|
| | | </el-form-item>
|
| | | <el-form-item prop="code" v-if="captchaOnOff">
|
| | | <el-form-item prop="code" v-if="captchaEnabled">
|
| | | <el-input
|
| | | size="large" |
| | | v-model="registerForm.code"
|
| | | auto-complete="off"
|
| | | placeholder="验证码"
|
| | |
| | | <el-form-item style="width:100%;">
|
| | | <el-button
|
| | | :loading="loading"
|
| | | size="medium"
|
| | | size="large" |
| | | type="primary"
|
| | | style="width:100%;"
|
| | | @click.prevent="handleRegister"
|
| | |
| | | </el-form>
|
| | | <!-- 底部 -->
|
| | | <div class="el-register-footer">
|
| | | <span>Copyright © 2018-2021 ruoyi.vip All Rights Reserved.</span>
|
| | | <span>Copyright © 2018-2025 ruoyi.vip All Rights Reserved.</span>
|
| | | </div>
|
| | | </div>
|
| | | </template>
|
| | |
| | | import { ElMessageBox } from "element-plus";
|
| | | import { getCodeImg, register } from "@/api/login";
|
| | |
|
| | | const title = import.meta.env.VITE_APP_TITLE;
|
| | | const router = useRouter();
|
| | | const { proxy } = getCurrentInstance();
|
| | |
|
| | |
| | | ],
|
| | | password: [
|
| | | { required: true, trigger: "blur", message: "请输入您的密码" },
|
| | | { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }
|
| | | { min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" },
|
| | | { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
|
| | | ],
|
| | | confirmPassword: [
|
| | | { required: true, trigger: "blur", message: "请再次输入您的密码" },
|
| | |
| | |
|
| | | const codeUrl = ref("");
|
| | | const loading = ref(false);
|
| | | const captchaOnOff = ref(true);
|
| | | const captchaEnabled = ref(true);
|
| | |
|
| | | function handleRegister() {
|
| | | proxy.$refs.registerRef.validate(valid => {
|
| | |
| | | }).catch(() => {});
|
| | | }).catch(() => {
|
| | | loading.value = false;
|
| | | if (captchaOnOff) {
|
| | | if (captchaEnabled) {
|
| | | getCode();
|
| | | }
|
| | | });
|
| | |
| | |
|
| | | function getCode() {
|
| | | getCodeImg().then(res => {
|
| | | captchaOnOff.value = res.captchaOnOff === undefined ? true : res.captchaOnOff;
|
| | | if (captchaOnOff.value) {
|
| | | captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
| | | if (captchaEnabled.value) {
|
| | | codeUrl.value = "data:image/gif;base64," + res.img;
|
| | | registerForm.value.uuid = res.uuid;
|
| | | }
|
| | |
| | | width: 400px;
|
| | | padding: 25px 25px 5px 25px;
|
| | | .el-input {
|
| | | height: 38px;
|
| | | height: 40px;
|
| | | input {
|
| | | height: 38px;
|
| | | height: 40px;
|
| | | }
|
| | | }
|
| | | .input-icon {
|
| | | height: 39px;
|
| | | width: 14px;
|
| | | margin-left: 2px;
|
| | | margin-left: 0px;
|
| | | }
|
| | | }
|
| | | .register-tip {
|
| | |
| | | }
|
| | | .register-code {
|
| | | width: 33%;
|
| | | height: 38px;
|
| | | height: 40px;
|
| | | float: right;
|
| | | img {
|
| | | cursor: pointer;
|
| | |
| | | letter-spacing: 1px;
|
| | | }
|
| | | .register-code-img {
|
| | | height: 38px;
|
| | | height: 40px;
|
| | | padding-left: 12px;
|
| | | }
|
| | | </style>
|