Ver código fonte

feat: 打包未找到js/图片的bug / 严格控制单点登录

@dayan_hjm 2 anos atrás
pai
commit
04065cbc05

+ 5 - 5
config/webpack.common.js

@@ -34,7 +34,7 @@ const plugins = [
34 34
     inject: false
35 35
   }),
36 36
 ];
37
-
37
+const name_ = 'data-operation-screen/'
38 38
 module.exports = {
39 39
   entry: [path.resolve(__dirname, "../src/index.js")],
40 40
   output: {
@@ -71,7 +71,7 @@ module.exports = {
71 71
         use: /* 使用loader */[{
72 72
           loader: "url-loader",
73 73
           options: /* 加载器相关的配置项 */ {
74
-            name: 'static/[name].[ext]',
74
+            name: name_+'static/[name].[ext]',
75 75
             limit: /* <=limit的图片转换成base64 */ 8196,
76 76
             mimetype: "image/jpg|image|gif/png|image/ico",
77 77
             fallback: 'file-loader',
@@ -86,7 +86,7 @@ module.exports = {
86 86
         use: /* 使用loader */[{
87 87
           loader: "file-loader",
88 88
           options: /* 加载器相关的配置项 */ {
89
-            name: 'static/[name].[ext]',
89
+            name: name_+'static/[name].[ext]',
90 90
             publicPath: '../../' //采用根路径
91 91
           },
92 92
         },
@@ -98,7 +98,7 @@ module.exports = {
98 98
         use: [{
99 99
           loader: 'file-loader',
100 100
           options: {
101
-            name: 'static/[name].[ext]',
101
+            name: name_+'static/[name].[ext]',
102 102
             publicPath: '../../'
103 103
           },
104 104
         }],
@@ -108,7 +108,7 @@ module.exports = {
108 108
         use: [{
109 109
           loader: 'file-loader',
110 110
           options: {
111
-            name: 'static/[name].[ext]',
111
+            name: name_+'static/[name].[ext]',
112 112
             publicPath: '../../'
113 113
           },
114 114
         }],

+ 22 - 2
config/webpack.prod.js

@@ -139,8 +139,28 @@ module.exports = merge(common, {
139 139
         // to: '../dist/static/privateConfig.js' 
140 140
       },
141 141
       { 
142
-        from: path.resolve(__dirname, '../src/assets/js/crypto-js.js'), 
143
-        to:path.resolve(__dirname, '../dist/static/crypto-js.js'),
142
+        from: path.resolve(__dirname, '../src/assets/js/privateConfig.js'), 
143
+        to:path.resolve(__dirname, '../dist/static/privateConfig.js'),
144
+        // to: '../dist/static/privateConfig.js' 
145
+      },
146
+      { 
147
+        from: path.resolve(__dirname, '../src/assets/js/jquery-1.11.0.min.js'), 
148
+        to:path.resolve(__dirname, '../dist/static/jquery-1.11.0.min.js'),
149
+        // to: '../dist/static/crypto-js.js' 
150
+      },
151
+      { 
152
+        from: path.resolve(__dirname, '../src/assets/js/jquery.numscroll.js'), 
153
+        to:path.resolve(__dirname, '../dist/static/jquery.numscroll.js'),
154
+        // to: '../dist/static/crypto-js.js' 
155
+      },
156
+      { 
157
+        from: path.resolve(__dirname, '../src/assets/js/echarts.all.js'), 
158
+        to:path.resolve(__dirname, '../dist/static/echarts.all.js'),
159
+        // to: '../dist/static/crypto-js.js' 
160
+      },
161
+      { 
162
+        from: path.resolve(__dirname, '../src/assets/js/echarts.min.js'), 
163
+        to:path.resolve(__dirname, '../dist/static/echarts.min.js'),
144 164
         // to: '../dist/static/crypto-js.js' 
145 165
       },
146 166
     ]),

+ 6 - 0
public/index.html

@@ -187,6 +187,12 @@
187 187
   <script type="text/javascript" src="<%=htmlWebpackPlugin.options.publicPath%>static/privateConfig.js"></script>
188 188
   <script type="text/javascript" src="../src/assets/js/crypto-js.js"></script>
189 189
   <script type="text/javascript" src="<%=htmlWebpackPlugin.options.publicPath%>static/crypto-js.js"></script>
190
+
191
+  <script type="text/javascript" src="<%=htmlWebpackPlugin.options.publicPath%>static/jquery-1.11.0.min.js"></script>
192
+  <script type="text/javascript" src="<%=htmlWebpackPlugin.options.publicPath%>static/jquery.numscroll.js"></script>
193
+  <script type="text/javascript" src="<%=htmlWebpackPlugin.options.publicPath%>static/echarts.all.js"></script>
194
+  <script type="text/javascript" src="<%=htmlWebpackPlugin.options.publicPath%>static/echarts.min.js"></script>
195
+
190 196
 </head>
191 197
 
192 198
 <body>

BIN
src/assets/imgs/dataVImg/homeBgDataV.png


+ 1 - 0
src/pages/frame/style.less

@@ -7,6 +7,7 @@
7 7
 
8 8
   .left_menu_area {
9 9
     height: calc(100% + 56px);
10
+    display: none;
10 11
   }
11 12
 
12 13
   .ant-menu.ant-menu-root.ant-menu-inline.ant-menu-dark {

+ 0 - 77
src/pages/frame/view.jsx

@@ -464,83 +464,6 @@ export default observer(function Frame(props) {
464 464
         background: 'rgb(255, 255, 255)',
465 465
         height: "100%",
466 466
       } : {display: "flex", height: '100%'})}>
467
-        {/* 子菜单 */}
468
-        {$store.sysMenu.submenuList.length > 0 && (
469
-          <div
470
-            style={{ paddingTop: 64, background: "#1C45B4" }}
471
-            className="left_menu_area"
472
-          >
473
-            <Button
474
-              style={{
475
-                width: "100%",
476
-                textAlign: "left",
477
-                background: '#1C45B4',
478
-                border: "none",
479
-              }}
480
-              type=""
481
-              onClick={() => {
482
-                setCollapsed(!collapsed);
483
-              }}
484
-            >
485
-              {collapsed ? (
486
-                <MenuUnfoldOutlined style={{ color: "#fff" }} />
487
-              ) : (
488
-                <MenuFoldOutlined style={{ color: "#fff" }} />
489
-              )}
490
-            </Button>
491
-            {$store.sysMenu.isShowLeftMenuSearch && !collapsed && (
492
-              <Search
493
-                className="left_menu_search"
494
-                placeholder="搜索关键词"
495
-                value={searchVal}
496
-                ref={$search}
497
-                onChange={(e) => {
498
-                  let val = e.target.value;
499
-                  setSearchVal(val);
500
-                  let ids = [];
501
-                  // showIds = [];
502
-                  // $store.app.setShowIds([]);
503
-                  // 找出所有叶子节点,以及有关系的fu id
504
-
505
-                  for (let key in leafNode) {
506
-                    if (new RegExp(val).test(leafNode[key].name)) {
507
-                      // console.log(leafNode[key].name);
508
-                      ids = ids.concat(leafNode[key].parentIds, [
509
-                        leafNode[key].id,
510
-                      ]);
511
-                    }
512
-                  }
513
-
514
-                  $store.app.setShowIds(ids);
515
-                }}
516
-                style={{ width: leftMenuWidth, display: "block", }}
517
-              />
518
-            )}
519
-
520
-            <Menu
521
-              style={{
522
-                height: leftMenuHeight,
523
-                overflow: "hidden",
524
-                overflowY: "auto",
525
-                width: collapsed ? 44 : leftMenuWidth,
526
-                backgroundColor: "#1C45B4",
527
-                fontSize: 13,
528
-              }}
529
-              mode="inline"
530
-              theme="dark"
531
-              onClick={handleClick}
532
-              selectedKeys={[$store.app.curNav]}
533
-              inlineCollapsed={collapsed}
534
-            //ref={leftMenu}
535
-            >
536
-              {/* 子菜单 */}
537
-
538
-              {searchVal === ""
539
-                ? loopMenu($store.sysMenu.submenuList)
540
-                : loopMenu2($store.sysMenu.submenuList)}
541
-            </Menu>
542
-          </div>
543
-        )}
544 467
 
545 468
         {$store.sysMenu.submenuList.length > 0 && !collapsed && (
546 469
           <div

+ 3 - 2
src/pages/jurisDiction/view.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm
3 3
  * @Date: 2023-11-07 14:21:24 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-07 16:35:29
5
+ * @Last Modified time: 2023-11-08 09:57:24
6 6
  */
7 7
 
8 8
 import React, { useState, useEffect, Component } from "react";
@@ -29,7 +29,7 @@ class JrisDiction extends Component {
29 29
     };
30 30
   }
31 31
 
32
-  componentWillMount() {
32
+  componentWillMount() { 
33 33
     let searchInstance = queryToObj(); // url查询参数对象化
34 34
     if(searchInstance?.token){
35 35
       this.getUrl(searchInstance?.token);
@@ -43,6 +43,7 @@ class JrisDiction extends Component {
43 43
   }
44 44
   async getUrl(token) {
45 45
     await checkToken(token).then(({ data, resultCode }) => {
46
+      sessionStorage.setItem("tqcVToken",token)
46 47
       if (data?.userId) {
47 48
         this.props.history.replace("/home/operation");
48 49
         // this.props.history.push('/')

+ 7 - 0
src/pages/tqcDataVHome/api.js

@@ -1,5 +1,12 @@
1 1
 import request from "@utils/request";
2 2
 
3
+/**登录*/
4
+export function checkToken(params) {
5
+  return request({
6
+    url: `/api/yonghong/checkToken?token=${params}`,
7
+    method: "GEt",
8
+  });
9
+}
3 10
 
4 11
 /**碳排放 */
5 12
 export function dataengineCenterOneservice(params) {

+ 19 - 2
src/pages/tqcDataVHome/view.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 
3 3
  * @Date: 2023-10-25 10:32:44 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-07 16:25:41
5
+ * @Last Modified time: 2023-11-08 09:56:35
6 6
  */
7 7
 /*
8 8
  * @Author: dayan_hjm 
@@ -27,6 +27,7 @@ import MapView from "./component/mapView.jsx";
27 27
 import {
28 28
   timeService,
29 29
   numberService,
30
+  checkToken,
30 31
   updateTimeService
31 32
 } from "./api";
32 33
 
@@ -58,7 +59,23 @@ class Home extends Component {
58 59
     };
59 60
     this.timer = null //定时器,用于检测同步状态
60 61
   }
62
+  componentWillMount() {
63
+    this.getToken()
64
+  }
61 65
 
66
+  async getToken() {
67
+    if (!sessionStorage.getItem("tqcVToken")) {
68
+      this.props.history.replace("/home/index");
69
+    } else {
70
+      await checkToken(sessionStorage.getItem("tqcVToken")).then(({ data, resultCode }) => {
71
+        if (data?.userId) {
72
+          // this.props.history.push('/')
73
+        } else {
74
+          this.props.history.replace("/home/index");
75
+        }
76
+      });
77
+    }
78
+  }
62 79
   componentDidMount() {
63 80
     this.fontMsgChange();
64 81
     this.getUrl();
@@ -234,7 +251,7 @@ class Home extends Component {
234 251
             <div class="center_box2 animate__animated animate__fadeInDown animate__slower animate__delay-1s">
235 252
               <div className="center_box">
236 253
                 <Tooltip placement="bottom" title={' ● 即为 t-1天的库存金额,百分比即为产品库存金额占总体金额的百分比'}>
237
-                  <p className="topMsg_title" style={{position: "relative",zIndex: 999999}}>库存金额</p>
254
+                  <p className="topMsg_title" style={{ position: "relative", zIndex: 999999 }}>库存金额</p>
238 255
                 </Tooltip>
239 256
                 <div className="topMsg_content">
240 257
                   <LeftMenoyView></LeftMenoyView>