Commit a78f7ba0 authored by 杨思琦's avatar 杨思琦

Merge branch 'dev' into 'master'

Dev See merge request !30
parents 46940680 8a668da7
Pipeline #78398 passed with stages
/* eslint-disable */ /* eslint-disable */
// const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin; // const proxyURL = process.env.NODE_ENV !== 'production' ? 'http://192.168.10.150:8777' : window.location.origin;
// const proxyURL = 'https://work.panda-water.cn'; // const proxyURL = 'https://work.panda-water.cn';
const proxyURL = 'http://localhost:8085'; const proxyURL = 'http://192.168.8.27:8023';
// const proxyURL = 'https://panda-water.cn' // const proxyURL = 'https://panda-water.cn'
//const proxyURL = 'http://192.168.12.189:8816/' //const proxyURL = 'http://192.168.12.189:8816/'
module.exports = { module.exports = {
......
...@@ -23,6 +23,9 @@ import { waterMark } from '../utils/mark'; ...@@ -23,6 +23,9 @@ import { waterMark } from '../utils/mark';
import layoutStyles from './BasicLayout.less'; import layoutStyles from './BasicLayout.less';
import SecurityLayout from './SecurityLayout'; import SecurityLayout from './SecurityLayout';
import Site from './Site'; import Site from './Site';
import { defaultApp } from '@/micro';
import { appService } from '@/api';
import LoginAction from '@/pages/user/login/login';
const { params } = helpers; const { params } = helpers;
...@@ -94,15 +97,16 @@ const OnlyFocusStations = props => { ...@@ -94,15 +97,16 @@ const OnlyFocusStations = props => {
</Spin> </Spin>
); );
}; };
const AllStations = props => { const AllStations = props => {
const data = props.data.stations; const data = props.data.stations;
const [targetOffset, setTargetOffset] = useState(undefined); const [targetOffset, setTargetOffset] = useState(undefined);
const cityPane = useRef(null); const cityPane = useRef(null);
const cityContent = useRef(null); const cityContent = useRef(null);
const [defaultTab, setDefaultTab] = useState('site'); const [defaultTab, setDefaultTab] = useState('site');
useEffect(() => { useEffect(() => {
setTargetOffset(cityPane.current.clientHeight / 2); setTargetOffset(cityPane.current.clientHeight / 2);
}, []); }, []);
const handleClick = (event, link) => { const handleClick = (event, link) => {
...@@ -223,6 +227,76 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM ...@@ -223,6 +227,76 @@ const renderSite = ({ data, config, loading, setLoading, action, actionRef, setM
); );
}; };
// const renderIntegration = (inData, loginAction, props) => {
// const [visible, setVisible] = useState(false);
// if (inData.length <= 1) {
// return <></>
// }
// let choiceOne = inData?.find(function (a) {
// return a.url?.indexOf(window?.globalConfig?.client) >= 0
// })
// //切换集成站点
// const checkIntegration = (val, loginAction, props) => {
// if (val.subType == '外链') {
// window.open(val.url, "_blank");
// } else {
// let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
// const config = props.global;
// config.uiwidgets = [];
// config.widgets = [];
// config.allWidgets = [];
// if (cli) {
// config.client = cli;
// }
// props.instance && props.instance.updateConfig(config);
// loginAction && loginAction.getUserInfoAndConfig('', true, val.type, cli);
// // props.history.push(`/?client=${cli}`);
// // props.updateCurrentIndex(0);
// // defaultApp();
// }
// }
// return (
// <>
// <Popover
// placement="bottomLeft"
// trigger="click"
// visible={visible}
// content={
// <div className={layoutStyles.integrationList}>
// {
// inData && inData.map((val) => (
// <p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p>
// ))
// }
// </div>
// }
// arrowPointAtCenter
// overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop2)}
// onVisibleChange={visible => setVisible(visible)}
// >
// {inData.length > 1 ? (
// <div className={layoutStyles.toggleSite}>
// <img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
// <span className={layoutStyles.name}>{choiceOne?.name ?? ''}</span>
// <ArrowIcon
// className={layoutStyles.arrow}
// style={{
// transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
// }}
// />
// </div>
// ) : null}
// </Popover>
// </>
// )
// }
// import defaultProps from '../defaultProps'; // import defaultProps from '../defaultProps';
const pickRoutes = memoized((routes, pathname, locale) => { const pickRoutes = memoized((routes, pathname, locale) => {
const matches = matchRoutes(routes, { pathname }); const matches = matchRoutes(routes, { pathname });
...@@ -255,12 +329,16 @@ const Layout = props => { ...@@ -255,12 +329,16 @@ const Layout = props => {
const [menuLoading, setMenuLoading] = useState(true); const [menuLoading, setMenuLoading] = useState(true);
const [subLoading, setSubLoading] = useState(true); const [subLoading, setSubLoading] = useState(true);
const [initWebContent, setInitWebContent] = useState(false); const [initWebContent, setInitWebContent] = useState(false);
const [integrationData, setIntegrationData] = useState([]);
const [loginAction, setAction] = useState(() => new LoginAction(props));
// const [settings, setSetting] = useState({}); // const [settings, setSetting] = useState({});
// const [routeConfig, setRouteConfig] = useState(null); // const [routeConfig, setRouteConfig] = useState(null);
// const [matchPath, setMatchPath] = useState(''); // const [matchPath, setMatchPath] = useState('');
const actionRef = useRef(); const actionRef = useRef();
const history = useHistory(); const history = useHistory();
const location = useLocation(); const location = useLocation();
const [visible, setVisible] = useState(false);
const [integrationLoading, setIntegrationLoading] = useState(false);
const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname); const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname);
// useEffect(() => { // useEffect(() => {
...@@ -318,11 +396,28 @@ const Layout = props => { ...@@ -318,11 +396,28 @@ const Layout = props => {
}, [cityData, props.global, props.global.userInfo, siteAction]); }, [cityData, props.global, props.global.userInfo, siteAction]);
useEffect(() => { useEffect(() => {
if (window?.globalConfig?.isIntegration >= 1) {
GetIntegrationConfig();
}
window.share.event.on('updateSite', res => { window.share.event.on('updateSite', res => {
setCityData(res); setCityData(res);
}); });
const handleToggleIndustry = event => {
setVisible(false);
setIntegrationLoading(false);
props.history.push(`/?client=${window.globalConfig.homepage.client}`);
props.updateCurrentIndex(0);
defaultApp();
};
if (window?.globalConfig?.isIntegration >= 1) {
loginAction.events.on('toggleIndustry', handleToggleIndustry);
}
return () => { return () => {
window.share.event.removeAllListeners('updateSite'); window.share.event.removeAllListeners('updateSite');
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
}; };
}, []); }, []);
...@@ -346,9 +441,25 @@ const Layout = props => { ...@@ -346,9 +441,25 @@ const Layout = props => {
}; };
}, [props.global.isHaveMark, props.global.userInfo]); }, [props.global.isHaveMark, props.global.userInfo]);
const GetIntegrationConfig = () => {
appService
.GetIntegrationConfig({
type: '集成登录',
userId: window.globalConfig.userInfo?.OID ?? null,
isEnable: true,
})
.then(res => {
const { code, data } = res;
if (code == '0') {
setIntegrationData(data);
} else {
setIntegrationData([]);
}
})
}
const onMenuHeaderClick = event => { const onMenuHeaderClick = event => {
//集成网站 //集成网站
if (window.globalConfig.isIntegration >= 1) { if (window.globalConfig.isIntegration > 1 || integrationData.length > 1) {
// window.qiankunIsCache = false; // window.qiankunIsCache = false;
history.push('/Industry'); history.push('/Industry');
} }
...@@ -437,6 +548,77 @@ const Layout = props => { ...@@ -437,6 +548,77 @@ const Layout = props => {
} }
return false; return false;
}; };
//渲染集成站点切换弹框
const renderIntegration = (inData, loginAction, props) => {
if (inData.length <= 1) {
return <></>
}
let choiceOne = inData?.find(function (a) {
return a.url?.indexOf(window?.globalConfig?.client) >= 0
})
//切换集成站点
const checkIntegration = (val, loginAction, props) => {
if (val.subType == '外链') {
window.open(val.url, "_blank");
} else {
let cli = val.url?.indexOf('client=') >= 0 ? val.url.split('client=')[1] : '';
setIntegrationLoading(true);
const config = props.global;
config.uiwidgets = [];
config.widgets = [];
config.allWidgets = [];
if (cli) {
config.client = cli;
}
props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, val.type, cli);
// props.history.push(`/?client=${cli}`);
// props.updateCurrentIndex(0);
// defaultApp();
}
}
return (
<>
<Popover
placement="bottomLeft"
trigger="click"
visible={visible}
content={
<div className={layoutStyles.integrationList}>
{
<Loading loading={integrationLoading} />
}
{
inData && inData.map((val) => (
<p onClick={() => checkIntegration(val, loginAction, props)}>{val.name}</p>
))
}
</div>
}
arrowPointAtCenter
overlayClassName={classNames(layoutStyles.stationsWrapper, layoutStyles.stationsTop2)}
onVisibleChange={visible => setVisible(visible)}
>
{inData.length > 1 ? (
<div className={layoutStyles.toggleSite}>
<img src={require('../assets/basic/site.png')} className={layoutStyles.site} />
<span className={layoutStyles.name}>{choiceOne?.name ?? ''}</span>
<ArrowIcon
className={layoutStyles.arrow}
style={{
transform: !visible ? `rotate(0deg)` : `rotate(180deg)`,
}}
/>
</div>
) : null}
</Popover>
</>
)
}
return ( return (
<SecurityLayout {...props}> <SecurityLayout {...props}>
<BasicLayout <BasicLayout
...@@ -472,15 +654,19 @@ const Layout = props => { ...@@ -472,15 +654,19 @@ const Layout = props => {
popupOffset: [0, 15], popupOffset: [0, 15],
}} }}
headerSiteRender={() => headerSiteRender={() =>
renderSite({ window?.globalConfig?.isIntegration >= 1
data: cityData, ?
config: props.global, renderIntegration(integrationData, loginAction, props)
loading: siteLoading, :
setLoading: setSiteLoading, renderSite({
action: siteAction, data: cityData,
actionRef, config: props.global,
setMenuLoading, loading: siteLoading,
}) setLoading: setSiteLoading,
action: siteAction,
actionRef,
setMenuLoading,
})
} }
menuItemRender={(item, dom) => ( menuItemRender={(item, dom) => (
<a <a
...@@ -530,6 +716,7 @@ const mapStateToProps = state => ({ ...@@ -530,6 +716,7 @@ const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']), global: state.getIn(['global', 'globalConfig']),
menu: state.getIn(['global', 'menu']), menu: state.getIn(['global', 'menu']),
flatMenu: state.getIn(['global', 'flatMenu']), flatMenu: state.getIn(['global', 'flatMenu']),
instance: state.getIn(['global', 'instance']),
currentMenuIndex: state.getIn(['global', 'currentMenuIndex']), currentMenuIndex: state.getIn(['global', 'currentMenuIndex']),
}); });
const mapDispatchToProps = dispatch => ({ const mapDispatchToProps = dispatch => ({
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
padding-left: 16px; padding-left: 16px;
padding-right: 16px; padding-right: 16px;
cursor: pointer; cursor: pointer;
margin-top: 3px;
// transition: all .3s; // transition: all .3s;
.site { .site {
width: 16px; width: 16px;
...@@ -347,6 +348,21 @@ ...@@ -347,6 +348,21 @@
} }
} }
.integrationList{
display: flex;
position: relative;
}
.integrationList p{
margin: 0 10px;
cursor: pointer;
color: #40a9ff;
}
.integrationList p:hover{
color: #096dd9;
}
.stationsTop2{
padding-top: 0!important;
}
.stationsWrapper { .stationsWrapper {
padding: 20px 10px 0 10px; padding: 20px 10px 0 10px;
max-width: 520px; max-width: 520px;
...@@ -359,6 +375,14 @@ ...@@ -359,6 +375,14 @@
} }
} }
} }
&.stationsTop {
top: 34px!important;
:global {
.ant-popover-arrow {
display: none;
}
}
}
.focusStations { .focusStations {
display: block; display: block;
// padding: 5px 0px; // padding: 5px 0px;
......
...@@ -13,7 +13,7 @@ const BootPageTemplate = { ...@@ -13,7 +13,7 @@ const BootPageTemplate = {
integration: IntegrationPage integration: IntegrationPage
}; };
let first = true;
const BootPage = props => { const BootPage = props => {
const [info, setInfo] = useState({ const [info, setInfo] = useState({
first: true, first: true,
...@@ -21,10 +21,10 @@ const BootPage = props => { ...@@ -21,10 +21,10 @@ const BootPage = props => {
error: false, error: false,
}); });
const [template, setTemplate] = useState('default'); const [template, setTemplate] = useState('default');
const RenderComponent = useMemo(() => { const RenderComponent = useMemo(() => {
if (window.globalConfig.isIntegration >= 1) { if (window?.globalConfig?.isIntegration >= 1 && first) {
first = false;
//集成登录 //集成登录
return BootPageTemplate.integration return BootPageTemplate.integration
} else { } else {
......
...@@ -55,7 +55,6 @@ const Integration = props => { ...@@ -55,7 +55,6 @@ const Integration = props => {
config.client = cli config.client = cli
} }
props.instance && props.instance.updateConfig(config); props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type, cli); loginAction && loginAction.getUserInfoAndConfig('', true, item.type, cli);
} }
...@@ -121,7 +120,7 @@ const Integration = props => { ...@@ -121,7 +120,7 @@ const Integration = props => {
<section className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')} > <section className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')} >
<ul className={classNames(styles.bootPageUl, 'animate__animated')} <ul className={classNames(styles.bootPageUl, 'animate__animated')}
style={{ transform: `scale(${scale})`, left: '300px', bottom: '105px', opacity: 1, width: num === 5 ? 960 : num === 9 || num === 10 ? 1600 : 1280, }} > style={{ transform: `scale(${scale})`, left: '300px', bottom: '105px', opacity: 1, width: num === 5 ? 960 : num === 9 || num === 10 ? 1600 : 1280, }} >
{dataList.map(item => ( {dataList.length > 1 ? dataList.map(item => (
<li className={styles.bootPageLi} key={item.name} onClick={event => handlePage(item, loginAction)} > <li className={styles.bootPageLi} key={item.name} onClick={event => handlePage(item, loginAction)} >
<div className={styles.bootPageList}> <div className={styles.bootPageList}>
<div className={styles.listMain}> <div className={styles.listMain}>
...@@ -147,7 +146,7 @@ const Integration = props => { ...@@ -147,7 +146,7 @@ const Integration = props => {
)} )}
</li> </li>
), ),
)} ) : ''}
</ul> </ul>
</section> </section>
</div> </div>
......
...@@ -293,7 +293,7 @@ class Login { ...@@ -293,7 +293,7 @@ class Login {
.getWateWayConfig(gateWayParam) .getWateWayConfig(gateWayParam)
.then(res => { .then(res => {
// eslint-disable-next-line prettier/prettier, no-undef // eslint-disable-next-line prettier/prettier, no-undef
const hasGateWay =!res || !res.data? false: _.isString(res.data)? JSON.parse(res.data): typeof res.data === 'boolean'? res.data: false; const hasGateWay = !res || !res.data ? false : _.isString(res.data) ? JSON.parse(res.data) : typeof res.data === 'boolean' ? res.data : false;
self.globalConfig.hasGateWay = hasGateWay; self.globalConfig.hasGateWay = hasGateWay;
self.globalConfig.apiGatewayDomain = `${window.location.origin}${hasGateWay ? '/PandaCore/GateWay' : ''}`; self.globalConfig.apiGatewayDomain = `${window.location.origin}${hasGateWay ? '/PandaCore/GateWay' : ''}`;
if (hasGateWay) { if (hasGateWay) {
...@@ -431,6 +431,11 @@ class Login { ...@@ -431,6 +431,11 @@ class Login {
hideFeedback, hideFeedback,
// mapsettings: config.mapsettings // mapsettings: config.mapsettings
}); });
if (this.globalConfig?.isIntegration >= 1) {
self.updateConfig && self.updateConfig(self.globalConfig);
}
self.getProjectItems().then(res => { self.getProjectItems().then(res => {
window.subSysCfg = {}; window.subSysCfg = {};
self.globalConfig = Object.assign(self.globalConfig, { self.globalConfig = Object.assign(self.globalConfig, {
...@@ -501,6 +506,9 @@ class Login { ...@@ -501,6 +506,9 @@ class Login {
// if (mainConf.productType) // if (mainConf.productType)
// self.globalConfig.productType = mainConf.productType; // self.globalConfig.productType = mainConf.productType;
} }
if (this.globalConfig?.isIntegration >= 1) {
self.updateConfig && self.updateConfig(self.globalConfig);
}
this.isOpenYanshi(self, getIndustry); this.isOpenYanshi(self, getIndustry);
}); });
} else { } else {
...@@ -929,6 +937,11 @@ class Login { ...@@ -929,6 +937,11 @@ class Login {
const self = this; const self = this;
if (client) { if (client) {
self.globalConfig.client = client; self.globalConfig.client = client;
Cookies.set('client', client, {
expires: 86400000 / (24 * 60 * 60 * 1000),
path: '/',
});
sessionStorage.setItem('client', client);
} }
/* eslint-disable */ /* eslint-disable */
...@@ -968,7 +981,6 @@ class Login { ...@@ -968,7 +981,6 @@ class Login {
}; };
self.updateConfig && self.updateConfig(self.globalConfig); self.updateConfig && self.updateConfig(self.globalConfig);
} }
console.log('globalConfig', self.globalConfig)
if (self.isSignIn || !!industry) { if (self.isSignIn || !!industry) {
// eslint-disable-next-line no-undef // eslint-disable-next-line no-undef
getUserInfo({ getUserInfo({
...@@ -1223,6 +1235,7 @@ class Login { ...@@ -1223,6 +1235,7 @@ class Login {
message.error('登录服务异常'); message.error('登录服务异常');
}); });
} }
phoneLoginFormHandler(userPhone, captcha) { phoneLoginFormHandler(userPhone, captcha) {
this.login('', '', userPhone, '', SERVICE_APP_LOGIN_MODE.phone); this.login('', '', userPhone, '', SERVICE_APP_LOGIN_MODE.phone);
} }
......
...@@ -80,7 +80,6 @@ ...@@ -80,7 +80,6 @@
.title-name { .title-name {
font-size: 36px; font-size: 36px;
font-family: PingFang SC;
font-weight: 500; font-weight: 500;
color: #000000; color: #000000;
text-shadow: 0px 1px 5px rgba(6, 27, 54, 0.8); text-shadow: 0px 1px 5px rgba(6, 27, 54, 0.8);
...@@ -202,7 +201,6 @@ ...@@ -202,7 +201,6 @@
.cn-title { .cn-title {
font-size: 28px; font-size: 28px;
font-family: PingFang SC;
font-weight: 400; font-weight: 400;
color: #FFFFFF; color: #FFFFFF;
} }
......
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