Pārlūkot izejas kodu

feat: #资讯重新对接

loki 3 gadi atpakaļ
vecāks
revīzija
5c8df0a46f
2 mainītis faili ar 18 papildinājumiem un 13 dzēšanām
  1. 8 3
      src/api/base/info.js
  2. 10 10
      src/views/baseManagement/infoManagement/index.vue

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

@@ -1,10 +1,15 @@
 import api from '@/utils/request';
 
-export const getList = params =>
+export const getPage = params =>
 	api.post(`/yxl-back-end/admin/tweet/page`, params);
 export const getItem = ({ 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 }) =>
 	api.del(`/yxl-back-end/admin/tweet/${id}`, params);

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

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