Browse Source

feat: iframe

nodejh 6 years ago
parent
commit
f74139fad4

+ 174
- 155
.roadhogrc.mock.js View File

@@ -135,161 +135,180 @@ const proxy = {
135 135
       path: '/base/category/list',
136 136
     });
137 137
   },
138
-   'GET /api/menus':[
139
-       {
140
-         name: 'dashboard',
141
-         icon: 'dashboard',
142
-         path: 'dashboard',
143
-         children: [
144
-           {
145
-             name: '分析页',
146
-             path: 'analysis',
147
-           },
148
-           {
149
-             name: '监控页',
150
-             path: 'monitor',
151
-           },
152
-           {
153
-             name: '工作台',
154
-             path: 'workplace',
155
-             // hideInBreadcrumb: true,
156
-             // hideInMenu: true,
157
-           },
158
-         ],
159
-       },
160
-       {
161
-         name: '表单页',
162
-         icon: 'form',
163
-         path: 'form',
164
-         children: [
165
-           {
166
-             name: '基础表单',
167
-             path: 'basic-form',
168
-           },
169
-           {
170
-             name: '分步表单',
171
-             path: 'step-form',
172
-           },
173
-           {
174
-             name: '高级表单',
175
-             authority: 'admin',
176
-             path: 'advanced-form',
177
-           },
178
-         ],
179
-       },
180
-       {
181
-         name: '列表页',
182
-         icon: 'table',
183
-         path: 'list',
184
-         children: [
185
-           {
186
-             name: '查询表格',
187
-             path: 'table-list',
188
-           },
189
-           {
190
-             name: '标准列表',
191
-             path: 'basic-list',
192
-           },
193
-           {
194
-             name: '卡片列表',
195
-             path: 'card-list',
196
-           },
197
-           {
198
-             name: '搜索列表',
199
-             path: 'search',
200
-             children: [
201
-               {
202
-                 name: '搜索列表(文章)',
203
-                 path: 'articles',
204
-               },
205
-               {
206
-                 name: '搜索列表(项目)',
207
-                 path: 'projects',
208
-               },
209
-               {
210
-                 name: '搜索列表(应用)',
211
-                 path: 'applications',
212
-               },
213
-             ],
214
-           },
215
-         ],
216
-       },
217
-       {
218
-         name: '详情页',
219
-         icon: 'profile',
220
-         path: 'profile',
221
-         children: [
222
-           {
223
-             name: '基础详情页',
224
-             path: 'basic',
225
-           },
226
-           {
227
-             name: '高级详情页',
228
-             path: 'advanced',
229
-             authority: 'admin',
230
-           },
231
-         ],
232
-       },
233
-       {
234
-         name: '结果页',
235
-         icon: 'check-circle-o',
236
-         path: 'result',
237
-         children: [
238
-           {
239
-             name: '成功',
240
-             path: 'success',
241
-           },
242
-           {
243
-             name: '失败',
244
-             path: 'fail',
245
-           },
246
-         ],
247
-       },
248
-       {
249
-         name: '异常页',
250
-         icon: 'warning',
251
-         path: 'exception',
252
-         children: [
253
-           {
254
-             name: '403',
255
-             path: '403',
256
-           },
257
-           {
258
-             name: '404',
259
-             path: '404',
260
-           },
261
-           {
262
-             name: '500',
263
-             path: '500',
264
-           },
265
-           {
266
-             name: '触发异常',
267
-             path: 'trigger',
268
-             hideInMenu: true,
269
-           },
270
-         ],
271
-       },
272
-       {
273
-         name: '账户',
274
-         icon: 'user',
275
-         path: 'user',
276
-         authority: 'guest',
277
-         children: [
278
-           {
279
-             name: '登录',
280
-             path: 'login',
281
-           },
282
-           {
283
-             name: '注册',
284
-             path: 'register',
285
-           },
286
-           {
287
-             name: '注册结果',
288
-             path: 'register-result',
289
-           },
290
-         ],
291
-       },
292
-     ]
138
+  'GET /api/menus': [
139
+    {
140
+      name: 'dashboard',
141
+      icon: 'dashboard',
142
+      path: 'dashboard',
143
+      children: [
144
+        {
145
+          name: '分析页',
146
+          path: 'analysis',
147
+        },
148
+        {
149
+          name: '监控页',
150
+          path: 'monitor',
151
+        },
152
+        {
153
+          name: '工作台',
154
+          path: 'workplace',
155
+          // hideInBreadcrumb: true,
156
+          // hideInMenu: true,
157
+        },
158
+      ],
159
+    },
160
+    {
161
+      name: '表单页',
162
+      icon: 'form',
163
+      path: 'form',
164
+      children: [
165
+        {
166
+          name: '基础表单',
167
+          path: 'basic-form',
168
+        },
169
+        {
170
+          name: '分步表单',
171
+          path: 'step-form',
172
+        },
173
+        {
174
+          name: '高级表单',
175
+          authority: 'admin',
176
+          path: 'advanced-form',
177
+        },
178
+      ],
179
+    },
180
+    {
181
+      name: '列表页',
182
+      icon: 'table',
183
+      path: 'list',
184
+      children: [
185
+        {
186
+          name: '查询表格',
187
+          path: 'table-list',
188
+        },
189
+        {
190
+          name: '标准列表',
191
+          path: 'basic-list',
192
+        },
193
+        {
194
+          name: '卡片列表',
195
+          path: 'card-list',
196
+        },
197
+        {
198
+          name: '搜索列表',
199
+          path: 'search',
200
+          children: [
201
+            {
202
+              name: '搜索列表(文章)',
203
+              path: 'articles',
204
+            },
205
+            {
206
+              name: '搜索列表(项目)',
207
+              path: 'projects',
208
+            },
209
+            {
210
+              name: '搜索列表(应用)',
211
+              path: 'applications',
212
+            },
213
+          ],
214
+        },
215
+      ],
216
+    },
217
+    {
218
+      name: '详情页',
219
+      icon: 'profile',
220
+      path: 'profile',
221
+      children: [
222
+        {
223
+          name: '基础详情页',
224
+          path: 'basic',
225
+        },
226
+        {
227
+          name: '高级详情页',
228
+          path: 'advanced',
229
+          authority: 'admin',
230
+        },
231
+      ],
232
+    },
233
+    {
234
+      name: '结果页',
235
+      icon: 'check-circle-o',
236
+      path: 'result',
237
+      children: [
238
+        {
239
+          name: '成功',
240
+          path: 'success',
241
+        },
242
+        {
243
+          name: '失败',
244
+          path: 'fail',
245
+        },
246
+      ],
247
+    },
248
+    {
249
+      name: '异常页',
250
+      icon: 'warning',
251
+      path: 'exception',
252
+      children: [
253
+        {
254
+          name: '403',
255
+          path: '403',
256
+        },
257
+        {
258
+          name: '404',
259
+          path: '404',
260
+        },
261
+        {
262
+          name: '500',
263
+          path: '500',
264
+        },
265
+        {
266
+          name: '触发异常',
267
+          path: 'trigger',
268
+          hideInMenu: true,
269
+        },
270
+      ],
271
+    },
272
+    {
273
+      name: '账户',
274
+      icon: 'user',
275
+      path: 'user',
276
+      authority: 'guest',
277
+      children: [
278
+        {
279
+          name: '登录',
280
+          path: 'login',
281
+        },
282
+        {
283
+          name: '注册',
284
+          path: 'register',
285
+        },
286
+        {
287
+          name: '注册结果',
288
+          path: 'register-result',
289
+        },
290
+      ],
291
+    },
292
+    {
293
+      name: 'iframe',
294
+      icon: 'desktop',
295
+      path: 'iframe',
296
+      children: [
297
+        {
298
+          name: 'Note',
299
+          path: 'note', // https://team.links123.com/Note
300
+        },
301
+        {
302
+          name: 'Project',
303
+          path: 'project', // https://team.links123.com/Note
304
+        },
305
+        {
306
+          name: 'Member',
307
+          path: 'member', // https://team.links123.com/Member
308
+        },
309
+      ],
310
+    },
311
+  ],
293 312
 };
294 313
 
295 314
 export default (noProxy ? {} : delay(proxy, 1000));

+ 1
- 0
package.json View File

@@ -46,6 +46,7 @@
46 46
     "react-document-title": "^2.0.3",
47 47
     "react-dom": "^16.2.0",
48 48
     "react-fittext": "^1.0.0",
49
+    "react-iframe": "^1.1.0",
49 50
     "rollbar": "^2.3.4",
50 51
     "url-polyfill": "^1.0.10"
51 52
   },

+ 10
- 0
src/common/router.js View File

@@ -171,6 +171,16 @@ export const getRouterData = app => {
171 171
     // '/user/:id': {
172 172
     //   component: dynamicWrapper(app, [], () => import('../routes/User/SomeComponent')),
173 173
     // },
174
+
175
+    '/iframe/note': {
176
+      component: dynamicWrapper(app, [], () => import('../routes/Iframe/Note')),
177
+    },
178
+    '/iframe/project': {
179
+      component: dynamicWrapper(app, [], () => import('../routes/Iframe/Project')),
180
+    },
181
+    '/iframe/member': {
182
+      component: dynamicWrapper(app, [], () => import('../routes/Iframe/Member')),
183
+    },
174 184
   };
175 185
   // Get name from ./menu.js or just set it in the router data.
176 186
   // const menuData = getFlatMenuData(getMenuData());

+ 14
- 0
src/routes/Iframe/Member/index.js View File

@@ -0,0 +1,14 @@
1
+import React from 'react';
2
+import Iframe from 'react-iframe';
3
+
4
+const Member = () => (
5
+  <Iframe
6
+    url="https://team.links123.com/Member"
7
+    width="100%"
8
+    height="500"
9
+    // height="100%"
10
+    position="relative"
11
+  />
12
+);
13
+
14
+export default Member;

+ 23
- 0
src/routes/Iframe/Note/index.js View File

@@ -0,0 +1,23 @@
1
+import React from 'react';
2
+
3
+const Note = () => (
4
+  <div
5
+    style={{
6
+      width: '100%',
7
+      height: '100%',
8
+      background: '#fff',
9
+    }}
10
+  >
11
+    {/* <iframe src="https://team.links123.com/Note" title="Note" /> */}
12
+    <iframe
13
+      src="http://localhost:5000"
14
+      title="Note"
15
+      // scrolling="no"
16
+      frameBorder="0"
17
+      width="100%"
18
+      height="100%"
19
+    />
20
+  </div>
21
+);
22
+
23
+export default Note;

+ 14
- 0
src/routes/Iframe/Project/index.js View File

@@ -0,0 +1,14 @@
1
+import React from 'react';
2
+import Iframe from 'react-iframe';
3
+
4
+const Project = () => (
5
+  <Iframe
6
+    url="https://team.links123.com/Project"
7
+    width="100%"
8
+    // height="500"
9
+    height="100%"
10
+    position="relative"
11
+  />
12
+);
13
+
14
+export default Project;