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