|
@@ -17,7 +17,7 @@
|
|
|
<img class="actionDo" src="../../images/arrow_down.png" />
|
|
|
</span>
|
|
|
<ul class="action">
|
|
|
- <li>修改密码</li>
|
|
|
+ <li @click="changeWords">修改密码</li>
|
|
|
<li @click="logout">退出系统</li>
|
|
|
</ul>
|
|
|
</div>
|
|
@@ -27,11 +27,26 @@
|
|
|
</el-main>
|
|
|
</el-container>
|
|
|
<el-dialog
|
|
|
- title="版本信息"
|
|
|
- :visible.sync="versionVisible"
|
|
|
- width="50%"
|
|
|
- class="version-info">
|
|
|
- <div v-html="versionInfo"></div>
|
|
|
+ title="修改密码"
|
|
|
+ class="changewords"
|
|
|
+ :visible.sync="changePassWord"
|
|
|
+ width="600"
|
|
|
+ top="20vh"
|
|
|
+ center>
|
|
|
+ <el-form :model="ruleForm2" status-icon :rules="rules2" ref="ruleForm2" label-width="100px" class="demo-ruleForm">
|
|
|
+ <el-form-item label="旧密码:" prop="oldpass">
|
|
|
+ <el-input type="password" placeholder="请输入旧密码" v-model.trim="ruleForm2.oldpass" auto-complete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="新密码:" prop="pass">
|
|
|
+ <el-input type="password" placeholder="请输入新密码" v-model.trim="ruleForm2.pass" auto-complete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="再次输入新密码:" prop="checkPass">
|
|
|
+ <el-input type="password" placeholder="请再次输入新密码" v-model.trim="ruleForm2.checkPass" auto-complete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm('ruleForm2')">确 定</el-button>
|
|
|
+ </span>
|
|
|
</el-dialog>
|
|
|
</el-container>
|
|
|
</template>
|
|
@@ -40,12 +55,39 @@
|
|
|
import LtMenu from '../common/Menu.vue';
|
|
|
import api from '@api/index.js';
|
|
|
import newIcon from '../../images/new.png';
|
|
|
+ import md5 from 'js-md5'
|
|
|
export default {
|
|
|
name: 'homepage',
|
|
|
components: {
|
|
|
'lt-menu': LtMenu,
|
|
|
},
|
|
|
- data: function () {
|
|
|
+ data() {
|
|
|
+ var validatePass1 = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入旧密码'));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var validatePass = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请输入新密码'));
|
|
|
+ } else {
|
|
|
+ if (this.ruleForm2.checkPass !== '') {
|
|
|
+ this.$refs.ruleForm2.validateField('checkPass');
|
|
|
+ }
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var validatePass2 = (rule, value, callback) => {
|
|
|
+ if (value === '') {
|
|
|
+ callback(new Error('请再次输入新密码'));
|
|
|
+ } else if (value !== this.ruleForm2.pass) {
|
|
|
+ callback(new Error('两次输入密码不一致!'));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
return {
|
|
|
menuWrappers: null,
|
|
|
organization: null,
|
|
@@ -58,6 +100,24 @@
|
|
|
versionInfo:'',
|
|
|
isNewV:false,
|
|
|
version:null, //版本信息接口返回的数据
|
|
|
+ changePassWord: false,
|
|
|
+
|
|
|
+ ruleForm2: {
|
|
|
+ pass: '',
|
|
|
+ checkPass: '',
|
|
|
+ oldpass: ''
|
|
|
+ },
|
|
|
+ rules2: {
|
|
|
+ oldpass: [
|
|
|
+ { validator: validatePass1, trigger: 'blur',required:true }
|
|
|
+ ],
|
|
|
+ pass: [
|
|
|
+ { validator: validatePass, trigger: 'blur',required:true }
|
|
|
+ ],
|
|
|
+ checkPass: [
|
|
|
+ { validator: validatePass2, trigger: 'blur',required:true }
|
|
|
+ ]
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -81,6 +141,60 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ CalcuMD5(password){
|
|
|
+ // password = password.toUpperCase();
|
|
|
+ password = md5(password);
|
|
|
+ return password;
|
|
|
+ },
|
|
|
+ submitForm(formName) {
|
|
|
+ this.$refs[formName].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ api.midifyPassword({
|
|
|
+ 'password':this.CalcuMD5(this.ruleForm2.oldpass),
|
|
|
+ 'modifyPassword':this.CalcuMD5(this.ruleForm2.pass)
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.data.code == '0') {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.$refs['ruleForm2'].resetFields();
|
|
|
+ this.changePassWord = false
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success',
|
|
|
+ duration: 1000,
|
|
|
+ onClose:()=>{
|
|
|
+ this.logout()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: res.data.msg,
|
|
|
+ type: 'error',
|
|
|
+ duration: 1000,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ // this.$message({
|
|
|
+ // message: '修改成功',
|
|
|
+ // type: 'success',
|
|
|
+ // duration: 1000,
|
|
|
+ // })
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.logout()
|
|
|
+ // }, 1000);
|
|
|
+ } else {
|
|
|
+ console.log('error submit!!');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ resetForm(formName) {
|
|
|
+ this.$refs[formName].resetFields();
|
|
|
+ },
|
|
|
+ changeWords(){
|
|
|
+ this.changePassWord = true
|
|
|
+ },
|
|
|
getMenuList(){
|
|
|
api.getAccessdMenu().then((res) => {
|
|
|
if (res.data.code == '0') {
|