|
|
@@ -38,37 +38,61 @@ const Submit: React.FC<Props> = ({ corpList, visible, pageSpecs, onChange, onClo
|
|
|
|
|
|
const handleOk = () => {
|
|
|
form.validateFields().then(valid => {
|
|
|
- const { bgColor, globalElementsSpecList, pageElementsSpecList } = pageSpecs
|
|
|
- let pageSpecsList = []
|
|
|
- let qrCodeFloatList: { siteId: number, urlList: string[] }[] = []
|
|
|
- if (globalElementsSpecList?.length > 0) {
|
|
|
- pageSpecsList = [...pageElementsSpecList.map(item => {
|
|
|
- delete (item as any)?.comptActive
|
|
|
- return item
|
|
|
- }), ...globalElementsSpecList.map(item => {
|
|
|
- delete item.comptActive
|
|
|
- return item
|
|
|
- })]
|
|
|
- const floatButton = globalElementsSpecList?.find(item => item.elementType === 'FLOAT_BUTTON')
|
|
|
- if (floatButton) {
|
|
|
- qrCodeFloatList = [{
|
|
|
- siteId: floatButton.id,
|
|
|
- urlList: floatButton.qrCodeFloatList
|
|
|
- }]
|
|
|
+ const { bgColor, globalElementsSpecList, pageElementsSpecList, pageType } = pageSpecs
|
|
|
+ let params: Record<string, unknown> = {}
|
|
|
+ if (pageType === "LANDING_PAGE") {
|
|
|
+ let pageSpecsList = []
|
|
|
+ let qrCodeFloatList: { siteId: number, urlList: string[] }[] = []
|
|
|
+ if (globalElementsSpecList?.length > 0) {
|
|
|
+ pageSpecsList = [...pageElementsSpecList.map(item => {
|
|
|
+ delete (item as any)?.comptActive
|
|
|
+ return item
|
|
|
+ }), ...globalElementsSpecList.map(item => {
|
|
|
+ delete item.comptActive
|
|
|
+ return item
|
|
|
+ })]
|
|
|
+ const floatButton = globalElementsSpecList?.find(item => item.elementType === 'FLOAT_BUTTON')
|
|
|
+ if (floatButton) {
|
|
|
+ qrCodeFloatList = [{
|
|
|
+ siteId: floatButton.id,
|
|
|
+ urlList: floatButton.qrCodeFloatList
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const qrCodeList = pageElementsSpecList.filter(item => item.elementType === 'QR_CODE')?.map((item: TASK_MINI_PAGE_CREATE.QrCode) => ({ siteId: item.id, urlList: item.imageList }))
|
|
|
+ const { pageName, ...v } = valid
|
|
|
+ params = {
|
|
|
+ content: JSON.stringify({
|
|
|
+ pageName,
|
|
|
+ bgColor,
|
|
|
+ elementsSpecList: pageSpecsList
|
|
|
+ }),
|
|
|
+ qrCodeFloatList,
|
|
|
+ qrCodeList,
|
|
|
+ type: 'LANDING_PAGE',
|
|
|
+ ...v
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const { pageName, ...v } = valid
|
|
|
+ const { data, url, tipText } = pageElementsSpecList[0] as TASK_MINI_PAGE_CREATE.TopShortVideo
|
|
|
+ params = {
|
|
|
+ content: JSON.stringify(data.map(item => {
|
|
|
+ return {
|
|
|
+ v_url: item.url,
|
|
|
+ du: item.duration,
|
|
|
+ user: {
|
|
|
+ hurl: "https://appresource.zanxiangnet.com/old-videos/6975eba200000150123b9894/user_avatar.jpg",
|
|
|
+ nick: pageName
|
|
|
+ },
|
|
|
+ url,
|
|
|
+ tipText
|
|
|
+ }
|
|
|
+ })),
|
|
|
+ type: 'VIDEO',
|
|
|
+ ...v
|
|
|
}
|
|
|
}
|
|
|
- const qrCodeList = pageElementsSpecList.filter(item => item.elementType === 'QR_CODE')?.map((item: TASK_MINI_PAGE_CREATE.QrCode) => ({ siteId: item.id, urlList: item.imageList }))
|
|
|
- const { pageName, ...v } = valid
|
|
|
- const params = {
|
|
|
- content: JSON.stringify({
|
|
|
- pageName,
|
|
|
- bgColor,
|
|
|
- elementsSpecList: pageSpecsList
|
|
|
- }),
|
|
|
- qrCodeFloatList,
|
|
|
- qrCodeList,
|
|
|
- ...v
|
|
|
- }
|
|
|
+
|
|
|
if (initialValues?.id) {
|
|
|
editLandingPage.run({ ...params, id: initialValues.id }).then(res => {
|
|
|
if (res?.data) {
|
|
|
@@ -110,7 +134,7 @@ const Submit: React.FC<Props> = ({ corpList, visible, pageSpecs, onChange, onClo
|
|
|
message.error(errorFields?.[0]?.errors?.[0])
|
|
|
}}
|
|
|
onFinish={handleOk}
|
|
|
- initialValues={initialValues}
|
|
|
+ initialValues={initialValues || { h5VisitSwitch: false }}
|
|
|
>
|
|
|
<Form.Item label={<strong>落地页名称</strong>} name="name" rules={[{ required: true, message: '请输入落地页名称!' }]}>
|
|
|
<Input placeholder="请输入落地页名称" />
|
|
|
@@ -127,7 +151,7 @@ const Submit: React.FC<Props> = ({ corpList, visible, pageSpecs, onChange, onClo
|
|
|
<Form.Item label={<strong>小程序预览AppId</strong>} name="previewAppId">
|
|
|
<Input placeholder="请输入小程序预览AppId" />
|
|
|
</Form.Item>
|
|
|
-
|
|
|
+
|
|
|
<Form.Item label={<strong>企微主体</strong>} name="corpId" rules={[{ required: true, message: '请选择主体!' }]}>
|
|
|
<Select
|
|
|
placeholder='请选择主体'
|
|
|
@@ -166,6 +190,12 @@ const Submit: React.FC<Props> = ({ corpList, visible, pageSpecs, onChange, onClo
|
|
|
}
|
|
|
/>
|
|
|
</Form.Item>
|
|
|
+ <Form.Item label={<strong>开启H5访问限制?</strong>} name="h5VisitSwitch" rules={[{ required: true, message: '请选择开启H5访问限制!' }]}>
|
|
|
+ <Radio.Group buttonStyle="solid">
|
|
|
+ <Radio.Button value={true}>是</Radio.Button>
|
|
|
+ <Radio.Button value={false}>否</Radio.Button>
|
|
|
+ </Radio.Group>
|
|
|
+ </Form.Item>
|
|
|
</Form>
|
|
|
</Modal>
|
|
|
}
|