zs 9 mēneši atpakaļ
vecāks
revīzija
46edf1d077

+ 1 - 1
.env

@@ -1 +1 @@
-VUE_APP_AXIOS_BASE_URL = ''
+VITE_APP_BASE_API = '/customer/api'

+ 2 - 2
src/components/frame/c-table.vue

@@ -106,7 +106,7 @@ export default {
     fields: { type: Array, required: true },
     data: { type: Array, required: true },
     opera: { type: Array, default: () => [] },
-    rowKey: { type: String, default: '_id' },
+    rowKey: { type: String, default: 'id' },
     select: { type: Boolean, default: false },
     selected: { type: Array, default: () => [] },
     usePage: { type: Boolean, default: true },
@@ -203,7 +203,7 @@ export default {
       this.$nextTick(() => {
         this.$refs.table.clearSelection();
         this.selected.forEach((info) => {
-          let d = this.data.filter((p) => p._id === info._id);
+          let d = this.data.filter((p) => p.id === info.id);
           if (d.length > 0) this.$refs.table.toggleRowSelection(d[0]);
         });
       });

+ 4 - 4
src/store/admin.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 import _ from 'lodash';
 Vue.use(Vuex);
 const api = {
-  test: `/projectadmin/api/admin`,
+  test: `/admin`,
 };
 const state = () => ({});
 const mutations = {};
@@ -25,8 +25,8 @@ const actions = {
     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 });
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.test}/${id}`, { ...info });
     return res;
   },
   async delete({ commit }, payload) {
@@ -35,7 +35,7 @@ const actions = {
   },
   // 重置密码
   async resetPwd({ commit }, payload) {
-    const id = _.get(payload, 'id', _.get(payload, '_id'));
+    const id = _.get(payload, 'id', _.get(payload, 'id'));
     const res = await this.$axios.$post(`${api.test}/resetPwd/${id}`, payload);
     return res;
   },

+ 0 - 42
src/store/app/appapk.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/appapk`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/appbanner.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/appbanner`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/appbasic.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/appbasic`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/discuss.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/discuss`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/hotlink.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/hotlink`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/moneylog.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/moneylog`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/scenedata.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/scenedata`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/scenetype.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/scenetype`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/videos.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/videos`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/app/vipsetting.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/vipsetting`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 6 - 0
src/store/getters.js

@@ -0,0 +1,6 @@
+const getters = {
+  visitedViews: (state) => state.tagsView.visitedViews,
+  cachedViews: (state) => state.tagsView.cachedViews,
+  token: (state) => state.user.token,
+};
+export default getters;

+ 0 - 42
src/store/program.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/program`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 3 - 3
src/store/system/dictdata.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 import _ from 'lodash';
 Vue.use(Vuex);
 const api = {
-  test: `/projectadmin/api/dictData`,
+  test: `/dictData`,
 };
 const state = () => ({});
 const mutations = {};
@@ -25,8 +25,8 @@ const actions = {
     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 });
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.test}/${id}`, { ...info });
     return res;
   },
   async delete({ commit }, payload) {

+ 3 - 3
src/store/system/dicttype.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 import _ from 'lodash';
 Vue.use(Vuex);
 const api = {
-  test: `/projectadmin/api/dictType`,
+  test: `/dictType`,
 };
 const state = () => ({});
 const mutations = {};
@@ -25,8 +25,8 @@ const actions = {
     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 });
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.test}/${id}`, { ...info });
     return res;
   },
   async delete({ commit }, payload) {

+ 4 - 4
src/store/user.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex';
 import _ from 'lodash';
 Vue.use(Vuex);
 const api = {
-  test: `/projectadmin/api/user`,
+  test: `/user`,
 };
 const state = () => ({});
 const mutations = {};
@@ -25,8 +25,8 @@ const actions = {
     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 });
+  async update({ commit }, { id, ...info } = {}) {
+    const res = await this.$axios.$post(`${api.test}/${id}`, { ...info });
     return res;
   },
   async delete({ commit }, payload) {
@@ -35,7 +35,7 @@ const actions = {
   },
   // 重置密码
   async resetPwd({ commit }, payload) {
-    const id = _.get(payload, 'id', _.get(payload, '_id'));
+    const id = _.get(payload, 'id', _.get(payload, 'id'));
     const res = await this.$axios.$post(`${api.test}/resetPwd/${id}`, payload);
     return res;
   },

+ 116 - 0
src/store/user/user.js

@@ -0,0 +1,116 @@
+import { login, logout, getInfo } from '@/api/user';
+import { getToken, setToken, removeToken } from '@/util/auth';
+import router, { resetRouter } from '@/router';
+
+const state = {
+  token: getToken(),
+  name: '',
+};
+
+const mutations = {
+  SET_TOKEN: (state, token) => {
+    state.token = token;
+  },
+  SET_NAME: (state, name) => {
+    state.name = name;
+  },
+  SET_ROLES: (state, roles) => {
+    state.roles = roles;
+  },
+};
+
+const actions = {
+  // user login
+  login({ commit }, userInfo) {
+    const { username, password } = userInfo;
+    return new Promise((resolve, reject) => {
+      login({ username: username.trim(), password: password })
+        .then((response) => {
+          const { data } = response;
+          commit('SET_TOKEN', data.token);
+          setToken(data.token);
+          resolve();
+        })
+        .catch((error) => {
+          reject(error);
+        });
+    });
+  },
+
+  // get user info
+  getInfo({ commit, state }) {
+    return new Promise((resolve, reject) => {
+      getInfo(state.token)
+        .then((response) => {
+          const { data } = response;
+
+          if (!data) {
+            reject('Verification failed, please Login again.');
+          }
+          const { roles, name, avatar, introduction } = data;
+          // roles must be a non-empty array
+          if (!roles || roles.length <= 0) {
+            reject('getInfo: roles must be a non-null array!');
+          }
+          commit('SET_ROLES', roles);
+          commit('SET_NAME', name);
+          resolve(data);
+        })
+        .catch((error) => {
+          reject(error);
+        });
+    });
+  },
+
+  // user logout
+  logout({ commit, state, dispatch }) {
+    return new Promise((resolve, reject) => {
+      logout(state.token)
+        .then(() => {
+          commit('SET_TOKEN', '');
+          commit('SET_ROLES', []);
+          removeToken();
+          resetRouter();
+          // reset visited views and cached views
+          // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485
+          dispatch('tagsView/delAllViews', null, { root: true });
+          resolve();
+        })
+        .catch((error) => {
+          reject(error);
+        });
+    });
+  },
+
+  // remove token
+  resetToken({ commit }) {
+    return new Promise((resolve) => {
+      commit('SET_TOKEN', '');
+      commit('SET_ROLES', []);
+      removeToken();
+      resolve();
+    });
+  },
+
+  // dynamically modify permissions
+  async changeRoles({ commit, dispatch }, role) {
+    const token = role + '-token';
+    commit('SET_TOKEN', token);
+    setToken(token);
+    const { roles } = await dispatch('getInfo');
+    resetRouter();
+    // generate accessible routes map based on roles
+    const accessRoutes = await dispatch('permission/generateRoutes', roles, { root: true });
+    // dynamically add accessible routes
+    router.addRoutes(accessRoutes);
+    // reset visited views and cached views
+    dispatch('tagsView/delAllViews', null, { root: true });
+  },
+};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 0 - 42
src/store/web/banner.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/banner`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/web/cases.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/cases`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/web/company.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/company`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/web/leavemess.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/leavemess`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 0 - 42
src/store/web/news.js

@@ -1,42 +0,0 @@
-import Vue from 'vue';
-import Vuex from 'vuex';
-import _ from 'lodash';
-Vue.use(Vuex);
-const api = {
-  test: `/projectadmin/api/news`,
-};
-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;
-  },
-};
-export default {
-  namespaced: true,
-  state,
-  mutations,
-  actions,
-};

+ 15 - 0
src/util/auth.js

@@ -0,0 +1,15 @@
+import Cookies from 'js-cookie';
+
+const TokenKey = 'token';
+
+export function getToken() {
+  return Cookies.get(TokenKey);
+}
+
+export function setToken(token) {
+  return Cookies.set(TokenKey, token);
+}
+
+export function removeToken() {
+  return Cookies.remove(TokenKey);
+}