Commit 65381607 authored by Maofei94's avatar Maofei94

fix: 图片选择优化

parent 9de83766
Pipeline #21945 skipped with stages
import { getImageBases, getSysConfigurate } from '@/services/common/api'; import { getImageBases, gateWayConfig } from '@/services/common/api';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
const UploadContext = React.createContext(); const UploadContext = React.createContext();
...@@ -27,24 +27,25 @@ const PictureWallProvider = props => { ...@@ -27,24 +27,25 @@ const PictureWallProvider = props => {
console.error(err); console.error(err);
return sleep(3000).then(update); return sleep(3000).then(update);
}); });
const updateDicName = () => {
getSysConfigurate().then(res => {
if (res.getMe && (res.getMe[0] === 1 || res.getMe[0] === '1')) {
window.DicNameSERVICE = 'publish';
} else {
window.DicNameSERVICE = '';
}
});
};
useEffect(() => { useEffect(() => {
update(); update();
}, []); }, []);
// const updateDicName = () => {
useEffect(() => { // gateWayConfig()
updateDicName(); // .then(res => {
}, []); // if (res.code === 0 && res.data) {
// window.DicNameSERVICE = 'GateWay';
// } else {
// window.DicNameSERVICE = '';
// }
// })
// .catch(err => {
// window.DicNameSERVICE = '';
// });
// };
// useEffect(() => {
// updateDicName();
// }, []);
return ( return (
<UploadContext.Provider value={{ imgBed, update }}> <UploadContext.Provider value={{ imgBed, update }}>
{children} {children}
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
} }
} }
.ant-tabs-content-holder{ .ant-tabs-content-holder{
padding: 5px 0; // padding: 5px 0;
} }
.ant-modal-body{ .ant-modal-body{
padding-top: 0; padding-top: 0;
......
...@@ -21,7 +21,7 @@ const wallCateName: any = { ...@@ -21,7 +21,7 @@ const wallCateName: any = {
const tabNames:any = { const tabNames:any = {
CityTemp: '用户上传', CityTemp: '用户上传',
icon: 'icon图标', icon: 'icon图标',
androidMenu: '安卓图标', androidMenu: '移动应用图标',
menuNew: '应用图标', menuNew: '应用图标',
logo:'项目logo', logo:'项目logo',
menu:'菜单图标' menu:'菜单图标'
...@@ -50,6 +50,7 @@ interface PicturesWallType { ...@@ -50,6 +50,7 @@ interface PicturesWallType {
uploadContext: any, uploadContext: any,
search: string, search: string,
actives: any, actives: any,
picType: any,
} }
class PicturesWall extends React.Component<PicturesWallType> { class PicturesWall extends React.Component<PicturesWallType> {
...@@ -310,6 +311,7 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -310,6 +311,7 @@ class PicturesWall extends React.Component<PicturesWallType> {
maxLen = 1, maxLen = 1,
cropRate = 375 / 158, cropRate = 375 / 158,
isCrop, isCrop,
picType,
} = this.props; } = this.props;
const uploadButton = ( const uploadButton = (
...@@ -391,7 +393,11 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -391,7 +393,11 @@ class PicturesWall extends React.Component<PicturesWallType> {
> >
<Tabs defaultActiveKey={imgBed[0]?.moduleName} tabPosition="left" style={{ height: 520 }}> <Tabs defaultActiveKey={imgBed[0]?.moduleName} tabPosition="left" style={{ height: 520 }}>
{imgBed.map((item, i) => { {imgBed.map((item, i) => {
if(item.moduleName!==picType){
return
}
const child = [...item.child] || []; const child = [...item.child] || [];
console.log(picType)
if(item.fileUrls.length > 0){ if(item.fileUrls.length > 0){
child.push({ child.push({
moduleName: item.moduleName, moduleName: item.moduleName,
...@@ -401,13 +407,13 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -401,13 +407,13 @@ class PicturesWall extends React.Component<PicturesWallType> {
} }
return ( return (
<TabPane tab={tabNames[item.moduleName]||item.moduleName} key={item.moduleName}> <TabPane tab={tabNames[item.moduleName]||item.moduleName} key={item.moduleName}>
<Input {/* <Input
placeholder="搜索图库" placeholder="搜索图库"
className={styles.search} className={styles.search}
size="middle" size="middle"
value={this.state.search} value={this.state.search}
onChange={e => this.setState({search: e.target.value})} onChange={e => this.setState({search: e.target.value})}
allowClear/> allowClear/> */}
<div className={styles.imgBox}> <div className={styles.imgBox}>
<Collapse <Collapse
bordered bordered
...@@ -419,9 +425,9 @@ class PicturesWall extends React.Component<PicturesWallType> { ...@@ -419,9 +425,9 @@ class PicturesWall extends React.Component<PicturesWallType> {
</TabPane> </TabPane>
); );
})} })}
<TabPane tab="更多" key="more"> {/* <TabPane tab="更多" key="more">
<Result status="500" title="温馨提示" subTitle="更多素材, 正在筹备中..." /> <Result status="500" title="温馨提示" subTitle="更多素材, 正在筹备中..." />
</TabPane> </TabPane> */}
</Tabs> </Tabs>
</Modal> </Modal>
</> </>
......
...@@ -207,6 +207,7 @@ const ManagementDataBase = () => { ...@@ -207,6 +207,7 @@ const ManagementDataBase = () => {
render: text => ( render: text => (
<Button <Button
size="small" size="small"
disabled={!text}
onClick={() => { onClick={() => {
handleLog(text, '版本日志'); handleLog(text, '版本日志');
}} }}
......
...@@ -110,6 +110,9 @@ const SiteConfig = props => { ...@@ -110,6 +110,9 @@ const SiteConfig = props => {
> >
<Input placeholder="请输入应用名称" allowClear /> <Input placeholder="请输入应用名称" allowClear />
</Item> </Item>
<Item label="应用类别:">
<Input value={clientName} disabled />
</Item>
<Item <Item
label="系统图标:" label="系统图标:"
name="shortcutIcon" name="shortcutIcon"
...@@ -120,7 +123,7 @@ const SiteConfig = props => { ...@@ -120,7 +123,7 @@ const SiteConfig = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="icon" />
</Item> </Item>
<Item <Item
......
...@@ -104,7 +104,7 @@ const AddConfig = props => { ...@@ -104,7 +104,7 @@ const AddConfig = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="icon" />
</Item> </Item>
<Item <Item
......
...@@ -74,7 +74,7 @@ const AddForm = props => { ...@@ -74,7 +74,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
{addType === 1 && ( {addType === 1 && (
...@@ -88,7 +88,7 @@ const AddForm = props => { ...@@ -88,7 +88,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
...@@ -103,7 +103,7 @@ const AddForm = props => { ...@@ -103,7 +103,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
<Item label="功能参数" name="funParam"> <Item label="功能参数" name="funParam">
...@@ -151,7 +151,7 @@ const AddForm = props => { ...@@ -151,7 +151,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
{addType === 3 && ( {addType === 3 && (
...@@ -165,7 +165,7 @@ const AddForm = props => { ...@@ -165,7 +165,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
{addType === 4 && ( {addType === 4 && (
...@@ -179,7 +179,7 @@ const AddForm = props => { ...@@ -179,7 +179,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
<Item <Item
......
...@@ -90,7 +90,7 @@ const EditForm = props => { ...@@ -90,7 +90,7 @@ const EditForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
{nodeType === 1 && ( {nodeType === 1 && (
...@@ -104,7 +104,7 @@ const EditForm = props => { ...@@ -104,7 +104,7 @@ const EditForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
...@@ -119,7 +119,7 @@ const EditForm = props => { ...@@ -119,7 +119,7 @@ const EditForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
<Item label="功能参数" name="funParam"> <Item label="功能参数" name="funParam">
...@@ -167,7 +167,7 @@ const EditForm = props => { ...@@ -167,7 +167,7 @@ const EditForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
{nodeType === 3 && ( {nodeType === 3 && (
...@@ -181,7 +181,7 @@ const EditForm = props => { ...@@ -181,7 +181,7 @@ const EditForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
{nodeType === 4 && ( {nodeType === 4 && (
...@@ -195,7 +195,7 @@ const EditForm = props => { ...@@ -195,7 +195,7 @@ const EditForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="androidMenu" />
</Item> </Item>
)} )}
<Item <Item
......
import React, { useState } from 'react'; import React, { useState, useEffect } from 'react';
import { Alert, notification } from 'antd'; import { Alert, notification } from 'antd';
import { OMSLogin } from '@/services/user/api'; import { OMSLogin } from '@/services/user/api';
import { gateWayConfig } from '@/services/common/api';
import { AUTHORITY, USER_MODE } from '@/utils/constants'; import { AUTHORITY, USER_MODE } from '@/utils/constants';
import { appConnector } from '@/containers/App/store'; import { appConnector } from '@/containers/App/store';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
...@@ -83,6 +84,23 @@ const Login = props => { ...@@ -83,6 +84,23 @@ const Login = props => {
}); });
}; };
const updateDicName = () => {
gateWayConfig()
.then(res => {
if (res.code === 0 && res.data) {
window.DicNameSERVICE = 'GateWay';
} else {
window.DicNameSERVICE = '';
}
})
.catch(err => {
window.DicNameSERVICE = '';
});
};
useEffect(() => {
updateDicName();
}, []);
return ( return (
<div className={styles.main}> <div className={styles.main}>
<LoginForm activeKey={type} onTabChange={setType} onSubmit={handleSubmit}> <LoginForm activeKey={type} onTabChange={setType} onSubmit={handleSubmit}>
......
...@@ -69,7 +69,7 @@ const AddForm = props => { ...@@ -69,7 +69,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="menuNew" />
</Item> </Item>
<Item <Item
label="功能路径" label="功能路径"
...@@ -142,7 +142,7 @@ const AddForm = props => { ...@@ -142,7 +142,7 @@ const AddForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="menuNew" />
</Item> </Item>
<Item wrapperCol={{ offset: 5 }} style={{ marginTop: '40px' }}> <Item wrapperCol={{ offset: 5 }} style={{ marginTop: '40px' }}>
<Button type="primary" htmlType="submit" loading={submitLoading}> <Button type="primary" htmlType="submit" loading={submitLoading}>
......
...@@ -76,11 +76,11 @@ const EditForm = props => { ...@@ -76,11 +76,11 @@ const EditForm = props => {
rules={[ rules={[
{ {
required: true, required: true,
message: '请选择在线图标', message: '请选择菜单图标',
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="menuNew" />
</Item> </Item>
<Item <Item
label="功能路径" label="功能路径"
...@@ -158,7 +158,7 @@ const EditForm = props => { ...@@ -158,7 +158,7 @@ const EditForm = props => {
}, },
]} ]}
> >
<PicturesWall /> <PicturesWall picType="menuNew" />
</Item> </Item>
<Item wrapperCol={{ offset: 10 }} style={{ marginTop: '40px' }}> <Item wrapperCol={{ offset: 10 }} style={{ marginTop: '40px' }}>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
......
...@@ -115,6 +115,7 @@ export const getDefaultGetWebconfig = ({ ...@@ -115,6 +115,7 @@ export const getDefaultGetWebconfig = ({
shortcutIcon: { shortcutIcon: {
label: '系统icon', label: '系统icon',
formType: ITEM_TYPE.IMGSHOP, formType: ITEM_TYPE.IMGSHOP,
picType: 'icon',
rules: [ rules: [
{ {
required: true, required: true,
...@@ -125,6 +126,7 @@ export const getDefaultGetWebconfig = ({ ...@@ -125,6 +126,7 @@ export const getDefaultGetWebconfig = ({
logo: { logo: {
label: '登录logo', label: '登录logo',
formType: ITEM_TYPE.IMGSHOP, formType: ITEM_TYPE.IMGSHOP,
picType: 'logo',
rules: [ rules: [
{ {
required: true, required: true,
...@@ -135,6 +137,7 @@ export const getDefaultGetWebconfig = ({ ...@@ -135,6 +137,7 @@ export const getDefaultGetWebconfig = ({
bannerLogo: { bannerLogo: {
label: '标题logo', label: '标题logo',
formType: ITEM_TYPE.IMGSHOP, formType: ITEM_TYPE.IMGSHOP,
picType: 'logo',
rules: [ rules: [
{ {
required: true, required: true,
......
...@@ -7,3 +7,5 @@ export const getSysConfigurate = params => ...@@ -7,3 +7,5 @@ export const getSysConfigurate = params =>
get( get(
`/CityInterface/rest/services/Common.svc/Tool/GetSysConfigurate?dicName=网关启停`, `/CityInterface/rest/services/Common.svc/Tool/GetSysConfigurate?dicName=网关启停`,
); );
export const gateWayConfig = params =>
get(`/Publish/OMS/GateWayConfig`, params);
import { request } from '../utils/request'; import { request } from '../utils/request';
console.log(window, 'window'); let isGateWay = false;
// export const CITY_SERVICE = console.log(window, 'window', isGateWay);
// window.DicNameSERVICE !== 'publish' const CITY_SERVICE = isGateWay
// ? '/Publish/GateWay/CityServer' ? '/Publish/GateWay/CityServer'
// : '/Cityinterface/rest/services'; : '/Cityinterface/rest/services';
export const CITY_SERVICE = '/Cityinterface/rest/services';
export const PUBLISH_SERVICE = '/Publish/OMS';
// export const PUBLISH_SERVICE = '/Publish/GateWay/OMS';
// export const CITY_SERVICE = '/Publish/GateWay/CityServer'; // export const CITY_SERVICE = '/Publish/GateWay/CityServer';
const PUBLISH_SERVICE = isGateWay ? '/Publish/GateWay/OMS' : '/Publish/OMS';
// export const PUBLISH_SERVICE = '/Publish/GateWay/OMS';
console.log(CITY_SERVICE, PUBLISH_SERVICE);
const get = async (url, params, options = {}) => const get = async (url, params, options = {}) =>
request({ request({
url, url,
...@@ -32,4 +31,4 @@ const postForm = async (url, params = {}, options = {}) => { ...@@ -32,4 +31,4 @@ const postForm = async (url, params = {}, options = {}) => {
return post(url, formData, options); return post(url, formData, options);
}; };
export { get, post, postForm }; export { get, post, postForm, CITY_SERVICE, PUBLISH_SERVICE };
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