|
@@ -0,0 +1,40 @@
|
|
|
+import Vue from 'vue';
|
|
|
+import Vuex from 'vuex';
|
|
|
+import _ from 'lodash';
|
|
|
+Vue.use(Vuex);
|
|
|
+const api = {
|
|
|
+ login: `/login`,
|
|
|
+ logout: `/logout`,
|
|
|
+ pwd: `/pwd`,
|
|
|
+ tokenView: `/tokenView`,
|
|
|
+};
|
|
|
+const state = () => ({});
|
|
|
+const mutations = {};
|
|
|
+
|
|
|
+const actions = {
|
|
|
+ // 重置密码
|
|
|
+ async resetPwd({ commit }, payload) {
|
|
|
+ const res = await this.$axios.$post(`${api.pwd}`, payload);
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ async login({ commit }, payload) {
|
|
|
+ const type = _.get(payload, 'type');
|
|
|
+ const np = _.omit(payload, 'type');
|
|
|
+ const res = await this.$axios.$post(`${api.login}/${type}`, np);
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ async logout({ commit }, payload) {
|
|
|
+ const res = await this.$axios.$post(`${api.logout}`, payload);
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+ async tokenView({ commit }, payload) {
|
|
|
+ const res = await this.$axios.$get(`${api.tokenView}`, payload);
|
|
|
+ return res;
|
|
|
+ },
|
|
|
+};
|
|
|
+export default {
|
|
|
+ namespaced: true,
|
|
|
+ state,
|
|
|
+ mutations,
|
|
|
+ actions,
|
|
|
+};
|