|
@@ -2,7 +2,21 @@
|
|
|
<div id="index">
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
- 修改密码
|
|
|
+ <el-col :span="24" class="leftTop"> <span>|</span> <span>修改密码</span> </el-col>
|
|
|
+ <el-col :span="24" class="info">
|
|
|
+ <el-form :model="form" :rules="rules" ref="form" label-width="100px">
|
|
|
+ <el-form-item label="旧密码" prop="oldpasswd">
|
|
|
+ <el-input v-model="form.oldpasswd" placeholder="请输入旧密码" show-password></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="新密码" prop="newpasswd">
|
|
|
+ <el-input v-model="form.newpasswd" placeholder="请输入新密码" show-password></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button @click="resetForm('form')">取消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('form')">提交</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -10,15 +24,49 @@
|
|
|
|
|
|
<script>
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: password } = createNamespacedHelpers('password');
|
|
|
+const { mapActions: login } = createNamespacedHelpers('login');
|
|
|
export default {
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
components: {},
|
|
|
data: function() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ form: {},
|
|
|
+ rules: {
|
|
|
+ oldpasswd: [{ required: true, message: '请输入旧密码', trigger: 'blur' }],
|
|
|
+ newpasswd: [{ required: true, message: '请输入新密码', trigger: 'blur' }],
|
|
|
+ },
|
|
|
+ };
|
|
|
},
|
|
|
created() {},
|
|
|
- methods: {},
|
|
|
+ methods: {
|
|
|
+ ...login({ logout: 'logout', transactiondtetle: 'delete' }),
|
|
|
+ ...password({ userFetch: 'fetch', userCreate: 'create', userUpdate: 'update' }),
|
|
|
+ resetForm(formName) {
|
|
|
+ this.$refs[formName].resetFields();
|
|
|
+ },
|
|
|
+ async submitForm(formName) {
|
|
|
+ this.$refs[formName].validate(async valid => {
|
|
|
+ if (valid) {
|
|
|
+ this.form.id = this.user.uid;
|
|
|
+ let res = await this.userUpdate(this.form);
|
|
|
+ if (res.errcode === 0) {
|
|
|
+ this.$message({
|
|
|
+ message: '密码修改成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.logout();
|
|
|
+ this.$router.push({ path: '/platlive/newlogin' });
|
|
|
+ } else {
|
|
|
+ this.$message.error('密码修改失败');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
|
pageTitle() {
|
|
@@ -31,4 +79,20 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.leftTop {
|
|
|
+ font-size: 18px;
|
|
|
+ width: 96%;
|
|
|
+ height: 41px;
|
|
|
+ line-height: 35px;
|
|
|
+ border-bottom: 1px solid #e5e5e5;
|
|
|
+ position: relative;
|
|
|
+ bottom: 1px;
|
|
|
+ margin: 10px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #22529a;
|
|
|
+}
|
|
|
+.info {
|
|
|
+ padding: 40px 40px 0 0;
|
|
|
+}
|
|
|
+</style>
|