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