فهرست منبع

添加来源字典

asd123a20 2 سال پیش
والد
کامیت
43c4aff90f
2فایلهای تغییر یافته به همراه13 افزوده شده و 3 حذف شده
  1. 10 1
      admin-content/src/store/index.js
  2. 3 2
      admin-content/src/views/home.vue

+ 10 - 1
admin-content/src/store/index.js

@@ -8,7 +8,8 @@ const api = {
   contentsQuery: '/api/cms/contents/query',
   contentsFetch: '/api/cms/contents/fetch',
   menusQuery: '/api/cms/menus/query',
-  userQuery: '/api/reader/user/query'
+  userQuery: '/api/reader/user/query',
+  sourceQuery: '/api/code/dictionary/query'
 };
 Vue.use(Vuex);
 const state = () => ({
@@ -21,6 +22,11 @@ const state = () => ({
 });
 
 const actions = {
+  async sourceQuery ({ commit }) {
+    const res = await $axios.get(api.sourceQuery, { parentCode: 'source' });
+    commit('sourceQuery', res);
+    return res;
+  },
   async userQuery ({ commit }, { filter, paging } = {}) {
     const res = await $axios.get(api.userQuery, { ...filter, skip: paging.page, limit: paging.size });
     commit('userQuery', res);
@@ -63,6 +69,9 @@ const mutations = {
     state.menusList = payload.data;
     state.dict.menus = payload.data.filter(e => e.type == 1);
   },
+  sourceQuery(state, payload) {
+    state.dict.source = payload.data;
+  },
   userQuery(state, payload) {
     state.userList = payload.data.map(e => e.userList[0]);
     state.userTotal = payload.total;

+ 3 - 2
admin-content/src/views/home.vue

@@ -98,7 +98,7 @@ export default {
         // { name: 'thumbnail', label: '缩略图', formater: 'slot' },
         { name: 'title', label: '标题' },
         { name: 'curtTitle', label: '副标题' },
-        { name: 'source', label: '来源' },
+        { name: 'source', label: '来源', formater: 'dict:source' },
         // { name: 'describe', label: '描述' },
         { name: 'bind', label: '绑定菜单', formater: 'dict:menus' },
         { name: 'date', label: '时间', formater: 'date:datetime' },
@@ -154,9 +154,10 @@ export default {
   async created() {
     await this.filterQuery();
     await this.menusQuery();
+    await this.sourceQuery();
   },
   methods: {
-    ...mapActions(['contentsQuery', 'contentsCreate', 'contentsUpdate', 'contentsDelete', 'contentsQuery', 'contentsFetch', 'menusQuery', 'userQuery']),
+    ...mapActions(['contentsQuery', 'contentsCreate', 'contentsUpdate', 'contentsDelete', 'contentsQuery', 'contentsFetch', 'menusQuery', 'userQuery', 'sourceQuery']),
     // 添加
     addcontents () {
       this.formdata = {};