Forráskód Böngészése

api接口连接,弹框改动

lrf 8 hónapja
szülő
commit
91b43e76ac
3 módosított fájl, 92 hozzáadás és 5 törlés
  1. 8 5
      src/components/frame/c-dialog.vue
  2. 42 0
      src/store/message.js
  3. 42 0
      src/store/sign.js

+ 8 - 5
src/components/frame/c-dialog.vue

@@ -1,7 +1,10 @@
 <template>
   <div id="e-dialog">
-    <el-dialog :title="dialog.title" :visible.sync="dialog.show" :width="width" :before-close="toClose" :close-on-click-modal="false" :append-to-body="true">
-      <slot name="info"></slot>
+    <el-dialog :title="dialog.title" :visible.sync="dialog.show" :width="width" :before-close="toClose"
+               :close-on-click-modal="false" :append-to-body="true">
+      <slot>
+        <slot name="info"></slot>
+      </slot>
     </el-dialog>
   </div>
 </template>
@@ -11,14 +14,14 @@ import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
   name: 'e-dialog',
   props: {
-    dialog: { type: Object, default: () => {} },
+    dialog: { type: Object, default: () => { } },
     width: { type: String, default: '50%' },
   },
   components: {},
   data: function () {
     return {};
   },
-  created() {},
+  created() { },
   methods: {
     toClose() {
       this.$emit('toClose');
@@ -34,7 +37,7 @@ export default {
     test: {
       deep: true,
       immediate: true,
-      handler(val) {},
+      handler(val) { },
     },
   },
 };

+ 42 - 0
src/store/message.js

@@ -0,0 +1,42 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  test: `/message`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip, 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,
+};

+ 42 - 0
src/store/sign.js

@@ -0,0 +1,42 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  test: `/platform`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip, 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,
+};