From f6a37b7887bcaa9fa60d8f496ab18f73b44cb2d1 Mon Sep 17 00:00:00 2001 From: zlt Date: Fri, 1 Feb 2019 15:31:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A9=E5=B1=95=E5=89=8D=E7=AB=AF=E5=A4=9A?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=83=A8=E7=BD=B2=E5=8A=A8=E6=80=81=E9=80=82?= =?UTF-8?q?=E9=85=8D=E7=8E=AF=E5=A2=83=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/index.html | 2 +- .../src/main/resources/static/login.html | 2 +- .../main/resources/static/module/apiUrl.js | 1 + .../main/resources/static/module/config.js | 19 +++++++++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 zlt-web/back-web/src/main/resources/static/module/apiUrl.js diff --git a/zlt-web/back-web/src/main/resources/static/index.html b/zlt-web/back-web/src/main/resources/static/index.html index 4a5d6696..79277a0d 100644 --- a/zlt-web/back-web/src/main/resources/static/index.html +++ b/zlt-web/back-web/src/main/resources/static/index.html @@ -53,7 +53,7 @@
- + diff --git a/zlt-web/back-web/src/main/resources/static/login.html b/zlt-web/back-web/src/main/resources/static/login.html index 160bc0e5..dc6ca347 100644 --- a/zlt-web/back-web/src/main/resources/static/login.html +++ b/zlt-web/back-web/src/main/resources/static/login.html @@ -58,7 +58,7 @@

© 2018 zlt版权所有

- + diff --git a/zlt-web/back-web/src/main/resources/static/module/apiUrl.js b/zlt-web/back-web/src/main/resources/static/module/apiUrl.js new file mode 100644 index 00000000..db75a8fd --- /dev/null +++ b/zlt-web/back-web/src/main/resources/static/module/apiUrl.js @@ -0,0 +1 @@ +var my_api_server_url = 'http://127.0.0.1:9900/'; \ No newline at end of file diff --git a/zlt-web/back-web/src/main/resources/static/module/config.js b/zlt-web/back-web/src/main/resources/static/module/config.js index 5fa85d79..07d11282 100644 --- a/zlt-web/back-web/src/main/resources/static/module/config.js +++ b/zlt-web/back-web/src/main/resources/static/module/config.js @@ -1,7 +1,22 @@ layui.define(function (exports) { - + /** + * 用于动态切换环境地址 + */ + //默认地址 + var defUrl = 'http://127.0.0.1:9900/'; + //当前环境的api地址 + var apiUrl; + try{ + if (my_api_server_url.length > 0) { + apiUrl = my_api_server_url; + } else { + apiUrl = defUrl; + } + } catch(e) { + apiUrl = defUrl; + } var config = { - base_server: 'http://127.0.0.1:9900/', // 接口地址,实际项目请换成http形式的地址 + base_server: apiUrl, tableName: 'easyweb', // 存储表名 autoRender: false, // 窗口大小改变后是否自动重新渲染表格,解决layui数据表格非响应式的问题,目前实现的还不是很好,暂时关闭该功能 pageTabs: true, // 是否开启多标签