|
@@ -1,6 +1,25 @@
|
|
|
<template>
|
|
|
<div class="home">
|
|
|
<div class="menu-box"></div>
|
|
|
+ <el-dialog class="dialog" title="请先修改密码,再进入系统." :visible.sync="dialogFormVisible" :close-on-click-modal="false" :show-close="false" width="600px">
|
|
|
+ <el-form :model="dialogForm" :rules="rules" ref="dialogForm" label-position="right"
|
|
|
+ label-width="110px"
|
|
|
+ style="width: 400px; margin-left:50px;">
|
|
|
+ <el-form-item label="原密码" prop="originalPassword" :rules="{required: true, message: '请输入原密码', trigger: 'blur'}">
|
|
|
+ <el-input v-model="dialogForm.originalPassword" type="password" autocomplete="off"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="新密码" prop="currentPassword" :rules="{required: true, message: '请输入新密码', trigger: 'blur'}">
|
|
|
+ <el-input v-model="dialogForm.currentPassword" type="password" autocomplete="off"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="确认密码" prop="repeatPassword" :rules="{required: true, message: '请输入确认密码', trigger: 'blur'}">
|
|
|
+ <el-input v-model="dialogForm.repeatPassword" type="password" autocomplete="off"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button divided @click.native="logout">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="savePass('dialogForm')">修 改</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -12,13 +31,16 @@
|
|
|
components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
- activeItem: {}
|
|
|
+ activeItem: {},
|
|
|
+ dialogFormVisible:false,
|
|
|
+ dialogForm:{},
|
|
|
+ rules:{}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters([
|
|
|
'permission_menus'
|
|
|
- ])
|
|
|
+ ]),
|
|
|
},
|
|
|
watch: {
|
|
|
permission_menus: {
|
|
@@ -26,11 +48,15 @@
|
|
|
deep: true,
|
|
|
handler(newv) {
|
|
|
if (newv && newv.length) {
|
|
|
- this.activeItem = newv[0]
|
|
|
- this.jumpMenu(this.activeItem)
|
|
|
+ const pswState = this.$store.getters.userInfo.passwordState;
|
|
|
+ this.dialogFormVisible = pswState;
|
|
|
+ this.activeItem = newv[0];
|
|
|
+ if (!this.dialogFormVisible){
|
|
|
+ this.jumpMenu(this.activeItem)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
created() {
|
|
|
},
|
|
@@ -90,6 +116,52 @@
|
|
|
console.error(new Error('一级未找到菜单'))
|
|
|
}
|
|
|
},
|
|
|
+ savePass(formName) {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.dialogForm.currentPassword.length!=8){
|
|
|
+ this.$notify({
|
|
|
+ title: '错误',
|
|
|
+ message: '新密码必须是8位字符',
|
|
|
+ type: 'error',
|
|
|
+ duration: 3000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (this.dialogForm.currentPassword != this.dialogForm.repeatPassword){
|
|
|
+ this.$notify({
|
|
|
+ title: '错误',
|
|
|
+ message: '两次输入的密码不一致,请检查。',
|
|
|
+ type: 'error',
|
|
|
+ duration: 3000
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.$api.user.modifyPass(this.dialogForm).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$notify({
|
|
|
+ title: '成功',
|
|
|
+ message: '密码修改成功,请重新登录.',
|
|
|
+ type: 'success',
|
|
|
+ duration: 10000
|
|
|
+ });
|
|
|
+ this.dialogFormVisible = false;
|
|
|
+ setTimeout(() => {
|
|
|
+ this.logout();
|
|
|
+ }, 3000);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async logout() {
|
|
|
+ await this.$store.dispatch('user/logout');
|
|
|
+ // this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
|
|
+ this.$router.push(`/login`);
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
@@ -182,4 +254,7 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .dialog{
|
|
|
+ border-radius: 20px;
|
|
|
+ }
|
|
|
</style>
|