|
@@ -8,7 +8,7 @@ import type {
|
|
|
OptionsItemType, RadioOptionsType
|
|
|
} from './types'
|
|
|
|
|
|
-const { Item, useForm } = Form
|
|
|
+const { Item, useForm, useWatch } = Form
|
|
|
const initialValues = {
|
|
|
unionAdPosition: 0, // 广告位类型
|
|
|
}
|
|
@@ -22,7 +22,20 @@ const CreateModal = forwardRef(({ allAppList, onCreate, onUpdate }:PropsType, re
|
|
|
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}))
|
|
|
+ const applicationId = useWatch('applicationId', form)
|
|
|
+ const unionAdPosition = useWatch('unionAdPosition', form)
|
|
|
+ const currentApp = allAppList.find(item=>item.id===applicationId)
|
|
|
+ const adTypesOptions:RadioOptionsType = Object.entries(adTypes || {}).map(
|
|
|
+ ([label,{code}])=>({
|
|
|
+ value: +code,
|
|
|
+ label,
|
|
|
+ disabled: currentApp?.thirdAppType===0 && +code===1 // 应用类型是小程序,banner广告位类型禁用
|
|
|
+ })
|
|
|
+ )
|
|
|
+ if (currentApp?.thirdAppType===0 && unionAdPosition===1) {
|
|
|
+ //应用类型是小程序,banner广告位类型会禁用,如果当前选择是banner,需要修改为插屏类型(0)
|
|
|
+ form.setFieldValue('unionAdPosition',0)
|
|
|
+ }
|
|
|
|
|
|
useImperativeHandle(ref,()=>({
|
|
|
open: (editRow?:RowDataType) => {
|