| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <div>
- <div class="crumbs">
- <el-breadcrumb separator="/">
- <el-breadcrumb-item>
- <i class="el-icon-lx-calendar"></i>个人中心
- </el-breadcrumb-item>
- <el-breadcrumb-item>
- <template>修改密码</template>
- </el-breadcrumb-item>
- </el-breadcrumb>
- </div>
- <div class="container">
- <div class="form-box">
- <el-form ref="form" :model="form" label-width="100px">
- <el-form-item label="原密码">
- <el-input type="password" v-model="form.password"></el-input>
- </el-form-item>
- <el-form-item label="新密码">
- <el-input type="password" v-model="form.newPassword"></el-input>
- </el-form-item>
- <el-form-item label="确认密码">
- <el-input type="password" v-model="form.rightPassword"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="save">保存</el-button>
- <el-button style="margin-left:5%; background:info" type="primary" @click="cancel">返回</el-button>
- </el-form-item>
- </el-form>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: "baseform",
- data() {
- return {
- updatePasswordUrl: "/api/usermanage/savePassword",
- form: {
- password: "",
- newPassword: "",
- rightPassword: ""
- }
- };
- },
- methods: {
- save() {
- if (this.form.password == "") {
- this.$message.error("请输入原密码");
- return;
- }
- if (this.form.newPassword == "") {
- this.$message.error("请输入新密码");
- return;
- }
- if (this.form.rightPassword == "") {
- this.$message.error("请输入确认密码");
- return;
- }
- if (this.form.rightPassword != this.form.newPassword) {
- this.$message.error("确认密码与新密码不一致");
- return;
- }
- const querystring = require("querystring");
- this.$axios.post(this.updatePasswordUrl,querystring.stringify({
- oldPassword: this.form.password,
- newPassword: this.form.newPassword
- })).then(res => {
- if (res.data.rtnBean.rtnCode == 0) {
- this.$message.success(res.data.rtnBean.rtnMsg);
- //清楚缓存
- window.localStorage.clear();
- this.$router.push({
- path: "/admin/login",
- params: {}
- });
- } else {
- this.$message.error(res.data.rtnBean.rtnMsg);
- }
- }).catch(error => {
- this.$message.error("更新失败了!");
- });
- },
- cancel() {
- this.$router.go(-1);
- },
- othder() {
- this.$message.error("其他的动作");
- }
- }
- };
- </script>
|