Przeglądaj źródła

feat: #资讯重新对接

loki 3 lat temu
rodzic
commit
5c8df0a46f

+ 8 - 3
src/api/base/info.js

@@ -1,10 +1,15 @@
 import api from '@/utils/request';
 import api from '@/utils/request';
 
 
-export const getList = params =>
+export const getPage = params =>
 	api.post(`/yxl-back-end/admin/tweet/page`, params);
 	api.post(`/yxl-back-end/admin/tweet/page`, params);
 export const getItem = ({ id, ...params }) =>
 export const getItem = ({ id, ...params }) =>
 	api.get(`/yxl-back-end/admin/tweet/${id}`, params);
 	api.get(`/yxl-back-end/admin/tweet/${id}`, params);
-export const saveItem = params =>
-	api.post(`/yxl-back-end/admin/tweet/save`, params);
+export const saveItem = ({ id, ...params }) => {
+	if (id) {
+		return api.put(`/yxl-back-end/admin/tweet/${id}`, params);
+	} else {
+		return api.post(`/yxl-back-end/admin/tweet`, params);
+	}
+};
 export const delItem = ({ id, ...params }) =>
 export const delItem = ({ id, ...params }) =>
 	api.del(`/yxl-back-end/admin/tweet/${id}`, params);
 	api.del(`/yxl-back-end/admin/tweet/${id}`, params);

+ 10 - 10
src/views/baseManagement/infoManagement/index.vue

@@ -19,7 +19,7 @@
 <script>
 <script>
 import toolbar from './toolbar';
 import toolbar from './toolbar';
 import mxFilterList from '@/mixins/filterList';
 import mxFilterList from '@/mixins/filterList';
-import { getList, delItem } from '@/api/base/info';
+import { getPage, delItem } from '@/api/base/info';
 
 
 export default {
 export default {
   name: 'InfoManagement',
   name: 'InfoManagement',
@@ -28,7 +28,7 @@ export default {
 
 
   mixins: [
   mixins: [
     mxFilterList({
     mxFilterList({
-      fetchList: getList // 在下方data再声明一个 fetchList: iGetList 同等效果
+      fetchList: getPage // 在下方data再声明一个 fetchList: iGetList 同等效果
     })
     })
   ],
   ],
 
 
@@ -38,45 +38,45 @@ export default {
         {
         {
           key: 'title',
           key: 'title',
           name: '标题',
           name: '标题',
-          minWidth: '240'
+          minWidth: this.$col.b
         },
         },
         {
         {
           key: 'author',
           key: 'author',
           name: '作者',
           name: '作者',
-          width: '160'
+          width: this.$col.s
         },
         },
         {
         {
           key: 'looks',
           key: 'looks',
           name: '阅读',
           name: '阅读',
-          width: '120',
+          width: this.$col.s,
           render: (h, { row }) => h('span', row.looks)
           render: (h, { row }) => h('span', row.looks)
         },
         },
         {
         {
           key: 'likes',
           key: 'likes',
           name: '点赞',
           name: '点赞',
-          width: '120',
+          width: this.$col.s,
           render: (h, { row }) => h('span', row.likes)
           render: (h, { row }) => h('span', row.likes)
         },
         },
         {
         {
           key: 'collections',
           key: 'collections',
           name: '收藏',
           name: '收藏',
-          width: '120',
+          width: this.$col.s,
           render: (h, { row }) => h('span', row.collections)
           render: (h, { row }) => h('span', row.collections)
         },
         },
         {
         {
           key: 'sort',
           key: 'sort',
           name: '排序',
           name: '排序',
-          width: '80'
+          width: this.$col.s
         },
         },
         {
         {
           key: 'createAt',
           key: 'createAt',
           name: '发布时间',
           name: '发布时间',
-          width: '140'
+          width: this.$col.b
         },
         },
         {
         {
           key: 'isShow',
           key: 'isShow',
           name: '状态',
           name: '状态',
-          width: '80',
+          width: this.$col.s,
           type: 'tag',
           type: 'tag',
           fetchTagType: val => (val ? 'success' : 'info'),
           fetchTagType: val => (val ? 'success' : 'info'),
           tagName: row => (row.isShow ? '显示' : '隐藏')
           tagName: row => (row.isShow ? '显示' : '隐藏')