浏览代码

路由根目录改为配置到systemConfig.js里

niuheng 3 年之前
父节点
当前提交
4bbeabdc40

+ 1 - 1
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "padm",
+  "name": "adm-frontend",
   "version": "0.0.0",
   "private": true,
   "description": "",

+ 14 - 1
public/systemConf.js

@@ -1,4 +1,6 @@
 var __systemConf = {
+  //路由根路径
+  baseRouteUrl: 'adm-frontend',
   //基础数据根域名
   baseServiceUrl: '/baseService',
   //系统图服务域名
@@ -79,4 +81,15 @@ var __systemConf = {
     }]
   }]
 };
-window.__systemConf = __systemConf;
+
+if (typeof window != 'undefined') {
+  window.__systemConf = __systemConf;
+}
+
+if (typeof module != 'undefined') {
+  module.exports = __systemConf;
+}
+
+// if (typeof export != 'undefined') {
+//   module.exports = __systemConf;
+// }

+ 1 - 2
src/components/systemGraph/addGraph.vue

@@ -65,7 +65,6 @@ import { mapState } from "vuex";
 import { sysGraphController } from "@/controller/systemGraph/sysGraphController";
 import { logicConfig } from "@/logicConfig";
 import { Message } from "element-ui";
-import packageConfig from "../../../package.json";
 
 export default {
   props: ["isVisible"],
@@ -177,7 +176,7 @@ export default {
               this.selProject.groupCode,
               this.selProject.id,
               this.selProject.name,
-              packageConfig.name,
+              window.__systemConf.baseRouteUrl,
               false
             );
             break;

+ 51 - 6
src/components/systemGraph/graph.vue

@@ -56,9 +56,17 @@ export default {
        * labels: [{
           id:'',
           text:'',
-          color: '',
-          fontSize: '',
-          backGround:''
+          style:{
+            color: '',
+            fontSize: '',
+            backGround:'',
+            fontWeight:1
+          },
+          //文本的绝对位置
+          absolutePosition: {
+            x: 1,
+            y: 1,
+          },
         }]
        */
       labelArr: [],
@@ -248,13 +256,50 @@ export default {
        */
       function parseNode(dataArr, absolutePosition) {
         dataArr.forEach((_dataObj) => {
+          //文本
+          if (_dataObj.label && _dataObj.label.content) {
+            let _labelObj = _dataObj.label;
+            _labelObj.id = _labelObj.id || Math.random().toString();
+
+            let _style = _labelObj.style || {};
+            _style.color =
+              _style.color ||
+              window.__systemConf.systemGraph.peiDian.text.color;
+            _style.fontSize =
+              _style.fontSize ||
+              window.__systemConf.systemGraph.peiDian.text.size;
+            _style.backGround =
+              _style.backGround ||
+              window.__systemConf.systemGraph.peiDian.text.backGround;
+            _style.fontWeight =
+              _style.fontWeight ||
+              window.__systemConf.systemGraph.peiDian.text.weight;
+
+            let textNewAbsolutePosition = {
+              x: _dataObj.location.x + absolutePosition.x,
+              y: _dataObj.location.y + absolutePosition.y,
+            };
+            labelArr.push({
+              id: _labelObj.id,
+              text: _labelObj.content,
+              style: {
+                color: _style.color,
+                fontSize: _style.fontSize,
+                backGround: _style.backGround,
+                fontWeight: _style.fontWeight,
+              },
+              //文本的绝对位置
+              absolutePosition: {
+                x: 1,
+                y: 1,
+              },
+            });
+          }
+
           var newAbsolutePosition = {
             x: _dataObj.location.x + absolutePosition.x,
             y: _dataObj.location.y + absolutePosition.y,
           };
-          //文本
-          if (_dataObj.label) {
-          }
           switch (_dataObj.compType) {
             //容器
             case "container":

+ 1 - 3
src/components/systemGraph/index.vue

@@ -61,9 +61,7 @@
 <script>
 import { mapState } from "vuex";
 import { logicConfig } from "@/logicConfig";
-import packageConfig from "../../../package.json";
 import { sysGraphController } from "@/controller/systemGraph/sysGraphController";
-import { TextureLoader } from "@pixi/loaders";
 
 export default {
   props: [],
@@ -156,7 +154,7 @@ export default {
         this.selectProject.groupCode,
         this.selectProject.id,
         this.selectProject.name,
-        packageConfig.name,
+        window.__systemConf.baseRouteUrl,
         true
       );
     },

+ 1 - 2
src/router/index.js

@@ -1,7 +1,6 @@
 import Vue from 'vue'
 import Router from 'vue-router'
 import systemRoute from './system'
-import packageConfig from '../../package.json'
 import {authUtils} from '@/utils/authUtils'
 
 Vue.use(Router)
@@ -11,7 +10,7 @@ routes = routes.concat(systemRoute)
 
 const router = new Router({
   mode: 'history',
-  base: '/' + packageConfig.name,
+  base: '/' + window.__systemConf.baseRouteUrl,
   routes: routes
 })
 

+ 3 - 3
vue.config.js

@@ -1,5 +1,5 @@
 const path = require('path');
-var packageConfig = require('./package.json');
+var systemConfig = require('./public/systemConf.js');
 
 function resolve(dir) {
   return path.join(__dirname, '..', dir);
@@ -39,9 +39,9 @@ module.exports = {
       filename: 'index.html'
     }
   },
-  publicPath: '/' + packageConfig.name,
+  publicPath: '/' + systemConfig.baseRouteUrl,
   //当运行vue-cli-service build时生成的生产环境构建环境的目录。用法和webpack的output.path一样,不要修改output.path
-  outputDir: packageConfig.name,
+  outputDir: systemConfig.baseRouteUrl,
   //放置打包后生成的静态资源(js、css、img、fonts)的目录,该目录相对于outputDir。
   assetsDir: 'public',
   //指定生成的index.html的输出路径,相对于outputDir。也可以是一个绝对路径。