Commit b278ba54 authored by 周宏民's avatar 周宏民

feat: 集成登录配置优化,添加通用模板

parent 215c0491
Pipeline #93597 waiting for manual action with stages
...@@ -62,6 +62,8 @@ export const API = { ...@@ -62,6 +62,8 @@ export const API = {
REFRESH_SECRET: '/PandaCore/GCK/IntegrationAuth/RefreshSecret', // 根据APPKey生成APPSecret REFRESH_SECRET: '/PandaCore/GCK/IntegrationAuth/RefreshSecret', // 根据APPKey生成APPSecret
CM_EVENT_LOAD_DEPARTMENT_ROLES: '/PandaOMS/OMS/WorkOrderCenter/CM_Event_LoadDepartmentAndRoles', CM_EVENT_LOAD_DEPARTMENT_ROLES: '/PandaOMS/OMS/WorkOrderCenter/CM_Event_LoadDepartmentAndRoles',
GET_CONFIG_FILE_JSON: '/PandaCore/GCK/FileCenter/ConfigJSON', // 获取配置文件 GET_CONFIG_FILE_JSON: '/PandaCore/GCK/FileCenter/ConfigJSON', // 获取配置文件
GET_CONFIG_FILE_LIST: '/PandaOMS/OMS/FileCenter/GetFileUrls', // 获取用户上传
EnableIntegrationConfig: '/PandaCore/GCK/IntegrationAuth/EnableIntegrationConfig', // 开启或关闭集成登录
}; };
const services = { const services = {
...@@ -319,6 +321,16 @@ const services = { ...@@ -319,6 +321,16 @@ const services = {
method: constants.REQUEST_METHOD_GET, method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP, type: constants.REQUEST_HTTP,
}, },
GetFileUrls: {
url: API.GET_CONFIG_FILE_LIST,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
EnableIntegrationConfig: {
url: API.EnableIntegrationConfig,
method: constants.REQUEST_METHOD_GET,
type: constants.REQUEST_HTTP,
},
}; };
export const searchAutoCity = keywords => { export const searchAutoCity = keywords => {
......
...@@ -7,28 +7,80 @@ import { actionCreators } from '@/containers/App/store'; ...@@ -7,28 +7,80 @@ import { actionCreators } from '@/containers/App/store';
import { store } from '@wisdom-utils/utils'; import { store } from '@wisdom-utils/utils';
import LoginAction from '@/pages/user/login/login'; import LoginAction from '@/pages/user/login/login';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import { notification, Tooltip } from 'antd'; import { notification, Tooltip, message } from 'antd';
import homeIcon from '@/assets/bootPage/集成登录.png'; import homeIcon from '@/assets/bootPage/集成登录.png';
import { appService } from '@/api'; import { appService } from '@/api';
import axios from 'axios'; import axios from 'axios';
import { defaultApp } from '@/micro'; import { defaultApp } from '@/micro';
import { useHistory } from '@wisdom-utils/runtime'; import { useHistory } from '@wisdom-utils/runtime';
import LoadPage from '@/components/LoadPage';
import styles from './index.less'; import styles from './index.less';
const IntegratedSwitch = props => { const IntegratedSwitch = props => {
const timer = useRef(null);
const timer3 = useRef(null);
const progressRef = useRef(0);
const history = useHistory(); const history = useHistory();
const [loginAction, setAction] = useState(() => new LoginAction(props)); const [loginAction, setAction] = useState(() => new LoginAction(props));
const [dataList, setDataList] = useState([]); const [dataList, setDataList] = useState([]);
const [client, setClient] = useState(''); const [client, setClient] = useState('');
const clientRef = useRef(props.global.client);
const [jumpLoading, setJumpLoading] = useState(false);
const [progressValue, setProgressValue] = useState(0);
const jumpProgressEnd = () => {
setProgressValue(100);
timer.current && clearInterval(timer.current);
timer.current = null;
};
const jumpProgressStart = () => {
if (timer.current) {
clearInterval(timer.current);
timer.current = null;
}
progressRef.current = 0;
setProgressValue(0);
timer.current = setInterval(() => {
if (progressRef.current < 97.5) {
progressRef.current += 2.5;
setProgressValue(progressRef.current);
} else {
setProgressValue(99);
timer.current && clearInterval(timer.current);
timer.current = null;
}
}, 100);
};
// 定时消除 loading
const startTiming = (time = 2) => {
if (timer3.current) {
clearInterval(timer3.current);
timer3.current = null;
}
timer3.current = setTimeout(() => {
setJumpLoading(false);
timer.current && clearInterval(timer.current);
timer.current = null;
}, time * 1000);
};
const handError = err => {
if (err) {
message.error(err);
}
setJumpLoading(false);
jumpProgressEnd();
};
useEffect(() => { useEffect(() => {
// if (!window?.globalConfig?.userInfo?.OID || (!(window?.globalConfig?.isIntegration > 1) && window?.globalConfig?.Industry !== '集成登录')) return setDataList([]); // if (!window?.globalConfig?.userInfo?.OID || (!(window?.globalConfig?.isIntegration > 1) && window?.globalConfig?.Industry !== '集成登录')) return setDataList([]);
if (!window?.globalConfig?.userInfo?.OID || !(window?.globalConfig?.isIntegration > 1)) return setDataList([]); if (!window?.globalConfig?.userInfo?.OID || !(window?.globalConfig?.isIntegration >= 1)) return setDataList([]);
appService.GetIntegrationConfig({ appService
.GetIntegrationConfig({
type: '集成登录', type: '集成登录',
userId: window?.globalConfig?.userInfo?.OID ?? null, userId: window?.globalConfig?.userInfo?.OID ?? null,
isEnable: true, isEnable: true,
// client: `${client || props.global.client || ''}`, client:
localStorage.getItem('integrationClient') || sessionStorage.getItem('client') || props?.global?.client || '',
}) })
.then(res => { .then(res => {
setDataList(res?.data || []); setDataList(res?.data || []);
...@@ -41,18 +93,24 @@ const IntegratedSwitch = props => { ...@@ -41,18 +93,24 @@ const IntegratedSwitch = props => {
// 子站跳转 // 子站跳转
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
const handlePage = useCallback((item, loginAction) => { const handlePage = useCallback((item, loginAction) => {
setJumpLoading(true);
jumpProgressStart();
startTiming(5);
if (item.subType === '外链') { if (item.subType === '外链') {
// 营收
if (item.paramValue === 'ticket') { if (item.paramValue === 'ticket') {
// 获取临时token // 获取临时token
appService.getTicketByToken({ token: window.globalConfig?.token }).then(res => { appService.getTicketByToken({ token: window.globalConfig?.token }).then(res => {
if (res.code === 0) { if (res.code === 0) {
const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName}=${res.data}`; const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramValue}=${res.data}`;
if (item?.openOpt === '当前页打开') { if (item?.openOpt === '当前页打开') {
history.push('/thirdParty', { linkUrl: url }); history.push('/thirdParty', { linkUrl: url });
} else { } else {
window.open(url, '_blank'); window.open(url, '_blank');
} }
} else { } else {
setJumpLoading(false);
jumpProgressEnd();
notification.error({ notification.error({
message: '提示', message: '提示',
duration: 3, duration: 3,
...@@ -61,7 +119,9 @@ const IntegratedSwitch = props => { ...@@ -61,7 +119,9 @@ const IntegratedSwitch = props => {
} }
}); });
} else { } else {
const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName}=${window.globalConfig?.token}`; const url = `${item.url + (item.url.indexOf('?') > 0 ? '&' : '?') + item.paramName}=${
window.globalConfig?.token
}`;
if (item?.openOpt === '当前页打开') { if (item?.openOpt === '当前页打开') {
history.push('/thirdParty', { linkUrl: url }); history.push('/thirdParty', { linkUrl: url });
} else { } else {
...@@ -72,9 +132,7 @@ const IntegratedSwitch = props => { ...@@ -72,9 +132,7 @@ const IntegratedSwitch = props => {
if (window.qiankunIsCache) { if (window.qiankunIsCache) {
store.set('event:dropCache'); store.set('event:dropCache');
} }
const cli = item.appKey;
const cli = item.url?.indexOf('client=') >= 0 ? item.url.split('client=')[1] : '';
Cookies.set('client', cli, { Cookies.set('client', cli, {
expires: 86400000 / (24 * 60 * 60 * 1000), expires: 86400000 / (24 * 60 * 60 * 1000),
path: '/', path: '/',
...@@ -87,7 +145,7 @@ const IntegratedSwitch = props => { ...@@ -87,7 +145,7 @@ const IntegratedSwitch = props => {
sessionStorage.setItem(currentProductNew, 0); sessionStorage.setItem(currentProductNew, 0);
setClient(cli); setClient(cli);
clientRef.current = cli;
const config = props.global; const config = props.global;
config.uiwidgets = []; config.uiwidgets = [];
config.widgets = []; config.widgets = [];
...@@ -98,7 +156,7 @@ const IntegratedSwitch = props => { ...@@ -98,7 +156,7 @@ const IntegratedSwitch = props => {
} }
// props.instance && props.instance.updateConfig(config); // props.instance && props.instance.updateConfig(config);
loginAction && loginAction.getUserInfoAndConfig('', true, item.type); loginAction && loginAction.getUserInfoAndConfig('', true);
} else { } else {
let { url } = item; let { url } = item;
if (url?.indexOf('{userId}') >= 0) { if (url?.indexOf('{userId}') >= 0) {
...@@ -122,26 +180,43 @@ const IntegratedSwitch = props => { ...@@ -122,26 +180,43 @@ const IntegratedSwitch = props => {
useEffect(() => { useEffect(() => {
const handleToggleIndustry = event => { const handleToggleIndustry = event => {
history.push(`/?client=${client || props.global.client || ''}`); setJumpLoading(false);
jumpProgressEnd();
history.push(`/?client=${clientRef.current || props.global.client || ''}`);
props.updateCurrentIndex(0); props.updateCurrentIndex(0);
defaultApp(); defaultApp();
}; };
const handleError = () => {
setJumpLoading(false);
jumpProgressEnd();
};
loginAction.events.on('toggleIndustry', handleToggleIndustry); loginAction.events.on('toggleIndustry', handleToggleIndustry);
loginAction.events.on('loginError', handleError);
return () => { return () => {
loginAction.events.removeListener('toggleIndustry', handleToggleIndustry); loginAction.events.removeListener('toggleIndustry', handleToggleIndustry);
loginAction && loginAction.events && loginAction.events.removeListener('loginError', handleError);
}; };
}, [loginAction.events, props]); }, [loginAction.events, props]);
return ( return dataList.length > 1 ? (
dataList.length > 1 ? <div className={styles.switchPage}> <div className={styles.switchPage}>
{jumpLoading ? (
<div className={styles.integrationJumpLoad} key="jumpLoading">
<div style={{ width: '285px' }}>
<LoadPage percent={progressValue / 100} text="页面加载中~" />
</div>
</div>
) : null}
<ul className={classNames(styles.switchPageCase, styles.switchPageSmall)}> <ul className={classNames(styles.switchPageCase, styles.switchPageSmall)}>
<li className={styles.switchPageLi} onClick={() => { history.push('/industry'); }}> <li
className={styles.switchPageLi}
onClick={() => {
history.push('/industry');
}}
>
<div className={styles.switchPageList}> <div className={styles.switchPageList}>
<Tooltip placement="top" title="主页"> <Tooltip placement="top" title="主页">
<img <img src={homeIcon} alt="" />
src={homeIcon}
alt=""
/>
</Tooltip> </Tooltip>
</div> </div>
</li> </li>
...@@ -158,8 +233,8 @@ const IntegratedSwitch = props => { ...@@ -158,8 +233,8 @@ const IntegratedSwitch = props => {
</li> </li>
))} ))}
</ul> </ul>
</div > : null </div>
); ) : null;
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
......
...@@ -9,6 +9,20 @@ ...@@ -9,6 +9,20 @@
width: 100%; width: 100%;
height: 0px; height: 0px;
.integrationJumpLoad {
width: 100vw;
height: 100vh;
position: fixed;
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
z-index: 1080;
padding-bottom: 50px;
background-color: rgba(0, 0, 0, 0.5);
}
.switchPageCase { .switchPageCase {
position: absolute; position: absolute;
bottom: 0; bottom: 0;
......
...@@ -394,7 +394,7 @@ const Layout = props => { ...@@ -394,7 +394,7 @@ const Layout = props => {
type: '集成登录', type: '集成登录',
userId: window.globalConfig.userInfo?.OID ?? null, userId: window.globalConfig.userInfo?.OID ?? null,
isEnable: true, isEnable: true,
client: integrationClient || '' // 只有指定client才能获取集成登录信息 client: integrationClient || props.global.client // 只有指定client才能获取集成登录信息
}) })
.then(res => { .then(res => {
setFirst(false); setFirst(false);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: hongmye * @Author: hongmye
* @Date: 2023-01-10 11:18:55 * @Date: 2023-01-10 11:18:55
*/ */
import React, { useEffect, useMemo, useState } from 'react'; import React, { useEffect, useMemo, useState, useRef } from 'react';
import { Empty, Spin, notification } from 'antd'; import { Empty, Spin, notification } from 'antd';
import SecurityLayout from '@/layouts/SecurityLayout'; import SecurityLayout from '@/layouts/SecurityLayout';
import { appService } from '@/api'; import { appService } from '@/api';
...@@ -22,6 +22,7 @@ const BootPage = props => { ...@@ -22,6 +22,7 @@ const BootPage = props => {
loading: true, loading: true,
error: false, error: false,
}); });
const integratedConfig = useRef({});
const { clear } = useAliveController(); const { clear } = useAliveController();
const history = useHistory(); const history = useHistory();
const [template, setTemplate] = useState(window?.globalConfig?.displayMode || 'default'); const [template, setTemplate] = useState(window?.globalConfig?.displayMode || 'default');
...@@ -56,6 +57,7 @@ const BootPage = props => { ...@@ -56,6 +57,7 @@ const BootPage = props => {
setInfo({ first: false, loading: false, error: true }); setInfo({ first: false, loading: false, error: true });
return; return;
} }
integratedConfig.current = data;
let displayMode = data?.displayMode || 'default'; let displayMode = data?.displayMode || 'default';
if (displayMode === '卡片' || displayMode === '地图') { if (displayMode === '卡片' || displayMode === '地图') {
displayMode = 'default'; displayMode = 'default';
...@@ -69,7 +71,15 @@ const BootPage = props => { ...@@ -69,7 +71,15 @@ const BootPage = props => {
}, []); }, []);
return ( return (
<SecurityLayout>{info.loading ? <Spin /> : info.error ? <Empty /> : <RenderComponent {...props} />}</SecurityLayout> <SecurityLayout>
{info.loading ? (
<Spin />
) : info.error ? (
<Empty />
) : (
<RenderComponent {...{ ...props, ...{ integratedConfig: integratedConfig.current } }} />
)}
</SecurityLayout>
); );
}; };
const mapStateToProps = state => ({ const mapStateToProps = state => ({
......
...@@ -15,12 +15,17 @@ import DanlingPage from './project/danling'; ...@@ -15,12 +15,17 @@ import DanlingPage from './project/danling';
import MilePage from './project/mile'; import MilePage from './project/mile';
import DongyingPage from './project/dongying'; import DongyingPage from './project/dongying';
import QinzhouPage from './project/qinzhou'; import QinzhouPage from './project/qinzhou';
import IntegrationNewPage from './integrationNew';
export const guidePage = [ export const guidePage = [
// type 为true 则需要 功能配置 isPanda 为true // type 为true 则需要 功能配置 isPanda 为true
{ {
label: '集成登录(默认)', label: '集成登录(默认)',
value: 'default', value: 'default',
}, },
{
label: '集成登录(新)',
value: 'integrationNew',
},
{ {
label: '集成登录演示', label: '集成登录演示',
value: 'integration2', value: 'integration2',
...@@ -66,6 +71,7 @@ export const guidePage = [ ...@@ -66,6 +71,7 @@ export const guidePage = [
]; ];
export const BootPageTemplate = { export const BootPageTemplate = {
default: IntegrationPage, default: IntegrationPage,
integrationNew: IntegrationNewPage,
panda: PandaBootPage, panda: PandaBootPage,
integration2: IntegrationPage2, integration2: IntegrationPage2,
demonstration: Demonstration, demonstration: Demonstration,
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
overflow: hidden; overflow: hidden;
z-index: 100; z-index: 100;
transition: all 0.2s; transition: all 0.2s;
background-color: #fff;
iframe { iframe {
border: none; border: none;
......
This diff is collapsed.
.integrationNew {
width: 100%;
position: relative;
height: 100%;
overflow: hidden;
background: url('@/assets/images/integration/danling/背景.png') center/100% 100% no-repeat;
.iframeBackIcon {
position: absolute;
top: 0;
right: -45px;
display: flex;
height: 44px;
width: 44px;
background: rgba(28, 94, 180, 0.95);
border-radius: 7px 0px 0px 7px;
flex-direction: column;
justify-content: space-around;
align-items: center;
font-size: 12px;
transition: all 0.2s;
padding: 3px 0;
img {
width: 17px;
height: 12px;
}
}
.iframeBack:hover {
.iframeBackIcon {
right: 0;
}
.iframeBackLeft {
right: -15px;
}
}
.iframeBackLeft {
position: absolute;
top: 0;
right: 0;
width: 14px;
height: 44px;
background: rgba(28, 94, 180, 0.95);
border-radius: 7px 0 0 7px;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s;
img {
width: 6px;
height: 11px;
}
}
.iframeBack {
width: 44px;
height: 44px;
position: absolute;
top: 50px;
right: 0;
color: #FFF;
cursor: pointer;
user-select: none;
position: absolute;
z-index: 110;
}
.iframeExitIcon {
position: absolute;
top: 0;
left: -45px;
display: flex;
height: 44px;
width: 44px;
background: rgba(28, 94, 180, 0.95);
border-radius: 0 7px 7px 0;
flex-direction: column;
justify-content: space-around;
align-items: center;
font-size: 12px;
transition: all 0.2s;
padding: 3px 0;
img {
width: 17px;
height: 12px;
}
}
.iframeExit:hover {
.iframeExitIcon {
left: 0;
}
.iframeExitLeft {
left: -15px;
}
}
.iframeExitLeft {
position: absolute;
top: 0;
left: 0;
width: 14px;
height: 44px;
background: rgba(28, 94, 180, 0.95);
border-radius: 0 7px 7px 0;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s;
img {
width: 6px;
height: 11px;
}
}
.iframeExit {
width: 44px;
height: 44px;
position: absolute;
top: 4px;
left: 0;
color: #FFF;
cursor: pointer;
user-select: none;
position: absolute;
z-index: 110;
}
.integrationNew_exit {
position: absolute;
right: 10px;
top: 10px;
z-index: 100;
}
.integration_content {
display: flex;
flex-direction: column;
align-items: center;
transform-origin: left top;
position: absolute;
left: 50%;
top: 50%;
padding: 0px 20px 10px;
z-index: 10;
pointer-events: none;
}
//基础平台end
.integrationNew_title {
display: flex;
align-items: center;
justify-content: center;
padding-top: 15px;
padding-bottom: 5px;
.integrationNew_icon {
margin-right: 20px;
img {
max-height: 60px;
}
}
&_text {
flex: none;
color: #fff;
span {
line-height: 64px;
font-weight: bold;
font-size: 36px;
color: #FFFFFF;
letter-spacing: 4px;
// background: linear-gradient(0deg, #56A1EF 0%, #FFFFFF 59%);
// -webkit-background-clip: text;
// -webkit-text-fill-color: transparent;
position: relative;
// top: -8px;
font-family: Microsoft YaHei;
}
}
}
.integrationNew_title_sub {
font-family: Microsoft YaHei;
font-weight: 400;
font-size: 14px;
color: rgba(255, 255, 255, 0.75);
line-height: 22px;
padding: 0 125px;
background: url(@/assets/images/integration/danling/title_left.png) no-repeat left center, url(@/assets/images/integration/danling/title_right.png) no-repeat right center;
background-size: 115px 1px, 115px 1px;
}
.IY_list .IY_row:not(:last-child) {
margin-bottom: 68px;
}
.IY_list {
padding-top: 60px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: auto;
// grid-template-columns: 270px 270px 270px 270px 270px;
// grid-template-rows: 280px;
// gap: 56px 68px;
z-index: 1000;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.IY_row {
display: flex;
justify-content: center;
}
.IY_row .IY_item:not(:last-child) {
margin-right: 56px;
}
.IY_item {
width: 270px;
height: 280px;
border-radius: 50px;
text-align: center;
padding-top: 198px;
transition: all 0.3s;
position: relative;
top: 0;
cursor: pointer;
z-index: 10;
pointer-events: all;
background: url('@/assets/images/integration/mile/领导驾驶舱.png') center/100% 100% no-repeat;
.IY_item_name {
font-weight: bold;
font-size: 24px;
line-height: 42px;
color: #FFFFFF;
}
.IY_item_name_sub {
font-weight: 400;
font-size: 14px;
color: rgba(255, 255, 255, 0.7);
}
}
.IY_item:hover {
top: -15px;
}
}
.integrationJumpLoad {
width: 100%;
height: 100%;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
z-index: 1080;
padding-bottom: 50px;
background-color: rgba(0, 0, 0, 0.6);
}
.hide {
visibility: hidden;
}
@-webkit-keyframes scale-in-center {
0% {
-webkit-transform: scaleY(0);
transform: scaleY(0);
opacity: 1;
}
100% {
-webkit-transform: scaleY(1);
transform: scaleY(1);
opacity: 1;
}
}
@keyframes scale-in-center {
0% {
-webkit-transform: scaleY(0);
transform: scaleY(0);
opacity: 1;
}
100% {
-webkit-transform: scaleY(1);
transform: scaleY(1);
opacity: 1;
}
}
.scaleInCenter {
visibility: visible;
-webkit-animation: scale-in-center .3s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
animation: scale-in-center .3s cubic-bezier(0.250, 0.460, 0.450, 0.940) both;
}
.CarouselRipples {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
& :global {
.CarouselRipples:before {
content: '';
display: inline-block;
vertical-align: middle;
height: 100%;
}
.integrationNew {
.anticon {
vertical-align: 0.125em;
}
}
}
\ No newline at end of file
/* eslint-disable no-lonely-if */ /* eslint-disable no-inner-declarations */
/* eslint-disable no-unused-expressions */
/* eslint-disable prefer-template */
/* eslint-disable react/jsx-boolean-value */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Modal, Collapse, notification } from 'antd'; import { Modal, Collapse, notification } from 'antd';
import { appService } from '@/api'; import { appService } from '@/api';
import classnames from 'classnames'; import classnames from 'classnames';
import { getImageUrl } from '@/utils/utils';
import styles from '../index.less'; import styles from '../index.less';
const { Panel } = Collapse; const { Panel } = Collapse;
const PreviewModal = props => { const PreviewModal = props => {
const { callBackSubmit = () => {}, visible, onCancel, imageUrl, keepImgeUrl, type } = props; const { callBackSubmit = () => {}, visible, onCancel, keepImgeUrl, type, moduleName, groupName } = props;
const [imgData, setImgData] = useState([]); const [imgData, setImgData] = useState([]);
const [pickItem, setPickItem] = useState(''); const [pickItem, setPickItem] = useState('');
const [keepItem, setKeepItem] = useState(''); const [keepItem, setKeepItem] = useState('');
const [keepGroupName, setKeepGroupName] = useState([]); const [keepGroupName, setKeepGroupName] = useState([]);
const update = () => { const update = () => {
appService const req1 = appService.GetIntegrationConfigIcon();
.GetIntegrationConfigIcon()
const req2 = appService.GetFileUrls({
// moduleName: 'icon,androidMenu,menuNew,logo,CityTemp,bootAnimation,loginPageImage,homePageImage,userPageImage',
moduleName: moduleName || 'CityTemp',
});
Promise.all([req1, req2])
.then(res => { .then(res => {
if (res.code === 0) {
const bb = []; const bb = [];
const aa = []; const aa = [];
res.data.map((i, a) => { if (res[0]?.code === 0) {
res[0].data.map((i, a) => {
if (i.files.length > 0 && type !== '' && i.groupName !== '网站图标') { if (i.files.length > 0 && type !== '' && i.groupName !== '网站图标') {
bb.push(i); bb.push(i);
aa.push(i.groupName); aa.push(i.groupName);
...@@ -34,21 +36,12 @@ const PreviewModal = props => { ...@@ -34,21 +36,12 @@ const PreviewModal = props => {
aa.push(i.groupName); aa.push(i.groupName);
} }
}); });
setKeepGroupName(aa); res[0].data.map(i => {
setImgData(bb);
res.data.map(i => {
i.files.map((j, index) => { i.files.map((j, index) => {
if (keepImgeUrl) { if (j.path === keepImgeUrl) {
if (j.path == keepImgeUrl) {
setKeepItem(i.groupName);
setPickItem(index);
}
} else {
if (j.path == imageUrl) {
setKeepItem(i.groupName); setKeepItem(i.groupName);
setPickItem(index); setPickItem(index);
} }
}
}); });
}); });
} else { } else {
...@@ -57,6 +50,37 @@ const PreviewModal = props => { ...@@ -57,6 +50,37 @@ const PreviewModal = props => {
description: res.msg, description: res.msg,
}); });
} }
if (res[1]?.code === 0) {
const urlList = [];
function getUrl(arr) {
if (Array.isArray(arr) && arr.length) {
arr.forEach(a => {
if (Array.isArray(a.fileUrls) && a.fileUrls.length) {
a.fileUrls.forEach(f => {
// if (f && f.includes('CityTemp\\图库')) {
urlList.push({
path: f,
name: '',
type: 'custom',
});
// }
});
}
getUrl(a.child);
});
}
}
getUrl(res[1].data || []);
if (urlList.length) {
aa.push(groupName || '用户上传');
bb.push({
groupName: groupName || '用户上传',
files: urlList,
});
}
}
setKeepGroupName(aa);
setImgData(bb);
}) })
.catch(err => { .catch(err => {
console.error(err); console.error(err);
...@@ -79,6 +103,7 @@ const PreviewModal = props => { ...@@ -79,6 +103,7 @@ const PreviewModal = props => {
} }
onCancel(); onCancel();
}; };
const getImg = img => `${window.location.origin}/${encodeURIComponent(img)}`;
const handleCollapseChange = key => { const handleCollapseChange = key => {
setKeepGroupName(key); setKeepGroupName(key);
...@@ -95,7 +120,7 @@ const PreviewModal = props => { ...@@ -95,7 +120,7 @@ const PreviewModal = props => {
okText="确认" okText="确认"
{...props} {...props}
onOk={() => onSubmit()} onOk={() => onSubmit()}
forceRender={true} forceRender
getContainer={false} getContainer={false}
> >
<Collapse <Collapse
...@@ -117,22 +142,14 @@ const PreviewModal = props => { ...@@ -117,22 +142,14 @@ const PreviewModal = props => {
}} }}
> >
{i.files.map((k, index) => ( {i.files.map((k, index) => (
// <Image
// src={`${isDev ? process.env.PROXY : window.location.origin}${k}`}
// height="100px"
// />
<div className={styles.divItem} key={index}> <div className={styles.divItem} key={index}>
{/* <CheckCircleTwoTone
className={classnames({
[styles.iconHidden]: index !== pickItem || i.groupName !== keepItem,
[styles.iconItem]: index === pickItem && i.groupName === keepItem,
})}
/> */}
<img <img
src={window.location.origin + `/${k.path}`} src={getImageUrl(k.path)}
className={classnames({ className={classnames({
[styles.imgCommon]: true,
[styles.imgHidden]: index !== pickItem || i.groupName !== keepItem, [styles.imgHidden]: index !== pickItem || i.groupName !== keepItem,
[styles.imgItem]: index === pickItem && i.groupName === keepItem, [styles.imgItem]: index === pickItem && i.groupName === keepItem,
[styles.imgCustom]: k.type === 'custom',
})} })}
height="80px" height="80px"
width="80px" width="80px"
......
This diff is collapsed.
...@@ -32,14 +32,17 @@ ...@@ -32,14 +32,17 @@
} }
.doctorTable { .doctorTable {
margin-bottom: 16px; margin-bottom: 10px;
} }
.divItem { .divItem {
display: inline-block; display: inline-block;
margin-left: 30px; margin-left: 30px;
margin-bottom: 30px;
// width: 80px; }
.imgCommon {
border: 3px solid transparent;
} }
.imgItem { .imgItem {
...@@ -56,6 +59,10 @@ ...@@ -56,6 +59,10 @@
background-color: #2881a1; background-color: #2881a1;
} }
.imgCustom {
background-color: #fafafa !important;
}
.imgHidden:hover { .imgHidden:hover {
border: 3px solid #00ff37; border: 3px solid #00ff37;
box-sizing: border-box; box-sizing: border-box;
...@@ -64,10 +71,7 @@ ...@@ -64,10 +71,7 @@
} }
.iconItem { .iconItem {
// position: relative;
// left: 70px;
// top: 10px;
// font-size: 17px;
margin-top: -3px; margin-top: -3px;
font-size: 17px; font-size: 17px;
float: right; float: right;
...@@ -79,10 +83,7 @@ ...@@ -79,10 +83,7 @@
} }
.iconHidden:hover { .iconHidden:hover {
// position: relative;
// left: 70px;
// top: 10px;
// font-size: 17px;
margin-top: -3px; margin-top: -3px;
font-size: 17px; font-size: 17px;
float: right; float: right;
...@@ -92,8 +93,7 @@ ...@@ -92,8 +93,7 @@
.table { .table {
flex: 1; flex: 1;
background-color: white; background-color: white;
//height: calc(100vh - 130px);
//margin-top: 10px;
overflow-y: scroll; overflow-y: scroll;
padding: 8px; padding: 8px;
} }
......
/* eslint-disable prettier/prettier */ /* eslint-disable prettier/prettier */
import React, { useEffect } from 'react'; import React, { useRef, useEffect, useState } from 'react';
import Iframe from 'react-iframe'; import Iframe from 'react-iframe';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
...@@ -8,6 +8,7 @@ import { actionCreators } from '@/containers/App/store'; ...@@ -8,6 +8,7 @@ import { actionCreators } from '@/containers/App/store';
import _ from 'lodash'; import _ from 'lodash';
import { useHistory, useAliveController } from '@wisdom-utils/runtime'; import { useHistory, useAliveController } from '@wisdom-utils/runtime';
import IntegratedSwitch from '@/components/IntegratedSwitch'; import IntegratedSwitch from '@/components/IntegratedSwitch';
import { message } from 'antd';
import styles from './index.less'; import styles from './index.less';
const ThirdParty = props => { const ThirdParty = props => {
...@@ -16,8 +17,38 @@ const ThirdParty = props => { ...@@ -16,8 +17,38 @@ const ThirdParty = props => {
if (!state.linkUrl) { if (!state.linkUrl) {
return props.history.push(`/industry`); return props.history.push(`/industry`);
}
const onMessageBack = e => {
const { data } = e?.data || {};
if (!data?.type) return;
switch (data?.type) {
// 页面加载完成
// 登录成功
case 'runAfterFirstMounted':
case 'loginSuccess':
break;
case 'loginError':
message.warning('登录失败,请联系管理人员');
break;
case '无法连接':
message.warning('该站点无法连接,请联系管理人员');
break;
case 'showBack':
break;
case 'hideBack':
break;
default:
break;
}
}; };
useEffect(() => {
window.addEventListener('message', onMessageBack);
return () => {
window.removeEventListener('message', onMessageBack);
};
}, []);
// eslint-disable-next-line react-hooks/rules-of-hooks // eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => { useEffect(() => {
const tk = Cookies.get('token') || props.global.token; const tk = Cookies.get('token') || props.global.token;
...@@ -58,4 +89,7 @@ const mapDispatchToProps = dispatch => ({ ...@@ -58,4 +89,7 @@ const mapDispatchToProps = dispatch => ({
dispatch(actionCreators.logout()); dispatch(actionCreators.logout());
}, },
}); });
export default connect(mapStateToProps, mapDispatchToProps)(ThirdParty); export default connect(
mapStateToProps,
mapDispatchToProps,
)(ThirdParty);
...@@ -4,3 +4,17 @@ ...@@ -4,3 +4,17 @@
position: relative; position: relative;
overflow: hidden; overflow: hidden;
} }
.integrationJumpLoad {
width: 100%;
height: 100%;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
z-index: 1080;
padding-bottom: 50px;
background-color: rgba(0, 0, 0, 0.5);
}
\ No newline at end of file
...@@ -83,3 +83,27 @@ export function getVideoUrl() { ...@@ -83,3 +83,27 @@ export function getVideoUrl() {
: window.location.origin.replace(protocol, 'ws:'); : window.location.origin.replace(protocol, 'ws:');
return `${address}/`; return `${address}/`;
} }
export const getImageUrl = path => {
if (!path || typeof path !== 'string') return '';
if (path.indexOf('http') === 0) {
return path;
}
if (path.indexOf('data:') === 0) {
return path;
}
if (path.startsWith('assets')) {
return `${window.location.origin}/civweb4/${path}`.replace(/\\/g, '/');
}
if (path.startsWith('center/images')) {
return `${window.location.origin}/${path}`.replace(/\\/g, '/');
}
if (path.includes('/个人信息/')) {
path = `/cityinterface/rest/services/filedownload.svc/download${path}`;
return path;
}
if (!path.includes('CityTemp') && !path.includes('图库')) {
path = `CityTemp\\图库\\${path}`;
}
return `/PandaOMS/OMS/FileCenter/DownLoadFiles?module=图库&filePath=${encodeURIComponent(path)}`;
};
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