lrf402788946 5 年之前
父节点
当前提交
b15687421d
共有 3 个文件被更改,包括 39 次插入1 次删除
  1. 1 0
      components/table.md
  2. 0 1
      store/student.js
  3. 38 0
      store/termquest.js

+ 1 - 0
components/table.md

@@ -8,6 +8,7 @@
 |opera|Array|[ ]|否|操作列的列表(下文会说明如何使用)|
 |toFormat|Function|`-`|否|如果fields中的format不是function类型,则会走toFormat的方法,需要自己写过滤规则,多个的情况需要区分|
 |select|Boolean|false|否|需要选择就变成true|
+|selected|Array|`-`|false|多选选项的数据|
 
 >fields
 >>

+ 0 - 1
store/student.js

@@ -11,7 +11,6 @@ const mutations = {};
 
 const actions = {
   async query({ commit }, { skip = 0, limit, ...info } = {}) {
-    console.log(info);
     const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
     return res;
   },

+ 38 - 0
store/termquest.js

@@ -0,0 +1,38 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  interface: `/api/train/termquest`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.interface}`, { skip, limit, ...info });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.interface}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};