shaogen1995 2 лет назад
Родитель
Сommit
404ef19ede

+ 1 - 1
houtai/src/pages/A1Hot/index.tsx

@@ -286,7 +286,7 @@ function Hot() {
             {/* 馆藏数据 */}
             <div className="hotListBox mySorrl" id="goodsSroolBox">
               {list2.length ? (
-                list2.slice(0, 20).map((v) => (
+                list2.slice(0, 10).map((v) => (
                   <div className="row" key={v.groupKey}>
                     <div className="rowLeft" title={v.groupKey}>
                       {v.groupKey}

+ 4 - 5
houtai/src/pages/A2News/NewsTable/index.tsx

@@ -11,7 +11,7 @@ import styles from "./index.module.scss";
 // 表格拖动排序-----------------
 import { DndProvider, useDrag, useDrop } from "react-dnd";
 import { HTML5Backend } from "react-dnd-html5-backend";
-import { newRemoveAPI } from "@/store/action/A2News";
+import { newRemoveAPI, newSortApi } from "@/store/action/A2News";
 import { MessageFu } from "@/utils/message";
 
 type Porps = {
@@ -207,13 +207,12 @@ function NewsTable({ tableType, editInfoFu, delInfoFu }: Porps) {
       // 交互位置-之前的id
       const beforeId = results[dragIndex].id;
       const afterId = results[hoverIndex].id;
-      console.log("发送请求", beforeId, afterId);
 
-      // const res = await wallSortAPI(beforeId, afterId);
+      const res = await newSortApi(beforeId, afterId);
 
-      // if (res.code === 0) dispatch(getWallTableListAPI());
+      if (res.code === 0) delInfoFu();
     },
-    [results]
+    [delInfoFu, results]
   );
 
   return (

+ 3 - 2
houtai/src/pages/A4Venue/VenueEdit/index.tsx

@@ -2,7 +2,7 @@ import { venueUploadAPI } from "@/store/action/A4Venue";
 import { ImgListType } from "@/types";
 import { domShowFu, progressDomFu } from "@/utils/domShow";
 import { MessageFu } from "@/utils/message";
-import { Button, Form, Input, Popconfirm } from "antd";
+import { Button, Form, FormInstance, Input, Popconfirm } from "antd";
 import { PlusOutlined, CloseOutlined } from "@ant-design/icons";
 import TextArea from "antd/es/input/TextArea";
 import classNames from "classnames";
@@ -24,7 +24,7 @@ type Props = {
 
 function VenueEdit({ id, closePageFu, editTableFu }: Props) {
   // 设置表单初始数据(区分编辑和新增)
-  const FormBoxRef = useRef<any>({});
+  const FormBoxRef = useRef<FormInstance>(null);
 
   // 文件的dirCode码
   const [dirCode, setDirCode] = useState("");
@@ -34,6 +34,7 @@ function VenueEdit({ id, closePageFu, editTableFu }: Props) {
   // 通过id获取详情,回显数据
   const getInfoFu = useCallback((id: number) => {
     // setDirCode(res.data.entity.dirCode);
+    FormBoxRef.current?.setFieldsValue({})
   }, []);
 
   useEffect(() => {

+ 3 - 2
houtai/src/pages/A4Venue/VenueTable/index.tsx

@@ -45,7 +45,8 @@ function VenueTable({ editInfoFu }: Porps) {
       },
       {
         title: "位置",
-        render: (item: VenueTableType) => (item.loc ? item.loc : "(空)"),
+        render: (item: VenueTableType) =>
+          item.creatorName ? item.creatorName : "(空)",
       },
       {
         title: "简介",
@@ -66,7 +67,7 @@ function VenueTable({ editInfoFu }: Porps) {
         title: "图片",
         render: (item: VenueTableType) => (
           <div className="tableImgAuto">
-            <ImageLazy width={60} height={60} src={item.img} />
+            <ImageLazy width={60} height={60} src={item.thumb} />
           </div>
         ),
       },

+ 11 - 4
houtai/src/pages/A4Venue/index.tsx

@@ -1,20 +1,27 @@
+import { getVenueListAPI } from "@/store/action/A4Venue";
 import { Button, DatePicker, Input } from "antd";
-import React, { useCallback, useRef, useState } from "react";
+import React, { useCallback, useEffect, useRef, useState } from "react";
+import { useDispatch } from "react-redux";
 import styles from "./index.module.scss";
 import VenueEdit from "./VenueEdit";
 import VenueTable from "./VenueTable";
 const { RangePicker } = DatePicker;
 
 function Venue() {
+  const dispatch = useDispatch();
   // 顶部筛选的数据
   const [tableSelect, setTableSelect] = useState({
-    name: "",
+    searchKey: "",
     startTime: "",
     endTime: "",
     pageSize: 50,
     pageNum: 1,
   });
 
+  useEffect(() => {
+    dispatch(getVenueListAPI(tableSelect));
+  }, [dispatch, tableSelect]);
+
   // 名称的输入
   const nameTime = useRef(-1);
   const nameChange = useCallback(
@@ -23,7 +30,7 @@ function Venue() {
       nameTime.current = window.setTimeout(() => {
         setTableSelect({
           ...tableSelect,
-          name: e.target.value,
+          searchKey: e.target.value,
           pageNum: 1,
         });
       }, 500);
@@ -48,7 +55,7 @@ function Venue() {
     // 把2个输入框和时间选择器清空
     setInputKey(Date.now());
     setTableSelect({
-      name: "",
+      searchKey: "",
       startTime: "",
       endTime: "",
       pageSize: 50,

+ 7 - 0
houtai/src/store/action/A2News.ts

@@ -60,4 +60,11 @@ export const newRemoveAPI = (id:number) => {
  */
 export const getNewsDetailAPI = (id:number) => {
   return http.get(`cms/news/detail/${id}`);
+};
+
+/**
+ * 拖动排序
+ */
+export const newSortApi = (id1:number,id2:number) => {
+  return http.get(`cms/news/sort/${id1}/${id2}`);
 };

+ 15 - 1
houtai/src/store/action/A4Venue.ts

@@ -1,7 +1,8 @@
+import { VenueTableApiType } from "@/types";
 import { domShowFu, progressDomFu } from "@/utils/domShow";
 import http from "@/utils/http";
 import axios from "axios";
-import store from "..";
+import store, { AppDispatch } from "..";
 
 const CancelToken = axios.CancelToken;
 /**
@@ -25,4 +26,17 @@ export const venueUploadAPI = (data: any) => {
       });
     }),
   });
+};
+
+/**
+ * 获取列表数据
+ */
+export const getVenueListAPI = (data: VenueTableApiType) => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post("cms/exhibition/getList", data);
+    dispatch({
+      type: "venue/getList",
+      payload: res.data,
+    });
+  };
 };

+ 1 - 23
houtai/src/store/reducer/A4Venue.ts

@@ -3,29 +3,7 @@ import { VenueTableType } from "@/types";
 // 初始化状态
 const initState = {
   // 表格数据
-  tableInfo: [
-    {
-      id: 1,
-      name:'名称1',
-      loc: "标题1",
-      txt: "正文666666",
-      time1: "2020-02-02 12:12",
-    },
-    {
-      id: 2,
-      name:'名称2',
-      loc: "标题2",
-      txt: "正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666正文666666",
-      time1: "2020-02-02 12:12",
-    },
-    {
-      id: 3,
-      name:'名称3',
-      loc: "标题3",
-      txt: "正文666666",
-      time1: "2020-02-02 12:12",
-    },
-  ] as VenueTableType[],
+  tableInfo: [] as VenueTableType[],
 };
 
 // 定义 action 类型

+ 22 - 1
houtai/src/types/api/A4Venue.d.ts

@@ -1 +1,22 @@
-export type VenueTableType =any
+export type VenueTableType = {
+  createTime: string;
+  creatorId?: any;
+  creatorName: string;
+  description: string;
+  dirCode: string;
+  fileIds: string;
+  id: number;
+  location: string;
+  name: string;
+  sort?: any;
+  thumb: string;
+  updateTime: string;
+};
+
+export type VenueTableApiType = {
+  searchKey: string;
+  startTime: string;
+  endTime: string;
+  pageSize: number;
+  pageNum: number;
+};