用户信息长度校验限制

pull/78/head
RuoYi 3 years ago
parent 6146d63f2c
commit 58b4600144

@ -209,7 +209,7 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="用户昵称" prop="nickName"> <el-form-item label="用户昵称" prop="nickName">
<el-input v-model="form.nickName" placeholder="请输入用户昵称" /> <el-input v-model="form.nickName" placeholder="请输入用户昵称" maxlength="30" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -233,12 +233,12 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName"> <el-form-item v-if="form.userId == undefined" label="用户名称" prop="userName">
<el-input v-model="form.userName" placeholder="请输入用户名称" /> <el-input v-model="form.userName" placeholder="请输入用户名称" maxlength="30" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item v-if="form.userId == undefined" label="用户密码" prop="password"> <el-form-item v-if="form.userId == undefined" label="用户密码" prop="password">
<el-input v-model="form.password" placeholder="请输入用户密码" type="password" /> <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -437,7 +437,8 @@ export default {
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }
], ],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" } { required: true, message: "用户密码不能为空", trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }
], ],
email: [ email: [
{ {
@ -589,7 +590,10 @@ export default {
handleResetPwd(row) { handleResetPwd(row) {
this.$prompt('请输入"' + row.userName + '"的新密码', "提示", { this.$prompt('请输入"' + row.userName + '"的新密码', "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消" cancelButtonText: "取消",
closeOnClickModal: false,
inputPattern: /^.{5,20}$/,
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间",
}).then(({ value }) => { }).then(({ value }) => {
resetUserPwd(row.userId, value).then(response => { resetUserPwd(row.userId, value).then(response => {
this.msgSuccess("修改成功,新密码是:" + value); this.msgSuccess("修改成功,新密码是:" + value);

@ -1,7 +1,7 @@
<template> <template>
<el-form ref="form" :model="user" :rules="rules" label-width="80px"> <el-form ref="form" :model="user" :rules="rules" label-width="80px">
<el-form-item label="用户昵称" prop="nickName"> <el-form-item label="用户昵称" prop="nickName">
<el-input v-model="user.nickName" /> <el-input v-model="user.nickName" maxlength="30" />
</el-form-item> </el-form-item>
<el-form-item label="手机号码" prop="phonenumber"> <el-form-item label="手机号码" prop="phonenumber">
<el-input v-model="user.phonenumber" maxlength="11" /> <el-input v-model="user.phonenumber" maxlength="11" />

Loading…
Cancel
Save