|
@@ -1,6 +1,6 @@
|
|
|
import { Modal, Form, Select, Input, Radio } from 'antd'
|
|
|
import { forwardRef, useImperativeHandle, useState } from 'react'
|
|
|
-import { adTypes } from '../../const'
|
|
|
+import adTypeState from '@src/store/globalStates/adTypeState'
|
|
|
import styles from './index.module.css'
|
|
|
import type { RowDataType } from '../ContentTable/types'
|
|
|
import type {
|
|
@@ -9,9 +9,8 @@ import type {
|
|
|
} from './types'
|
|
|
|
|
|
const { Item, useForm } = Form
|
|
|
-const adTypesOptions:RadioOptionsType = Object.entries(adTypes).map(([value,label])=>({value: +value,label}))
|
|
|
const initialValues = {
|
|
|
- unionAdPosition: 0, // 广告类型
|
|
|
+ unionAdPosition: 0, // 广告位类型
|
|
|
}
|
|
|
|
|
|
const CreateModal = forwardRef(({ allAppList, onCreate, onUpdate }:PropsType, ref) => {
|
|
@@ -20,8 +19,10 @@ const CreateModal = forwardRef(({ allAppList, onCreate, onUpdate }:PropsType, re
|
|
|
const [form] = useForm()
|
|
|
const [editRow, setEditRow] = useState<RowDataType>()
|
|
|
const isEdit = action === 'edit'
|
|
|
- const title = isEdit ? '编辑广告' : '新建广告'
|
|
|
+ const title = isEdit ? '编辑广告位' : '新建广告位'
|
|
|
const allAppOptions:OptionsItemType[] = allAppList.map(({id, unionAppName})=>({label:unionAppName, value:id}))
|
|
|
+ const adTypes = adTypeState.useGlobalState()
|
|
|
+ const adTypesOptions:RadioOptionsType = Object.entries(adTypes || {}).map(([label,{code}])=>({value: +code,label}))
|
|
|
|
|
|
useImperativeHandle(ref,()=>({
|
|
|
open: (editRow?:RowDataType) => {
|