shaogen1995 8 mesi fa
parent
commit
dc488f8391

+ 2 - 2
后台管理/src/pages/A2orderSet/A2EMail.tsx

@@ -16,7 +16,7 @@ function A2EMail({ closeFu }: Props) {
 
   // 获取设置
   const getEMfu = useCallback(async () => {
-    const res = await A2_APIgetConfig(12)
+    const res = await A2_APIgetConfig('cms/book/config/get', 12)
     if (res.code === 0) {
       FormBoxRef.current?.setFieldsValue({ rtf: res.data.rtf })
     }
@@ -32,7 +32,7 @@ function A2EMail({ closeFu }: Props) {
   //  通过校验点击确定
   const onFinish = useCallback(
     async (values: { rtf: string }) => {
-      const res = await A2_APIsetConfig({ id: 12, rtf: values.rtf || '' })
+      const res = await A2_APIsetConfig('cms/book/config/edit', { id: 12, rtf: values.rtf || '' })
       if (res.code === 0) {
         MessageFu.success('设置邮箱地址成功!')
         closeFu()

+ 18 - 14
后台管理/src/pages/A2orderSet/A2NoTime.tsx

@@ -1,17 +1,18 @@
 import React, { useCallback, useEffect, useState } from 'react'
 import styles from './index.module.scss'
-import { Button, DatePicker, DatePickerProps, Modal } from 'antd'
+import { Button, DatePicker, Modal } from 'antd'
 import MyPopconfirm from '@/components/MyPopconfirm'
-import dayjs, { Dayjs } from 'dayjs'
+import dayjs from 'dayjs'
 import { MessageFu } from '@/utils/message'
 
 type Props = {
   closeFu: () => void
   editFu: (val: string[] | null) => void
   baseTime: string
+  num: 20 | 50
 }
 
-function A2NoTime({ baseTime, closeFu, editFu }: Props) {
+function A2NoTime({ baseTime, closeFu, editFu, num }: Props) {
   const [value, setValue] = useState<null | string[]>(null)
 
   useEffect(() => {
@@ -21,16 +22,19 @@ function A2NoTime({ baseTime, closeFu, editFu }: Props) {
     }
   }, [baseTime])
 
-  const onChange: DatePickerProps<Dayjs[]>['onChange'] = (date, dateString) => {
-    if (date && dateString.length) {
-      let arr = dateString as string[]
-      if (arr.length > 50) {
-        arr = arr.filter((c, i) => i < 50)
-        MessageFu.warning('最多50个日期,已过滤超出日期')
-      }
-      setValue(arr.map(v => v.replaceAll('月', '-').replaceAll('日', '')))
-    } else setValue(null)
-  }
+  const onChange = useCallback(
+    (date: any, dateString: any) => {
+      if (date && dateString.length) {
+        let arr = dateString as string[]
+        if (arr.length > num) {
+          arr = arr.filter((c, i) => i < num)
+          MessageFu.warning(`最多${num}个日期,已过滤超出日期`)
+        }
+        setValue(arr.map(v => v.replaceAll('月', '-').replaceAll('日', '')))
+      } else setValue(null)
+    },
+    [num]
+  )
 
   const disabledDate = useCallback((time: any) => {
     return dayjs().year() !== time.year()
@@ -45,7 +49,7 @@ function A2NoTime({ baseTime, closeFu, editFu }: Props) {
         [] // 设置footer为空,去掉 取消 确定默认按钮
       }
     >
-      <div className='A2NoTit'>请选择日期,最多50个</div>
+      <div className='A2NoTit'>请选择日期,最多{num}个</div>
       <DatePicker
         multiple
         onChange={onChange}

+ 5 - 2
后台管理/src/pages/A2orderSet/A2template.tsx

@@ -16,7 +16,7 @@ function A2template({ closeFu }: Props) {
 
   // 获取设置
   const getEMfu = useCallback(async () => {
-    const res = await A2_APIgetConfig(13)
+    const res = await A2_APIgetConfig('cms/book/config/get', 13)
     if (res.code === 0) {
       // 设置附件
       const info = JSON.parse(res.data.rtf || '{}')
@@ -40,7 +40,10 @@ function A2template({ closeFu }: Props) {
     fileName = ZupTxtRefObj.fileName
     filePath = ZupTxtRefObj.filePath
 
-    const res = await A2_APIsetConfig({ id: 13, rtf: JSON.stringify({ fileName, filePath }) })
+    const res = await A2_APIsetConfig('cms/book/config/edit', {
+      id: 13,
+      rtf: JSON.stringify({ fileName, filePath })
+    })
     if (res.code === 0) {
       MessageFu.success('设置预约单模板成功!')
       closeFu()

+ 9 - 5
后台管理/src/pages/A2orderSet/A2xuZhi.tsx

@@ -5,23 +5,27 @@ import MyPopconfirm from '@/components/MyPopconfirm'
 import ZRichTexts from '@/components/ZRichTexts'
 import { A2_APIgetConfig, A2_APIsetConfig } from '@/store/action/A2orderSet'
 import { MessageFu } from '@/utils/message'
+import { A2getConfigType, A2NolistIdType, A2setConfigType } from './type'
 
 type Props = {
   closeFu: () => void
+  getSrc: A2getConfigType
+  setSrc: A2setConfigType
+  sId: A2NolistIdType
 }
 
-function A2xuZhi({ closeFu }: Props) {
+function A2xuZhi({ closeFu, getSrc, setSrc, sId }: Props) {
   // 富文本的ref
   const ZRichTextRef = useRef<any>(null)
 
   // 获取设置
   const getEMfu = useCallback(async () => {
-    const res = await A2_APIgetConfig(11)
+    const res = await A2_APIgetConfig(getSrc, sId)
     if (res.code === 0) {
       // 设置富文本
       ZRichTextRef.current?.ritxtShowFu(JSON.parse(res.data.rtf || '{}'))
     }
-  }, [])
+  }, [getSrc, sId])
 
   useEffect(() => {
     getEMfu()
@@ -32,13 +36,13 @@ function A2xuZhi({ closeFu }: Props) {
     // 富文本校验不通过
     const rtf = ZRichTextRef.current?.fatherBtnOkFu() || { flag: true }
 
-    const res = await A2_APIsetConfig({ id: 11, rtf: rtf.val || '' })
+    const res = await A2_APIsetConfig(setSrc, { id: sId, rtf: rtf.val || '' })
 
     if (res.code === 0) {
       MessageFu.success('设置预约须知成功!')
       closeFu()
     }
-  }, [closeFu])
+  }, [closeFu, sId, setSrc])
 
   return (
     <Modal

+ 16 - 4
后台管理/src/pages/A2orderSet/index.tsx

@@ -89,7 +89,7 @@ function A2orderSet() {
   const [noList, setNoList] = useState<A2NolistType[]>([])
 
   const getNoListFu = useCallback(async () => {
-    const res = await A2_APIgetConfig(10)
+    const res = await A2_APIgetConfig('cms/book/config/get', 10)
     if (res.code === 0) {
       setNoList([{ id: '不可预约id', time: res.data.rtf }])
     }
@@ -129,7 +129,7 @@ function A2orderSet() {
         str = arr.join(',')
       }
 
-      const res = await A2_APIsetConfig({ id: 10, rtf: str })
+      const res = await A2_APIsetConfig('cms/book/config/edit', { id: 10, rtf: str })
       if (res.code === 0) {
         MessageFu.success('设置不可预约日期成功!')
         getNoListFu()
@@ -182,14 +182,26 @@ function A2orderSet() {
 
       {/* 不可预约日期设置 */}
       {noTxt ? (
-        <A2NoTime baseTime={noTxt} editFu={val => A2NoBtn(val)} closeFu={() => setNoTxt('')} />
+        <A2NoTime
+          num={50}
+          baseTime={noTxt}
+          editFu={val => A2NoBtn(val)}
+          closeFu={() => setNoTxt('')}
+        />
       ) : null}
 
       {/* 邮箱设置 */}
       {emShow ? <A2EMail closeFu={() => setEmShow(false)} /> : null}
 
       {/*预约须知 */}
-      {xuZhi ? <A2xuZhi closeFu={() => setXuZhi(false)} /> : null}
+      {xuZhi ? (
+        <A2xuZhi
+          setSrc='cms/book/config/edit'
+          getSrc='cms/book/config/get'
+          sId={11}
+          closeFu={() => setXuZhi(false)}
+        />
+      ) : null}
 
       {/*预约单模板设置 */}
       {template ? <A2template closeFu={() => setTemplate(false)} /> : null}

+ 5 - 1
后台管理/src/pages/A2orderSet/type.d.ts

@@ -17,4 +17,8 @@ export type A2listType = {
 
 export type A2NolistType = { id: string; time: string }
 
-export type A2NolistIdType = 10 | 11 | 12 | 13
+export type A2NolistIdType = 10 | 11 | 12 | 13 | 15 | 16
+
+export type A2setConfigType = 'cms/book/config/edit' | 'cms/configExhibition/setConfig'
+
+export type A2getConfigType = 'cms/book/config/get' | 'cms/configExhibition/getConfig'

+ 86 - 0
后台管理/src/pages/B1exhibit/B1edit/index.module.scss

@@ -0,0 +1,86 @@
+.B1edit {
+  position: absolute;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 24px;
+  display: flex;
+
+  :global {
+    .B1ell {
+      width: 100px;
+      margin-right: 20px;
+    }
+
+    .B1err {
+      width: calc(100% - 260px);
+
+      .B1ett1 {
+        position: relative;
+
+        .anticon-delete {
+          position: absolute;
+          top: 50%;
+          transform: translateY(-50%);
+          left: -90px;
+          cursor: pointer;
+          font-size: 18px;
+          &:hover {
+            color: var(--themeColor);
+          }
+        }
+      }
+
+      .B1ett {
+        display: inline-block;
+        width: 100%;
+        text-align: center;
+        cursor: pointer;
+        text-decoration: underline;
+        &:hover {
+          color: var(--themeColor);
+        }
+      }
+    }
+
+    .B1eBtn {
+      position: absolute;
+      top: 50%;
+      transform: translateY(-50%);
+      right: 50px;
+    }
+  }
+}
+
+// 时段选择
+.B1eMBox {
+  :global {
+    .ant-modal-close {
+      display: none;
+    }
+
+    .ant-modal {
+      width: 500px !important;
+    }
+
+    .ant-modal-body {
+      border-top: 1px solid #ccc;
+    }
+
+    .B1eMmain {
+      padding-top: 15px;
+      text-align: center;
+      .B1eMmainTit {
+        margin-top: 10px;
+      }
+    }
+
+    .B1eMbtn {
+      margin-top: 24px;
+      text-align: center;
+    }
+  }
+}

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

@@ -0,0 +1,287 @@
+import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'
+import styles from './index.module.scss'
+import { Button, Input, Modal, Table, TimePicker } from 'antd'
+import dayjs from 'dayjs'
+import { DeleteOutlined } from '@ant-design/icons'
+import MyPopconfirm from '@/components/MyPopconfirm'
+import { MessageFu } from '@/utils/message'
+import { B1eTableDataKeyType, B1tableType } from '../type'
+import { B1eTableData } from '../data'
+import { B1_APIdel, B1_APIsave } from '@/store/action/B1exhibit'
+
+type TimeType = {
+  id: string
+  show: boolean
+  value: string[] | null
+  txt: '新增' | '编辑'
+}
+
+type NumType = {
+  id: string
+  show: boolean
+  value: number
+  title: string
+  key: B1eTableDataKeyType
+}
+
+type Props = {
+  list: B1tableType[]
+  closeFu: () => void
+  editTableFu: () => void
+}
+
+function B1edit({ list, closeFu, editTableFu }: Props) {
+  // 表格数据
+  const [listRes, setListRes] = useState<B1tableType[]>([])
+
+  useEffect(() => {
+    setListRes(
+      list.map(v => ({
+        ...v,
+        id: v.id + ''
+      }))
+    )
+  }, [list])
+
+  // 1---------时段
+  const [time, setTime] = useState({} as TimeType)
+
+  // 1---------时段点击确定
+  const timeBtnOk = useCallback(async () => {
+    if (time.txt === '新增') {
+      setListRes([
+        ...listRes,
+        {
+          id: time.id,
+          time: time.value!.join('-'),
+          monday: 100,
+          tuesday: 100,
+          wednesday: 100,
+          thursday: 100,
+          friday: 100,
+          saturday: 100,
+          sunday: 100
+        }
+      ])
+    } else {
+      setListRes(
+        listRes.map(v => ({
+          ...v,
+          time: v.id === time.id ? time.value!.join('-') : v.time
+        }))
+      )
+    }
+
+    MessageFu.success(time.txt + '时段成功!')
+
+    setTime({} as TimeType)
+  }, [listRes, time])
+
+  // 1---------时间段改变
+  const timeChangeFu = useCallback(
+    (value: string[]) => {
+      const valueRes = value[0] && value[1] ? value : null
+      setTime({ ...time, value: valueRes })
+    },
+    [time]
+  )
+
+  // 从后台拿的数据,id里面没有’新‘。删除的时候需要记录下来。最后点击提交的时候一起删除
+  const delIds = useRef<string[]>([])
+
+  // 表格
+  const columns = useMemo(() => {
+    const arr: any = [
+      {
+        title: '时段',
+        render: (item: B1tableType) => (
+          <div className='B1ett1'>
+            <MyPopconfirm
+              txtK='删除'
+              onConfirm={() => {
+                setListRes(listRes.filter(v => v.id !== item.id))
+                if (!item.id.includes('新')) {
+                  delIds.current.push(item.id)
+                }
+              }}
+              Dom={<DeleteOutlined />}
+            />
+
+            <span
+              className='B1ett'
+              onClick={() =>
+                setTime({
+                  show: true,
+                  value: item.time.split('-'),
+                  txt: '编辑',
+                  id: item.id
+                })
+              }
+            >
+              {item.time}
+            </span>
+          </div>
+        )
+      }
+    ]
+
+    B1eTableData.forEach(v => {
+      arr.push({
+        title: v.title,
+        render: (item: B1tableType) => (
+          <span
+            className='B1ett'
+            onClick={() =>
+              setNum({
+                id: item.id,
+                show: true,
+                value: Reflect.get(item, v.key),
+                title: `${item.time} / ${v.title}`,
+                key: v.key
+              })
+            }
+          >
+            {Reflect.get(item, v.key)}
+          </span>
+        )
+      })
+    })
+    return arr
+  }, [listRes])
+
+  // 2---------星期的数字
+  const [num, setNum] = useState({} as NumType)
+
+  const inputChange = useCallback(
+    (val: React.ChangeEvent<HTMLInputElement>) => {
+      let txt = val.target.value.replace(/^(0+)|[^\d]+/g, '')
+      let txtNum = Number(txt)
+      txtNum = txtNum > 9999 ? 9999 : txtNum
+      setNum({ ...num, value: txtNum })
+    },
+    [num]
+  )
+
+  // 2---------提交
+  const numBtnOk = useCallback(() => {
+    setListRes(
+      listRes.map(v => ({
+        ...v,
+        [num.key]: v.id === num.id ? Number(num.value) : Reflect.get(v, num.key)
+      }))
+    )
+    MessageFu.success('编辑可预约人数成功!')
+    setNum({} as NumType)
+  }, [listRes, num])
+
+  // 最后点击提交
+  const btnLastOk = useCallback(async () => {
+    if (delIds.current.length) B1_APIdel(delIds.current.join(','))
+
+    const arr = listRes.map(v => ({
+      ...v,
+      id: v.id.includes('新') ? null : Number(v.id)
+    }))
+    const res = await B1_APIsave(arr)
+    if (res.code === 0) {
+      MessageFu.success('编辑成功!')
+      editTableFu()
+      closeFu()
+    }
+  }, [closeFu, editTableFu, listRes])
+
+  return (
+    <div className={styles.B1edit}>
+      <div className='B1ell'>
+        <Button
+          type='primary'
+          onClick={() => {
+            if (listRes.length >= 10) return MessageFu.warning('最多10个时段!')
+            setTime({
+              show: true,
+              value: null,
+              txt: '新增',
+              id: Date.now() + '新'
+            })
+          }}
+        >
+          新增时段
+        </Button>
+      </div>
+      <div className='B1err'>
+        <Table
+          rowKey='id'
+          size='middle'
+          columns={columns}
+          dataSource={listRes}
+          pagination={false}
+        />
+      </div>
+
+      <div className='B1eBtn'>
+        <Button type='primary' onClick={btnLastOk}>
+          提交
+        </Button>
+        <br />
+        <br />
+        <MyPopconfirm txtK='取消' onConfirm={closeFu} />
+      </div>
+
+      {/* 时间选择 */}
+      <Modal
+        wrapClassName={styles.B1eMBox}
+        open={time.show}
+        title={`${time.txt}时段`}
+        footer={
+          [] // 设置footer为空,去掉 取消 确定默认按钮
+        }
+      >
+        <div className='B1eMmain'>
+          <TimePicker.RangePicker
+            format='HH:mm'
+            value={
+              time.value ? [dayjs(time.value[0], 'HH:mm'), dayjs(time.value[1], 'HH:mm')] : null
+            }
+            onChange={(_, value) => timeChangeFu(value)}
+          />
+        </div>
+        <div className='B1eMbtn'>
+          <Button onClick={() => setTime({} as TimeType)}>取消</Button>&emsp;
+          <Button type='primary' disabled={!time.value} onClick={timeBtnOk}>
+            提交
+          </Button>
+        </div>
+      </Modal>
+
+      {/* 星期的数字改变 */}
+      <Modal
+        wrapClassName={styles.B1eMBox}
+        open={num.show}
+        title={`${num.title} / 可预约人数`}
+        footer={
+          [] // 设置footer为空,去掉 取消 确定默认按钮
+        }
+      >
+        <div className='B1eMmain'>
+          <Input
+            style={{ width: 208 }}
+            // placeholder="请输入0~9999整数"
+            value={num.value}
+            onChange={e => inputChange(e)}
+          />
+          <div className='B1eMmainTit'>&nbsp;&nbsp;为0时,则该时段不可预约(闭馆)</div>
+        </div>
+        <div className='B1eMbtn'>
+          <Button onClick={() => setNum({} as NumType)}>取消</Button>&emsp;
+          <Button type='primary' onClick={numBtnOk}>
+            提交
+          </Button>
+        </div>
+      </Modal>
+    </div>
+  )
+}
+
+const MemoB1edit = React.memo(B1edit)
+
+export default MemoB1edit

+ 35 - 0
后台管理/src/pages/B1exhibit/data.ts

@@ -0,0 +1,35 @@
+import { B1eTableDataKeyType } from './type'
+
+export const B1eTableData: {
+  title: string
+  key: B1eTableDataKeyType
+}[] = [
+  {
+    title: '周一',
+    key: 'monday'
+  },
+  {
+    title: '周二',
+    key: 'tuesday'
+  },
+  {
+    title: '周三',
+    key: 'wednesday'
+  },
+  {
+    title: '周四',
+    key: 'thursday'
+  },
+  {
+    title: '周五',
+    key: 'friday'
+  },
+  {
+    title: '周六',
+    key: 'saturday'
+  },
+  {
+    title: '周日',
+    key: 'sunday'
+  }
+]

+ 11 - 0
后台管理/src/pages/B1exhibit/index.module.scss

@@ -1,4 +1,15 @@
 .B1exhibit {
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+  border-radius: 10px;
+  padding: 15px 24px 0;
+  position: relative;
+
   :global {
+    .B1top {
+      text-align: right;
+      margin-bottom: 15px;
+    }
   }
 }

+ 107 - 2
后台管理/src/pages/B1exhibit/index.tsx

@@ -1,9 +1,114 @@
-import React from 'react'
+import React, { useCallback, useEffect, useRef, useState } from 'react'
 import styles from './index.module.scss'
+import { Button } from 'antd'
+import MyTable from '@/components/MyTable'
+import { useDispatch, useSelector } from 'react-redux'
+import { RootState } from '@/store'
+import { B1_APIgetList } from '@/store/action/B1exhibit'
+import { B1tableC } from '@/utils/tableData'
+import B1edit from './B1edit'
+import { A2NolistType } from '../A2orderSet/type'
+import { A2_APIgetConfig, A2_APIsetConfig } from '@/store/action/A2orderSet'
+import { MessageFu } from '@/utils/message'
+import A2NoTime from '../A2orderSet/A2NoTime'
+import A2xuZhi from '../A2orderSet/A2xuZhi'
 function B1exhibit() {
+  const dispatch = useDispatch()
+
+  const getListFu = useCallback(() => {
+    dispatch(B1_APIgetList())
+  }, [dispatch])
+
+  useEffect(() => {
+    getListFu()
+  }, [getListFu])
+
+  const { list } = useSelector((state: RootState) => state.B1exhibit)
+
+  // 编辑
+  const [edit, setEdit] = useState(false)
+
+  // 1111111111111不可预约日期--------------开始
+  const noListRef = useRef('')
+
+  const getNoListFu = useCallback(async () => {
+    const res = await A2_APIgetConfig('cms/configExhibition/getConfig', 15)
+    if (res.code === 0) {
+      noListRef.current = res.data.rtf
+    }
+  }, [])
+
+  useEffect(() => {
+    getNoListFu()
+  }, [getNoListFu])
+
+  const [noTxt, setNoTxt] = useState('')
+
+  // 点击提交或者取消
+  const A2NoBtn = useCallback(
+    async (val: string[] | null) => {
+      let str = ''
+
+      if (val) {
+        const arr = val.map(v => v.replaceAll('-', '月') + '日')
+        str = arr.join(',')
+      }
+
+      const res = await A2_APIsetConfig('cms/configExhibition/setConfig', { id: 15, rtf: str })
+      if (res.code === 0) {
+        MessageFu.success('设置不可预约日期成功!')
+        getNoListFu()
+        setNoTxt('')
+      }
+    },
+    [getNoListFu]
+  )
+  // 1111111111111不可预约日期--------------结束
+
+  // 2222222222------------- 预约须知---------开始
+  const [xuZhi, setXuZhi] = useState(false)
+  // 2222222222------------- 预约须知---------结束
+
   return (
     <div className={styles.B1exhibit}>
-      <h1>B1exhibit</h1>
+      <div className='pageTitle'>展馆预约设置{edit ? ' - 编辑' : null}</div>
+      <div className='B1top'>
+        <Button type='primary' onClick={() => setNoTxt(noListRef.current || '空')}>
+          设置不可预约日期
+        </Button>
+        &emsp;
+        <Button type='primary' onClick={() => setXuZhi(true)}>
+          设置预约需知
+        </Button>
+        &emsp;
+        <Button type='primary' onClick={() => setEdit(true)}>
+          编辑
+        </Button>
+      </div>
+      <MyTable list={list} columnsTemp={B1tableC} pagingInfo={false} isNull='闭馆' />
+
+      {/* 编辑 */}
+      {edit ? <B1edit list={list} closeFu={() => setEdit(false)} editTableFu={getListFu} /> : null}
+
+      {/* 不可预约日期设置 */}
+      {noTxt ? (
+        <A2NoTime
+          num={20}
+          baseTime={noTxt}
+          editFu={val => A2NoBtn(val)}
+          closeFu={() => setNoTxt('')}
+        />
+      ) : null}
+
+      {/*预约须知 */}
+      {xuZhi ? (
+        <A2xuZhi
+          setSrc='cms/configExhibition/setConfig'
+          getSrc='cms/configExhibition/getConfig'
+          sId={16}
+          closeFu={() => setXuZhi(false)}
+        />
+      ) : null}
     </div>
   )
 }

+ 20 - 0
后台管理/src/pages/B1exhibit/type.d.ts

@@ -0,0 +1,20 @@
+export type B1tableType = {
+  id: string
+  time: string
+  monday: number
+  tuesday: number
+  wednesday: number
+  thursday: number
+  friday: number
+  saturday: number
+  sunday: number
+}
+
+export type B1eTableDataKeyType =
+  | 'monday'
+  | 'tuesday'
+  | 'wednesday'
+  | 'thursday'
+  | 'friday'
+  | 'saturday'
+  | 'sunday'

+ 10 - 7
后台管理/src/store/action/A2orderSet.ts

@@ -1,4 +1,4 @@
-import { A2NolistIdType } from '@/pages/A2orderSet/type'
+import { A2getConfigType, A2NolistIdType, A2setConfigType } from '@/pages/A2orderSet/type'
 import http from '@/utils/http'
 
 /**
@@ -16,15 +16,18 @@ export const A2_APIedit = (data: any) => {
 }
 
 /**
- * 课程预约设置-修改配置项 不可约日期:id=10 | 预约须知:id=11 | 邮箱:id=12 | 预约单模板:id=13, rtf:前端内容; 日期yyyy-MM-dd用逗号分隔
+ * 课程预约设置-修改配置项 不可约日期:id=10 | 预约须知:id=11 | 邮箱:id=12 | 预约单模板:id=13, rtf:前端内容; 日期yyyy-MM-dd用逗号分隔-----15:展馆-不可预约日期 | 16:展馆-预约须知
  */
-export const A2_APIsetConfig = (data: { id: A2NolistIdType; rtf: string }) => {
-  return http.post('cms/book/config/edit', data)
+export const A2_APIsetConfig = (
+  src: A2setConfigType,
+  data: { id: A2NolistIdType; rtf: string }
+) => {
+  return http.post(src, data)
 }
 
 /**
- * 课程预约设置-获取配置 不可约日期:id=10 | 预约须知:id=11 | 邮箱:id=12 | 预约单模板:id=13
+ * 课程预约设置-获取配置 不可约日期:id=10 | 预约须知:id=11 | 邮箱:id=12 | 预约单模板:id=13-----15:展馆-不可预约日期 | 16:展馆-预约须知
  */
-export const A2_APIgetConfig = (id: A2NolistIdType) => {
-  return http.get(`cms/book/config/get/${id}`)
+export const A2_APIgetConfig = (src: A2getConfigType, id: A2NolistIdType) => {
+  return http.get(`${src}/${id}`)
 }

+ 29 - 0
后台管理/src/store/action/B1exhibit.ts

@@ -0,0 +1,29 @@
+import http from '@/utils/http'
+import { AppDispatch } from '..'
+
+/**
+ *展馆预约设置-列表
+ */
+
+export const B1_APIgetList = (): any => {
+  return async (dispatch: AppDispatch) => {
+    const res = await http.get('cms/configExhibition/getList')
+    if (res.code === 0) {
+      dispatch({ type: 'B1/getList', payload: res.data || [] })
+    }
+  }
+}
+
+/**
+ * 展馆预约设置-删除
+ */
+export const B1_APIdel = (ids: string) => {
+  return http.get(`cms/configExhibition/removes/${ids}`)
+}
+
+/**
+ * 展馆预约设置-新增、修改
+ */
+export const B1_APIsave = (data: any) => {
+  return http.post('cms/configExhibition/save', data)
+}

+ 25 - 0
后台管理/src/store/reducer/B1exhibit.ts

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

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

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

+ 9 - 103
后台管理/src/utils/tableData.ts

@@ -14,109 +14,15 @@
 //     ["text", "创建日期",'description', 50,A],
 //   ];
 
-const A1tableCTemp = [
-  ['txt', '书名', 'name'],
-  ['img', '封面', 'thumb'],
-  ['txt', '作者', 'author'],
-  ['txt', '出版社', 'press'],
-  ['txt', '中图法分类', 'storageName'],
-  ['txt', '展示分类', 'exhibitTypeName'],
-  ['txt', 'ISBN编号', 'num'],
-  ['txt', '排序值', 'sort'],
-  ['txt', '编辑人', 'creatorName'],
-  ['txt', '编辑时间', 'updateTime']
-]
-
-export const A1tableC = isBookIdShow ? [['txt', 'bookId', 'id'], ...A1tableCTemp] : A1tableCTemp
-
-export const A1tableCimp = [
-  ['txt', '书名', 'name'],
-  ['img', '封面(png、jpg)', 'thumb', `<span class='tabx'>(待填入)</span>`],
-  ['txt', '作者', 'author'],
-  ['txt', '出版社', 'press'],
-  ['txt', '出版年份', 'year'],
-  ['txt', '中图法分类', 'storageName', `<span class='tabx'>(待填入)</span>`],
-  ['txt', '展示分类', 'exhibitTypeName', `<span class='tabx'>(待填入)</span>`],
-  ['txt', 'ISBN编号', 'num'],
-  ['txt', '排序值', 'sort'],
-  ['txt', '附件(equb格式)', 'fileName', `<span class='tabx'>(待填入)</span>`]
-]
-
-export const A2tableY1 = [
-  ['img', '封面', 'thumb'],
-  ['text', '正文', 'description', 50],
-  ['txt', '排序值', 'sort'],
-  ['txt', '编辑人', 'creatorName'],
-  ['txt', '编辑时间', 'updateTime']
-]
-
-export const A2tableY2 = [
-  ['txt', '标题', 'name'],
-  ['img', '视频封面', 'thumb'],
-  ['text', '简介', 'description', 50],
-  ['txt', '附件', 'fileName'],
-  ['txt', '排序值', 'sort'],
-  ['txt', '编辑人', 'creatorName'],
-  ['txt', '编辑时间', 'updateTime']
-]
-
-export const A2tableC = [
-  ['txt', '分类名称', 'name'],
-  ['txt', '排序值', 'sort'],
-  ['txt', '编辑人', 'creatorName'],
-  ['txt', '编辑时间', 'updateTime']
-]
-
-export const A3tableC = [
-  ['txt', '书名', 'name'],
-  ['img', '封面', 'thumb'],
-  ['txt', '作者', 'author'],
-  ['txt', '出版社', 'press'],
-  ['txt', 'ISBN编号', 'num'],
-  ['txt', '排序值', 'sort'],
-  ['txt', '编辑人', 'creatorName'],
-  ['txt', '编辑时间', 'updateTime']
-]
-
-export const A4tableC = [
-  ['txt', '用户ID', 'openId'],
-  ['txt', '用户昵称', 'nickName'],
-  ['img', '用户头像', 'avatarUrl'],
-  ['txt', '注册时间', 'createTime'],
-  ['txt', '最近登录时间', 'lastLoginTime'],
-  ['txt', '最近登录IP', 'lastIp']
-]
-
-export const A5tableC = [
-  ['txt', '书名', 'name'],
-  ['img', '封面', 'thumb'],
-  ['txt', '作者', 'author'],
-  ['txt', '出版社', 'press'],
-  ['txt', 'ISBN编号', 'num'],
-  ['txt', '提交人', 'wxUserName'],
-  ['txt', '提交时间', 'createTime'],
-  ['txtChange', '审核状态', 'auditStatus', { 0: '待审核', 1: '审核通过', 2: '审核驳回' }],
-  ['text', '审核备注', 'auditDesc', 50]
-]
-
-export const A6tableC = [
-  ['txt', '书名', 'bookName'],
-  ['text', '评论内容', 'content', 50],
-  ['txtChange', '审核状态', 'auditStatus', { 0: '待审核', 1: '审核通过', 2: '审核驳回' }],
-  ['txt', '提交人', 'createBy'],
-  ['txt', '提交时间', 'createTime']
-]
-
-export const A7tableC = [
-  ['txt', '标题', 'name'],
-  ['txt', '公告类型', 'dictName'],
-  ['txt', '排序值', 'sort'],
-  ['txt', '编辑人', 'creatorName']
-]
-
-export const A7tableCtype = [
-  ['txt', '类型名称', 'name'],
-  ['txt', '排序值', 'sort']
+export const B1tableC = [
+  ['txt', '时段', 'time'],
+  ['txt', '周一', 'monday'],
+  ['txt', '周二', 'tuesday'],
+  ['txt', '周三', 'wednesday'],
+  ['txt', '周四', 'thursday'],
+  ['txt', '周五', 'friday'],
+  ['txt', '周六', 'saturday'],
+  ['txt', '周日', 'sunday']
 ]
 
 export const Z1tableC = [