增加测试平台功能,系统设置,支持多个角色,分配菜单
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
<div class="location-title"><h1>注册</h1></div>
|
||||
|
||||
<el-form ref="ruleForm" :model="ruleForm" status-icon :rules="rules" label-width="100px" class="demo-ruleForm">
|
||||
<el-form-item label="学号" prop="studentId">
|
||||
<el-input v-model="ruleForm.studentId" type="text" placeholder="学号" autocomplete="off"></el-input>
|
||||
<el-form-item label="用户名" prop="username">
|
||||
<el-input v-model.trim="ruleForm.username" type="text" placeholder="用户名" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="ruleForm.password" type="password" placeholder="密码" autocomplete="off"></el-input>
|
||||
@@ -14,22 +14,17 @@
|
||||
<el-form-item label="确认密码" prop="checkPass">
|
||||
<el-input v-model="ruleForm.checkPass" type="password" placeholder="确认密码" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input v-model="ruleForm.name" placeholder="姓名" autocomplete="off"></el-input>
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model.trim="ruleForm.mobile" placeholder="手机号" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="gender">
|
||||
<el-input v-model="ruleForm.gender" placeholder="性别" autocomplete="off"></el-input>
|
||||
<el-form-item label="邮箱" prop="email">
|
||||
<el-input v-model.trim="ruleForm.email" type="text" placeholder="邮箱" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="学院" prop="faculty">
|
||||
<el-input v-model="ruleForm.faculty" type="text" placeholder="学院" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="年级" prop="grade">
|
||||
<el-input v-model="ruleForm.grade" type="text" placeholder="年级" autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-form-item class="register-actions">
|
||||
<el-button class="enter-btn" type="primary" :disabled="!select" @click="submitForm('ruleForm')">
|
||||
立即注册
|
||||
</el-button>
|
||||
<el-button class="login-link-btn" type="text" @click="goLogin">去登录</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
@@ -61,9 +56,9 @@ export default {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
const validateStudentId = (rule, value, callback) => {
|
||||
const validateUsername = (rule, value, callback) => {
|
||||
if (value === '') {
|
||||
callback(new Error('请输入学号'))
|
||||
callback(new Error('请输入用户名'))
|
||||
return
|
||||
}
|
||||
callback()
|
||||
@@ -72,22 +67,16 @@ export default {
|
||||
return {
|
||||
select: true,
|
||||
ruleForm: {
|
||||
studentId: '',
|
||||
username: '',
|
||||
password: '',
|
||||
checkPass: '',
|
||||
name: '',
|
||||
gender: '',
|
||||
faculty: '',
|
||||
grade: ''
|
||||
mobile: '',
|
||||
email: ''
|
||||
},
|
||||
rules: {
|
||||
studentId: [{ required: true, validator: validateStudentId, trigger: 'blur' }],
|
||||
username: [{ required: true, validator: validateUsername, trigger: 'blur' }],
|
||||
password: [{ required: true, validator: validatePass, trigger: 'blur' }],
|
||||
checkPass: [{ required: true, validator: validatePass2, trigger: 'blur' }],
|
||||
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
|
||||
gender: [{ required: true, message: '请输入性别', trigger: 'blur' }],
|
||||
faculty: [{ required: true, message: '请输入学院', trigger: 'blur' }],
|
||||
grade: [{ required: true, message: '请输入年级', trigger: 'blur' }]
|
||||
checkPass: [{ required: true, validator: validatePass2, trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -99,18 +88,17 @@ export default {
|
||||
},
|
||||
handleRegister() {
|
||||
Register({
|
||||
studentId: this.ruleForm.studentId,
|
||||
username: this.ruleForm.username,
|
||||
password: this.ruleForm.password,
|
||||
name: this.ruleForm.name,
|
||||
gender: this.ruleForm.gender,
|
||||
faculty: this.ruleForm.faculty,
|
||||
grade: this.ruleForm.grade
|
||||
mobile: this.ruleForm.mobile,
|
||||
email: this.ruleForm.email,
|
||||
createdBy: 1
|
||||
}).then(data => {
|
||||
if (data.code === 200 && data.success === 'true') {
|
||||
if (data && data.id) {
|
||||
this.open('注册成功')
|
||||
this.$router.push({ name: 'login' })
|
||||
} else {
|
||||
this.open(data.message)
|
||||
this.open(data.message || '注册失败')
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -120,6 +108,9 @@ export default {
|
||||
this.handleRegister()
|
||||
}
|
||||
})
|
||||
},
|
||||
goLogin() {
|
||||
this.$router.push({ name: 'login' })
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -140,4 +131,20 @@ export default {
|
||||
float: left;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.register-actions .el-form-item__content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.login-link-wrap {
|
||||
width: 100%;
|
||||
margin-top: 8px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.login-link-btn {
|
||||
padding-right: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user