schangxiang@126.com
2025-09-19 9be9c3784b2881a3fa25e93ae2033dc2803c0ed0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
 
<template>
  <el-dialog v-dialogDrag :visible.sync="currentVisible" width="600px" title="修改密码">
    <el-form ref="form" :model="form" class="demo-form-inline w-400">
      <el-form-item :label-width="formLabelWidth" label="请输入密码:">
        <el-input :type="passwordType" v-model="form.password" auto-complete="off"></el-input>
        <span class="show-pwd" @click="showPwd">
          <svg-icon :icon-class="passwordType=='password'?'eye':'eye-open'" />
        </span>
      </el-form-item>
      <el-form-item :label-width="formLabelWidth" label="重复输入密码:">
        <el-input :type="passwordType" v-model="form.password_repeat" auto-complete="off"></el-input>
        <span class="show-pwd" @click="showPwd">
          <svg-icon :icon-class="passwordType=='password'?'eye':'eye-open'" />
        </span>
      </el-form-item>
    </el-form>
 
    <div slot="footer" class="dialog-footer">
      <el-button @click="currentVisible = false">取 消</el-button>
      <el-button type="primary" @click="modifypwd">确 定</el-button>
    </div>
  </el-dialog>
</template>
 
<script>
export default {
  name: "order-barcode",
  components: {},
  props: {
    visible: {
      type: Boolean,
      default: false,
      required: true
    }
  },
  data() {
    return {
      id: "",
      passwordType: "password",
      form: {
        password: "",
        password_repeat: ""
      },
      formLabelWidth: "150px",
      user_Id: ""
    };
  },
  computed: {
    currentVisible: {
      get: function() {
        return this.visible;
      },
      set: function(val) {
        this.$emit("update:visible", val);
      }
    }
  },
  mounted() {
    const userInfo = this.common.getUserInfo();
    this.user_Id = userInfo.user_Id;
  },
  methods: {
    showPwd() {
      if (this.passwordType === "password") {
        this.passwordType = "";
      } else {
        this.passwordType = "password";
      }
    },
    setUser_Id(user_Id) {
      this.user_Id = user_Id;
    },
    modifypwd() {
      // 密码
      var password = this.form.password;
      if (password.length < 3) {
        this.$notify.error({
          title: "错误提示",
          message: "密码必须大于3位!"
        });
        return;
      }
 
      // 重复密码
      var password_repeat = this.form.password_repeat;
      if (password_repeat.length < 3) {
        this.$notify.error({
          title: "错误提示",
          message: "密码必须大于3位!"
        });
        return;
      } else if (password_repeat !== password) {
        this.$notify.error({
          title: "错误提示",
          message: "两次密码不一致!"
        });
        return;
      }
 
      const url = "/api/sys/user/modifyPwd";
      const params = {
        user_Id: this.user_Id,
        userPwd: password,
        repeatPassWord: password_repeat
      };
      var callback = res => {
        this.common.showMsg(res);
        if (res.result) {
          this.currentVisible = false;
          this.$parent.editorOptions.config.visible = false;
        }
      };
      this.common.ajax(url, params, callback, this.$refs.form);
    }
  }
};
</script>
 
<style lang="less" scoped>
@deep: ~">>>";
 
@{deep} .el-dialog__body {
  padding: 0px 10px;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
$bg: #2d3a4b;
$dark_gray: #889aa4;
$light_gray: #eee;
 
.show-pwd {
  position: absolute;
  right: 10px;
  top: 2px;
  font-size: 16px;
  color: $dark_gray;
  cursor: pointer;
  user-select: none;
}
</style>