| | |
| | | function GetWEBURL() { |
| | | //var WEBURL = "http://192.168.16.80:8011/"; //办公室服务器 |
| | | //var WEBURL = "http://61.164.86.218:8099/ABAPI/"; |
| | | /*var WEBURL = "http://localhost/API/"; //颜晓军本地配置*/ |
| | | //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //杨乐本地配置 |
| | | /* var WEBURL = "http://localhost:8082/API/"; //杜贺本地配置*/ |
| | | // var WEBURL = "http://localhost:8082/API/"; //张瑞广本地配置 |
| | | //var WEBURL = "http://localhost:81/API/" //翁涛涛本地配置 |
| | | //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //杨乐本地配置 |
| | | //var WEBURL = "http://localhost/API/"; //颜晓军本地配置 |
| | | //var WEBURL = "http://localhost:8082/API/"; //杜贺本地配置 |
| | | //var WEBURL = "http://localhost:81/API/" //翁涛涛本地配置 |
| | | // var WEBURL = "http://localhost:8082/API/"; //张瑞广本地配置 |
| | | var WEBURL = "http://localhost:81/API/"; //陈镐哲本地配置 |
| | | //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //李林俊本地配置 |
| | | //var WEBURL = "http://localhost:8080/API/"; //王仪本地配置 |
| | | //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //余思杰本地配置 |
| | | //var WEBURL = "http://localhost:8088/ARAPI/"; //余思杰本地配置(安瑞) |
| | | //var WEBURL = "http://47.96.97.237/API/"; //智云服务器 |
| | | /* var WEBURL = "http://localhost:8082/LuBaoAPI/"; //余思杰本地配置*/ |
| | | var WEBURL = "http://localhost:81/API/"; // 陈镐哲本地配置*/ |
| | | //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //李林俊本地配置 |
| | | /* var WEBURL = "http://localhost:8082/LuBaoAPI/"; //余思杰本地配置*/ |
| | | // var WEBURL = "http://localhost:81/API/"; // 陈镐哲本地配置*/ |
| | | //var WEBURL = "http://localhost:8082/LuBaoAPI/"; //李林俊本地配置 |
| | | //var WEBURL = "http://localhost:8088/ARAPI/"; //余思杰本地配置(安瑞) |
| | | //var WEBURL = "http://61.164.86.218:8099/ABAPI/"; //奥邦 |
| | | //var WEBURL = "http://10.1.4.155/API/"; //江丰客户NEW |
| | |
| | | //var WEBURL = "http://121.36.199.126:8181/API/"; //三升 |
| | | //var WEBURL = "http://36.134.2.30:200/WEBS-API/"; //金帅 |
| | | //var WEBURL = "http://172.16.1.85/API/"; //迦南 |
| | | // var WEBURL = "http://61.164.64.222:8082/API_WW/" |
| | | return WEBURL |
| | | } |
| | | |
| | |
| | | return GetWEBURL() |
| | | } |
| | | |
| | | |
| | | layui.use(['jquery', 'layer'], function () { |
| | | var $ = layui.jquery, |
| | | layer = layui.layer; |
| | | |
| | | // 全局配置 |
| | | layer.config({ |
| | | scrollbar: false |
| | | }); |
| | | |
| | | // 全局配置 默认不显示父级滚动框 |
| | | var _open = layer.open; |
| | | layer.open = function (opts) { |
| | | // 合并默认配置 |
| | | var options = $.extend({}, layer.config, opts); |
| | | |
| | | var oldSuccess = options.success; |
| | | var oldEnd = options.end; |
| | | var needHideScroll = options.scrollbar === false; |
| | | |
| | | // 打开弹窗时 |
| | | options.success = function (layero, index) { |
| | | if (needHideScroll) { |
| | | $('body').css('overflow', 'hidden'); |
| | | } |
| | | if (oldSuccess) oldSuccess.call(this, layero, index); |
| | | }; |
| | | |
| | | // 关闭弹窗时 |
| | | options.end = function () { |
| | | if (needHideScroll) { |
| | | // 只有最后一个弹窗关闭才恢复 |
| | | if ($('.layui-layer:visible').length <= 1) { |
| | | $('body').css('overflow', ''); |
| | | } |
| | | } |
| | | if (oldEnd) oldEnd.call(this); |
| | | }; |
| | | |
| | | return _open.call(this, options); |
| | | }; |
| | | |
| | | // 全局拦截所有 layui ajax 请求 |
| | | $(document).ajaxSend(function (event, jqxhr, settings) { |
| | | var token = localStorage.getItem('token'); |
| | | if (token) { |
| | | // 自动带上 token |
| | | jqxhr.setRequestHeader('Authorization', 'Bearer ' + token); |
| | | } |
| | | |
| | | }); |
| | | |
| | | |
| | | // 统一处理 未认证/未授权请求 |
| | | $(document).ajaxComplete(function (event, jqxhr, settings) { |
| | | // HTTP 状态码 |
| | | var status = jqxhr.status; |
| | | |
| | | if (status === 401) { |
| | | // 未登录 / token 过期 |
| | | layer.confirm('登录已过期,请重新登录', { icon: 7, title: '提示' }, function () { |
| | | localStorage.removeItem('token'); |
| | | window.top.location.href = '../../views/user/login.html'; // 跳到登录页 |
| | | |
| | | }); |
| | | } else if (status === 403) { |
| | | // 无权限 |
| | | layer.msg('您没有该模块的操作权限', { icon: 2, time: 2000 }); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | if (typeof $ != 'undefined') { |
| | | $(document).ajaxSend(function (event, jqxhr, settings) { |
| | | var token = localStorage.getItem('token'); |
| | | if (token) { |
| | | // 自动带上 token |
| | | jqxhr.setRequestHeader('Authorization', 'Bearer ' + token); |
| | | } |
| | | |
| | | }); |
| | | |
| | | |
| | | // 统一处理 未认证/未授权请求 |
| | | $(document).ajaxComplete(function (event, jqxhr, settings) { |
| | | // HTTP 状态码 |
| | | var status = jqxhr.status; |
| | | |
| | | if (status === 401) { |
| | | // 未登录 / token 过期 |
| | | layer.confirm('登录已过期,请重新登录', { icon: 7, title: '提示' }, function () { |
| | | localStorage.removeItem('token'); |
| | | window.top.location.href = '../../views/user/login.html'; // 跳到登录页 |
| | | |
| | | }); |
| | | } else if (status === 403) { |
| | | // 无权限 |
| | | layui.layer.msg('您没有该模块的操作权限', { icon: 2, time: 2000 }); |
| | | } |
| | | }); |
| | | } |