jt
2021-06-10 5d0d028456874576560552f5a5c4e8b801786f11
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
@{
    ViewBag.Title = "UpdatePassword";
    Layout = "~/Views/Shared/_LayoutVue.cshtml";
}
<div id="updatePassword" v-cloak>
    <el-form label-width="135px" v-bind:rules="formRules" v-bind:model="formData" class="demo-ruleForm" v-bind:inline="true" ref="formData">
        <el-form-item label="当前密码:" prop="currentPwd">
            <el-input type="password" autocomplete="off" v-model="formData.currentPwd" size="mini"></el-input>
        </el-form-item><el-form-item label="新密码:" prop="newPwd">
            <el-input type="password" autocomplete="off" v-model="formData.newPwd" size="mini"></el-input>
        </el-form-item><el-form-item label="确认新密码:" prop="secondPwd">
            <el-input type="password" autocomplete="off" v-model="formData.secondPwd" size="mini"></el-input>
        </el-form-item>
    </el-form>
    <el-footer style="text-align:center;padding:20px 20px 20px">
        <el-row>
            <el-button v-on:click="close" size="mini">取消</el-button>
            <el-button type="primary" v-on:click="save" size="mini">确定</el-button>
        </el-row>
    </el-footer>
</div>
@section scripts{
    <script>
        new Vue({
            el: '#updatePassword',
            data: {
                formData: {
                    currentPwd: "",
                    newPwd: "",
                    secondPwd: ""
                },
                formRules: {
                    currentPwd: [
                        { required: true, message: ' ', trigger: 'blur' }
                    ],
                    newPwd: [
                        { required: true, message: ' ', trigger: 'blur' }
                    ],
                    secondPwd: [
                        { required: true, message: ' ', trigger: 'blur' }
                    ]
                },
            },
            methods: {
                save: function () {
                    var $this = this;
                    this.$refs["formData"].validate(function (valid) {
                        if (valid) {
                            if ($this.formData.newPwd != $this.formData.secondPwd) {
                                wms.warning("两次输入不一致!");
                                return;
                            }
                            ajaxManage({
                                url: "@Url.Action("UpdatePassword")",
                                data: $this.formData,
                                success: function (data) {
                                    if (!data) {
                                        wms.error("系统异常");
                                        return;
                                    }
                                    if (data.Success) {
                                        $this.close();
                                        $.ajax({
                                            type: 'GET',
                                            async: false,
                                            data: { endType: "hand" },
                                            url: '../Home/Exit',
                                            success: function (data) {
                                                location.href = '/Login';
                                            }
                                        });
                                    }
                                    else {
                                        wms.error(data.Msg);
                                    }
                                }
                            });
                        } else {
                            wms.warning("验证不通过!");
                        }
                    });
                },
                close: function () {
                    wms.dialogFrame.show = false;
                }
            }
 
        });
    </script>
}