浏览代码

视频管理

shaogen1995 2 周之前
父节点
当前提交
af797ebfb9

+ 11 - 0
src/assets/styles/base.css

@@ -158,3 +158,14 @@ textarea {
   border-radius: 10px;
   border-radius: 10px;
   background: transparent;
   background: transparent;
 }
 }
+.A4dictBox {
+  animation: B4dict 0.3s linear forwards;
+}
+@keyframes B4dict {
+  0% {
+    opacity: 0;
+  }
+  100% {
+    opacity: 1;
+  }
+}

+ 14 - 0
src/assets/styles/base.less

@@ -257,3 +257,17 @@ textarea {
   border-radius: 10px;
   border-radius: 10px;
   background: transparent;
   background: transparent;
 }
 }
+
+// 动画停在最后一帧
+.A4dictBox {
+  animation: B4dict 0.3s linear forwards;
+}
+@keyframes B4dict {
+  0% {
+    opacity: 0;
+  }
+
+  100% {
+    opacity: 1;
+  }
+}

+ 1 - 1
src/components/ZupOne/index.tsx

@@ -67,7 +67,7 @@ function ZupOne(
       if (e.target.files) {
       if (e.target.files) {
         // 拿到files信息
         // 拿到files信息
         const filesInfo = e.target.files[0]
         const filesInfo = e.target.files[0]
-        // console.log('-----', filesInfo.type)
+        console.log('-----', filesInfo.type)
 
 
         // 校验格式
         // 校验格式
         const type = format
         const type = format

+ 2 - 2
src/pages/B2line/B2add/index.tsx

@@ -135,7 +135,7 @@ function B2add({ info, closeFu, addTableFu, upTableFu }: Props) {
                 isLook={false}
                 isLook={false}
                 fileCheck={fileCheck}
                 fileCheck={fileCheck}
                 size={5}
                 size={5}
-                dirCode='B1panorama'
+                dirCode='B2line'
                 myUrl='cms/content/upload'
                 myUrl='cms/content/upload'
                 format={['image/jpeg', 'image/png']}
                 format={['image/jpeg', 'image/png']}
                 formatTxt='png、jpg和jpeg'
                 formatTxt='png、jpg和jpeg'
@@ -155,7 +155,7 @@ function B2add({ info, closeFu, addTableFu, upTableFu }: Props) {
                 isLook={false}
                 isLook={false}
                 fileCheck={false}
                 fileCheck={false}
                 size={50}
                 size={50}
-                dirCode='B1panoramaAudio'
+                dirCode='B2lineAudio'
                 myUrl='cms/content/upload'
                 myUrl='cms/content/upload'
                 format={['audio/mpeg']}
                 format={['audio/mpeg']}
                 formatTxt='mp3'
                 formatTxt='mp3'

+ 2 - 2
src/pages/B3scene/B3add/index.tsx

@@ -123,12 +123,12 @@ function B3add({ info, closeFu, addTableFu, upTableFu }: Props) {
                 isLook={false}
                 isLook={false}
                 fileCheck={fileCheck}
                 fileCheck={fileCheck}
                 size={5}
                 size={5}
-                dirCode='B1panorama'
+                dirCode='B3scene'
                 myUrl='cms/content/upload'
                 myUrl='cms/content/upload'
                 format={['image/jpeg', 'image/png']}
                 format={['image/jpeg', 'image/png']}
                 formatTxt='png、jpg和jpeg'
                 formatTxt='png、jpg和jpeg'
                 checkTxt='请上传封面'
                 checkTxt='请上传封面'
-                upTxt='最多1张;建议尺寸:500 X 240'
+                upTxt='最多1张;建议尺寸:450 X 250'
                 myType='thumb'
                 myType='thumb'
               />
               />
             </div>
             </div>

+ 2 - 2
src/pages/B3scene/index.tsx

@@ -9,7 +9,7 @@ import { Button, Select } from 'antd'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import MyPopconfirm from '@/components/MyPopconfirm'
 import { B3Select } from './data'
 import { B3Select } from './data'
 import MyTable from '@/components/MyTable'
 import MyTable from '@/components/MyTable'
-import { B3tableC } from '@/utils/tableData'
+import { B1tableC } from '@/utils/tableData'
 import B3add from './B3add'
 import B3add from './B3add'
 function B3scene() {
 function B3scene() {
   const dispatch = useDispatch()
   const dispatch = useDispatch()
@@ -90,7 +90,7 @@ function B3scene() {
           widthSet={{ content: 800 }}
           widthSet={{ content: 800 }}
           yHeight={617}
           yHeight={617}
           list={tableInfo.list}
           list={tableInfo.list}
-          columnsTemp={B3tableC}
+          columnsTemp={B1tableC}
           lastBtn={tableLastBtn}
           lastBtn={tableLastBtn}
           pageNum={fromData.pageNum}
           pageNum={fromData.pageNum}
           pageSize={fromData.pageSize}
           pageSize={fromData.pageSize}

+ 52 - 0
src/pages/B4video/B4add/index.module.scss

@@ -0,0 +1,52 @@
+.B4add {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal {
+      width: 800px !important;
+    }
+    .B4Amain {
+      border-top: 1px solid #ccc;
+      padding-top: 20px;
+
+      .ant-form-item-label {
+        width: 81px;
+      }
+
+      .formRow {
+        display: flex;
+
+        .formLeft {
+          position: relative;
+          top: 3px;
+          width: 81px;
+          text-align: right;
+
+          & > span {
+            color: #ff4d4f;
+          }
+        }
+
+        .formRight {
+          width: calc(100% - 81px);
+        }
+      }
+      .A3fromRow {
+        position: relative;
+
+        .A3_6Frow {
+          position: absolute;
+          left: 185px;
+          top: 5px;
+          color: #999;
+          font-size: 12px;
+        }
+      }
+      .B4Abtn {
+        margin-top: 40px;
+        padding-left: 80px;
+      }
+    }
+  }
+}

+ 216 - 0
src/pages/B4video/B4add/index.tsx

@@ -0,0 +1,216 @@
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { B1ListType } from '@/pages/B1panorama/data'
+import { Button, Form, FormInstance, Input, InputNumber, Modal, Select } from 'antd'
+import { MessageFu } from '@/utils/message'
+import { B1_APIsave } from '@/store/action/B1panorama'
+import { useDispatch, useSelector } from 'react-redux'
+import { B4_APIgetDictList } from '@/store/action/B4video'
+import { RootState } from '@/store'
+import ZupOne from '@/components/ZupOne'
+import MyPopconfirm from '@/components/MyPopconfirm'
+
+type Props = {
+  info: B1ListType
+  closeFu: () => void
+  addTableFu: () => void
+  upTableFu: (type: string) => void
+}
+
+function B4add({ info, closeFu, addTableFu, upTableFu }: Props) {
+  const dispatch = useDispatch()
+
+  useEffect(() => {
+    dispatch(B4_APIgetDictList())
+  }, [dispatch])
+
+  const { dictList } = useSelector((state: RootState) => state.B4video)
+
+  const getInfoFu = useCallback((info: B1ListType) => {
+    FormBoxRef.current?.setFieldsValue({ ...info, type: Number(info.type) })
+    // 设置封面图
+    ZupThumbRef.current?.setFileComFileFu({
+      fileName: '',
+      filePath: info.thumbPc,
+      thumb: info.thumb
+    })
+    // 设置音频
+    ZupVideoRef.current?.setFileComFileFu({
+      fileName: info.content,
+      filePath: info.mediaPath,
+      thumb: info.mediaPath
+    })
+  }, [])
+
+  useEffect(() => {
+    if (info.id > 0) getInfoFu(info)
+    else FormBoxRef.current?.setFieldsValue({ sort: 999 })
+  }, [getInfoFu, info])
+
+  // 表单的ref
+  const FormBoxRef = useRef<FormInstance>(null)
+
+  // 封面图的ref
+  const ZupThumbRef = useRef<any>(null)
+
+  // 视频的ref
+  const ZupVideoRef = useRef<any>(null)
+
+  // 附件 是否 已经点击过确定
+  const [fileCheck, setFileCheck] = useState(false)
+
+  // 没有通过校验
+  const onFinishFailed = useCallback(() => {
+    setFileCheck(true)
+  }, [])
+
+  //  通过校验点击确定
+  const onFinish = useCallback(
+    async (values: any) => {
+      setFileCheck(true)
+
+      const coverUrl1 = ZupThumbRef.current?.fileComFileResFu()
+      // 没有传 封面图
+      if (!coverUrl1.filePath) return MessageFu.warning('请上传封面')
+
+      const videoInfo = ZupVideoRef.current?.fileComFileResFu()
+
+      if (!videoInfo.filePath) return MessageFu.warning('请上传视频')
+
+      const obj = {
+        ...values,
+        id: info.id > 0 ? info.id : null,
+        thumb: coverUrl1.thumb || '',
+        thumbPc: coverUrl1.filePath || '',
+        content: videoInfo.fileName || '',
+        mediaPath: videoInfo.filePath || '',
+        module: 'video'
+      }
+
+      // if (1 + 1 === 2) {
+      //   console.log('------222', obj)
+      //   return
+      // }
+
+      const res = await B1_APIsave(obj)
+
+      if (res.code === 0) {
+        MessageFu.success(`${info.id > 0 ? '编辑' : '新增'}成功`)
+        info.id > 0 ? upTableFu(values.type) : addTableFu()
+
+        closeFu()
+      }
+    },
+    [addTableFu, closeFu, info.id, upTableFu]
+  )
+
+  return (
+    <Modal
+      wrapClassName={styles.B4add}
+      open={true}
+      title={info.id > 0 ? '编辑' : '新增'}
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <div className='B4Amain'>
+        <Form
+          ref={FormBoxRef}
+          name='basic'
+          onFinish={onFinish}
+          onFinishFailed={onFinishFailed}
+          autoComplete='off'
+          scrollToFirstError
+        >
+          <Form.Item
+            label='标题'
+            getValueFromEvent={e => e.target.value.trim()}
+            name='name'
+            rules={[{ required: true, message: '请输入标题' }]}
+          >
+            <Input maxLength={20} showCount placeholder='请输入内容' />
+          </Form.Item>
+
+          <Form.Item label='板块' name='type' rules={[{ required: true, message: '请选择板块' }]}>
+            <Select
+              style={{ width: 300 }}
+              options={dictList.map(v => ({ value: v.id, label: v.name }))}
+              placeholder='请选择'
+            />
+          </Form.Item>
+
+          {/* 封面 */}
+          <div className='formRow'>
+            <div className='formLeft'>
+              <span>* </span>
+              封面:
+            </div>
+            <div className='formRight'>
+              <ZupOne
+                ref={ZupThumbRef}
+                isLook={false}
+                fileCheck={fileCheck}
+                size={5}
+                dirCode='B4videoImg'
+                myUrl='cms/content/upload'
+                format={['image/jpeg', 'image/png']}
+                formatTxt='png、jpg和jpeg'
+                checkTxt='请上传封面'
+                upTxt='最多1张;建议尺寸:600 X 350'
+                myType='thumb'
+              />
+            </div>
+          </div>
+
+          {/* 视频 */}
+          <div className='formRow'>
+            <div className='formLeft'>
+              <span>* </span>视频:
+            </div>
+            <div className='formRight'>
+              <ZupOne
+                ref={ZupVideoRef}
+                isLook={false}
+                fileCheck={fileCheck}
+                size={500}
+                dirCode='B4video'
+                myUrl='cms/content/upload'
+                format={['video/mp4']}
+                formatTxt='mp4'
+                checkTxt='请上传视频'
+                upTxt='最多1个。'
+                myType='video'
+              />
+            </div>
+          </div>
+
+          <div className='A3fromRow'>
+            <Form.Item
+              label='排序值'
+              name='sort'
+              rules={[{ required: true, message: '请输入排序值' }]}
+            >
+              <InputNumber min={1} max={999} precision={0} placeholder='请输入' />
+            </Form.Item>
+            <div className='A3_6Frow'>
+              请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
+            </div>
+          </div>
+
+          {/* 确定和取消按钮 */}
+          <Form.Item className='B4Abtn'>
+            <Button type='primary' htmlType='submit'>
+              提交
+            </Button>
+            &emsp;
+            <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+          </Form.Item>
+        </Form>
+      </div>
+    </Modal>
+  )
+}
+
+const MemoB4add = React.memo(B4add)
+
+export default MemoB4add

+ 34 - 0
src/pages/B4video/B4dict/index.module.scss

@@ -0,0 +1,34 @@
+.B4dict {
+  padding: 24px;
+  :global {
+    .B4dTit {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+      margin-bottom: 15px;
+      & > h3 {
+        font-size: 18px;
+      }
+    }
+    .ant-table-cell {
+      padding: 8px !important;
+    }
+  }
+}
+
+.B4dictMo {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal-header {
+      border-bottom: 1px solid #ccc !important;
+      padding-bottom: 15px !important;
+      margin-bottom: 24px !important;
+    }
+    .B4Dbtn {
+      margin-top: 20px;
+      padding-left: 80px;
+    }
+  }
+}

+ 208 - 0
src/pages/B4video/B4dict/index.tsx

@@ -0,0 +1,208 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Form, FormInstance, Input, Modal } from 'antd'
+import MyTable from '@/components/MyTable'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import {
+  B4_APIdelDict,
+  B4_APIgetDictList,
+  B4_APIsaveDict,
+  B4_APIsortDict
+} from '@/store/action/B4video'
+import { MessageFu } from '@/utils/message'
+import { useDispatch, useSelector } from 'react-redux'
+import { RootState } from '@/store'
+
+export type B4dictlistType = {
+  name: string
+  sort: number
+  id: number
+}
+
+type Props = {
+  closeFu: () => void
+}
+
+function B4dict({ closeFu }: Props) {
+  const dispatch = useDispatch()
+
+  const getList = useCallback(async () => {
+    dispatch(B4_APIgetDictList())
+  }, [dispatch])
+
+  useEffect(() => {
+    getList()
+  }, [getList])
+
+  // 新增和编辑
+  const [addInfo, setAddInfo] = useState({} as B4dictlistType)
+
+  useEffect(() => {
+    FormBoxRef.current?.setFieldsValue({ name: addInfo.id > 0 ? addInfo.name : '' })
+  }, [addInfo])
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res: any = await B4_APIdelDict(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getList()
+      }
+    },
+    [getList]
+  )
+
+  // 从仓库获取列表
+  const { dictList } = useSelector((state: RootState) => state.B4video)
+
+  // 点击排序
+  const sortFu = useCallback(
+    async (id1: number, id2: number) => {
+      const res = await B4_APIsortDict(id1, id2)
+      if (res.code === 0) {
+        MessageFu.success('排序操作成功')
+        getList()
+      }
+    },
+    [getList]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: B4dictlistType, _: any, index: number) => {
+          return (
+            <>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => sortFu(item.id, dictList[0].id)}
+                disabled={index === 0}
+              >
+                置顶
+              </Button>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => sortFu(item.id, dictList[index - 1].id)}
+                disabled={index === 0}
+              >
+                上移
+              </Button>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => sortFu(item.id, dictList[index + 1].id)}
+                disabled={index === dictList.length - 1}
+              >
+                下移
+              </Button>
+              <Button size='small' type='text' onClick={() => setAddInfo(item)}>
+                编辑
+              </Button>
+              <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+            </>
+          )
+        }
+      }
+    ]
+  }, [delTableFu, dictList, sortFu])
+
+  // 表单的ref
+  const FormBoxRef = useRef<FormInstance>(null)
+
+  // 没有通过校验
+  const onFinishFailed = useCallback(() => {}, [])
+
+  //  通过校验点击确定
+  const onFinish = useCallback(
+    async (values: any) => {
+      const obj = {
+        name: values.name,
+        id: addInfo.id > 0 ? addInfo.id : null
+      }
+
+      // if (1 + 1 === 2) {
+      //   console.log('------222', obj)
+      //   return
+      // }
+
+      const res = await B4_APIsaveDict(obj)
+
+      if (res.code === 0) {
+        MessageFu.success(`${addInfo.id > 0 ? '编辑' : '新增'}成功`)
+        getList()
+        setAddInfo({} as B4dictlistType)
+      }
+    },
+    [addInfo.id, getList]
+  )
+
+  return (
+    <div className={styles.B4dict}>
+      <div className='B4dTit'>
+        <h3>板块管理</h3>
+        <div>
+          <Button type='primary' onClick={() => setAddInfo({ id: -1 } as B4dictlistType)}>
+            新增
+          </Button>
+          &emsp;
+          <Button onClick={closeFu}>返回</Button>
+        </div>
+      </div>
+
+      <MyTable
+        classKey='B4dict'
+        yHeight={600}
+        list={dictList}
+        columnsTemp={[['txt', '板块名称', 'name']]}
+        lastBtn={tableLastBtn}
+        pagingInfo={false}
+      />
+
+      {addInfo.id ? (
+        <Modal
+          wrapClassName={styles.B4dictMo}
+          open={true}
+          title={addInfo.id > 0 ? '编辑' : '新增'}
+          footer={
+            [] // 设置footer为空,去掉 取消 确定默认按钮
+          }
+        >
+          <Form
+            ref={FormBoxRef}
+            name='basic'
+            onFinish={onFinish}
+            onFinishFailed={onFinishFailed}
+            autoComplete='off'
+            scrollToFirstError
+          >
+            <Form.Item
+              label='板块名称'
+              getValueFromEvent={e => e.target.value.trim()}
+              name='name'
+              rules={[{ required: true, message: '请输入板块名称' }]}
+            >
+              <Input maxLength={20} showCount placeholder='请输入内容' />
+            </Form.Item>
+
+            {/* 确定和取消按钮 */}
+            <Form.Item className='B4Dbtn'>
+              <Button type='primary' htmlType='submit'>
+                提交
+              </Button>
+              &emsp;
+              <MyPopconfirm txtK='取消' onConfirm={() => setAddInfo({} as B4dictlistType)} />
+            </Form.Item>
+          </Form>
+        </Modal>
+      ) : null}
+    </div>
+  )
+}
+
+const MemoB4dict = React.memo(B4dict)
+
+export default MemoB4dict

+ 35 - 0
src/pages/B4video/index.module.scss

@@ -1,4 +1,39 @@
 .B4video {
 .B4video {
+  position: relative;
   :global {
   :global {
+    .B4top {
+      border-radius: 10px;
+      padding: 15px 24px;
+      background-color: #fff;
+      display: flex;
+      justify-content: space-between;
+      .ant-select-selection-placeholder {
+        color: black;
+      }
+    }
+
+    .tableBox {
+      border-radius: 10px;
+      overflow: hidden;
+      margin-top: 15px;
+      height: calc(100% - 77px);
+      background-color: #fff;
+    }
+    .A4dictBox {
+      position: absolute;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: 100%;
+      border-radius: 10px;
+      background-color: rgba(0, 0, 0, 0.6);
+      padding: 50px 100px;
+      & > div {
+        width: 100%;
+        height: 100%;
+        background-color: #fff;
+        border-radius: 10px;
+      }
+    }
   }
   }
 }
 }

+ 140 - 2
src/pages/B4video/index.tsx

@@ -1,9 +1,147 @@
-import React from 'react'
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
 import styles from './index.module.scss'
 import styles from './index.module.scss'
+import { useDispatch, useSelector } from 'react-redux'
+import { B1baseFromData, B1ListType } from '../B1panorama/data'
+import { B1_APIdel, B1_APIgetList } from '@/store/action/B1panorama'
+import { RootState } from '@/store'
+import { MessageFu } from '@/utils/message'
+import { Button, Select } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import MyTable from '@/components/MyTable'
+import { B1tableC } from '@/utils/tableData'
+import B4dict from './B4dict'
+import { B4_APIgetDictList } from '@/store/action/B4video'
+import B4add from './B4add'
 function B4video() {
 function B4video() {
+  const dispatch = useDispatch()
+
+  useEffect(() => {
+    dispatch(B4_APIgetDictList())
+  }, [dispatch])
+
+  const { dictList } = useSelector((state: RootState) => state.B4video)
+
+  // 顶部筛选
+  const [fromData, setFromData] = useState(B1baseFromData)
+
+  // 封装发送请求的函数
+  const getList = useCallback(async () => {
+    dispatch(B1_APIgetList(fromData, 'video'))
+  }, [dispatch, fromData])
+
+  useEffect(() => {
+    getList()
+  }, [getList])
+
+  // 从仓库中获取表格数据
+  const tableInfo = useSelector((state: RootState) => state.B1panorama.tableInfo.video)
+
+  // 点击删除
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res: any = await B1_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getList()
+      }
+    },
+    [getList]
+  )
+
+  const frontBtn = useMemo(() => {
+    return [
+      {
+        title: '板块',
+        render: (item: B1ListType) => {
+          const obj = dictList.find(v => v.id === Number(item.type))
+          return obj ? obj.name : '(空)'
+        }
+      }
+    ]
+  }, [dictList])
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: B1ListType) => {
+          return (
+            <>
+              <Button size='small' type='text' onClick={() => setEditInfo(item)}>
+                编辑
+              </Button>
+              <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+            </>
+          )
+        }
+      }
+    ]
+  }, [delTableFu])
+
+  // 新增/编辑
+  const [editInfo, setEditInfo] = useState({} as B1ListType)
+
+  // 板块管理
+  const [dict, setDict] = useState(false)
+
   return (
   return (
     <div className={styles.B4video}>
     <div className={styles.B4video}>
-      <h1>B4video</h1>
+      <div className='pageTitle'>视频管理</div>
+      <div className='B4top'>
+        <div>
+          <span>板块:</span>
+          <Select
+            style={{ width: 300 }}
+            allowClear
+            placeholder='全部'
+            value={fromData.type || undefined}
+            onChange={e => setFromData({ ...fromData, pageNum: 1, type: e })}
+            options={dictList.map(v => ({ value: v.id, label: v.name }))}
+          />
+        </div>
+
+        <div>
+          <Button type='primary' onClick={() => setDict(true)}>
+            板块管理
+          </Button>
+          &emsp;
+          <Button type='primary' onClick={() => setEditInfo({ id: -1 } as B1ListType)}>
+            新增
+          </Button>
+        </div>
+      </div>
+      {/* 表格主体 */}
+      <div className='tableBox'>
+        <MyTable
+          widthSet={{ content: 800 }}
+          yHeight={617}
+          list={tableInfo.list}
+          columnsTemp={B1tableC.filter((v, i) => i !== 0)}
+          frontBtn={frontBtn}
+          lastBtn={tableLastBtn}
+          pageNum={fromData.pageNum}
+          pageSize={fromData.pageSize}
+          total={tableInfo.total}
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
+        />
+      </div>
+      {editInfo.id ? (
+        <B4add
+          info={editInfo}
+          closeFu={() => setEditInfo({} as B1ListType)}
+          addTableFu={() => setFromData({ ...B1baseFromData })}
+          upTableFu={type => {
+            type === fromData.type ? getList() : setFromData({ ...B1baseFromData })
+          }}
+        />
+      ) : null}
+
+      {/* 板块管理 */}
+      {dict ? (
+        <div className='A4dictBox'>
+          <B4dict closeFu={() => setDict(false)} />
+        </div>
+      ) : null}
     </div>
     </div>
   )
   )
 }
 }

+ 36 - 0
src/store/action/B4video.ts

@@ -0,0 +1,36 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+
+/**
+ * 视频板块---获取列表
+ */
+
+export const B4_APIgetDictList = (type = 'video'): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.get(`cms/dict/getList?type=${type}`)
+    if (res.code === 0) {
+      dispatch({ type: 'B4dict/getList', payload: res.data })
+    }
+  }
+}
+
+/**
+ * 视频板块---删除
+ */
+export const B4_APIdelDict = (id: number) => {
+  return http.get(`cms/dict/remove/${id}`)
+}
+
+/**
+ * 视频板块---新增/编辑
+ */
+export const B4_APIsaveDict = (data: any, type = 'video') => {
+  return http.post('cms/dict/save', { ...data, type })
+}
+
+/**
+ * 视频板块---排序
+ */
+export const B4_APIsortDict = (id1: number, id2: number) => {
+  return http.get(`cms/dict/sort/${id1}/${id2}`)
+}

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

@@ -0,0 +1,25 @@
+import { B4dictlistType } from '@/pages/B4video/B4dict'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  dictList: [] as B4dictlistType[]
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'B4dict/getList'
+  payload: B4dictlistType[]
+}
+
+// reducer
+export default function userReducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'B4dict/getList':
+      return { ...state, dictList: action.payload }
+
+    default:
+      return state
+  }
+}

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

@@ -10,6 +10,7 @@ import Z2log from './Z2log'
 import A2intro from './A2intro'
 import A2intro from './A2intro'
 import A3message from './A3message'
 import A3message from './A3message'
 import B1panorama from './B1panorama'
 import B1panorama from './B1panorama'
+import B4video from './B4video'
 
 
 // 合并 reducer
 // 合并 reducer
 const rootReducer = combineReducers({
 const rootReducer = combineReducers({
@@ -18,6 +19,7 @@ const rootReducer = combineReducers({
   A2intro,
   A2intro,
   A3message,
   A3message,
   B1panorama,
   B1panorama,
+  B4video,
   A4hot,
   A4hot,
   Z1user,
   Z1user,
   Z2log
   Z2log

+ 0 - 7
src/utils/tableData.ts

@@ -42,13 +42,6 @@ export const B2tableC = [
   ['txt', '排序值', 'sort']
   ['txt', '排序值', 'sort']
 ]
 ]
 
 
-export const B3tableC = [
-  ['txt', '板块', 'type'],
-  ['txt', '名称', 'name'],
-  ['img', '图片', 'thumb'],
-  ['txt', '排序值', 'sort']
-]
-
 export const Z1tableC = [
 export const Z1tableC = [
   ['txt', '用户名', 'userName'],
   ['txt', '用户名', 'userName'],
   ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],
   ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],