lrf402788946 5 lat temu
rodzic
commit
0ead482080
3 zmienionych plików z 39 dodań i 11 usunięć
  1. 10 10
      config/menu-config.js
  2. 28 0
      store/login.js
  3. 1 1
      store/task.js

+ 10 - 10
config/menu-config.js

@@ -39,11 +39,11 @@ export const devMenu = [
         name: '寝室管理',
         module: 'center',
       },
-      {
-        path: '/classes/index',
-        name: '班级管理',
-        module: 'center',
-      },
+      // {
+      //   path: '/classes/index',
+      //   name: '班级管理',
+      //   module: 'center',
+      // },
       {
         path: '/subject/index',
         name: '科目管理',
@@ -77,11 +77,11 @@ export const devMenu = [
     name: '作业管理',
     module: 'center',
   },
-  {
-    path: '/timeTable/index',
-    name: '课表管理',
-    module: 'center',
-  },
+  // {
+  //   path: '/timeTable/index',
+  //   name: '课表管理',
+  //   module: 'center',
+  // },
   {
     path: '',
     name: '调查问卷',

+ 28 - 0
store/login.js

@@ -0,0 +1,28 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+const jwt = require('jsonwebtoken');
+Vue.use(Vuex);
+const api = {
+  interface: `/api/train/login`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async login({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}`, payload);
+    let result = true;
+    if (res.errcode === 0) {
+      let info = jwt.decode(res.data);
+      commit('setUser', info, { root: true });
+    } else result = res;
+    return result;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 1 - 1
store/task.js

@@ -18,7 +18,7 @@ const actions = {
     return res;
   },
   async fetch({ commit }, payload) {
-    const res = await this.$axios.$get(`${api.interface}/show/${payload}`);
+    const res = await this.$axios.$get(`${api.interface}/${payload}`);
     return res;
   },
   async update({ commit }, { id, ...data }) {