shaogen1995 8 months ago
parent
commit
ec36d41f4b

+ 96 - 0
后台管理/src/pages/A3course/A3add/index.module.scss

@@ -0,0 +1,96 @@
+.A3add {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 24px;
+  :global {
+    .A3aMain {
+      width: 100%;
+      height: 100%;
+      overflow-y: auto;
+
+      textarea {
+        min-height: 75px !important;
+      }
+
+      .A3fromRow {
+        position: relative;
+        width: 800px;
+
+        .A3_6Frow {
+          position: absolute;
+          left: 200px;
+          top: 5px;
+          color: #999;
+          font-size: 12px;
+        }
+      }
+
+      .ant-form {
+        width: 800px;
+
+        // .ant-input-affix-wrapper{
+        //   width: 800px;
+        // }
+        .formRow {
+          display: flex;
+
+          .formLeft {
+            position: relative;
+            top: 3px;
+            width: 100px;
+            text-align: right;
+
+            & > span {
+              color: #ff4d4f;
+            }
+          }
+
+          .formRight {
+            width: calc(100% - 100px);
+          }
+        }
+
+        .A3abtn {
+          position: absolute;
+          z-index: 10;
+          left: 1200px;
+          top: 50%;
+          transform: translateY(-50%);
+        }
+      }
+    }
+
+    // 从查看进入
+    .A3aMainLook {
+      // 左边的 label 也不让选中
+      label {
+        pointer-events: none;
+      }
+
+      .ant-picker {
+        pointer-events: none;
+      }
+
+      .ant-checkbox-wrapper {
+        pointer-events: none;
+      }
+
+      .ant-input-number {
+        pointer-events: none;
+      }
+
+      .ant-select {
+        pointer-events: none;
+      }
+
+      .ant-radio-wrapper {
+        pointer-events: none;
+      }
+    }
+  }
+}

+ 240 - 0
后台管理/src/pages/A3course/A3add/index.tsx

@@ -0,0 +1,240 @@
+import React, { useCallback, useEffect, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { A3EditInfoType } from '../type'
+import { Button, Form, FormInstance, Input, InputNumber, Select } from 'antd'
+import classNames from 'classnames'
+import { A3_APIgetInfo, A3_APIgetTypeList, A3_APIsave } from '@/store/action/A3course'
+import TextArea from 'antd/es/input/TextArea'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import ZRichTexts from '@/components/ZRichTexts'
+import { MessageFu } from '@/utils/message'
+
+type Props = {
+  editInfo: A3EditInfoType
+  closeFu: () => void
+  addTableFu: () => void
+  editTableFu: () => void
+}
+
+function A3add({ editInfo, closeFu, addTableFu, editTableFu }: Props) {
+  // 表单的ref
+  const FormBoxRef = useRef<FormInstance>(null)
+
+  // 课程类别数组
+  const [list, setList] = useState<any>([])
+
+  const getListFu = useCallback(async () => {
+    const res = await A3_APIgetTypeList()
+    if (res.code === 0) {
+      const data: any = res.data
+      setList(
+        data.map((v: any) => ({
+          label: v.name,
+          value: v.id
+        }))
+      )
+    }
+  }, [])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  // 富文本的ref
+  const ZRichTextRef1 = useRef<any>(null)
+  const ZRichTextRef2 = useRef<any>(null)
+  const ZRichTextRef3 = useRef<any>(null)
+
+  //  获取详情
+  const getInfoFu = useCallback(async (id: number) => {
+    const res = await A3_APIgetInfo(id)
+    if (res.code === 0) {
+      FormBoxRef.current?.setFieldsValue(res.data)
+      ZRichTextRef1.current?.ritxtShowFu(JSON.parse(res.data.introRtf || '{}'))
+      ZRichTextRef2.current?.ritxtShowFu(JSON.parse(res.data.teamRtf || '{}'))
+      ZRichTextRef3.current?.ritxtShowFu(JSON.parse(res.data.infoRtf || '{}'))
+    }
+  }, [])
+
+  useEffect(() => {
+    if (editInfo.id > 0) getInfoFu(editInfo.id)
+    else
+      FormBoxRef.current?.setFieldsValue({
+        sort: 999
+      })
+  }, [editInfo.id, getInfoFu])
+
+  // 没有通过校验
+  const onFinishFailed = useCallback(() => {}, [])
+
+  //  通过校验点击确定
+  const onFinish = useCallback(
+    async (values: any) => {
+      // 富文本校验不通过
+      const rtf1 = ZRichTextRef1.current?.fatherBtnOkFu() || { flag: true }
+      const rtf2 = ZRichTextRef2.current?.fatherBtnOkFu() || { flag: true }
+      const rtf3 = ZRichTextRef3.current?.fatherBtnOkFu() || { flag: true }
+
+      const obj = {
+        ...values,
+        id: editInfo.id > 0 ? editInfo.id : null,
+        introRtf: rtf1.val,
+        teamRtf: rtf2.val,
+        infoRtf: rtf3.val
+      }
+      const res = await A3_APIsave(obj)
+      if (res.code === 0) {
+        MessageFu.success(`${editInfo.txt}成功!`)
+        editInfo.id > 0 ? editTableFu() : addTableFu()
+        closeFu()
+      }
+    },
+    [addTableFu, closeFu, editInfo.id, editInfo.txt, editTableFu]
+  )
+
+  return (
+    <div className={styles.A3add}>
+      <div className={classNames('A3aMain', editInfo.txt === '查看' ? 'A3aMainLook' : '')}>
+        <Form
+          ref={FormBoxRef}
+          name='basic'
+          labelCol={{ span: 3 }}
+          onFinish={onFinish}
+          onFinishFailed={onFinishFailed}
+          autoComplete='off'
+          scrollToFirstError
+        >
+          <Form.Item
+            label='课程类别'
+            name='dictTypeId'
+            rules={[{ required: true, message: '请选择课程类别!' }]}
+          >
+            <Select allowClear placeholder='请选择' style={{ width: 200 }} options={list} />
+          </Form.Item>
+
+          <Form.Item
+            label='课程名称'
+            name='name'
+            rules={[{ required: true, message: '请输入课程名称!' }]}
+            getValueFromEvent={e => e.target.value.trim()}
+          >
+            <Input
+              readOnly={editInfo.txt === '查看'}
+              placeholder='请输入内容'
+              maxLength={20}
+              showCount
+            />
+          </Form.Item>
+
+          <Form.Item label='课堂简介' name='intro'>
+            <TextArea
+              readOnly={editInfo.txt === '查看'}
+              maxLength={100}
+              showCount
+              placeholder='请输入内容概要'
+            />
+          </Form.Item>
+
+          <div className='formRow'>
+            <div className='formLeft'></div>
+            <div className='formRight'>
+              <ZRichTexts
+                check={false}
+                dirCode={'A2xuZhiText'}
+                isLook={editInfo.txt === '查看'}
+                ref={ZRichTextRef1}
+                myUrl='cms/subject/upload'
+                isOne={true}
+                upAudioBtnNone={true}
+                otherArr={[{ key: 'moduleName', value: 'apply' }]}
+              />
+            </div>
+          </div>
+
+          <Form.Item label='授课团队' name='team'>
+            <TextArea
+              readOnly={editInfo.txt === '查看'}
+              maxLength={100}
+              showCount
+              placeholder='请输入内容概要'
+            />
+          </Form.Item>
+
+          <div className='formRow'>
+            <div className='formLeft'></div>
+            <div className='formRight'>
+              <ZRichTexts
+                check={false}
+                dirCode={'A2xuZhiText'}
+                isLook={editInfo.txt === '查看'}
+                ref={ZRichTextRef2}
+                myUrl='cms/subject/upload'
+                isOne={true}
+                upAudioBtnNone={true}
+                otherArr={[{ key: 'moduleName', value: 'apply' }]}
+              />
+            </div>
+          </div>
+
+          <Form.Item label='预约须知' name='info'>
+            <TextArea
+              readOnly={editInfo.txt === '查看'}
+              maxLength={100}
+              showCount
+              placeholder='请输入内容概要'
+            />
+          </Form.Item>
+
+          <div className='formRow'>
+            <div className='formLeft'></div>
+            <div className='formRight'>
+              <ZRichTexts
+                check={false}
+                dirCode={'A2xuZhiText'}
+                isLook={editInfo.txt === '查看'}
+                ref={ZRichTextRef3}
+                myUrl='cms/subject/upload'
+                isOne={true}
+                upAudioBtnNone={true}
+                otherArr={[{ key: 'moduleName', value: 'apply' }]}
+              />
+            </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' hidden={editInfo.txt === '查看'}>
+              请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
+            </div>
+          </div>
+
+          {/* 确定和取消按钮 */}
+          <Form.Item className='A3abtn'>
+            {editInfo.txt === '查看' ? (
+              <Button onClick={closeFu}>返回</Button>
+            ) : (
+              <>
+                <Button type='primary' htmlType='submit'>
+                  提交
+                </Button>
+                <br />
+                <br />
+                <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+              </>
+            )}
+          </Form.Item>
+        </Form>
+      </div>
+    </div>
+  )
+}
+
+const MemoA3add = React.memo(A3add)
+
+export default MemoA3add

+ 99 - 0
后台管理/src/pages/A3course/A3typeTable/A3typeAdd.tsx

@@ -0,0 +1,99 @@
+import React, { useCallback, useEffect, useRef } from 'react'
+import styles from './index.module.scss'
+import { Button, Form, FormInstance, Input, InputNumber, Modal } from 'antd'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { A3_APItypeSave } from '@/store/action/A3course'
+import { MessageFu } from '@/utils/message'
+
+type Props = {
+  info: { id: number; name: string; sort: number }
+  closeFu: () => void
+  editTableFu: () => void
+}
+
+function A3typeAdd({ info, closeFu, editTableFu }: Props) {
+  // 表单的ref
+  const FormBoxRef = useRef<FormInstance>(null)
+
+  useEffect(() => {
+    FormBoxRef.current?.setFieldsValue(info)
+  }, [info])
+
+  // 没有通过校验
+  const onFinishFailed = useCallback(() => {}, [])
+
+  //  通过校验点击确定
+  const onFinish = useCallback(
+    async (values: any) => {
+      const obj = {
+        ...values,
+        id: info.id > 0 ? info.id : null,
+        display: 1
+      }
+
+      const res = await A3_APItypeSave(obj)
+      if (res.code === 0) {
+        MessageFu.success(info.id > 0 ? '编辑成功!' : '新增成功!')
+        editTableFu()
+        closeFu()
+      }
+    },
+    [closeFu, editTableFu, info.id]
+  )
+
+  return (
+    <Modal
+      wrapClassName={styles.A3typeAdd}
+      open={true}
+      title={info.id > 0 ? '编辑' : '新增'}
+      footer={
+        [] // 设置footer为空,去掉 取消 确定默认按钮
+      }
+    >
+      <Form
+        ref={FormBoxRef}
+        name='basic'
+        labelCol={{ span: 4 }}
+        onFinish={onFinish}
+        onFinishFailed={onFinishFailed}
+        autoComplete='off'
+        scrollToFirstError
+      >
+        <Form.Item
+          label='课程类别名称'
+          name='name'
+          rules={[{ required: true, message: '请输入课程类别名称!' }]}
+          getValueFromEvent={e => e.target.value.replace(/\s+/g, '')}
+        >
+          <Input placeholder='请输入内容' maxLength={10} showCount />
+        </Form.Item>
+
+        <div className='A3TAfromRow'>
+          <Form.Item
+            label='排序值'
+            name='sort'
+            rules={[{ required: true, message: '请输入排序值!' }]}
+          >
+            <InputNumber min={1} max={999} precision={0} placeholder='请输入' />
+          </Form.Item>
+          <div className='A3TA_6Frow'>
+            请输入1~999的数字。数字越小,排序越靠前。数字相同时,更新发布的内容排在前面
+          </div>
+        </div>
+
+        {/* 确定和取消按钮 */}
+        <Form.Item className='A3TAbtn'>
+          <Button type='primary' htmlType='submit'>
+            提交
+          </Button>
+          &emsp;
+          <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+        </Form.Item>
+      </Form>
+    </Modal>
+  )
+}
+
+const MemoA3typeAdd = React.memo(A3typeAdd)
+
+export default MemoA3typeAdd

+ 54 - 0
后台管理/src/pages/A3course/A3typeTable/index.module.scss

@@ -0,0 +1,54 @@
+.A3typeTable {
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 24px;
+  :global {
+    .A3Ttop {
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      margin-bottom: 15px;
+      .A3TtopTit {
+        font-size: 18px;
+        font-weight: 700;
+        color: var(--themeColor);
+      }
+    }
+  }
+}
+
+// 新增/编辑
+.A3typeAdd {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+    .ant-modal {
+      width: 800px !important;
+    }
+    .ant-modal-body {
+      border-top: 1px solid #ccc;
+      padding-top: 25px !important;
+
+      .A3TAfromRow {
+        position: relative;
+        width: 752px;
+
+        .A3TA_6Frow {
+          position: absolute;
+          left: 220px;
+          top: 5px;
+          color: #999;
+          font-size: 12px;
+        }
+      }
+
+      .A3TAbtn {
+        margin-top: 24px;
+        text-align: center;
+      }
+    }
+  }
+}

+ 121 - 0
后台管理/src/pages/A3course/A3typeTable/index.tsx

@@ -0,0 +1,121 @@
+import React, { useCallback, useEffect, useMemo, useState } from 'react'
+import styles from './index.module.scss'
+import { Button } from 'antd'
+import MyTable from '@/components/MyTable'
+import { A3_APIgetTypeList, A3_APItypeDel } from '@/store/action/A3course'
+import { A3typeTableType } from '../type'
+import { A3tableCtype } from '@/utils/tableData'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { MessageFu } from '@/utils/message'
+import A3typeAdd from './A3typeAdd'
+
+type Props = {
+  closeFu: () => void
+}
+
+function A3typeTable({ closeFu }: Props) {
+  const [list, setList] = useState<A3typeTableType[]>([])
+
+  const getListFu = useCallback(async () => {
+    const res = await A3_APIgetTypeList()
+    if (res.code === 0) {
+      const data: A3typeTableType[] = res.data
+      setList(
+        data.map(v => ({
+          ...v,
+          sort: v.id === 1 || v.name === '未分类' ? '/' : v.sort
+        }))
+      )
+    }
+  }, [])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await A3_APItypeDel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: A3typeTableType) =>
+          item.id === 1 || item.name === '未分类' ? (
+            '/'
+          ) : (
+            <>
+              <Button
+                size='small'
+                type='text'
+                onClick={() => setEditInfo({ id: item.id, name: item.name, sort: item.sort })}
+              >
+                编辑
+              </Button>
+
+              <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+            </>
+          )
+      }
+    ]
+  }, [delTableFu])
+
+  //新增、编辑
+  const [editInfo, setEditInfo] = useState({
+    id: 0,
+    name: '',
+    sort: 0
+  })
+  return (
+    <div className={styles.A3typeTable}>
+      <div className='A3Ttop'>
+        <div>
+          <span className='A3TtopTit'>类别设置</span>&emsp;未分类的课程不会展示在用户端
+        </div>
+        <div>
+          <Button
+            type='primary'
+            onClick={() => {
+              if (list.length >= 20) return MessageFu.warning('最多支持20条数据!')
+              setEditInfo({ id: -1, name: '', sort: 999 })
+            }}
+          >
+            新增
+          </Button>
+          &emsp;
+          <Button onClick={closeFu}>关闭</Button>
+        </div>
+      </div>
+
+      <MyTable
+        classKey='A3Ttable'
+        yHeight={600}
+        list={list}
+        columnsTemp={A3tableCtype}
+        lastBtn={tableLastBtn}
+        pagingInfo={false}
+      />
+
+      {/* 新增 / 编辑*/}
+      {editInfo.id ? (
+        <A3typeAdd
+          info={editInfo}
+          closeFu={() => setEditInfo({ id: 0, name: '', sort: 0 })}
+          editTableFu={getListFu}
+        ></A3typeAdd>
+      ) : null}
+    </div>
+  )
+}
+
+const MemoA3typeTable = React.memo(A3typeTable)
+
+export default MemoA3typeTable

+ 22 - 0
后台管理/src/pages/A3course/index.module.scss

@@ -1,4 +1,26 @@
 .A3course {
 .A3course {
+  position: relative;
+  border-radius: 10px;
+  background-color: #fff;
   :global {
   :global {
+    .A3top {
+      padding: 15px 24px;
+      text-align: end;
+    }
+    .A3main {
+      border-radius: 10px;
+      overflow: hidden;
+      height: calc(100% - 67px);
+    }
+    .A3tanBox {
+      position: absolute;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: 100%;
+      padding: 50px;
+      background-color: rgba(0, 0, 0, 0.6);
+      border-radius: 10px;
+    }
   }
   }
 }
 }

+ 120 - 2
后台管理/src/pages/A3course/index.tsx

@@ -1,9 +1,127 @@
-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 { A3EditInfoType, A3tableType } from './type'
+import { Button } from 'antd'
+import { useDispatch, useSelector } from 'react-redux'
+import { A3_APIdel, A3_APIgetList } from '@/store/action/A3course'
+import MyTable from '@/components/MyTable'
+import { RootState } from '@/store'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { MessageFu } from '@/utils/message'
+import { A3tableC } from '@/utils/tableData'
+import A3typeTable from './A3typeTable'
+import A3add from './A3add'
 function A3course() {
 function A3course() {
+  const dispatch = useDispatch()
+
+  const [fromData, setFromData] = useState({ pageNum: 1, pageSize: 10 })
+
+  const getListFu = useCallback(() => {
+    dispatch(A3_APIgetList(fromData))
+  }, [dispatch, fromData])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  const tableInfo = useSelector((state: RootState) => state.A3course.tableInfo)
+
+  const delTableFu = useCallback(
+    async (id: number) => {
+      const res = await A3_APIdel(id)
+      if (res.code === 0) {
+        MessageFu.success('删除成功!')
+        getListFu()
+      }
+    },
+    [getListFu]
+  )
+
+  const tableLastBtn = useMemo(() => {
+    return [
+      {
+        title: '操作',
+        render: (item: A3tableType) => (
+          <>
+            <Button
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '查看' })}
+            >
+              查看
+            </Button>
+            <Button
+              size='small'
+              type='text'
+              onClick={() => setEditInfo({ id: item.id, txt: '编辑' })}
+            >
+              编辑
+            </Button>
+
+            <MyPopconfirm txtK='删除' onConfirm={() => delTableFu(item.id)} />
+          </>
+        )
+      }
+    ]
+  }, [delTableFu])
+
+  // 类别设置
+  const [typeShow, setTypeShow] = useState(false)
+
+  //查看、新增、编辑
+  const [editInfo, setEditInfo] = useState<A3EditInfoType>({
+    id: 0,
+    txt: ''
+  })
+
   return (
   return (
     <div className={styles.A3course}>
     <div className={styles.A3course}>
-      <h1>A3course</h1>
+      <div className='pageTitle'>课程管理 {editInfo.id ? ` - ${editInfo.txt}` : ''}</div>
+
+      <div className='A3top'>
+        <Button type='primary' onClick={() => setTypeShow(true)}>
+          类别设置
+        </Button>
+        &emsp;
+        <Button type='primary' onClick={() => setEditInfo({ id: -1, txt: '新增' })}>
+          新增
+        </Button>
+      </div>
+
+      <div className='A3main'>
+        <MyTable
+          yHeight={640}
+          list={tableInfo.list}
+          columnsTemp={A3tableC}
+          lastBtn={tableLastBtn}
+          pageNum={fromData.pageNum}
+          pageSize={fromData.pageSize}
+          total={tableInfo.total}
+          onChange={(pageNum, pageSize) => setFromData({ ...fromData, pageNum, pageSize })}
+        />
+      </div>
+
+      {/* 类别设置 */}
+      {typeShow ? (
+        <div className='A3tanBox'>
+          <A3typeTable
+            closeFu={() => {
+              setTypeShow(false)
+              getListFu()
+            }}
+          />
+        </div>
+      ) : null}
+
+      {/* 新增 / 编辑 / 查看 */}
+      {editInfo.id ? (
+        <A3add
+          editInfo={editInfo}
+          closeFu={() => setEditInfo({ id: 0, txt: '新增' })}
+          addTableFu={() => setFromData({ pageNum: 1, pageSize: 10 })}
+          editTableFu={getListFu}
+        ></A3add>
+      ) : null}
     </div>
     </div>
   )
   )
 }
 }

+ 31 - 0
后台管理/src/pages/A3course/type.d.ts

@@ -0,0 +1,31 @@
+export type A3EditInfoType = {
+  id: number
+  txt: '新增' | '编辑' | '查看' | ''
+  info?: A1tableType
+}
+
+export type A3tableType = {
+  creatorName: string
+  dictTypeName: string
+  id: number
+  info: string
+  infoRtf: string
+  intro: string
+  introRtf: string
+  name: string
+  sort: number
+  team: string
+  teamRtf: string
+  updateTime?: any
+}
+
+export type A3typeTableType = {
+  createTime: string
+  creatorName: string
+  id: number
+  name: string
+  rtf: string
+  sort: any
+  type: string
+  updateTime: string
+}

+ 0 - 1
后台管理/src/pages/B1exhibit/index.tsx

@@ -7,7 +7,6 @@ import { RootState } from '@/store'
 import { B1_APIgetList } from '@/store/action/B1exhibit'
 import { B1_APIgetList } from '@/store/action/B1exhibit'
 import { B1tableC } from '@/utils/tableData'
 import { B1tableC } from '@/utils/tableData'
 import B1edit from './B1edit'
 import B1edit from './B1edit'
-import { A2NolistType } from '../A2orderSet/type'
 import { A2_APIgetConfig, A2_APIsetConfig } from '@/store/action/A2orderSet'
 import { A2_APIgetConfig, A2_APIsetConfig } from '@/store/action/A2orderSet'
 import { MessageFu } from '@/utils/message'
 import { MessageFu } from '@/utils/message'
 import A2NoTime from '../A2orderSet/A2NoTime'
 import A2NoTime from '../A2orderSet/A2NoTime'

+ 1 - 1
后台管理/src/pages/Layout/data.ts

@@ -20,7 +20,7 @@ const tabLeftArr: RouterType = [
       },
       },
       {
       {
         id: 103,
         id: 103,
-        name: '课程设置',
+        name: '课程管理',
         path: '/course',
         path: '/course',
         Com: React.lazy(() => import('../A3course'))
         Com: React.lazy(() => import('../A3course'))
       },
       },

+ 61 - 0
后台管理/src/store/action/A3course.ts

@@ -0,0 +1,61 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+
+/**
+ *课程管理-列表
+ */
+
+export const A3_APIgetList = (data: any): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.post('cms/subject/pageList', data)
+    if (res.code === 0) {
+      const obj = {
+        list: res.data.records,
+        total: res.data.total
+      }
+      dispatch({ type: 'A3/getList', payload: obj })
+    }
+  }
+}
+
+/**
+ * 课程管理-详情
+ */
+export const A3_APIgetInfo = (id: number) => {
+  return http.get(`cms/subject/detail/${id}`)
+}
+
+/**
+ * 课程管理-删除
+ */
+export const A3_APIdel = (id: number) => {
+  return http.get(`cms/subject/removes/${id}`)
+}
+
+/**
+ * 课程管理-新增、修改
+ */
+export const A3_APIsave = (data: any) => {
+  return http.post('cms/subject/save', data)
+}
+
+/**
+ * 课程管理-类别设置-列表
+ */
+export const A3_APIgetTypeList = () => {
+  return http.get('cms/dict/getList?type=subject')
+}
+
+/**
+ * 课程管理-类别设置-删除
+ */
+export const A3_APItypeDel = (id: number) => {
+  return http.get(`cms/dict/removes/${id}`)
+}
+
+/**
+ * 课程管理-类别设置-新增、修改
+ */
+export const A3_APItypeSave = (data: any) => {
+  return http.post('cms/dict/save', { ...data, type: 'subject' })
+}

+ 28 - 0
后台管理/src/store/reducer/A3course.ts

@@ -0,0 +1,28 @@
+import { A3tableType } from '@/pages/A3course/type'
+
+// 初始化状态
+const initState = {
+  // 列表数据
+  tableInfo: {
+    list: [] as A3tableType[],
+    total: 0
+  }
+}
+
+// 定义 action 类型
+type Props = {
+  type: 'A3/getList'
+  payload: { list: A3tableType[]; total: number }
+}
+
+// reducer
+export default function Reducer(state = initState, action: Props) {
+  switch (action.type) {
+    // 获取列表数据
+    case 'A3/getList':
+      return { ...state, tableInfo: action.payload }
+
+    default:
+      return state
+  }
+}

+ 2 - 0
后台管理/src/store/reducer/index.ts

@@ -3,6 +3,7 @@ import { combineReducers } from 'redux'
 
 
 // 导入 登录 模块的 reducer
 // 导入 登录 模块的 reducer
 import A0Layout from './layout'
 import A0Layout from './layout'
+import A3course from './A3course'
 import B1exhibit from './B1exhibit'
 import B1exhibit from './B1exhibit'
 import Z1user from './Z1user'
 import Z1user from './Z1user'
 import Z2log from './Z2log'
 import Z2log from './Z2log'
@@ -10,6 +11,7 @@ import Z2log from './Z2log'
 // 合并 reducer
 // 合并 reducer
 const rootReducer = combineReducers({
 const rootReducer = combineReducers({
   A0Layout,
   A0Layout,
+  A3course,
   B1exhibit,
   B1exhibit,
   Z1user,
   Z1user,
   Z2log
   Z2log

+ 11 - 0
后台管理/src/utils/tableData.ts

@@ -25,6 +25,17 @@ export const B1tableC = [
   ['txt', '周日', 'sunday']
   ['txt', '周日', 'sunday']
 ]
 ]
 
 
+export const A3tableC = [
+  ['txt', '课程类别', 'dictTypeName'],
+  ['txt', '课程名称', 'name'],
+  ['txt', '排序值', 'sort']
+]
+
+export const A3tableCtype = [
+  ['txt', '课程类别名称', 'name'],
+  ['txt', '排序值', 'sort']
+]
+
 export const Z1tableC = [
 export const Z1tableC = [
   ['txt', '用户名', 'userName'],
   ['txt', '用户名', 'userName'],
   ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],
   ['txtChange', '角色', 'isAdmin', { 1: '管理员', 0: '普通成员' }],