guhongwei 4 år sedan
förälder
incheckning
a6e0dde1fe
4 ändrade filer med 102 tillägg och 0 borttagningar
  1. 12 0
      src/router/index.js
  2. 4 0
      src/store/adminLogin.js
  3. 32 0
      src/views/dictionary/index.vue
  4. 54 0
      src/views/updatePwd/index.vue

+ 12 - 0
src/router/index.js

@@ -192,6 +192,18 @@ export default new Router({
           component: () => import('../views/channel/detail.vue'),
           meta: { title: '科技频道信息管理' },
         },
+        // 字典表
+        {
+          path: '/dictionary',
+          component: () => import('../views/dictionary/index.vue'),
+          meta: { title: '字典表管理' },
+        },
+        // 字典表
+        {
+          path: '/updatePwd',
+          component: () => import('../views/updatePwd/index.vue'),
+          meta: { title: '密码管理' },
+        },
       ],
     },
     {

+ 4 - 0
src/store/adminLogin.js

@@ -43,6 +43,10 @@ const actions = {
     }
     return res;
   },
+  async updatePwd({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}/password/${id}`, data);
+    return res;
+  },
 };
 export default {
   namespaced: true,

+ 32 - 0
src/views/dictionary/index.vue

@@ -0,0 +1,32 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24">
+        <p>index</p>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  name: 'index',
+  props: {},
+  components: {},
+  data: function() {
+    return {};
+  },
+  created() {},
+  methods: {},
+  computed: {
+    ...mapState(['user']),
+  },
+  watch: {},
+};
+</script>
+
+<style lang="less" scoped></style>

+ 54 - 0
src/views/updatePwd/index.vue

@@ -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>