guhongwei 2 năm trước cách đây
mục cha
commit
95844e3ebe
2 tập tin đã thay đổi với 58 bổ sung0 xóa
  1. 6 0
      src/layout/site.js
  2. 52 0
      src/store/user.js

+ 6 - 0
src/layout/site.js

@@ -172,6 +172,12 @@ export const menus = [
         name: '视频信息',
         path: '/app/videos',
       },
+      {
+        _id: 'me3us_2_7',
+        icon: 'el-icon-user',
+        name: '用户管理',
+        path: '/app/users',
+      },
     ],
   },
   {

+ 52 - 0
src/store/user.js

@@ -0,0 +1,52 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  test: `/projectadmin/api/user`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.test}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.test}/${payload}`);
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.test}`, payload);
+    return res;
+  },
+  async update({ commit }, { _id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.test}/${_id}`, { ...info });
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.test}/${payload}`);
+    return res;
+  },
+  // 重置密码
+  async resetPwd({ commit }, payload) {
+    const id = _.get(payload, 'id', _.get(payload, '_id'));
+    const res = await this.$axios.$post(`${api.test}/resetPwd/${id}`, payload);
+    return res;
+  },
+  async login({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.test}/login`, payload);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};