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 */
// 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 = 'http://localhost:8085';
const proxyURL = 'http://192.168.8.27:8023';
// const proxyURL = 'https://panda-water.cn'
//const proxyURL = 'http://192.168.12.189:8816/'
module.exports = {
......
......@@ -23,6 +23,9 @@ import { waterMark } from '../utils/mark';
import layoutStyles from './BasicLayout.less';
import SecurityLayout from './SecurityLayout';
import Site from './Site';
import { defaultApp } from '@/micro';
import { appService } from '@/api';
import LoginAction from '@/pages/user/login/login';
const { params } = helpers;
......@@ -94,15 +97,16 @@ const OnlyFocusStations = props => {
</Spin>
);
};
const AllStations = props => {
const data = props.data.stations;
const [targetOffset, setTargetOffset] = useState(undefined);
const cityPane = useRef(null);
const cityContent = useRef(null);
const [defaultTab, setDefaultTab] = useState('site');
useEffect(() => {
setTargetOffset(cityPane.current.clientHeight / 2);
}, []);
const handleClick = (event, link) => {
......@@ -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';
const pickRoutes = memoized((routes, pathname, locale) => {
const matches = matchRoutes(routes, { pathname });
......@@ -255,12 +329,16 @@ const Layout = props => {
const [menuLoading, setMenuLoading] = useState(true);
const [subLoading, setSubLoading] = useState(true);
const [initWebContent, setInitWebContent] = useState(false);
const [integrationData, setIntegrationData] = useState([]);
const [loginAction, setAction] = useState(() => new LoginAction(props));
// const [settings, setSetting] = useState({});
// const [routeConfig, setRouteConfig] = useState(null);
// const [matchPath, setMatchPath] = useState('');
const actionRef = useRef();
const history = useHistory();
const location = useLocation();
const [visible, setVisible] = useState(false);
const [integrationLoading, setIntegrationLoading] = useState(false);
const { routeConfig = {}, matchPath } = pickRoutes(props.flatMenu, location.pathname);
// useEffect(() => {
......@@ -318,11 +396,28 @@ const Layout = props => {
}, [cityData, props.global, props.global.userInfo, siteAction]);
useEffect(() => {
if (window?.globalConfig?.isIntegration >= 1) {
GetIntegrationConfig();
}
window.share.event.on('updateSite', 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 () => {
window.share.event.removeAllListeners('updateSite');
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
};
}, []);
......@@ -346,9 +441,25 @@ const Layout = props => {
};
}, [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 => {
//集成网站
if (window.globalConfig.isIntegration >= 1) {
if (window.globalConfig.isIntegration > 1 || integrationData.length > 1) {
// window.qiankunIsCache = false;
history.push('/Industry');
}
......@@ -437,6 +548,77 @@ const Layout = props => {
}
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 (
<SecurityLayout {...props}>
<BasicLayout
......@@ -472,15 +654,19 @@ const Layout = props => {
popupOffset: [0, 15],
}}
headerSiteRender={() =>
renderSite({
data: cityData,
config: props.global,
loading: siteLoading,
setLoading: setSiteLoading,
action: siteAction,
actionRef,
setMenuLoading,
})
window?.globalConfig?.isIntegration >= 1
?
renderIntegration(integrationData, loginAction, props)
:
renderSite({
data: cityData,
config: props.global,
loading: siteLoading,
setLoading: setSiteLoading,
action: siteAction,
actionRef,
setMenuLoading,
})
}
menuItemRender={(item, dom) => (
<a
......@@ -530,6 +716,7 @@ const mapStateToProps = state => ({
global: state.getIn(['global', 'globalConfig']),
menu: state.getIn(['global', 'menu']),
flatMenu: state.getIn(['global', 'flatMenu']),
instance: state.getIn(['global', 'instance']),
currentMenuIndex: state.getIn(['global', 'currentMenuIndex']),
});
const mapDispatchToProps = dispatch => ({
......
......@@ -27,6 +27,7 @@
padding-left: 16px;
padding-right: 16px;
cursor: pointer;
margin-top: 3px;
// transition: all .3s;
.site {
width: 16px;
......@@ -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 {
padding: 20px 10px 0 10px;
max-width: 520px;
......@@ -359,6 +375,14 @@
}
}
}
&.stationsTop {
top: 34px!important;
:global {
.ant-popover-arrow {
display: none;
}
}
}
.focusStations {
display: block;
// padding: 5px 0px;
......
......@@ -13,7 +13,7 @@ const BootPageTemplate = {
integration: IntegrationPage
};
let first = true;
const BootPage = props => {
const [info, setInfo] = useState({
first: true,
......@@ -21,10 +21,10 @@ const BootPage = props => {
error: false,
});
const [template, setTemplate] = useState('default');
const RenderComponent = useMemo(() => {
if (window.globalConfig.isIntegration >= 1) {
if (window?.globalConfig?.isIntegration >= 1 && first) {
first = false;
//集成登录
return BootPageTemplate.integration
} else {
......
......@@ -55,7 +55,6 @@ const Integration = props => {
config.client = cli
}
props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type, cli);
}
......@@ -121,7 +120,7 @@ const Integration = props => {
<section className={classNames(styles.bootPageSection, 'animate__fadeInDown', 'animate__animated', 'duration-500ms')} >
<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, }} >
{dataList.map(item => (
{dataList.length > 1 ? dataList.map(item => (
<li className={styles.bootPageLi} key={item.name} onClick={event => handlePage(item, loginAction)} >
<div className={styles.bootPageList}>
<div className={styles.listMain}>
......@@ -147,7 +146,7 @@ const Integration = props => {
)}
</li>
),
)}
) : ''}
</ul>
</section>
</div>
......
......@@ -293,7 +293,7 @@ class Login {
.getWateWayConfig(gateWayParam)
.then(res => {
// 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.apiGatewayDomain = `${window.location.origin}${hasGateWay ? '/PandaCore/GateWay' : ''}`;
if (hasGateWay) {
......@@ -431,6 +431,11 @@ class Login {
hideFeedback,
// mapsettings: config.mapsettings
});
if (this.globalConfig?.isIntegration >= 1) {
self.updateConfig && self.updateConfig(self.globalConfig);
}
self.getProjectItems().then(res => {
window.subSysCfg = {};
self.globalConfig = Object.assign(self.globalConfig, {
......@@ -501,6 +506,9 @@ class Login {
// if (mainConf.productType)
// self.globalConfig.productType = mainConf.productType;
}
if (this.globalConfig?.isIntegration >= 1) {
self.updateConfig && self.updateConfig(self.globalConfig);
}
this.isOpenYanshi(self, getIndustry);
});
} else {
......@@ -929,6 +937,11 @@ class Login {
const self = this;
if (client) {
self.globalConfig.client = client;
Cookies.set('client', client, {
expires: 86400000 / (24 * 60 * 60 * 1000),
path: '/',
});
sessionStorage.setItem('client', client);
}
/* eslint-disable */
......@@ -968,7 +981,6 @@ class Login {
};
self.updateConfig && self.updateConfig(self.globalConfig);
}
console.log('globalConfig', self.globalConfig)
if (self.isSignIn || !!industry) {
// eslint-disable-next-line no-undef
getUserInfo({
......@@ -1223,6 +1235,7 @@ class Login {
message.error('登录服务异常');
});
}
phoneLoginFormHandler(userPhone, captcha) {
this.login('', '', userPhone, '', SERVICE_APP_LOGIN_MODE.phone);
}
......
......@@ -80,7 +80,6 @@
.title-name {
font-size: 36px;
font-family: PingFang SC;
font-weight: 500;
color: #000000;
text-shadow: 0px 1px 5px rgba(6, 27, 54, 0.8);
......@@ -202,7 +201,6 @@
.cn-title {
font-size: 28px;
font-family: PingFang SC;
font-weight: 400;
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