1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = undefined;
|
7 |
|
8 | var _react = require('react');
|
9 |
|
10 | var _react2 = _interopRequireDefault(_react);
|
11 |
|
12 | var _img = require('@icedesign/img');
|
13 |
|
14 | var _img2 = _interopRequireDefault(_img);
|
15 |
|
16 | var _layout = require('@icedesign/layout');
|
17 |
|
18 | var _layout2 = _interopRequireDefault(_layout);
|
19 |
|
20 | var _menu = require('@icedesign/menu');
|
21 |
|
22 | var _menu2 = _interopRequireDefault(_menu);
|
23 |
|
24 | var _foundationSymbol = require('foundation-symbol');
|
25 |
|
26 | var _foundationSymbol2 = _interopRequireDefault(_foundationSymbol);
|
27 |
|
28 | var _reactRouter = require('react-router');
|
29 |
|
30 | var _navs = require('./navs');
|
31 |
|
32 | var _Logo = require('./Logo');
|
33 |
|
34 | var _Logo2 = _interopRequireDefault(_Logo);
|
35 |
|
36 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37 |
|
38 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
39 |
|
40 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
41 |
|
42 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
43 |
|
44 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : _defaults(subClass, superClass); }
|
45 |
|
46 | var Balloon = require('@icedesign/base/lib/balloon');
|
47 |
|
48 | var Icon = require('@icedesign/base/lib/icon');
|
49 |
|
50 | var Header = function (_PureComponent) {
|
51 | _inherits(Header, _PureComponent);
|
52 |
|
53 | function Header() {
|
54 | _classCallCheck(this, Header);
|
55 |
|
56 | return _possibleConstructorReturn(this, _PureComponent.apply(this, arguments));
|
57 | }
|
58 |
|
59 | Header.prototype.render = function render() {
|
60 | var _props = this.props,
|
61 | width = _props.width,
|
62 | theme = _props.theme,
|
63 | isMobile = _props.isMobile;
|
64 |
|
65 |
|
66 | return _react2.default.createElement(
|
67 | _layout2.default.Header,
|
68 | {
|
69 | theme: theme,
|
70 | className: 'ice-design-layout-header',
|
71 | style: { width: width }
|
72 | },
|
73 | _react2.default.createElement(_Logo2.default, null),
|
74 | _react2.default.createElement(
|
75 | 'div',
|
76 | {
|
77 | className: 'ice-design-layout-header-menu',
|
78 | style: { display: 'flex' }
|
79 | },
|
80 | _navs.headerNavs && _navs.headerNavs.length > 0 ? _react2.default.createElement(
|
81 | _menu2.default,
|
82 | { mode: 'horizontal', selectedKeys: [] },
|
83 | _navs.headerNavs.map(function (nav, idx) {
|
84 | var linkProps = {};
|
85 | if (nav.newWindow) {
|
86 | linkProps.href = nav.to;
|
87 | linkProps.target = '_blank';
|
88 | } else if (nav.external) {
|
89 | linkProps.href = nav.to;
|
90 | } else {
|
91 | linkProps.to = nav.to;
|
92 | }
|
93 | return _react2.default.createElement(
|
94 | _menu2.default.Item,
|
95 | { key: idx },
|
96 | _react2.default.createElement(
|
97 | _reactRouter.Link,
|
98 | linkProps,
|
99 | nav.icon ? _react2.default.createElement(_foundationSymbol2.default, { type: nav.icon, size: 'small' }) : null,
|
100 | !isMobile ? nav.text : null
|
101 | )
|
102 | );
|
103 | })
|
104 | ) : null,
|
105 | _react2.default.createElement(
|
106 | Balloon,
|
107 | {
|
108 | trigger: _react2.default.createElement(
|
109 | 'div',
|
110 | {
|
111 | className: 'ice-design-header-userpannel',
|
112 | style: {
|
113 | marginLeft: 20,
|
114 | display: 'flex',
|
115 | alignItems: 'center',
|
116 | fontSize: 12
|
117 | }
|
118 | },
|
119 | _react2.default.createElement(_img2.default, {
|
120 | height: 40,
|
121 | width: 40,
|
122 | src: 'https://img.alicdn.com/tfs/TB1L6tBXQyWBuNjy0FpXXassXXa-80-80.png',
|
123 | style: { marginRight: '12px', borderRadius: 4 }
|
124 | }),
|
125 | _react2.default.createElement(
|
126 | 'div',
|
127 | { className: 'user-profile' },
|
128 | _react2.default.createElement(
|
129 | 'span',
|
130 | { className: 'user-name', style: { fontSize: '13px' } },
|
131 | '\u6DD8\u5C0F\u5B9D'
|
132 | ),
|
133 | _react2.default.createElement('br', null),
|
134 | _react2.default.createElement(
|
135 | 'span',
|
136 | {
|
137 | className: 'user-department',
|
138 | style: { fontSize: '12px' }
|
139 | },
|
140 | '\u6280\u672F\u90E8'
|
141 | )
|
142 | ),
|
143 | _react2.default.createElement(Icon, {
|
144 | type: 'arrow-down-filling',
|
145 | size: 'xxs',
|
146 | className: 'icon-down'
|
147 | })
|
148 | ),
|
149 | closable: false,
|
150 | className: 'user-profile-menu'
|
151 | },
|
152 | _react2.default.createElement(
|
153 | 'ul',
|
154 | null,
|
155 | _react2.default.createElement(
|
156 | 'li',
|
157 | { className: 'user-profile-menu-item' },
|
158 | _react2.default.createElement(
|
159 | _reactRouter.Link,
|
160 | { to: '/' },
|
161 | _react2.default.createElement(_foundationSymbol2.default, { type: 'person', size: 'small' }),
|
162 | '\u6211\u7684\u4E3B\u9875'
|
163 | )
|
164 | ),
|
165 | _react2.default.createElement(
|
166 | 'li',
|
167 | { className: 'user-profile-menu-item' },
|
168 | _react2.default.createElement(
|
169 | _reactRouter.Link,
|
170 | { to: '/' },
|
171 | _react2.default.createElement(_foundationSymbol2.default, { type: 'repair', size: 'small' }),
|
172 | '\u8BBE\u7F6E'
|
173 | )
|
174 | ),
|
175 | _react2.default.createElement(
|
176 | 'li',
|
177 | { className: 'user-profile-menu-item' },
|
178 | _react2.default.createElement(
|
179 | _reactRouter.Link,
|
180 | { to: '/' },
|
181 | _react2.default.createElement(_foundationSymbol2.default, { type: 'compass', size: 'small' }),
|
182 | '\u9000\u51FA'
|
183 | )
|
184 | )
|
185 | )
|
186 | )
|
187 | )
|
188 | );
|
189 | };
|
190 |
|
191 | return Header;
|
192 | }(_react.PureComponent);
|
193 |
|
194 | exports.default = Header;
|
195 | module.exports = exports['default']; |
\ | No newline at end of file |