|
@@ -0,0 +1,54 @@
|
|
|
|
+<template>
|
|
|
|
+ <div id="index">
|
|
|
|
+ <el-row>
|
|
|
|
+ <el-col :span="24" class="main">
|
|
|
|
+ <data-form :data="form" :fields="formFields" :rules="rules" @save="toSave"> </data-form>
|
|
|
|
+ </el-col>
|
|
|
|
+ </el-row>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import dataForm from '@common/src/components/frame/form.vue';
|
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions: adminLogin } = createNamespacedHelpers('adminLogin');
|
|
|
|
+export default {
|
|
|
|
+ metaInfo() {
|
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
|
+ },
|
|
|
|
+ name: 'index',
|
|
|
|
+ props: {},
|
|
|
|
+ components: { dataForm },
|
|
|
|
+ data: function() {
|
|
|
|
+ return {
|
|
|
|
+ formFields: [{ label: '新密码', model: 'passwd' }],
|
|
|
|
+ form: {},
|
|
|
|
+ rules: {
|
|
|
|
+ passwd: [{ required: true, message: '请输入密码' }],
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ created() {},
|
|
|
|
+ methods: {
|
|
|
|
+ ...adminLogin(['updatePwd']),
|
|
|
|
+ async toSave({ data }) {
|
|
|
|
+ data.id = this.user.id;
|
|
|
|
+ let res = await this.updatePwd(data);
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '密码修改成功',
|
|
|
|
+ type: 'success',
|
|
|
|
+ });
|
|
|
|
+ localStorage.removeItem('token');
|
|
|
|
+ this.$router.push('/login');
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState(['user']),
|
|
|
|
+ },
|
|
|
|
+ watch: {},
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="less" scoped></style>
|