index.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * @Author: your name
  3. * @Date: 2022-03-03 18:04:40
  4. * @LastEditTime: 2024-09-13 11:12:26
  5. * @LastEditors: code4eat awesomedema@gmail.com
  6. * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  7. * @FilePath: /KC-MiddlePlatform/src/pages/platform/setting/reports/index.tsx
  8. */
  9. import { useEffect, useState } from 'react';
  10. import { Skeleton } from 'antd';
  11. import { useModel } from 'umi';
  12. export default () => {
  13. const { initialState, setInitialState } = useModel('@@initialState');
  14. const [specialPageUrl, setspecialPageUrl] = useState<string | undefined>(undefined);
  15. const [loading, setloading] = useState(false);
  16. const onLoadhandle = () => {
  17. setloading(false);
  18. };
  19. useEffect(() => {
  20. setloading(true);
  21. if (initialState && initialState.spacicalPageParamsType && initialState.userData) {
  22. const {
  23. spacicalPageParamsType,
  24. userData: { youshuToken },
  25. } = initialState;
  26. const { pathname } = location;
  27. const spacialPage = spacicalPageParamsType.filter((t) => t.path == pathname);
  28. if (spacialPage.length > 0) {
  29. //当前页面属于有数数据展示页面
  30. const url = `${spacialPage[0].url}`;
  31. setspecialPageUrl(url);
  32. }
  33. }
  34. }, [initialState]);
  35. return (
  36. <>
  37. <Skeleton loading={loading} paragraph={{ rows: 50 }} active />
  38. <iframe onLoad={() => onLoadhandle()} style={{ width: '100%', height: '90vh', border: 'none' }} src={specialPageUrl}></iframe>
  39. </>
  40. );
  41. };