index.js 684 Bytes
Newer Older
邓晓峰's avatar
邓晓峰 committed
1 2
import React from 'react';
import Iframe from 'react-iframe';
邓晓峰's avatar
邓晓峰 committed
3 4
import { connect } from 'react-redux';
const ShareFrame = props => {
邓晓峰's avatar
邓晓峰 committed
5
  const state = props.location.state || {};
邓晓峰's avatar
邓晓峰 committed
6

邓晓峰's avatar
邓晓峰 committed
7 8 9 10
  if (!state.linkUrl) {
    return null;
  }
  const { token, userInfo } = props.global;
邓晓峰's avatar
邓晓峰 committed
11

邓晓峰's avatar
邓晓峰 committed
12 13
  return (
    <Iframe
邓晓峰's avatar
邓晓峰 committed
14
      url={`${state.linkUrl}?token=${token}&loginName=${userInfo.loginName}`}
邓晓峰's avatar
邓晓峰 committed
15 16 17 18 19 20 21 22 23 24
      width="100%"
      height="100%"
      id="myId"
      frameBorder="0"
      className="myClassname"
      display="initial"
      position="relative"
    />
  );
};
邓晓峰's avatar
邓晓峰 committed
25 26

const mapStateToProps = state => ({
邓晓峰's avatar
邓晓峰 committed
27
  global: state.getIn(['global', 'globalConfig']),
邓晓峰's avatar
邓晓峰 committed
28
});
邓晓峰's avatar
邓晓峰 committed
29
export default connect(mapStateToProps)(ShareFrame);