Commit d8cdec6b authored by 田翔's avatar 田翔

fix: 代码优化

parent c4e973a5
Pipeline #81838 passed with stages
import React, { useState, useContext, useMemo, useEffect } from 'react' import React, { useState, useContext, useMemo, useEffect } from 'react'
import styles from './index.less' import styles from './index.less'
import { Input, Form, TreeSelect, Switch, Modal, Space, Button } from 'antd' import { Input, Form, TreeSelect, Switch, Modal, Space, Button, Popover } from 'antd'
import { GlobalStore } from '../index' import { GlobalStore } from '../index'
import { getMenuInfo, getMiniAppModuleTree } from '@/services/mobileConfig/api' import { getMenuInfo, getMiniAppModuleTree } from '@/services/mobileConfig/api'
import { import {
...@@ -19,6 +19,7 @@ import { getImageBases } from '@/services/common/api' ...@@ -19,6 +19,7 @@ import { getImageBases } from '@/services/common/api'
import PicturesWall from '@/components/Upload/index' import PicturesWall from '@/components/Upload/index'
const { TreeNode } = TreeSelect const { TreeNode } = TreeSelect
const { TextArea } = Input
const themes = [ const themes = [
{ name: '供水主题背景' }, { name: '供水主题背景' },
...@@ -220,6 +221,25 @@ const Right = () => { ...@@ -220,6 +221,25 @@ const Right = () => {
setParamShow(false) setParamShow(false)
} }
const content = (
<TreeSelect
showSearch
treeNodeFilterProp="title"
style={{ width: '280px' }}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择功能路径"
allowClear
treeDefaultExpandAll
treeIcon
onChange={(value) => {
let item = urlArray.find(v => v.menuID === value)
cardSettingOther(item.product + item.pageUrl, 'url')
}}
>
{moblieList.map(i => mapTreeMoblie(i))}
</TreeSelect>
)
useEffect(() => { useEffect(() => {
getData() getData()
//初始增加一个供水主题 //初始增加一个供水主题
...@@ -298,24 +318,12 @@ const Right = () => { ...@@ -298,24 +318,12 @@ const Right = () => {
} }
</Form.Item> </Form.Item>
<Form.Item label="功能跳转" name="url"> <Form.Item label="功能跳转" name="url">
<TreeSelect <Popover
showSearch content={content}
treeNodeFilterProp="title" trigger="click"
style={{ width: '97%' }}
value={card.url}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择功能路径"
allowClear
treeDefaultExpandAll
treeIcon
// onSearch={(value) => cardSettingOther(value, 'url')}
onChange={(value) => {
let item = urlArray.find(v => v.menuID === value)
cardSettingOther(item.product + item.pageUrl, 'url')
}}
> >
{moblieList.map(i => mapTreeMoblie(i))} <TextArea value={card.url} onChange={e => cardSettingOther(e.target.value, 'url')} rows={4} />
</TreeSelect> </Popover>
</Form.Item> </Form.Item>
<Form.Item label="卡片参数" name="param"> <Form.Item label="卡片参数" name="param">
<Input value={card.param} onClick={paramShowChange} /> <Input value={card.param} onClick={paramShowChange} />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment