权限、统计接口、默认密码登录

This commit is contained in:
zhaoxiao
2021-09-23 18:32:01 +08:00
parent de97364b92
commit e13418046b
49 changed files with 989 additions and 530 deletions
+10 -1
View File
@@ -154,7 +154,6 @@ export default {
that.loginBtn = true
that.form.validateFields([ 'username', 'password','inputCode', 'rememberMe' ], { force: true }, (err, values) => {
if (!err) {
loginParams.remember_me = values.rememberMe
loginParams.captcha = that.inputCodeContent
loginParams.checkKey = that.currdatetime
@@ -169,6 +168,16 @@ export default {
that.Login(loginParams).then(() => {
this.loginSuccess()
}).catch((err) => {
if (err.message === 'updatePassword') {
this.$notification.error({
message: '登录失败',
description: '不能使用默认密码登录,请修改密码后登录!'
})
that.$router.push({
path: '/user/alteration'
})
return
}
if (err.code === 500) {
// 刷新验证码
this.handleChangeCheckCode()
+105 -68
View File
@@ -10,6 +10,22 @@
<div class='alteration-content'>
<a-form :form="form">
<span class='setPassword'>设置密码</span>
<a-row>
<a-col :span='22'>
<a-form-item
label="用户名"
:labelCol="{span: 5}"
:wrapperCol="{span: 19}"
>
<a-input
type="text"
v-decorator="['username',{ rules: validatorRules.username.rules}]"
placeholder="请输入用户名">
</a-input>
</a-form-item>
</a-col>
<a-col :span='6'></a-col>
</a-row>
<a-row>
<a-col :span='22'>
<a-form-item
@@ -36,7 +52,7 @@
<a-input
v-decorator="['captcha', { rules: validatorRules.captcha.rules}]"
type="text"
placeholder="验证码">
placeholder="请输入验证码">
</a-input>
<a-button
tabindex="-1"
@@ -55,7 +71,7 @@
:labelCol="{span: 5}"
:wrapperCol="{span: 19}">
<a-input
placeholder="新密码"
placeholder="请输入新密码"
v-decorator="['password', { rules: validatorRules.password.rules}]"
type="password">
</a-input>
@@ -70,7 +86,7 @@
:labelCol="{span: 5}"
:wrapperCol="{span: 19}">
<a-input
placeholder="确认密码"
placeholder="请输入确认密码"
v-decorator="['confirmPassword', { rules: validatorRules.confirmPassword.rules}]"
type="password"
autocomplete="false">
@@ -99,20 +115,25 @@
import { getAction, postAction } from '@/api/manage'
export default {
name: "Alteration",
name: 'Alteration',
components: {},
data() {
return {
form: this.$form.createForm(this),
loading: false,
validatorRules: {
username: {
rules: [
{ required: true, message: '请输入用户名!' }],
validateTrigger: 'blur'
},
phone: {
rules: [
{required: true, message: '请输入手机号码!'},{validator: this.validatePhone}],
{ required: true, message: '请输入手机号码!' }, { validator: this.validatePhone }],
validateTrigger: 'blur'
},
captcha: {
rules: [{required: true, message: '请输入短信验证码!'}],
rules: [{ required: true, message: '请输入短信验证码!' }],
validateTrigger: 'blur'
},
password: {
@@ -127,15 +148,15 @@ export default {
},
confirmPassword: {
rules: [
{required: true, message: '密码不能为空!'},
{validator: this.handlePasswordCheck}
{ required: true, message: '密码不能为空!' },
{ validator: this.handlePasswordCheck }
],
validateTrigger: 'blur'
},
}
},
state: {
time: 60,
smsSendBtn: false,
smsSendBtn: false
},
userList: {}
}
@@ -148,16 +169,16 @@ export default {
if (!err) {
let params = {}
console.log(values, '======values')
params.phone = values.phone;
params.password = values.password;
params.captcha = values.captcha;
params.confirmPassword = values.confirmPassword;
getAction("/sys/user/passwordChange", params).then((res) => {
params.phone = values.phone
params.password = values.password
params.captcha = values.captcha
params.confirmPassword = values.confirmPassword
getAction('/sys/user/passwordChange', params).then((res) => {
if (res.success) {
that.loading = false
that.$router.go(-1)
} else {
this.passwordFailed(res.message);
this.passwordFailed(res.message)
that.loading = false
}
})
@@ -170,25 +191,25 @@ export default {
this.$router.go(-1)
},
passwordFailed(err) {
this.$notification[ 'error' ]({
message: "更改密码失败",
description:err,
duration: 4,
});
this.$notification['error']({
message: '更改密码失败',
description: err,
duration: 4
})
},
validatePhone(rule,value,callback){
if(value){
var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
if(!myreg.test(value)){
callback("请输入正确的手机号")
}else{
callback();
validatePhone(rule, value, callback) {
if (value) {
var myreg = /^[1][3,4,5,7,8][0-9]{9}$/
if (!myreg.test(value)) {
callback('请输入正确的手机号')
} else {
callback()
}
}else{
} else {
callback()
}
},
handlePasswordCheck (rule, value, callback) {
handlePasswordCheck(rule, value, callback) {
let password = this.form.getFieldValue('password')
if (value && password && value.trim() !== password.trim()) {
callback(new Error('两次密码不一致'))
@@ -196,70 +217,74 @@ export default {
callback()
},
getCaptcha(e) {
e.preventDefault();
let that = this;
let phone=that.form.getFieldValue("phone")
if(!phone){
this.cmsFailed("手机号不能为空!");
return;
e.preventDefault()
let that = this
let phone = that.form.getFieldValue('phone')
if (!phone) {
this.cmsFailed('手机号不能为空!')
return
}
this.state.smsSendBtn = true;
this.state.smsSendBtn = true
let interval = window.setInterval(() => {
if (that.state.time-- <= 0) {
that.state.time = 60;
that.state.smsSendBtn = false;
window.clearInterval(interval);
that.state.time = 60
that.state.smsSendBtn = false
window.clearInterval(interval)
}
}, 1000);
}, 1000)
const hide = this.$message.loading('验证码发送中..', 0);
const hide = this.$message.loading('验证码发送中..', 0)
let smsParams = {
mobile: phone,
smsmode: "2"
};
postAction("/sys/sms", smsParams).then(res => {
smsmode: '2'
}
postAction('/sys/sms', smsParams).then(res => {
if (!res.success) {
setTimeout(hide, 1);
this.cmsFailed(res.message);
setTimeout(hide, 1)
this.cmsFailed(res.message)
}
setTimeout(hide, 500);
setTimeout(hide, 500)
})
},
cmsFailed(err) {
this.$notification['error']({
message: "验证错误",
message: '验证错误',
description: err,
duration: 4,
});
duration: 4
})
}
}
}
</script>
<style lang="less" scoped>
/deep/.ant-card{
/deep/ .ant-card {
width: 100%;
}
/deep/.ant-card-body{
/deep/ .ant-card-body {
padding: 0 !important;
height: 100%;
background: #F0F2F5;
}
.alteration-center{
.alteration-center {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
background: #F0F2F5;
}
.alteration-content{
.alteration-content {
margin: auto;
width: 1000px;
display: flex;
justify-content: center;
align-items: center;
background: #fff;
.setPassword{
.setPassword {
font-size: 26px;
display: block;
background: #fff;
@@ -268,28 +293,33 @@ export default {
margin-top: 30px;
}
}
/deep/.ant-form{
/deep/ .ant-form {
width: 500px;
height: 500px;
}
.alteration-head{
.alteration-head {
position: absolute;
top: 0;
width: 100%;
background: #069F99;
height: 60px;
}
.logo {
box-shadow: none !important;
transition: background 300ms;
height: 60px;
line-height: 60px;
padding-left: 12px;
a {
color: white;
&:hover {
color: rgba(255, 255, 255, 0.8);
}
h1 {
margin-left: 12px;
color: #fff;
@@ -299,35 +329,42 @@ export default {
}
}
.alteration-content{
.alteration-content {
}
/deep/.ant-row{
/deep/ .ant-row {
margin-bottom: 20px !important;
height: 60px;
}
/deep/.ant-form-item-label{
/deep/ .ant-form-item-label {
height: 50px;
line-height: 50px;
}
/deep/.ant-input{
/deep/ .ant-input {
border-radius: 30px;
height: 50px;
border: 1px solid #E6E3E3;
}
.btn{
/deep/button{
.btn {
/deep/ button {
border-radius: 30px;
margin: 0 20px;
}
.ant-btn-primary{
.ant-btn-primary {
background: #069F99;
border: none;
}
}
.captcha{
.captcha {
position: relative;
/deep/button{
/deep/ button {
border: none;
color: #069F99;
position: absolute;