|
@@ -3,12 +3,12 @@ const $ = require("jquery");
|
|
|
var Promise = require('./rePromise');
|
|
|
//重写assign方法
|
|
|
if (typeof Object.assign != 'function') {
|
|
|
- Object.assign = function(target) {
|
|
|
+ Object.assign = function (target) {
|
|
|
'use strict';
|
|
|
if (target == null) {
|
|
|
throw new TypeError('Cannot convert undefined or null to object');
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
target = Object(target);
|
|
|
for (var index = 1; index < arguments.length; index++) {
|
|
|
var source = arguments[index];
|
|
@@ -23,16 +23,25 @@ if (typeof Object.assign != 'function') {
|
|
|
return target;
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+window.console = window.console || (function () {
|
|
|
+ var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile
|
|
|
+ = c.clear = c.exception = c.trace = c.assert = function () { };
|
|
|
+ return c;
|
|
|
+})();
|
|
|
+
|
|
|
const config = {
|
|
|
- pushInner:'/api/data/push/push',
|
|
|
- calculate:'/api/data/calc/calculate',
|
|
|
+ pushInner: '/api/data/push/push',
|
|
|
+ calculate: '/api/data/calc/calculate',
|
|
|
disclaimer: '/api/data/disclaimerInformation/getDisclaimerInformations',
|
|
|
information: '/api/data/conceptDetail/getConceptDetail',
|
|
|
pushScale: '/api/data/push/pushScale',
|
|
|
pushTreatment: '/api/data/push/pushTreatment',
|
|
|
getSysSetInfoDatas: '/api/data/sysSet/getSysSetInfoDatas',
|
|
|
getMr: '/api/data/mr/getMr',
|
|
|
- getVersion:'/api/data/versionInfo/getVersionInfoAlls',
|
|
|
+ getVersion: '/api/data/versionInfo/getVersionInfoAlls',
|
|
|
+ getStaticKnowledge: '/api/data/search/getStaticKnowledge',
|
|
|
+ getStaticScale: '/api/data/search/getScale',
|
|
|
}
|
|
|
const imageUrlPrefix = 'http://192.168.2.121:82';
|
|
|
// const getUrlArgObject = function(parm) {
|
|
@@ -41,42 +50,35 @@ const imageUrlPrefix = 'http://192.168.2.121:82';
|
|
|
// return args[parm];//返回对象
|
|
|
// }
|
|
|
|
|
|
-
|
|
|
const getUrlArgObject = function getQueryString(name) {
|
|
|
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
|
|
var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
|
|
|
var r = window.location.search.substr(1).match(reg);
|
|
|
var q = window.location.pathname.substr(1).match(reg_rewrite);
|
|
|
- if(r != null){
|
|
|
- return decodeURIComponent(r[2]);
|
|
|
- }else if(q != null){
|
|
|
- return decodeURIComponent(q[2]);
|
|
|
- }else{
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ if (r != null) {
|
|
|
+ return decodeURIComponent(r[2]);
|
|
|
+ } else if (q != null) {
|
|
|
+ return decodeURIComponent(q[2]);
|
|
|
+ } else {
|
|
|
+ return null;
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
-const post = function(url,data){
|
|
|
- return new Promise((resolve,reject)=>{
|
|
|
+const post = function (url, data) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
$.ajax({
|
|
|
- method:'post',
|
|
|
- url:url,
|
|
|
- data:JSON.stringify(data),
|
|
|
- contentType:"application/json; charset=UTF-8",
|
|
|
- beforeSend :function(xmlHttp){
|
|
|
- xmlHttp.setRequestHeader("If-Modified-Since","0");
|
|
|
- xmlHttp.setRequestHeader("Cache-Control","no-cache");
|
|
|
+ method: 'post',
|
|
|
+ url: url,
|
|
|
+ data: JSON.stringify(data),
|
|
|
+ contentType: "application/json; charset=UTF-8",
|
|
|
+ beforeSend: function (xmlHttp) {
|
|
|
+ xmlHttp.setRequestHeader("If-Modified-Since", "0");
|
|
|
+ xmlHttp.setRequestHeader("Cache-Control", "no-cache");
|
|
|
},
|
|
|
- success:function(res){
|
|
|
- resolve({data:res});
|
|
|
+ success: function (res) {
|
|
|
+ resolve({ data: res });
|
|
|
},
|
|
|
- error:function(error){
|
|
|
+ error: function (error) {
|
|
|
reject(error);
|
|
|
},
|
|
|
});
|
|
@@ -91,45 +93,45 @@ const newinConf = {
|
|
|
}
|
|
|
|
|
|
const newWindowLocation = `width=${newinConf.width}, height=${newinConf.height}, left=${newinConf.left}, top=${newinConf.top} scrollbars=yes`
|
|
|
-const openNewWin = function(url) {
|
|
|
+const openNewWin = function (url) {
|
|
|
window.open(url, newinConf.openMode, newWindowLocation)
|
|
|
}
|
|
|
|
|
|
//判断浏览器是否为Ie8
|
|
|
-const isIe8 = function(){
|
|
|
+const isIe8 = function () {
|
|
|
var DEFAULT_VERSION = 8.0;
|
|
|
var ua = navigator.userAgent.toLowerCase();
|
|
|
- var isIE = ua.indexOf("msie")>-1;
|
|
|
+ var isIE = ua.indexOf("msie") > -1;
|
|
|
var safariVersion;
|
|
|
- if(isIE){
|
|
|
- safariVersion = ua.match(/msie ([\d.]+)/)[1];
|
|
|
- }
|
|
|
- if(safariVersion <= DEFAULT_VERSION ) {
|
|
|
+ if (isIE) {
|
|
|
+ safariVersion = ua.match(/msie ([\d.]+)/)[1];
|
|
|
+ }
|
|
|
+ if (safariVersion <= DEFAULT_VERSION) {
|
|
|
return true
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-const throttle = function(fn, threshhold) {
|
|
|
+const throttle = function (fn, threshhold) {
|
|
|
var timeout
|
|
|
var start = new Date;
|
|
|
var threshhold = threshhold || 160
|
|
|
return function () {
|
|
|
-
|
|
|
- var context = this, args = arguments, curr = new Date() - 0
|
|
|
-
|
|
|
- clearTimeout(timeout)//总是干掉事件回调
|
|
|
- if(curr - start >= threshhold){
|
|
|
+
|
|
|
+ var context = this, args = arguments, curr = new Date() - 0
|
|
|
+
|
|
|
+ clearTimeout(timeout)//总是干掉事件回调
|
|
|
+ if (curr - start >= threshhold) {
|
|
|
// console.log("now", curr, curr - start)//注意这里相减的结果,都差不多是160左右
|
|
|
fn.apply(context, args) //只执行一部分方法,这些方法是在某个时间段内执行一次
|
|
|
start = curr
|
|
|
- }else{
|
|
|
- //让方法在脱离事件后也能执行一次
|
|
|
- timeout = setTimeout(function(){
|
|
|
- fn.apply(context, args)
|
|
|
+ } else {
|
|
|
+ //让方法在脱离事件后也能执行一次
|
|
|
+ timeout = setTimeout(function () {
|
|
|
+ fn.apply(context, args)
|
|
|
}, threshhold);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
module.exports = {
|
|
|
config,
|