Selaa lähdekoodia

增加环境变量

YaolongHan 4 vuotta sitten
vanhempi
commit
23be411d95

+ 5 - 2
package.json

@@ -3,8 +3,10 @@
     "version": "0.1.0",
     "private": true,
     "scripts": {
-        "serve": "vue-cli-service serve --open",
-        "build": "vue-cli-service build",
+        "serve": "cross-env NODE_ENV=serve vue-cli-service serve --open",
+        "build:aly": "cross-env NODE_ENV=aly_dev vue-cli-service build",
+        "build:wanda_dev": "cross-env NODE_ENV=wanda_dev vue-cli-service build",
+        "build:wanda_build": "cross-env NODE_ENV=wanda_build vue-cli-service build",
         "lint": "vue-cli-service lint"
     },
     "dependencies": {
@@ -43,6 +45,7 @@
         "@vue/eslint-config-typescript": "^5.0.2",
         "babel-eslint": "^10.0.3",
         "babel-plugin-component": "^1.1.1",
+        "cross-env": "^7.0.2",
         "eslint": "^5.16.0",
         "eslint-plugin-vue": "^5.0.0",
         "fengmap": "^2.5.3",

+ 11 - 7
public/systemConf.js

@@ -24,13 +24,17 @@ var __systemConf = {
     systemCode: 'wandaBmGuide',
     conf: {
         // 阿里云
-        // editerUrl: 'http://60.205.177.43:80/wandaEditer/', // 编辑器地址
-        // wandaBmGuideUrl: 'http://60.205.177.43:80/wandaBmGuide/', //管理书地址
-        // http://glsms.wanda-dev.cn/ 测试服
-        // editerUrl: 'http://glsms.wanda-dev.cn/wandaEditer/', // 编辑器地址
-        // wandaBmGuideUrl: 'http://glsms.wanda-dev.cn/wandaBmGuide/', //管理书地址
-        editerUrl: 'http://localhost:8091/wandaEditer/', // 编辑器地址
-        wandaBmGuideUrl: 'http://localhost:8090/wandaBmGuide/', //管理书地址
+        aly_dev_editerUrl: 'http://60.205.177.43:80/wandaEditer/', // 编辑器地址
+        aly_dev_wandaBmGuideUrl: 'http://60.205.177.43:80/wandaBmGuide/', //管理书地址
+        //   万达内网测试服
+        wanda_dev_editerUrl: 'http://glsms.wanda-dev.cn/wandaEditer/', // 编辑器地址
+        wanda_dev_wandaBmGuideUrl: 'http://glsms.wanda-dev.cn/wandaBmGuide/', //管理书地址
+        //   万达生产服
+        wanda_build_editerUrl: 'http://glsms.wanda.cn/wandaEditer/', // 编辑器地址
+        wanda_build_wandaBmGuideUrl: 'http://glsms.wanda.cn/wandaBmGuide/', //管理书地址
+        //开发
+        serve_editerUrl: 'http://localhost:8091/wandaEditer/', // 编辑器地址
+        serve_wandaBmGuideUrl: 'http://localhost:8090/wandaBmGuide/', //管理书地址
     },
 }
 window.__systemConf = __systemConf

+ 1 - 1
src/App.vue

@@ -39,7 +39,7 @@ export default {
     },
     mounted() {
         this.isMounted = true
-        this.plazaIds = localStorage.getItem('PLAZAID')
+        this.plazaIds = localStorage.getItem('PLAZAID');
     },
     computed: {
         ...mapGetters(['plazaId', 'fmapID', 'haveFengMap', 'accessLevel'])

+ 2 - 2
src/components/Legend/src/legend.vue

@@ -318,8 +318,8 @@ export default {
 
             let FloorID = this.floor ? this.floor : this.$cookie.get('floorMapId') || 'f1'
             let categoryId = this.categoryId ? this.categoryId : this.$cookie.get('categoryId')
-            const { conf } = window.__systemConf,
-                { editerUrl } = conf
+            const { conf } = window.__systemConf;
+            const editerUrl = conf[process.env.NODE_ENV+'_editerUrl'];
             let floorName = this.floorName ? this.floorName : this.$cookie.get('floorNow')
             let seq = this.$cookie.get('currentFloorId')
             let data = `categoryId=${categoryId}&projectId=${this.plazaId}&BuildingID=1&FloorID=${FloorID}&FloorName=${floorName}&fmapID=${this.fmapID}&seq=${seq}&token=${this.ssoToken}`

+ 5 - 4
src/components/menuList.vue

@@ -123,8 +123,9 @@ export default {
         },
         //入草稿箱
         toDrafts() {
-            const { conf } = window.__systemConf,
-                { editerUrl } = conf
+            const { conf } = window.__systemConf;
+                // { editerUrl } = conf;
+            const editerUrl = conf[process.env.NODE_ENV+'_editerUrl'];
             let data = `projectId=${this.plazaId}&fmapID=${this.fmapID}&token=${this.$store.state.ssoToken}`
             let url = editerUrl + 'drafts?' + encodeURIComponent(data)
             window.open(url, true)
@@ -176,8 +177,8 @@ export default {
         },
 
         dumpLegend() {
-            const { conf } = window.__systemConf,
-                { wandaBmGuideUrl } = conf
+            const { conf } = window.__systemConf;
+            const wandaBmGuideUrl = conf[process.env.NODE_ENV+'_wandaBmGuideUrl'];
             window.open(`${wandaBmGuideUrl}home/legendLibrary?token=${this.$store.state.ssoToken}`, true)
         }
     }

+ 0 - 1
src/main.js

@@ -58,7 +58,6 @@ Vue.use(cookies)
 import Pui from 'meri-design'
 import 'meri-design/dist/index.css'
 Vue.use(Pui)
-
 new Vue({
     router,
     store,

+ 3 - 0
src/router/index.js

@@ -114,6 +114,9 @@ router.beforeEach(async (to, from, next) => {
             }
             store.commit('SETLASTROUTER', lastRoute)
             let ssoServer = 'http://oauth.wanda-dev.cn'
+            if(process.env.NODE_ENV=="wanda_build"){
+                ssoServer = 'http://oauth.wanda.cn'
+            }
             let systemcode = 'CAD156',
                 signal = new Date().getTime(),
                 version = '1.0.0'

+ 1 - 1
src/store/index.js

@@ -148,7 +148,7 @@ export default new Vuex.Store({
     },
     actions: {
         // 获取项目列表、userId
-        async getUserInfo({ commit }, palyload) {
+        async getUserInfo({ commit },) {
             await login({
                 returnTree: true,
             })