瀏覽代碼

视频 海报

shaogen1995 1 年之前
父節點
當前提交
b910a15dd2

+ 100 - 0
src/components/ZupOne/index.module.scss

@@ -0,0 +1,100 @@
+.ZupOne {
+  width: 100%;
+  height: 100%;
+  position: relative;
+
+  :global {
+
+    .file_upIcon {
+      color: #a6a6a6;
+      border-radius: 3px;
+      cursor: pointer;
+      font-size: 30px;
+      width: 100px;
+      height: 100px;
+      border: 1px dashed #797979;
+      display: flex;
+      justify-content: center;
+      align-items: center;
+
+
+    }
+
+    .file_img {
+      width: 100px;
+      height: 126px;
+      position: relative;
+
+      .file_closeBox {
+        position: absolute;
+        right: -10px;
+        top: -10px;
+        z-index: 99;
+        background-color: rgba(0, 0, 0, 0.8);
+        width: 20px;
+        height: 20px;
+        border-radius: 50%;
+        font-size: 16px;
+        color: #fff;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+      }
+
+
+
+      .file_lookBox {
+        width: 100%;
+        background-color: rgba(0, 0, 0, .6);
+        color: #fff;
+        display: flex;
+        justify-content: space-around;
+
+        &>a {
+          color: #fff;
+        }
+
+        font-size: 16px;
+      }
+    }
+
+    .fileInfo {
+      display: flex;
+      align-items: center;
+      font-size: 16px;
+
+      .clearCover {
+        margin-left: 20px;
+        cursor: pointer;
+        font-size: 16px;
+      }
+
+      &>a {
+        color: black;
+      }
+    }
+
+    .fileBoxRow_r_tit {
+      height: 46px;
+      margin-top: 5px;
+      font-size: 14px;
+      color: rgb(126, 124, 124);
+
+
+    }
+
+    .noUpThumb {
+      position: relative;
+      overflow: hidden;
+      opacity: 0;
+      transition: top .2s;
+      color: #ff4d4f;
+      top: -10px;
+    }
+
+    .noUpThumbAc {
+      top: 0;
+      opacity: 1;
+    }
+  }
+}

+ 247 - 0
src/components/ZupOne/index.tsx

@@ -0,0 +1,247 @@
+import React, { useCallback, useMemo, useRef, useState } from "react";
+import styles from "./index.module.scss";
+import ImageLazy from "@/components/ImageLazy";
+import {
+  PlusOutlined,
+  EyeOutlined,
+  CloseOutlined,
+  DownloadOutlined,
+} from "@ant-design/icons";
+import store from "@/store";
+import { baseURL } from "@/utils/http";
+import classNames from "classnames";
+import { Popconfirm } from "antd";
+import { MessageFu } from "@/utils/message";
+import { fileDomInitialFu } from "@/utils/domShow";
+import { API_upFile } from "@/store/action/layout";
+import { forwardRef, useImperativeHandle } from "react";
+
+// 这个组件 只处理 上传 一张图片或者 视频 音频 模型 的情况
+
+type Props = {
+  isLook: boolean; //是不是查看
+  fileCheck: boolean; //有没有点击过确定
+  size: number; //上传附件大小(M)
+  dirCode: string; //文件的code码
+  myUrl: string; //请求地址
+  format: string[]; //上传格式
+  formatTxt: string; //上传图片提示
+  checkTxt: string;
+  upTxt: string;
+  myType: "thumb" | "video" | "audio" | "model";
+  fromData?: any;
+  ref: any; //当前自己的ref,给父组件调用
+};
+
+function ZupOne(
+  {
+    isLook,
+    fileCheck,
+    size,
+    dirCode,
+    myUrl,
+    format,
+    formatTxt,
+    checkTxt,
+    upTxt,
+    myType,
+    fromData,
+  }: Props,
+  ref: any
+) {
+  const [fileUrl, setFileUrl] = useState({
+    fileName: "",
+    filePath: "",
+  });
+
+  const myInput = useRef<HTMLInputElement>(null);
+
+  // 上传封面图
+  const handeUpPhoto = useCallback(
+    async (e: React.ChangeEvent<HTMLInputElement>) => {
+      if (e.target.files) {
+        // 拿到files信息
+        const filesInfo = e.target.files[0];
+        // 校验格式
+        const type = format;
+        if (!type.includes(filesInfo.type)) {
+          e.target.value = "";
+          return MessageFu.warning(`只支持${formatTxt}格式!`);
+        }
+        // 校验大小
+        if (filesInfo.size > size * 1024 * 1024) {
+          e.target.value = "";
+          return MessageFu.warning(`最大支持${size}M!`);
+        }
+        // 创建FormData对象
+        const fd = new FormData();
+        // 把files添加进FormData对象(‘photo’为后端需要的字段)
+        fd.append("type", myType);
+        fd.append("dirCode", dirCode);
+        fd.append("file", filesInfo);
+
+        if (fromData) {
+          for (const k in fromData) {
+            if (fromData[k]) fd.append(k, fromData[k]);
+          }
+        }
+
+        e.target.value = "";
+
+        try {
+          const res = await API_upFile(fd, myUrl);
+          if (res.code === 0) {
+            MessageFu.success("上传成功!");
+            setFileUrl(res.data);
+          }
+          fileDomInitialFu();
+        } catch (error) {
+          fileDomInitialFu();
+        }
+      }
+    },
+    [dirCode, format, formatTxt, fromData, myType, myUrl, size]
+  );
+
+  // 让父组件调用的 回显 附件 地址
+  const setFileComFileFu = useCallback(
+    (valObj: { fileName: string; filePath: string }) => {
+      setFileUrl(valObj);
+    },
+    []
+  );
+
+  // 让父组件调用的返回 附件 名字和路径
+  const fileComFileResFu = useCallback(() => {
+    return fileUrl;
+  }, [fileUrl]);
+
+  // 可以让父组件调用子组件的方法
+  useImperativeHandle(ref, () => ({
+    setFileComFileFu,
+    fileComFileResFu,
+  }));
+
+  const acceptRes = useMemo(() => {
+    let accept = ".png,.jpg,.jpeg";
+    if (myType === "video") accept = ".mp4";
+    else if (myType === "audio") accept = ".mp3";
+    else if (myType === "model") accept = ".4dage";
+    return accept;
+  }, [myType]);
+
+  return (
+    <div className={styles.ZupOne}>
+      <input
+        id="upInput"
+        type="file"
+        accept={acceptRes}
+        ref={myInput}
+        onChange={(e) => handeUpPhoto(e)}
+      />
+
+      <div
+        hidden={fileUrl.filePath !== ""}
+        className="file_upIcon"
+        onClick={() => myInput.current?.click()}
+      >
+        <PlusOutlined rev={undefined} />
+      </div>
+
+      {/* 为图片的情况-------------- */}
+      {myType === "thumb" ? (
+        <div className="file_img" hidden={fileUrl.filePath === ""}>
+          {fileUrl ? (
+            <ImageLazy width={100} height={100} src={fileUrl.filePath} noLook />
+          ) : null}
+
+          {/* 删除 */}
+          <div className="file_closeBox" hidden={isLook}>
+            <Popconfirm
+              title="删除后无法恢复,是否删除?"
+              okText="删除"
+              cancelText="取消"
+              onConfirm={() => setFileUrl({ fileName: "", filePath: "" })}
+            >
+              <CloseOutlined rev={undefined} />
+            </Popconfirm>
+          </div>
+
+          {/* 预览 下载 */}
+          <div className="file_lookBox">
+            <EyeOutlined
+              onClick={() =>
+                store.dispatch({
+                  type: "layout/lookBigImg",
+                  payload: { url: baseURL + fileUrl, show: true },
+                })
+              }
+              rev={undefined}
+            />
+            <a
+              href={baseURL + fileUrl}
+              download
+              target="_blank"
+              rel="noreferrer"
+            >
+              <DownloadOutlined rev={undefined} />
+            </a>
+          </div>
+        </div>
+      ) : fileUrl.filePath ? (
+        <div className="fileInfo">
+          <div className="upSuccTxt">{fileUrl.fileName}</div>
+          {/* 视频预览 */}
+          <div
+            className="clearCover"
+            hidden={!fileUrl.filePath}
+            onClick={() =>
+              store.dispatch({
+                type: "layout/lookDom",
+                payload: { src: fileUrl.filePath, type: myType },
+              })
+            }
+          >
+            <EyeOutlined rev={undefined} />
+          </div>
+          {/* 视频下载 */}
+          <a
+            href={baseURL + fileUrl.filePath}
+            download
+            target="_blank"
+            className="clearCover"
+            rel="noreferrer"
+          >
+            <DownloadOutlined rev={undefined} />
+          </a>
+          {/* 视频删除 */}
+          <Popconfirm
+            title="删除后无法恢复,是否删除?"
+            okText="删除"
+            cancelText="取消"
+            onConfirm={() => setFileUrl({ fileName: "", filePath: "" })}
+          >
+            <div className="clearCover" hidden={isLook}>
+              <CloseOutlined rev={undefined} />
+            </div>
+          </Popconfirm>
+        </div>
+      ) : null}
+
+      <div className="fileBoxRow_r_tit" hidden={isLook}>
+        支持{formatTxt}的图片格式;最大支持{size}M。{upTxt}
+        <br />
+        <div
+          className={classNames(
+            "noUpThumb",
+            !fileUrl.filePath && fileCheck ? "noUpThumbAc" : ""
+          )}
+        >
+          {checkTxt}
+        </div>
+      </div>
+    </div>
+  );
+}
+
+export default forwardRef(ZupOne);

+ 31 - 0
src/pages/A1video/A1add/index.module.scss

@@ -0,0 +1,31 @@
+.A1add{
+  position: absolute;
+  top: 0;
+  left: 0;
+  z-index: 10;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 20px;
+  width: 100%;
+  height: 100%;
+  :global{
+    .A1Amain{
+      width: 800px;
+      .formRow{
+        display: flex;
+        .formLeft{
+          position: relative;
+          top: 3px;
+          width: 100px;
+          text-align: right;
+          &>span{
+            color: #ff4d4f;
+          }
+        }
+        .formRight{
+          width: calc(100% - 100px);
+        }
+      }
+    }
+  }
+}

+ 204 - 0
src/pages/A1video/A1add/index.tsx

@@ -0,0 +1,204 @@
+import React, { useCallback, useEffect, useRef, useState } from "react";
+import styles from "./index.module.scss";
+import { Button, Form, FormInstance, Input, Popconfirm, Select } from "antd";
+import ZupOne from "@/components/ZupOne";
+import { A1_APIgetInfo, A1_APIsave } from "@/store/action/A1video";
+import { MessageFu } from "@/utils/message";
+
+type Props = {
+  addId: number;
+  closeFu: () => void;
+  addTableFu: () => void;
+  type: "video" | "poster";
+};
+
+function A1add({ addId, closeFu, addTableFu, type }: Props) {
+  // 表单的ref
+  const FormBoxRef = useRef<FormInstance>(null);
+
+  // 没有通过校验
+  const onFinishFailed = useCallback(() => {
+    setFileCheck(true);
+  }, []);
+
+  //  通过校验点击确定
+  const onFinish = useCallback(
+    async (value: any) => {
+      setFileCheck(true);
+      const coverUrl1 = ZupOneRef1.current?.fileComFileResFu();
+      // 没有传 封面图
+      if (!coverUrl1.filePath) return;
+
+      let coverUrl2 = { filePath: "", fileName: "" };
+
+      if (type === "video") {
+        coverUrl2 = ZupOneRef2.current?.fileComFileResFu();
+        // 没有传 视频
+        if (!coverUrl2.filePath) return;
+      }
+
+      const obj = {
+        ...value,
+        id: addId > 0 ? addId : null,
+        thumb: coverUrl1.filePath,
+        type,
+        filePath: type === "video" ? coverUrl2.filePath : null,
+        fileName: type === "video" ? coverUrl2.fileName : null,
+      };
+
+      const res = await A1_APIsave(obj);
+      if (res.code === 0) {
+        MessageFu.success(addId > 0 ? "编辑成功!" : "新增成功!");
+        addTableFu();
+        closeFu();
+      }
+    },
+    [addId, addTableFu, closeFu, type]
+  );
+
+  // 附件 是否 已经点击过确定
+  const [fileCheck, setFileCheck] = useState(false);
+
+  // 上传附件的ref
+  const ZupOneRef1 = useRef<any>(null);
+  const ZupOneRef2 = useRef<any>(null);
+
+  // 通过id获取详情
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await A1_APIgetInfo(id);
+    if (res.code === 0) {
+      const data = res.data;
+      FormBoxRef.current?.setFieldsValue({
+        name: data.name,
+        display: data.display,
+      });
+      ZupOneRef1.current?.setFileComFileFu({
+        fileName: "",
+        filePath: data.thumb,
+      });
+      ZupOneRef2.current?.setFileComFileFu({
+        fileName: data.fileName,
+        filePath: data.filePath,
+      });
+    }
+  }, []);
+
+  useEffect(() => {
+    if (addId > 0) {
+      // 编辑
+      getInfoFu(addId);
+    } else {
+      // 新增
+      FormBoxRef.current?.setFieldsValue({
+        display: 1,
+      });
+    }
+  }, [addId, getInfoFu]);
+
+  return (
+    <div className={styles.A1add}>
+      <div className="A1Amain">
+        <Form
+          ref={FormBoxRef}
+          name="basic"
+          labelCol={{ span: 3 }}
+          onFinish={onFinish}
+          onFinishFailed={onFinishFailed}
+          autoComplete="off"
+        >
+          <Form.Item
+            label="标题"
+            name="name"
+            rules={[{ required: true, message: "请输入标题!" }]}
+            getValueFromEvent={(e) => e.target.value.replace(/\s+/g, "")}
+          >
+            <Input maxLength={10} showCount placeholder="请输入内容" />
+          </Form.Item>
+
+          {/* 封面 */}
+          <div className="formRow">
+            <div className="formLeft">
+              <span>* </span>
+              {type === "video" ? "封面" : "海报"}:
+            </div>
+            <div className="formRight">
+              <ZupOne
+                ref={ZupOneRef1}
+                isLook={false}
+                fileCheck={fileCheck}
+                size={5}
+                dirCode={type === "video" ? "tab1Video" : "tab2Poster"}
+                myUrl="cms/poster/upload"
+                format={["image/jpeg", "image/png"]}
+                formatTxt="png、jpg和jpeg"
+                checkTxt="请上传封面图"
+                upTxt="最多一张"
+                myType="thumb"
+              />
+            </div>
+          </div>
+
+          {/* 视频 */}
+          {type === "video" ? (
+            <div className="formRow">
+              <div className="formLeft">
+                <span>* </span>视频:
+              </div>
+              <div className="formRight">
+                <ZupOne
+                  ref={ZupOneRef2}
+                  isLook={false}
+                  fileCheck={fileCheck}
+                  size={200}
+                  dirCode={type === "video" ? "tab1Video" : "tab2Poster"}
+                  myUrl="cms/poster/upload"
+                  format={["video/mp4"]}
+                  formatTxt="mp4"
+                  checkTxt="请上传视频"
+                  upTxt="最多一个"
+                  myType="video"
+                />
+              </div>
+            </div>
+          ) : null}
+
+          <Form.Item
+            label="自动播放"
+            name="display"
+            rules={[{ required: true, message: "请选择自动播放!" }]}
+          >
+            <Select
+              placeholder="请选择"
+              style={{ width: 200 }}
+              options={[
+                { value: 1, label: "是" },
+                { value: 0, label: "否" },
+              ]}
+            />
+          </Form.Item>
+
+          {/* 确定和取消按钮 */}
+          <br />
+          <Form.Item wrapperCol={{ offset: 9, span: 16 }}>
+            <Button type="primary" htmlType="submit">
+              提交
+            </Button>
+            &emsp;
+            <Popconfirm
+              title="放弃编辑后,信息将不会保存!"
+              okText="放弃"
+              cancelText="取消"
+              onConfirm={closeFu}
+            >
+              <Button>取消</Button>
+            </Popconfirm>
+          </Form.Item>
+        </Form>
+      </div>
+    </div>
+  );
+}
+
+const MemoA1add = React.memo(A1add);
+
+export default MemoA1add;

+ 29 - 0
src/pages/A1video/A1main/index.module.scss

@@ -0,0 +1,29 @@
+.A1main {
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 20px;
+
+  :global {
+    .A1addBtn {
+      text-align: right;
+    }
+
+    .A1main {
+      overflow: hidden;
+      margin-top: 18px;
+      height: calc(100% - 50px);
+
+      .ant-table-body {
+        height: 680px;
+        overflow-y: auto !important;
+        overflow-y: overlay !important;
+
+        .ant-table-row {
+          .ant-table-cell {
+            padding: 10px;
+          }
+        }
+      }
+    }
+  }
+}

+ 151 - 0
src/pages/A1video/A1main/index.tsx

@@ -0,0 +1,151 @@
+import React, { useCallback, useEffect, useMemo, useState } from "react";
+import styles from "./index.module.scss";
+import { Button, Popconfirm, Table } from "antd";
+import { useDispatch, useSelector } from "react-redux";
+import { A1_APIdel, A1_APIgetList, A1_APIsort } from "@/store/action/A1video";
+import { RootState } from "@/store";
+import { A1TableType } from "@/types";
+import ImageLazy from "@/components/ImageLazy";
+import { MessageFu } from "@/utils/message";
+import A1add from "../A1add";
+
+type Props = {
+  type: "video" | "poster";
+};
+
+function A1main({ type }: Props) {
+  const dispatch = useDispatch();
+
+  const getListFu = useCallback(() => {
+    dispatch(A1_APIgetList(type));
+  }, [dispatch, type]);
+
+  useEffect(() => {
+    getListFu();
+  }, [getListFu]);
+
+  const tableList = useSelector((state: RootState) => {
+    return type === "video"
+      ? state.A1video.tableList
+      : state.A2poster.tableList;
+  });
+
+  // 点击上移和下移动
+  const moveTableFu = useCallback(
+    async (id1: number, id2: number) => {
+      const res = await A1_APIsort(id1, id2);
+      if (res.code === 0) getListFu();
+    },
+    [getListFu]
+  );
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await A1_APIdel(id);
+      if (res.code === 0) {
+        MessageFu.success("删除成功!");
+        getListFu();
+      }
+    },
+    [getListFu]
+  );
+
+  const columns = useMemo(() => {
+    return [
+      {
+        title: "标题",
+        dataIndex: "name",
+      },
+      {
+        title: type === "video" ? "视频封面" : "海报",
+        render: (item: A1TableType) => (
+          <div className="tableImgAuto">
+            <ImageLazy width={60} height={60} src={item.thumb} />
+          </div>
+        ),
+      },
+      {
+        title: "创建日期",
+        dataIndex: "createTime",
+      },
+      {
+        title: "操作",
+        render: (item: A1TableType, _: any, index: number) => (
+          <>
+            <Button
+              size="small"
+              type="text"
+              onClick={() => moveTableFu(item.id, tableList[index - 1].id)}
+              disabled={index === 0}
+            >
+              上移
+            </Button>
+            <Button
+              size="small"
+              type="text"
+              onClick={() => moveTableFu(item.id, tableList[index + 1].id)}
+              disabled={index === tableList.length - 1}
+            >
+              下移
+            </Button>
+            <Button size="small" type="text" onClick={() => setAddId(item.id)}>
+              编辑
+            </Button>
+
+            <Popconfirm
+              title="删除后无法恢复,是否删除?"
+              okText="删除"
+              cancelText="取消"
+              onConfirm={() => delTableFu(item.id)}
+            >
+              <Button size="small" type="text" danger>
+                删除
+              </Button>
+            </Popconfirm>
+          </>
+        ),
+      },
+    ];
+  }, [delTableFu, moveTableFu, tableList, type]);
+
+  // 点击新增和编辑
+  const [addId, setAddId] = useState(0);
+
+  return (
+    <div className={styles.A1main}>
+      <div className="pageTitle">
+        {type === "video" ? "视频" : "海报"}管理{" "}
+        {addId ? (addId > 0 ? "- 编辑" : "- 新增") : ""}
+      </div>
+      <div className="A1addBtn">
+        <Button type="primary" onClick={() => setAddId(-1)}>
+          新增
+        </Button>
+      </div>
+      {/* 表格 */}
+      <div className="A1main">
+        <Table
+          scroll={{ y: 680 }}
+          dataSource={tableList}
+          columns={columns}
+          rowKey="id"
+          pagination={false}
+        />
+      </div>
+      {/* 点击新增和编辑 */}
+      {addId ? (
+        <A1add
+          addId={addId}
+          closeFu={() => setAddId(0)}
+          addTableFu={() => getListFu()}
+          type={type}
+        />
+      ) : null}
+    </div>
+  );
+}
+
+const MemoA1main = React.memo(A1main);
+
+export default MemoA1main;

+ 0 - 5
src/pages/A1video/index.module.scss

@@ -1,5 +0,0 @@
-.A1video{
-  :global{
-    
-  }
-}

+ 3 - 8
src/pages/A1video/index.tsx

@@ -1,12 +1,7 @@
 import React from "react";
-import styles from "./index.module.scss";
- function A1video() {
-  
-  return (
-    <div className={styles.A1video}>
-      <div className="pageTitle">视频管理</div>
-    </div>
-  )
+import A1main from "./A1main";
+function A1video() {
+  return <A1main type="video" />;
 }
 
 const MemoA1video = React.memo(A1video);

+ 0 - 5
src/pages/A2poster/index.module.scss

@@ -1,5 +0,0 @@
-.A2poster{
-  :global{
-    
-  }
-}

+ 3 - 8
src/pages/A2poster/index.tsx

@@ -1,12 +1,7 @@
 import React from "react";
-import styles from "./index.module.scss";
- function A2poster() {
-  
-  return (
-    <div className={styles.A2poster}>
-      <h1>A2poster</h1>
-    </div>
-  )
+import A1main from "../A1video/A1main";
+function A2poster() {
+  return <A1main type="poster" />;
 }
 
 const MemoA2poster = React.memo(A2poster);

+ 44 - 0
src/store/action/A1video.ts

@@ -0,0 +1,44 @@
+import http from "@/utils/http";
+import { AppDispatch } from "..";
+/**
+ * 获取 视频 / 海报 列表
+ */
+export const A1_APIgetList = (type: "video" | "poster") => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.get(`cms/poster/getList/${type}`);
+    if (res.code === 0) {
+      dispatch({
+        type: type === "video" ? "A1/getList" : 'A2/getList',
+        payload: res.data,
+      });
+    }
+  };
+};
+
+/**
+ * 排序 -上移 下移
+ */
+export const A1_APIsort = (id1: number, id2: number) => {
+  return http.get(`cms/poster/sort/${id1}/${id2}`);
+};
+
+/**
+ * 删除
+ */
+export const A1_APIdel = (id: number) => {
+  return http.get(`cms/poster/remove/${id}`);
+};
+
+/**
+ * 新增/编辑
+ */
+export const A1_APIsave = (data: any) => {
+  return http.post("cms/poster/save", data);
+};
+
+/**
+ * 通过id获取详情
+ */
+export const A1_APIgetInfo = (id: number) => {
+  return http.get(`cms/poster/detail/${id}`);
+};

+ 1 - 0
src/store/action/layout.ts

@@ -40,3 +40,4 @@ export const API_upFile = (data: any, url: string) => {
     }),
   });
 };
+

+ 25 - 0
src/store/reducer/A1video.ts

@@ -0,0 +1,25 @@
+import { A1TableType } from "@/types";
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableList: [] as A1TableType[],
+};
+
+// 定义 action 类型
+type Props = {
+  type: "A1/getList";
+  payload: A1TableType[];
+};
+
+// 频道 reducer
+export default function Reducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case "A1/getList":
+      return { ...state, tableList: action.payload };
+
+    default:
+      return state;
+  }
+}

+ 25 - 0
src/store/reducer/A2poster.ts

@@ -0,0 +1,25 @@
+import { A1TableType } from "@/types";
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableList: [] as A1TableType[],
+};
+
+// 定义 action 类型
+type Props = {
+  type: "A2/getList";
+  payload: A1TableType[];
+};
+
+// 频道 reducer
+export default function Reducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case "A2/getList":
+      return { ...state, tableList: action.payload };
+
+    default:
+      return state;
+  }
+}

+ 4 - 0
src/store/reducer/index.ts

@@ -3,6 +3,8 @@ import { combineReducers } from "redux";
 
 // 导入 登录 模块的 reducer
 import A0Layout from "./layout";
+import A1video from "./A1video";
+import A2poster from "./A2poster";
 import A7user from "./A7user";
 import A8log from "./A8log";
 
@@ -10,6 +12,8 @@ import A8log from "./A8log";
 // 合并 reducer
 const rootReducer = combineReducers({
   A0Layout,
+  A1video,
+  A2poster,
   A7user,
   A8log
 });

+ 13 - 0
src/types/api/A1video.d.ts

@@ -0,0 +1,13 @@
+export type A1TableType = {
+	createTime: string;
+	creatorId: number;
+	creatorName: string;
+	display: number;
+	filePath: string;
+	id: number;
+	name: string;
+	sort: number;
+	thumb: string;
+	type: string;
+	updateTime: string;
+}

+ 1 - 0
src/types/index.d.ts

@@ -1,3 +1,4 @@
 export * from './api/layot'
+export * from './api/A1video'
 export * from './api/A7user'
 export * from './api/A8log'