|
|
@@ -0,0 +1,149 @@
|
|
|
+<template>
|
|
|
+ <div style="text-align: center;font-size: 30px;margin-top: 40px;">修改密码</div>
|
|
|
+ <div style="margin: 60px;">
|
|
|
+ <!-- <el-dialog
|
|
|
+ :class="'editUser'"
|
|
|
+ :visible.sync="userUpdPwdVisible"
|
|
|
+ width="650px"
|
|
|
+ top="7%"
|
|
|
+ title="修改密码"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :before-close="dialogBeforeClose"
|
|
|
+ style="overflow: auto; height: 700px"
|
|
|
+ > -->
|
|
|
+ <el-form
|
|
|
+ :model="toUpdUserPwd"
|
|
|
+ :rules="userPwdRules"
|
|
|
+ ref="toUpdPwdForm"
|
|
|
+ :label-width="100"
|
|
|
+ >
|
|
|
+ <el-form-item label="ID:" v-if="false">
|
|
|
+ <el-input v-model="toUpdUserPwd.id" autocomplete="off" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="原密码:" prop="oldPwd">
|
|
|
+ <el-input
|
|
|
+ type="password"
|
|
|
+ v-model="toUpdUserPwd.oldPwd"
|
|
|
+ autocomplete="off"
|
|
|
+ placeholder="请输入原密码"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="新密码:" prop="password">
|
|
|
+ <el-input
|
|
|
+ type="password"
|
|
|
+ v-model="toUpdUserPwd.password"
|
|
|
+ autocomplete="off"
|
|
|
+ placeholder="请输入新密码"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="重复密码:" prop="newPwd">
|
|
|
+ <el-input
|
|
|
+ type="password"
|
|
|
+ v-model="toUpdUserPwd.newPwd"
|
|
|
+ autocomplete="off"
|
|
|
+ placeholder="请再次输入新密码"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <div style="width: 100%;text-align: center;margin: 50px 0;">
|
|
|
+ <el-button type="primary" style="width: 80%;" @click="updUserPwd">确认修改</el-button>
|
|
|
+ </div>
|
|
|
+ <!-- <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="updUserPwd">确认修改</el-button>
|
|
|
+ </span>
|
|
|
+ </template> -->
|
|
|
+ <!-- </el-dialog> -->
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+
|
|
|
+import common from "@/api/common";
|
|
|
+export default {
|
|
|
+ name: "editUser",
|
|
|
+ data() {
|
|
|
+ var validatePass = (rule, value, callback) => {
|
|
|
+ if (value !== this.toUpdUserPwd.password) {
|
|
|
+ callback(new Error("两次输入密码不一致!"));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ var ZZPass = (rule, value, callback) => {
|
|
|
+ if (!/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=\S+$).{8,}$/.test(value)) {
|
|
|
+ callback(new Error("密码必须包括英文字母的大写、小写以及数字!"));
|
|
|
+ } else {
|
|
|
+ callback();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ modelId: systemConfig.modelIds[1], // 青浦一张图登录模型id
|
|
|
+ columnId: systemConfig.columnIds[3], // 青浦一张图登录栏目id
|
|
|
+ userUpdPwdVisible: false,
|
|
|
+ toUpdUserPwd: {
|
|
|
+ id: this.$store.state.userInfo.id,
|
|
|
+ password: ""
|
|
|
+ },
|
|
|
+ userPwdRules: {
|
|
|
+ oldPwd: [{ required: true, message: "请输入原密码", trigger: "blur" }],
|
|
|
+ password: [
|
|
|
+ { required: true, message: "请输入新密码", trigger: "blur" },
|
|
|
+ { min: 8, max: 30, message: "长度在8个字符以上", trigger: "blur" },
|
|
|
+ { validator: ZZPass, trigger: "blur" }
|
|
|
+ ],
|
|
|
+ newPwd: [
|
|
|
+ { required: true, message: "请再次输入新密码", trigger: "blur" },
|
|
|
+ { min: 8, max: 30, message: "长度在8个字符以上", trigger: "blur" },
|
|
|
+ { validator: ZZPass, trigger: "blur" },
|
|
|
+ { validator: validatePass, trigger: "blur" }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ close: Function,
|
|
|
+ showFlag: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ mounted() {},
|
|
|
+ methods: {
|
|
|
+ updUserPwd() {
|
|
|
+ let that = this;
|
|
|
+ let app = this;
|
|
|
+ app.$refs["toUpdPwdForm"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ let params = {
|
|
|
+ id: that.toUpdUserPwd.id,
|
|
|
+ oldPwd: that.toUpdUserPwd.oldPwd,
|
|
|
+ password: that.toUpdUserPwd.password
|
|
|
+ };
|
|
|
+ common.updatePassword(params).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ that.toUpdUserPwd = {};
|
|
|
+ that.userUpdPwdVisible = false;
|
|
|
+ this.close();
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "修改成功",
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ that.$message({
|
|
|
+ type: "error",
|
|
|
+ message: res.message,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style lang="less" scoped>
|
|
|
+
|
|
|
+</style>
|