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

fix: 图片预览修改

parent 5a6a7d77
Pipeline #86426 passed with stages
import { request } from '@wisdom-utils/utils';
import * as constants from '../../constants'; import * as constants from '../../constants';
const portalURL = 'CityInterface/rest/Services/Portal.svc'; const portalURL = 'CityInterface/rest/Services/Portal.svc';
export const API = { export const API = {
GET_DATA_DICTIONARY_LIST: GET_DATA_DICTIONARY_LIST: '/CityInterface/Services/CityServer_WorkFlow/REST/WorkFlowREST.svc/GetDataDictionaryList',
'/CityInterface/Services/CityServer_WorkFlow/REST/WorkFlowREST.svc/GetDataDictionaryList',
// GET_ACCOUNT_PAGELIST: `/CityInterface/Services/CityServer_CaseManage/REST/CaseManageREST.svc/GetAccountPageList`, // GET_ACCOUNT_PAGELIST: `/CityInterface/Services/CityServer_CaseManage/REST/CaseManageREST.svc/GetAccountPageList`,
GET_ACCOUNT_PAGELIST: `/PandaWorkFlow/WorkFlow/AccountManage/GetAccountPageList`, GET_ACCOUNT_PAGELIST: `/PandaWorkFlow/WorkFlow/AccountManage/GetAccountPageList`,
// 云平台使用分析 // 云平台使用分析
LOGIN_STATISTIC: `${portalURL}/OMManage/LoginStatisticServer`, LOGIN_STATISTIC: `${portalURL}/OMManage/LoginStatisticServer`,
FUNCTIONS_STATISTIC: `${portalURL}/OMManage/FunctionStatisticServer`, FUNCTIONS_STATISTIC: `${portalURL}/OMManage/FunctionStatisticServer`,
...@@ -50,4 +49,19 @@ const services = { ...@@ -50,4 +49,19 @@ const services = {
}, },
}; };
export const getAccountPageListSite = (data, props, site) => {
const url = `${API.GET_ACCOUNT_PAGELIST}`;
const token = props && props.access_token !== '' ? props.access_token : localStorage.getItem('access_token');
return request({
url,
method: constants.REQUEST_METHOD_POST,
type: constants.REQUEST_HTTP,
data,
headers: {
'civ-site': site,
Authorization: `Bearer ${token}`,
},
});
};
export default services; export default services;
...@@ -157,64 +157,64 @@ class Site { ...@@ -157,64 +157,64 @@ class Site {
const stations = self.insertYSStation(); const stations = self.insertYSStation();
if (city) { // if (city) {
// eslint-disable-next-line no-undef // // eslint-disable-next-line no-undef
appService // appService
.getWeather({ // .getWeather({
city, // city,
'request.preventCache': new Date().getTime(), // 'request.preventCache': new Date().getTime(),
ignoreSite: true, // ignoreSite: true,
}) // })
// eslint-disable-next-line no-shadow // // eslint-disable-next-line no-shadow
.then(res => { // .then(res => {
if (res.say.statusCode === ERR_OK) { // if (res.say.statusCode === ERR_OK) {
const firtValue = res.getMe[0]; // const firtValue = res.getMe[0];
if (firtValue.cityName) { // if (firtValue.cityName) {
const text = firtValue.forcastFirst.split(' ')[1]; // const text = firtValue.forcastFirst.split(' ')[1];
const imgPath = firtValue.presentPictureFirst.replace('gif', 'svg'); // const imgPath = firtValue.presentPictureFirst.replace('gif', 'svg');
resolve({ // resolve({
stations, // stations,
allStation, // allStation,
weathers: { // weathers: {
icon: `https://panda-water.cn/web4/assets/images/weather2/${imgPath}`, // icon: `https://panda-water.cn/web4/assets/images/weather2/${imgPath}`,
text: `${text} ${firtValue.temperatureFirst}`, // text: `${text} ${firtValue.temperatureFirst}`,
}, // },
siteCityList: self.siteCityList, // siteCityList: self.siteCityList,
citySelector: self.citySelector, // citySelector: self.citySelector,
currentStationName: self.currentStationName, // currentStationName: self.currentStationName,
}); // });
} // }
} else { // } else {
resolve({ // resolve({
stations, // stations,
allStation, // allStation,
siteCityList: self.siteCityList, // siteCityList: self.siteCityList,
citySelector: self.citySelector, // citySelector: self.citySelector,
currentStationName: self.currentStationName, // currentStationName: self.currentStationName,
weathers: {}, // weathers: {},
}); // });
} // }
}) // })
.catch(error => { // .catch(error => {
resolve({ // resolve({
stations, // stations,
allStation, // allStation,
currentStationName: self.currentStationName, // currentStationName: self.currentStationName,
weathers: {}, // weathers: {},
siteCityList: self.siteCityList, // siteCityList: self.siteCityList,
citySelector: self.citySelector, // citySelector: self.citySelector,
}); // });
}); // });
} else { // } else {
resolve({ resolve({
stations, stations,
allStation, allStation,
currentStationName: self.currentStationName, currentStationName: self.currentStationName,
weathers: {}, weathers: {},
siteCityList: self.siteCityList, siteCityList: self.siteCityList,
citySelector: self.citySelector, citySelector: self.citySelector,
}); });
} // }
} }
}); });
} }
......
...@@ -2,11 +2,10 @@ import React, { useEffect, useState, useCallback } from 'react'; ...@@ -2,11 +2,10 @@ import React, { useEffect, useState, useCallback } from 'react';
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons'; import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
import { notification } from 'antd'; import { notification } from 'antd';
import classnames from 'classnames'; import classnames from 'classnames';
import { cloudService } from '@/api'; import { getAccountPageListSite } from '@/api/service/cloud';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import useFullScreen from '../iframe/useFullScreen'; import useFullScreen from '../iframe/useFullScreen';
import styles from './index.less'; import styles from './index.less';
const PrevieView = props => { const PrevieView = props => {
const params = Object.assign({}, props.params, { const params = Object.assign({}, props.params, {
fullscreen: props.params !== undefined && props.params.fullscreen === 'true', fullscreen: props.params !== undefined && props.params.fullscreen === 'true',
...@@ -15,34 +14,38 @@ const PrevieView = props => { ...@@ -15,34 +14,38 @@ const PrevieView = props => {
const { imgName, accountName, fullscreen, canScroll } = params; const { imgName, accountName, fullscreen, canScroll } = params;
const [ref, isFullscreen, handleFullScreen, handleExitFullScreen] = useFullScreen(fullscreen); const [ref, isFullscreen, handleFullScreen, handleExitFullScreen] = useFullScreen(fullscreen);
const [imgUrl, setImgUrl] = useState(''); const [imgUrl, setImgUrl] = useState('');
const userInfo = props.global?.userInfo; const { userInfo = {} } = props.global;
const getImgUrl = useCallback(() => { const getImgUrl = useCallback(() => {
cloudService getAccountPageListSite(
.getAccountPageList({ {
pageIndex: 1, pageIndex: 1,
pageSize: 5, pageSize: 5,
sortFields: '录入时间', sortFields: '录入时间',
direction: 'desc', direction: 'desc',
info: imgName, info: imgName,
accountName, accountName,
}) ignoreSite: true,
},
props.global,
userInfo.site,
)
.then(res => { .then(res => {
const configData = JSON.parse(res.data.jsonData || '[]'); const configData = JSON.parse(res.data.jsonData || '[]');
if (configData.length > 0 && configData[0]['演示图片']) { if (configData.length > 0 && configData[0]['演示图片']) {
const url = `${window.location.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=${ const url = `${window.location.origin}/PandaWorkFlow/WorkFlow/AccountManage/DownloadFiles?filePath=${
configData[0]['演示图片'] configData[0]['演示图片']
}&_site=${userInfo?.site}`; }&_site=${userInfo.site}`;
setImgUrl(url); setImgUrl(url);
} }
}) })
.catch(err => { .catch(err => {
// notification.error({ message: '提示', duration: 3, description: '获取图片信息错误' }); // notification.error({ message: '提示', duration: 3, description: '获取图片信息错误' });
}); });
}); }, [accountName, imgName, props.global, userInfo.site]);
useEffect(() => { useEffect(() => {
getImgUrl(); getImgUrl();
}, [getImgUrl, userInfo]); }, [getImgUrl]);
return ( return (
<div className={classnames(styles['tab-preview'], canScroll ? styles['long-img'] : styles['normal-img'])} ref={ref}> <div className={classnames(styles['tab-preview'], canScroll ? styles['long-img'] : styles['normal-img'])} ref={ref}>
......
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