Explorar o código

生产环境去掉login

李帅 hai 3 semanas
pai
achega
888265b5a9
Modificáronse 4 ficheiros con 145 adicións e 406 borrados
  1. 2 0
      .gitignore
  2. 135 406
      src/router/index.js
  3. 5 0
      src/utils/request.js
  4. 3 0
      vue.config.js

+ 2 - 0
.gitignore

@@ -21,3 +21,5 @@ selenium-debug.log
21 21
 
22 22
 package-lock.json
23 23
 yarn.lock
24
+
25
+helper.json

+ 135 - 406
src/router/index.js

@@ -28,6 +28,140 @@ import ParentView from '@/components/ParentView'
28 28
     activeMenu: '/system/user'      // 当路由设置了该属性,则会高亮相对应的侧边栏。
29 29
   }
30 30
  */
31
+let constantRoutes1 = []
32
+  if (process.env.NODE_ENV === 'production') {
33
+    // 生产环境逻辑
34
+    constantRoutes1 = [
35
+      {
36
+        path: '/redirect',
37
+        component: Layout,
38
+        hidden: true,
39
+        children: [
40
+          {
41
+            path: '/redirect/:path(.*)',
42
+            component: () => import('@/views/redirect')
43
+          }
44
+        ]
45
+      },
46
+      {
47
+        path: '/postcheck',
48
+        component: () => import('@/views/postcheck'),
49
+        hidden: true
50
+      },
51
+      {
52
+        path: '/register',
53
+        component: () => import('@/views/register'),
54
+        hidden: true
55
+      },
56
+      {
57
+        path: '/404',
58
+        component: () => import('@/views/error/404'),
59
+        hidden: true
60
+      },
61
+      {
62
+        path: '',
63
+        redirect: 'index',
64
+        component: Layout,
65
+        hidden: true,
66
+        children: [
67
+          {
68
+            path: 'index',
69
+            component: () => import('@/views/home/index'),
70
+            name: 'Index',
71
+            meta: { title: '首页', icon: 'dashboard', affix: true }
72
+          }
73
+        ]
74
+      },
75
+      {
76
+        path: '/401',
77
+        component: () => import('@/views/error/401'),
78
+        hidden: true
79
+      },
80
+      {
81
+        path: '/user',
82
+        component: Layout,
83
+        hidden: true,
84
+        redirect: 'noredirect',
85
+        children: [
86
+          {
87
+            path: 'profile',
88
+            component: () => import('@/views/system/user/profile/index'),
89
+            name: 'Profile',
90
+            meta: { title: '个人中心', icon: 'user' }
91
+          }
92
+        ]
93
+      },
94
+    ]
95
+  } else {
96
+    // 开发环境逻辑
97
+    console.log('这是开发环境');
98
+    constantRoutes1 = [
99
+      {
100
+        path: '/redirect',
101
+        component: Layout,
102
+        hidden: true,
103
+        children: [
104
+          {
105
+            path: '/redirect/:path(.*)',
106
+            component: () => import('@/views/redirect')
107
+          }
108
+        ]
109
+      },
110
+      {
111
+        path: '/login',
112
+        component: () => import('@/views/login'),
113
+        hidden: true
114
+      },
115
+      {
116
+        path: '/postcheck',
117
+        component: () => import('@/views/postcheck'),
118
+        hidden: true
119
+      },
120
+      {
121
+        path: '/register',
122
+        component: () => import('@/views/register'),
123
+        hidden: true
124
+      },
125
+      {
126
+        path: '/404',
127
+        component: () => import('@/views/error/404'),
128
+        hidden: true
129
+      },
130
+      {
131
+        path: '',
132
+        redirect: 'index',
133
+        component: Layout,
134
+        hidden: true,
135
+        children: [
136
+          {
137
+            path: 'index',
138
+            component: () => import('@/views/home/index'),
139
+            name: 'Index',
140
+            meta: { title: '首页', icon: 'dashboard', affix: true }
141
+          }
142
+        ]
143
+      },
144
+      {
145
+        path: '/401',
146
+        component: () => import('@/views/error/401'),
147
+        hidden: true
148
+      },
149
+      {
150
+        path: '/user',
151
+        component: Layout,
152
+        hidden: true,
153
+        redirect: 'noredirect',
154
+        children: [
155
+          {
156
+            path: 'profile',
157
+            component: () => import('@/views/system/user/profile/index'),
158
+            name: 'Profile',
159
+            meta: { title: '个人中心', icon: 'user' }
160
+          }
161
+        ]
162
+      },
163
+    ]
164
+  }
31 165
 
32 166
 // 公共路由
33 167
 export const constantRoutes = [
@@ -81,19 +215,6 @@ export const constantRoutes = [
81 215
     component: () => import('@/views/error/401'),
82 216
     hidden: true
83 217
   },
84
-  // {
85
-  //   path: '',
86
-  //   component: Layout,
87
-  //   redirect: 'index',
88
-  //   children: [
89
-  //     {
90
-  //       path: 'index',
91
-  //       component: () => import('@/views/index'),
92
-  //       name: 'Index',
93
-  //       meta: { title: '首页', icon: 'dashboard', affix: true }
94
-  //     }
95
-  //   ]
96
-  // },
97 218
   {
98 219
     path: '/user',
99 220
     component: Layout,
@@ -108,398 +229,6 @@ export const constantRoutes = [
108 229
       }
109 230
     ]
110 231
   },
111
-  // {
112
-  //   path: '/postResponsibility',
113
-  //   component: Layout,
114
-  //   redirect: "noRedirect",
115
-  //   meta: { title: '岗位责任制管理' },
116
-  //   redirect: "noRedirect",
117
-  //   alwaysShow: true,
118
-  //   children: [
119
-  //     {
120
-  //       path: 'postResponsibilityOrganization',
121
-  //       name: 'postResponsibilityOrganization',
122
-  //       component: () => import('@/views/postResponsibility/postResponsibilityOrganization/index.vue'),
123
-  //       meta: { title: '岗位责任制编制'}
124
-  //     },
125
-  //     {
126
-  //       path: 'postResponsibilityOrganizationLook',
127
-  //       name: 'postResponsibilityOrganizationLook',
128
-  //       hidden: true,
129
-  //       component: () => import('@/views/postResponsibility/postResponsibilityOrganization/lookPage.vue'),
130
-  //       meta: { title: '责任清单'}
131
-  //     },
132
-  //     {
133
-  //       path: 'assign',
134
-  //       name: 'assign',
135
-  //       hidden: true ,
136
-  //       component: () => import('@/views/postResponsibility/postResponsibilityOrganization/assign.vue'),
137
-  //       meta: { title: '批量处理'}
138
-  //     },
139
-  //     {
140
-  //       path: 'inventoryReview',
141
-  //       name: 'inventoryReview',
142
-  //       component: () => import('@/views/postResponsibility/inventoryReview/index.vue'),
143
-  //       meta: { title: '责任制清单审核'}
144
-  //     },
145
-  //     {
146
-  //       path: 'inventoryRelease',
147
-  //       name: 'inventoryRelease',
148
-  //       component: () => import('@/views/postResponsibility/inventoryRelease/index.vue'),
149
-  //       meta: { title: '责任制清单查看'}
150
-  //     },
151
-  //   ]
152
-  // },
153
-  // {
154
-  //   path: '/postInspectionPlanning',
155
-  //   component: Layout,
156
-  //   redirect: "noRedirect",
157
-  //   meta: { title: '岗检策划' },
158
-  //   children: [
159
-  //     {
160
-  //       path: 'projectManagement',
161
-  //       name: 'projectManagement',
162
-  //       component: () => import('@/views/postInspectionPlanning/schemeReview/index'),
163
-  //       meta: { title: '岗检方案管理'}
164
-  //     //   children: [
165
-  //     //     {
166
-  //     //       path: 'postStation',
167
-  //     //       component: () => import('@/views/postInspectionPlanning/projectManagement/index'),
168
-  //     //       name: 'postStation',
169
-  //     //       meta: { title: '(岗位)岗检方案'}
170
-  //     //     }
171
-  //     //   ]
172
-  //     // },
173
-  //     // {
174
-  //     //   path: 'schemeReview',
175
-  //     //   name: 'schemeReview',
176
-  //     //   component: ParentView,
177
-  //     //   redirect: "noRedirect",
178
-  //     //   meta: { title: '岗检方案审核'},
179
-  //     //   alwaysShow: true,
180
-  //     //   children: [
181
-  //     //     {
182
-  //     //       path: 'auditDepartment',
183
-  //     //       component: () => import('@/views/postInspectionPlanning/schemeReview/index'),
184
-  //     //       name: 'auditDepartment',
185
-  //     //       meta: { title: '(审核部门)岗检方案'}
186
-  //     //     }
187
-  //     //   ]
188
-  //     },
189
-      // {
190
-      //   path: 'teamManagement',
191
-      //   name: 'teamManagement',
192
-      //   component: ParentView,
193
-      //   redirect: "noRedirect",
194
-      //   meta: { title: '岗检小组管理'},
195
-      //   alwaysShow: true,
196
-      //   children: [
197
-      //     {
198
-      //       path: 'institutionalFramework',
199
-      //       component: () => import('@/views/postInspectionPlanning/teamManagement/index'),
200
-      //       name: 'institutionalFramework',
201
-      //       meta: { title: '组织机构'}
202
-      //     },
203
-      //     {
204
-      //       path: 'teamMembers',
205
-      //       hidden: true,
206
-      //       component: () => import('@/views/postInspectionPlanning/teamManagement/teamMembers.vue'),
207
-      //       name: 'teamMembers',
208
-      //       meta: { title: '小组配置'}
209
-      //     },
210
-      //     {
211
-      //       path: 'personnelAllocation',
212
-      //       component: () => import('@/views/postInspectionPlanning/teamManagement/personnelAllocation.vue'),
213
-      //       name: 'personnelAllocation',
214
-      //       meta: { title: '人员配置'}
215
-      //     },
216
-      //     {
217
-      //       path: 'guideGroup',
218
-      //       component: () => import('@/views/postInspectionPlanning/teamManagement/guideGroup.vue'),
219
-      //       name: 'guideGroup',
220
-      //       hidden: true,
221
-      //       meta: { title: '岗检领导小组配置'}
222
-      //     },
223
-      //     {
224
-      //       path: 'jointOffice',
225
-      //       component: () => import('@/views/postInspectionPlanning/teamManagement/jointOffice.vue'),
226
-      //       name: 'jointOffice',
227
-      //       hidden: true,
228
-      //       meta: { title: '岗检联合办公室'}
229
-      //     },
230
-      //     {
231
-      //       path: 'workingGroup',
232
-      //       component: () => import('@/views/postInspectionPlanning/teamManagement/workingGroup.vue'),
233
-      //       name: 'workingGroup',
234
-      //       hidden: true,
235
-      //       meta: { title: '综合岗检工作组'}
236
-      //     }
237
-      //   ]
238
-      // },
239
-  //     {
240
-  //       path: 'planManagement',
241
-  //       name: 'planManagement',
242
-  //       component: ParentView,
243
-  //       redirect: "noRedirect",
244
-  //       meta: { title: '岗检计划管理'},
245
-  //       alwaysShow: true,
246
-  //       children: [
247
-  //         {
248
-  //           path: 'jobPlan',
249
-  //           component: () => import('@/views/postInspectionPlanning/planManagement/jobPlan.vue'),
250
-  //           name: 'jobPlan',
251
-  //           meta: { title: '岗检计划创建'}
252
-  //         },
253
-  //         {
254
-  //           path: 'jobPlanAudit',
255
-  //           component: () => import('@/views/postInspectionPlanning/planManagement/jobPlanAudit.vue'),
256
-  //           name: 'jobPlanAudit',
257
-  //           meta: { title: '岗检计划审核'}
258
-  //         },
259
-  //         {
260
-  //           path: 'jobPlanLook',
261
-  //           component: () => import('@/views/postInspectionPlanning/planManagement/jobPlanLook.vue'),
262
-  //           name: 'jobPlanLook',
263
-  //           meta: { title: '岗检计划查看'}
264
-  //         }
265
-  //       ]
266
-  //     },
267
-  //     {
268
-  //       path: 'tableManagement',
269
-  //       name: 'tableManagement',
270
-  //       component: ParentView,
271
-  //       redirect: "noRedirect",
272
-  //       alwaysShow: true,
273
-  //       meta: { title: '岗检表管理'},
274
-  //       children: [
275
-  //         {
276
-  //           path: 'addTableManagement',
277
-  //           component: () => import('@/views/postInspectionPlanning/tableManagement/index.vue'),
278
-  //           name: 'addTableManagement',
279
-  //           meta: { title: '岗检表创建'}
280
-  //         },
281
-  //         {
282
-  //           path: 'tableManagementAudit',
283
-  //           component: () => import('@/views/postInspectionPlanning/tableManagement/tableManagementAudit.vue'),
284
-  //           name: 'tableManagementAudit',
285
-  //           meta: { title: '岗检表审核'}
286
-  //         },
287
-  //         {
288
-  //           path: 'tableManagementLook',
289
-  //           component: () => import('@/views/postInspectionPlanning/tableManagement/tableManagementLook.vue'),
290
-  //           name: 'tableManagementLook',
291
-  //           meta: { title: '岗检表查看'}
292
-  //         }
293
-  //       ]
294
-  //     }
295
-  //   ]
296
-  // },
297
-  // {
298
-  //   path: '/postImplementation',
299
-  //   component: Layout,
300
-  //   redirect: "noRedirect",
301
-  //   meta: { title: '岗检实施' },
302
-  //   alwaysShow: true,
303
-  //   children: [
304
-  //     {
305
-  //       path: 'recordUpload',
306
-  //       name: 'recordUpload',
307
-  //       component: () => import('@/views/postImplementation/recordUpload.vue'),
308
-  //       meta: { title: '岗检记录上传'}
309
-  //     },
310
-  //     {
311
-  //       path: 'problemEntry',
312
-  //       name: 'problemEntry',
313
-  //       component: () => import('@/views/postImplementation/problemEntry.vue'),
314
-  //       meta: { title: '岗检问题录入'}
315
-  //     },
316
-  //     {
317
-  //       path: 'rectificationProblem',
318
-  //       name: 'rectificationProblem',
319
-  //       component: ParentView,
320
-  //       redirect: "noRedirect",
321
-  //       meta: { title: '岗检问题整改'},
322
-  //       alwaysShow: true,
323
-  //       children: [
324
-  //         {
325
-  //           path: 'remediationAction',
326
-  //           component: () => import('@/views/postImplementation/rectificationProblem/remediationAction/index.vue'),
327
-  //           name: 'remediationAction',
328
-  //           meta: { title: '整改实施'}
329
-  //         },
330
-  //         {
331
-  //           path: 'rectificationVerification',
332
-  //           component: () => import('@/views/postImplementation/rectificationProblem/rectificationVerification/index.vue'),
333
-  //           name: 'rectificationVerification',
334
-  //           meta: { title: '整改验证'}
335
-  //         }
336
-  //       ]
337
-  //     },
338
-  //     {
339
-  //       path: 'reportManagement',
340
-  //       name: 'reportManagement',
341
-  //       component: () => import('@/views/postImplementation/reportManagement/index.vue'),
342
-  //       meta: { title: '岗检报告管理'}
343
-  //     },
344
-  //     {
345
-  //       path: 'reportReview',
346
-  //       name: 'reportReview',
347
-  //       component: () => import('@/views/postImplementation/reportReview.vue'),
348
-  //       meta: { title: '岗检报告审核'}
349
-  //     }
350
-  //   ]
351
-  // },
352
-  // {
353
-  //   path: '/examineCompetition',
354
-  //   component: Layout,
355
-  //   meta: { title: '考核评比' },
356
-  //   redirect: "noRedirect",
357
-  //   alwaysShow: true,
358
-  //   children: [
359
-  //     {
360
-  //       path: 'examineRanking',
361
-  //       name: 'examineRanking',
362
-  //       component: () => import('@/views/examineCompetition/examineRanking/index.vue'),
363
-  //       meta: { title: '考核排名'}
364
-  //     },
365
-  //     {
366
-  //       path: 'ruleManagement',
367
-  //       name: 'ruleManagement',
368
-  //       component: ParentView,
369
-  //       redirect: "noRedirect",
370
-  //       meta: { title: '考核评比规则管理'},
371
-  //       alwaysShow: true,
372
-  //       children: [
373
-  //         {
374
-  //           path: 'assessment',
375
-  //           component: () => import('@/views/examineCompetition/assessment/index.vue'),
376
-  //           name: 'assessment',
377
-  //           meta: { title: '互评'}
378
-  //         },
379
-  //         {
380
-  //           path: 'assessmentEditOrLook',
381
-  //           component: () => import('@/views/examineCompetition/assessment/isEditDialog.vue'),
382
-  //           name: 'assessmentEditOrLook',
383
-  //           meta: { title: '职能互评表'},
384
-  //           hidden: true,
385
-  //         },
386
-  //         {
387
-  //           path: 'produceScore',
388
-  //           component: () => import('@/views/examineCompetition/assessment/produceScore.vue'),
389
-  //           name: 'produceScore',
390
-  //           meta: { title: '生产部门日常得分'},
391
-  //           hidden: true,
392
-  //         },
393
-  //         {
394
-  //           path: 'assessmentRules',
395
-  //           component: () => import('@/views/examineCompetition/assessmentRules/index.vue'),
396
-  //           name: 'assessmentRules',
397
-  //           meta: { title: '考核规则'}
398
-  //         },
399
-          // {
400
-          //   path: 'functionalDepartment',
401
-          //   component: () => import('@/views/examineCompetition/ruleManagement/functionalDepartment.vue'),
402
-          //   name: 'functionalDepartment',
403
-          //   meta: { title: '职能部门互评表'}
404
-          // },
405
-          // {
406
-          //   path: 'productionDepartment',
407
-          //   component: () => import('@/views/examineCompetition/ruleManagement/productionDepartment.vue'),
408
-          //   name: 'productionDepartment',
409
-          //   meta: { title: '生产部门日常得分'}
410
-          // }
411
-  //       ]
412
-  //     },
413
-  //     {
414
-  //       path: 'ruleReview',
415
-  //       name: 'ruleReview',
416
-  //       component: () => import('@/views/examineCompetition/ruleReview/index.vue'),
417
-  //       meta: { title: '考核规则审核'}
418
-  //     },
419
-  //   ]
420
-  // },
421
-  // {
422
-  //   path: '/statisticAnalysis',
423
-  //   component: Layout,
424
-  //   redirect: "noRedirect",
425
-  //   meta: { title: '统计分析' },
426
-  //   alwaysShow: true,
427
-  //   children: [
428
-  //     {
429
-  //       path: 'checkStatistics',
430
-  //       name: 'checkStatistics',
431
-  //       component: ParentView,
432
-  //       meta: { title: '检查统计'},
433
-  //       redirect: "noRedirect",
434
-  //       alwaysShow: true,
435
-  //       children: [
436
-  //         {
437
-  //           path: 'problemStatistics',
438
-  //           component: () => import('@/views/statisticAnalysis/checkStatistics/index.vue'),
439
-  //           name: 'problemStatistics',
440
-  //           meta: { title: '问题统计'}
441
-  //         },
442
-  //         {
443
-  //           path: 'lookDialogPage',
444
-  //           hidden: true,
445
-  //           component: () => import('@/views/statisticAnalysis/lookDialogPage.vue'),
446
-  //           name: 'lookDialogPage',
447
-  //           meta: { title: '统计-查看'}
448
-  //         },
449
-  //       ]
450
-  //     },
451
-  //     {
452
-  //       path: 'problemStatistics',
453
-  //       name: 'problemStatistics',
454
-  //       component: ParentView,
455
-  //       meta: { title: '整改统计'},
456
-  //       redirect: "noRedirect",
457
-  //       alwaysShow: true,
458
-  //       children: [
459
-  //         {
460
-  //           path: 'rectificationStatistics',
461
-  //           component: () => import('@/views/statisticAnalysis/problemStatistics/index.vue'),
462
-  //           name: 'rectificationStatistics',
463
-  //           meta: { title: '整改统计'}
464
-  //         }
465
-  //       ]
466
-  //     },
467
-  //   ]
468
-  // },
469
-  // {
470
-  //   path: '/jobinspectionHistory',
471
-  //   component: Layout,
472
-  //   meta: { title: '岗检历史' },
473
-  //   redirect: "noRedirect",
474
-  //   alwaysShow: true,
475
-  //   children: [
476
-  //     {
477
-  //       path: 'jobinspectionHistory',
478
-  //       name: 'jobinspectionHistory',
479
-  //       component: () => import('@/views/jobinspectionHistory/jobinspectionHistory/jobinspectionHistory.vue'),
480
-  //       meta: { title: '岗检历史'}
481
-  //     },
482
-  //     {
483
-  //       path: 'jobinspectionHistoryLook',
484
-  //       name: 'jobinspectionHistoryLook',
485
-  //       hidden: true,
486
-  //       component: () => import('@/views/jobinspectionHistory/jobinspectionHistory/jobinspectionHistoryLook.vue'),
487
-  //       meta: { title: '岗检历史-查看'}
488
-  //     },
489
-  //     {
490
-  //       path: 'jobinspectionProblem',
491
-  //       name: 'jobinspectionProblem',
492
-  //       component: () => import('@/views/jobinspectionHistory/jobinspectionProblem/index.vue'),
493
-  //       meta: { title: '岗检问题库'}
494
-  //     },
495
-  //     {
496
-  //       path: 'jobinspectionHighlights',
497
-  //       name: 'jobinspectionHighlights',
498
-  //       component: () => import('@/views/jobinspectionHistory/jobinspectionHighlights/index.vue'),
499
-  //       meta: { title: '岗检亮点'}
500
-  //     },
501
-  //   ]
502
-  // },
503 232
 ]
504 233
 
505 234
 // 动态路由,基于用户权限动态去加载
@@ -591,5 +320,5 @@ Router.prototype.replace = function push(location) {
591 320
 export default new Router({
592 321
   mode: 'history', // 去掉url中的#
593 322
   scrollBehavior: () => ({ y: 0 }),
594
-  routes: constantRoutes
323
+  routes: constantRoutes1
595 324
 })

+ 5 - 0
src/utils/request.js

@@ -12,10 +12,15 @@ let downloadLoadingInstance;
12 12
 export let isRelogin = { show: false };
13 13
 
14 14
 axios.defaults.headers["Content-Type"] = "application/json;charset=utf-8";
15
+// axios.defaults.headers.post['Access-Control-Allow-Origin']='*'
16
+
15 17
 // 创建axios实例
16 18
 const service = axios.create({
17 19
   // axios中请求配置有baseURL选项,表示请求URL公共部分
18 20
   baseURL: getBaseUrl(),
21
+  headers: {
22
+    'X-Frame-Options': 'SAMEORIGIN'
23
+  },
19 24
   // 超时
20 25
   // timeout: 10000
21 26
   timeout: 30000,

+ 3 - 0
vue.config.js

@@ -33,6 +33,9 @@ module.exports = {
33 33
     host: '0.0.0.0',
34 34
     port: port,
35 35
     open: true,
36
+    headers: {
37
+      'X-Frame-Options': 'SAMEORIGIN', // 只允许同源嵌套
38
+    },
36 39
     proxy: {
37 40
       // detail: https://cli.vuejs.org/config/#devserver-proxy
38 41
       [process.env.VUE_APP_BASE_API]: {