Bläddra i källkod

feat: 单点登录

@dayan_hjm 2 år sedan
förälder
incheckning
ff28fa1e92

+ 4 - 4
config/webpack.dev.js

@@ -135,15 +135,15 @@ module.exports = merge(common, {
135 135
       "/api": {
136 136
         // target: "http://47.96.100.195:9081"
137 137
         // target: "http://dataportal-test.agile.com.cn:8081"
138
-        target: "http://106.52.242.177:9081",
138
+        target: "http://10.8.8.173:9081",
139 139
         // target:"http://dataportal.dtyunxi.cn/demo",
140 140
         changeOrigin:true,
141 141
 
142 142
       },
143
-      "/data-screen": {
144
-        target: "http://10.8.8.185:31233",
143
+      "/dataengine-center-oneservice": {
144
+        // target: "http://10.8.8.185:31233",
145
+        target: "http://10.8.8.173:9081",
145 146
         changeOrigin:true,
146
-        pathRewrite: { '^/data-screen': '' },
147 147
       },
148 148
       "/mock":{
149 149
         target: "http://172.24.81.106:9999",

+ 7 - 6
src/assets/css/styleTemplate.less

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 茶百道主题样式
3 3
  * @Date: 2022-10-27 10:56:37 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-07 11:02:52
5
+ * @Last Modified time: 2023-11-07 17:33:48
6 6
  */
7 7
 
8 8
 @import url("../../themes/themes.less");
@@ -414,7 +414,7 @@
414 414
           height: 100%;
415 415
 
416 416
           .topMsg_content {
417
-            height: calc(100% - 2em);
417
+            height: calc(100% - 1em);
418 418
             line-height: 4em;
419 419
             font-size: 2em;
420 420
             color: #69FFDE;
@@ -482,11 +482,12 @@
482 482
                 color: #fff;
483 483
                 position: absolute;
484 484
                 right: 0%;
485
-                top: 0.4em;
485
+                top: 0.5em;
486 486
 
487 487
                 li {
488
-                  height: 25%;
488
+                  height: 24%;
489 489
                   text-align: left;
490
+                  font-size: 0.9em;
490 491
                 }
491 492
               }
492 493
 
@@ -506,7 +507,7 @@
506 507
                   height: 120%;
507 508
                   position: absolute;
508 509
                   left: 0;
509
-                  top: -1.5em;
510
+                  top: -1em;
510 511
                 }
511 512
 
512 513
                 #echarts6 {
@@ -870,7 +871,7 @@
870 871
         .center_li {
871 872
           width: 33%;
872 873
           background: url(../imgs/dataVimg/toplineB.png) no-repeat 0 bottom / 100% 11%;
873
-          height: 60%;
874
+          height: 78%;
874 875
         }
875 876
 
876 877
         .right_li {

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


+ 4 - 4
src/pages/frame/view.jsx

@@ -458,7 +458,7 @@ export default observer(function Frame(props) {
458 458
       {/* <div className="nowifi-tip">当前网络状态不佳</div> */}
459 459
 
460 460
       {/* 正文 */}
461
-      <div style={history.location.pathname === "/home/index" ? { display: "flex", height: '100%' } : (history.location.pathname.indexOf("/home/outer") > -1 ?{
461
+      <div style={history.location.pathname === "/home/index" || history.location.pathname === '/home/operation'? { display: "flex", height: '100%' } : (history.location.pathname.indexOf("/home/outer") > -1 ?{
462 462
         overflow: "hidden",
463 463
         display: "flex",
464 464
         background: 'rgb(255, 255, 255)',
@@ -554,7 +554,7 @@ export default observer(function Frame(props) {
554 554
         {isMove && <div className="markmore"></div>}
555 555
 
556 556
         <div
557
-          className={`${history.location.pathname !== "/home/index" &&
557
+          className={`${history.location.pathname !== "/home/index" && history.location.pathname !== '/home/operation'&&
558 558
               $store.app.navList.length > 0
559 559
               ? (history.location.pathname.indexOf("/home/outer") > -1 ? "body_box outer_body_box" : 'body_box') : "body_box homePage"
560 560
             }`}
@@ -562,14 +562,14 @@ export default observer(function Frame(props) {
562 562
           <Navigator
563 563
             style={{
564 564
               display:
565
-                history.location.pathname !== "/home/index" &&
565
+                history.location.pathname !== "/home/index" && history.location.pathname !== '/home/operation'&&
566 566
                   $store.app.navList.length > 0
567 567
                   ? "flex"
568 568
                   : "none",
569 569
             }}
570 570
           />
571 571
           <TipMsg onRef={onRef2}></TipMsg>
572
-          {$store.app.navList.length === 0 &&
572
+          {$store.app.navList.length === 0 && false &&
573 573
             !history.location.pathname.match(/index|work|center|clush/) ? (
574 574
             <DefaultImg />
575 575
           ) : (

+ 8 - 0
src/pages/jurisDiction/api.js

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

+ 72 - 0
src/pages/jurisDiction/mod.js

@@ -0,0 +1,72 @@
1
+/*
2
+ * @Author: dayan_hjm 
3
+ * @Date: 2022-10-27 11:11:30 
4
+ * @Last modified by:   dayan_hjm 
5
+ * @Last modified time: 2022-10-27 11:11:30 
6
+ */
7
+
8
+// 状态管理方法
9
+import { observable, action, configure, makeObservable, runInAction } from 'mobx';
10
+// 工具方法
11
+import { cloneDeep, get, groupBy, isEmpty, orderBy, pick, values } from "lodash";
12
+
13
+import { message } from 'antd';
14
+
15
+// 默认状态
16
+const defaultState = {
17
+  totalValue:0,
18
+  yearDecline:0,
19
+  yearSend:0,
20
+  productInventory:0,
21
+  list:[{name:'营运数据大屏'},{name:'经营大盘'},{name:'到家专题'},{name:'门店大盘'},{name:'自助跑数SQL平台'},{name:'月度包材预警跑数模板'}],
22
+  rightlist:[],
23
+  bumen:'数字化中心/数据工程部',
24
+  gw:'数据产品经理',
25
+}
26
+
27
+// 严格模式
28
+configure({
29
+  enforceActions: 'observed'
30
+});
31
+
32
+
33
+/**
34
+ * mod层 - 业务逻辑,数据逻辑应该存储于此
35
+ */
36
+class Mod {
37
+  constructor() {
38
+    makeObservable(this);
39
+  }
40
+  // 监视状态
41
+  @observable state = cloneDeep(defaultState);
42
+
43
+  @action saveState = async (payload) => {
44
+    runInAction(() => {
45
+      this.state = {
46
+        ...this.state,
47
+        ...payload
48
+      };
49
+    });
50
+  };
51
+
52
+
53
+  // 新增/编辑运营商
54
+  // @action customerOperatorsmod = async (par, type) => {
55
+  //   try {
56
+  //     const { data, resultCode, resultMsg } = await Serv.customerOperatorsServ(par, type);
57
+  //     if (resultCode + '' === '0') {
58
+  //       runInAction(() => {
59
+  //         message.success('操作成功!')
60
+  //         this.state.addEditVisiable = false;
61
+  //         this.state.version = Math.random()
62
+  //       });
63
+  //     }
64
+  //   } catch (e) {
65
+  //     console.log('e: ', e);
66
+  //   }
67
+  // }
68
+}
69
+
70
+// 将组件实例化,这意味着组件将不能从别处实例化
71
+const mod = new Mod();
72
+export default mod;

+ 29 - 0
src/pages/jurisDiction/style.less

@@ -0,0 +1,29 @@
1
+@import url("../../themes/themes.less");
2
+
3
+.jrisdiction_box{
4
+  width: 100%;
5
+  height: 100%;
6
+  position: relative;
7
+  background: #f7f8f9;
8
+  display: flex;
9
+  align-items: center;
10
+  justify-content: center;
11
+  :global {
12
+    .center{
13
+      text-align: center;
14
+      >img{
15
+        width: 850px;
16
+        margin-top: -150px;
17
+      }
18
+      >h1{
19
+        font-size: 2.5em;
20
+      margin-top: 0.3em;
21
+      margin-bottom: 0;
22
+      }
23
+      >span{
24
+        font-size: 1.2em;
25
+      line-height: 0.5em;
26
+      }
27
+    }
28
+  }
29
+}

+ 73 - 0
src/pages/jurisDiction/view.jsx

@@ -0,0 +1,73 @@
1
+/*
2
+ * @Author: dayan_hjm
3
+ * @Date: 2023-11-07 14:21:24 
4
+ * @Last Modified by: dayan_hjm
5
+ * @Last Modified time: 2023-11-07 16:35:29
6
+ */
7
+
8
+import React, { useState, useEffect, Component } from "react";
9
+import styles from "./style.less";
10
+import { useHistory, useLocation, withRouter } from "react-router-dom";
11
+import mod from './mod';
12
+import { toJS } from "mobx";
13
+import { queryToObj } from "@utils/util";
14
+
15
+import {
16
+  checkToken,
17
+} from "./api";
18
+
19
+import 'animate.css';
20
+@withRouter
21
+
22
+class JrisDiction extends Component {
23
+  // 构造函数,组件的实例创建时,最先执行
24
+  constructor(props, context) {
25
+    super(props, context);
26
+    this.store = mod;
27
+    this.state = {
28
+      showMsg: false
29
+    };
30
+  }
31
+
32
+  componentWillMount() {
33
+    let searchInstance = queryToObj(); // url查询参数对象化
34
+    if(searchInstance?.token){
35
+      this.getUrl(searchInstance?.token);
36
+    }else{
37
+      this.setState({ showMsg: true })
38
+    }
39
+
40
+  }
41
+
42
+  componentDidMount() {
43
+  }
44
+  async getUrl(token) {
45
+    await checkToken(token).then(({ data, resultCode }) => {
46
+      if (data?.userId) {
47
+        this.props.history.replace("/home/operation");
48
+        // this.props.history.push('/')
49
+      } else {
50
+        this.setState({ showMsg: true })
51
+      }
52
+    });
53
+  }
54
+  componentDidCatch() {
55
+  }
56
+
57
+
58
+  render() {
59
+  const { showMsg } = this.state;
60
+    return (
61
+      <div className={styles.jrisdiction_box}>
62
+        {
63
+          showMsg && <div className="center">
64
+            <img src={require("@assets/imgs/dataVImg/wuQuanXuan.png").default} alt="" />
65
+            <h1>您暂无权限访问</h1>
66
+            <span>请联系管理员开通权限</span>
67
+          </div>
68
+        }
69
+      </div>
70
+    )
71
+  }
72
+}
73
+export default JrisDiction;

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

@@ -4,7 +4,7 @@ import request from "@utils/request";
4 4
 /**碳排放 */
5 5
 export function dataengineCenterOneservice(params) {
6 6
   return request({
7
-    url: "/data-screen/dataengine-center-oneservice/list/1356250396177503367",
7
+    url: "/dataengine-center-oneservice/list/1356250396177503367",
8 8
     method: "POST",
9 9
     data: {
10 10
       "apiId": "1356250396177503367",
@@ -37,7 +37,7 @@ export function dataengineCenterOneservice(params) {
37 37
 /**库存金额 */
38 38
 export function momeyService(params) {
39 39
   return request({
40
-    url: "/data-screen/dataengine-center-oneservice/list/1356776817075459329",
40
+    url: "/dataengine-center-oneservice/list/1356776817075459329",
41 41
     method: "POST",
42 42
     data: {
43 43
       "apiId": "1356776817075459329",
@@ -69,7 +69,7 @@ export function momeyService(params) {
69 69
 /**百万工时损工率   产量计划完成率*/
70 70
 export function timeService(params) {
71 71
   return request({
72
-    url: "/data-screen/dataengine-center-oneservice/list/1356250124518724729",
72
+    url: "/dataengine-center-oneservice/list/1356250124518724729",
73 73
     method: "POST",
74 74
     data: {
75 75
       "apiId": "1356250124518724729",
@@ -100,7 +100,7 @@ export function timeService(params) {
100 100
 /**产值+发货量+产量+库存*/
101 101
 export function numberService(params) {
102 102
   return request({
103
-    url: "/data-screen/dataengine-center-oneservice/list/1356243326548087867",
103
+    url: "/dataengine-center-oneservice/list/1356243326548087867",
104 104
     method: "POST",
105 105
     data: {
106 106
       "apiId": "1356243326548087867",
@@ -131,7 +131,7 @@ export function numberService(params) {
131 131
 /**近30天产量*/
132 132
 export function mondService(params) {
133 133
   return request({
134
-    url: "/data-screen/dataengine-center-oneservice/list/1356244872119751767",
134
+    url: "/dataengine-center-oneservice/list/1356244872119751767",
135 135
     method: "POST",
136 136
     data: {
137 137
       "apiId": "1356244872119751767",
@@ -162,7 +162,7 @@ export function mondService(params) {
162 162
 /**月度产量/发货量+一次合格率*/
163 163
 export function twoService(params) {
164 164
   return request({
165
-    url: "/data-screen/dataengine-center-oneservice/list/1356411403496625359",
165
+    url: "/dataengine-center-oneservice/list/1356411403496625359",
166 166
     method: "POST",
167 167
     data: {
168 168
       "apiId": "1356411403496625359",
@@ -195,7 +195,7 @@ export function twoService(params) {
195 195
 /**更新时间*/
196 196
 export function updateTimeService(params) {
197 197
   return request({
198
-    url: "/data-screen/dataengine-center-oneservice/list/1356778817327502618",
198
+    url: "/dataengine-center-oneservice/list/1356778817327502618",
199 199
     method: "POST",
200 200
     data: {
201 201
       "apiId": "1356778817327502618",

+ 2 - 2
src/pages/tqcDataVHome/component/leftMenoyView.jsx

@@ -2,7 +2,7 @@
2 2
  * @Author: dayan_hjm 库存金额
3 3
  * @Date: 2023-10-23 09:32:12 
4 4
  * @Last Modified by: dayan_hjm
5
- * @Last Modified time: 2023-11-06 15:18:24
5
+ * @Last Modified time: 2023-11-07 17:18:38
6 6
  */
7 7
 
8 8
 
@@ -157,7 +157,7 @@ class LeftMenoyView extends Component {
157 157
 
158 158
         grid: {
159 159
           left: '0%',
160
-          top: '1%',
160
+          top: '4%',
161 161
           right: '5%',
162 162
           bottom: '0%',
163 163
           containLabel: true

+ 1 - 1
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 11:26:49
5
+ * @Last Modified time: 2023-11-07 16:25:41
6 6
  */
7 7
 /*
8 8
  * @Author: dayan_hjm 

+ 8 - 2
src/router/router.js

@@ -14,6 +14,7 @@ import Login from "@pages/login/view.jsx";
14 14
 import NotFound from "@pages/notFound/view.jsx";
15 15
 import Home from '@pages/home/view.jsx';
16 16
 import HomeForchaBaiDao from '@pages/tqcDataVHome/view.jsx';
17
+import JurisDiction from '@pages/jurisDiction/view.jsx';
17 18
 import Loading from "@components/Loading/view.jsx";
18 19
 import $store from "@store/";
19 20
 import { CacheSwitch, CacheRoute } from 'react-router-cache-route';
@@ -46,13 +47,18 @@ const routes = [
46 47
     component: Login,
47 48
   },
48 49
   {
50
+    path: "/home/index",
51
+    component: JurisDiction,
52
+  },
53
+  {
49 54
     path: "/home",
50 55
     component: Frame,
51 56
     children: [
52 57
       {
53 58
         name: "首页",
54
-        path: "/home/index",
55
-        component: $store.app.styleCommon.theme == 'chaBaiDao' ? HomeForchaBaiDao : Home,
59
+        path: "/home/operation",
60
+        component: HomeForchaBaiDao,
61
+        // component: $store.app.styleCommon.theme == 'chaBaiDao' ? HomeForchaBaiDao : Home,
56 62
         // navigator: true,
57 63
       },
58 64
     ],

+ 3 - 1
src/utils/request.js

@@ -38,7 +38,9 @@ console.log("11");
38 38
 instance.interceptors.response.use(
39 39
   function (response) {
40 40
     // 对响应数据做点什么
41
-    if (+response.data.resultCode === -1) {
41
+    if(response.config.url.indexOf('yonghong/checkToken')> -1){
42
+      return Promise.resolve({data:response.data});
43
+    }else if (+response.data.resultCode === -1) {
42 44
       message.destroy();
43 45
       // //兼容PC钉钉/微信转跳系统,去除提示token失效
44 46
       if (window.location.href.indexOf("authCode") == -1 && window.location.href.indexOf("code") == -1) {