Browse Source

环境配置

username 3 years ago
parent
commit
a13ec46398

+ 5 - 0
config/evn.dev.js

@@ -0,0 +1,5 @@
+/**开发地址配置 */
+export default {
+    BASE_URL:'http://192.168.2.224:1111',
+    ISERVER_BASE_URL:'http://117.174.10.73:8090/'
+}

+ 17 - 0
config/evn.js

@@ -0,0 +1,17 @@
+import dev from './evn.dev'
+import pro from './evn.pro'
+import staging from './evn.staging'
+import evn from '../evn.setting'
+
+function getEvn() {
+    if (evn == 'dev') {
+        return dev
+    } else if (evn == 'pro') {
+        return pro
+    } else if (evn == 'staging') {
+        return staging
+    }
+}
+const SYSTEM_EVN = getEvn()
+
+export default SYSTEM_EVN

+ 5 - 0
config/evn.pro.js

@@ -0,0 +1,5 @@
+/**生产地址配置 */
+export default {
+    BASE_URL:'http://10.0.67.89:1111',
+    ISERVER_BASE_URL:'http://10.0.67.89:8090/'
+}

+ 5 - 0
config/evn.staging.js

@@ -0,0 +1,5 @@
+/**测试地址配置 */
+export default {
+    BASE_URL:'http://117.174.10.73:1111',
+    ISERVER_BASE_URL:'http://117.174.10.73:8090/'
+}

+ 6 - 0
evn.setting.js

@@ -0,0 +1,6 @@
+const dev = 'dev' // 开发环境
+const pro = 'pro' // 生产环境
+const staging = 'dev' // 测试环境
+
+export default
+    dev

+ 2 - 2
src/api/common.js

@@ -6,7 +6,7 @@
   *
   */
 import request from '@/utils/request'
-import { baseUrl } from '@/utils/request'
+import SYSTEM_EVN from '../../config/evn'
 /**
  * 获取系统行政区划
  * @data 为空查全部
@@ -59,7 +59,7 @@ export function excelUpload(data) {
  * @description 数据导出
  */
 export function excelDownload(params) {
-  const url = baseUrl + '/excel-dispose-info/exportData?dto=' + encodeURIComponent(JSON.stringify(params.dto)) + '&templateFlag=' + params.templateFlag + '&templateServiceType=' + params.templateServiceType + ''
+  const url = SYSTEM_EVN.BASE_URL + '/excel-dispose-info/exportData?dto=' + encodeURIComponent(JSON.stringify(params.dto)) + '&templateFlag=' + params.templateFlag + '&templateServiceType=' + params.templateServiceType + ''
   const a = document.createElement('a')
   a.href = url
   a.download = url

+ 4 - 4
src/api/kxc/publicHouse.js

@@ -1,5 +1,5 @@
 import request from '@/utils/request'
-import { baseUrl } from '@/utils/request'
+import SYSTEM_EVN from '../../../config/evn'
 import { getToken } from '@/utils/auth'
 /**
   * 使用模块:
@@ -43,7 +43,7 @@ export function getPublicHouseByBuildings(data) {
 // 下载地籍表
 export function exportQuestionnaire(landInfos, name) {
   let xhr = new XMLHttpRequest();
-  let url = baseUrl + '/kxc/publicHouse/downloadCadastral'  //请求地址
+  let url = SYSTEM_EVN.BASE_URL + '/kxc/publicHouse/downloadCadastral'  //请求地址
   xhr.open('POST', url, true);
   xhr.responseType = "blob"; // 返回类型blob
   xhr.setRequestHeader("Content-type", "application/json")
@@ -70,7 +70,7 @@ export function exportQuestionnaire(landInfos, name) {
 */
 export function downloadHouseFile(id, name) {
   let xhr = new XMLHttpRequest();
-  let url = baseUrl + '/kxc/publicHouse/downloadPublicHouseFile/' + id  //请求地址
+  let url = SYSTEM_EVN.BASE_URL + '/kxc/publicHouse/downloadPublicHouseFile/' + id  //请求地址
   xhr.open('get', url, true);
   xhr.responseType = "blob"; // 返回类型blob
   xhr.setRequestHeader('Authorization', 'bearer ' + getToken()); // 携带token校验
@@ -107,7 +107,7 @@ export function downloadHouseFile(id, name) {
 */
 export function loadPhMould(fileName) {
   let xhr = new XMLHttpRequest();
-  let url = baseUrl + '/kxc/publicHouse/loadPhMould' //请求地址
+  let url = SYSTEM_EVN.BASE_URL + '/kxc/publicHouse/loadPhMould' //请求地址
   xhr.open('get', url, true);
   xhr.responseType = "blob"; // 返回类型blob
   xhr.setRequestHeader('Authorization', 'bearer ' + getToken()); // 携带token校验

+ 0 - 1
src/api/kxc/serviceConfig.js

@@ -1,5 +1,4 @@
 import request from '@/utils/request'
-import { baseUrl } from '@/utils/request'
 import { getToken } from '@/utils/auth'
 /**
   * 使用模块:

+ 2 - 4
src/utils/request.js

@@ -3,13 +3,11 @@ import { MessageBox, Message } from 'element-ui'
 import store from '@/store'
 import { getToken } from '@/utils/auth'
 import qs from 'qs'
+import SYSTEM_EVN from '../../config/evn'
 
-// 请求的url
-// export const baseUrl = 'http://192.168.2.242:1111'  ////192.168.2.74:1111
-export const baseUrl = 'http://192.168.2.224:1111'
 // 创建axios实例
 const service = axios.create({
-  baseURL: baseUrl // url = base url + request url
+  baseURL: SYSTEM_EVN.BASE_URL
   // baseURL: 'http://getway.vipgz4.idcfengye.com'
   // withCredentials: true, // 跨域请求时发送cookiesokies
   // timeout: 30000 // 请求超时

+ 2 - 1
src/views/MapView/map.config.js

@@ -1,5 +1,6 @@
+import SYSTEM_EVN from '../../../config/evn'
 // iServer访问地址
-export const iServerBaseUrl = "http://117.174.10.73:8090/"
+export const iServerBaseUrl = SYSTEM_EVN.ISERVER_BASE_URL
 export const mapConfig = {
   // 国家发布地图
   layers: [{

+ 1 - 0
vue.config.js

@@ -25,6 +25,7 @@ module.exports = {
   lintOnSave: false,
   productionSourceMap: false, // 生产环境是否生成 sourceMap 文件
   devServer: {
+    // public:'0.0.0.0:8086',
     hot: true,//自动保存
     port: port, // 端口
     open: true, // 自动开启浏览器