|
@@ -1,4 +1,6 @@
|
|
|
-import { validatenull } from './validate'
|
|
|
+import {
|
|
|
+ validatenull
|
|
|
+} from './validate'
|
|
|
/**
|
|
|
* 动态插入css
|
|
|
*/
|
|
@@ -46,11 +48,11 @@ const isInclude = (name) => {
|
|
|
}
|
|
|
const addCallback = (obj, callback) => {
|
|
|
if (obj.addEventListener) {
|
|
|
- obj.addEventListener('load', function () {
|
|
|
+ obj.addEventListener('load', function() {
|
|
|
callback && callback();
|
|
|
}, false);
|
|
|
} else if (obj.attachEvent) {
|
|
|
- obj.attachEvent('onreadystatechange', function () {
|
|
|
+ obj.attachEvent('onreadystatechange', function() {
|
|
|
var target = window.event.srcElement;
|
|
|
if (target.readyState == 'loaded') {
|
|
|
callback && callback();
|
|
@@ -172,16 +174,16 @@ export const listenfullscreen = (callback) => {
|
|
|
function listen() {
|
|
|
callback()
|
|
|
}
|
|
|
- document.addEventListener('fullscreenchange', function () {
|
|
|
+ document.addEventListener('fullscreenchange', function() {
|
|
|
listen();
|
|
|
});
|
|
|
- document.addEventListener('mozfullscreenchange', function () {
|
|
|
+ document.addEventListener('mozfullscreenchange', function() {
|
|
|
listen();
|
|
|
});
|
|
|
- document.addEventListener('webkitfullscreenchange', function () {
|
|
|
+ document.addEventListener('webkitfullscreenchange', function() {
|
|
|
listen();
|
|
|
});
|
|
|
- document.addEventListener('msfullscreenchange', function () {
|
|
|
+ document.addEventListener('msfullscreenchange', function() {
|
|
|
listen();
|
|
|
});
|
|
|
};
|
|
@@ -244,7 +246,8 @@ export const diff = (obj1, obj2) => {
|
|
|
delete obj1.close;
|
|
|
var o1 = obj1 instanceof Object;
|
|
|
var o2 = obj2 instanceof Object;
|
|
|
- if (!o1 || !o2) { /* 判断不是对象 */
|
|
|
+ if (!o1 || !o2) {
|
|
|
+ /* 判断不是对象 */
|
|
|
return obj1 === obj2;
|
|
|
}
|
|
|
|
|
@@ -270,7 +273,7 @@ export const diff = (obj1, obj2) => {
|
|
|
export const findByvalue = (dic, value) => {
|
|
|
let result = '';
|
|
|
if (validatenull(dic)) return value;
|
|
|
- if (typeof (value) == 'string' || typeof (value) == 'number' || typeof (value) == 'boolean') {
|
|
|
+ if (typeof(value) == 'string' || typeof(value) == 'number' || typeof(value) == 'boolean') {
|
|
|
let index = 0;
|
|
|
index = findArray(dic, value);
|
|
|
if (index != -1) {
|
|
@@ -321,12 +324,16 @@ export const openWindow = (url, title, w, h) => {
|
|
|
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : screen.left
|
|
|
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : screen.top
|
|
|
|
|
|
- const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width
|
|
|
- const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height
|
|
|
+ const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document
|
|
|
+ .documentElement.clientWidth : screen.width
|
|
|
+ const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document
|
|
|
+ .documentElement.clientHeight : screen.height
|
|
|
|
|
|
const left = ((width / 2) - (w / 2)) + dualScreenLeft
|
|
|
const top = ((height / 2) - (h / 2)) + dualScreenTop
|
|
|
- const newWindow = window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left)
|
|
|
+ const newWindow = window.open(url, title,
|
|
|
+ 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' +
|
|
|
+ w + ', height=' + h + ', top=' + top + ', left=' + left)
|
|
|
|
|
|
// Puts focus on the newWindow
|
|
|
if (window.focus) {
|
|
@@ -371,7 +378,9 @@ export const generateTitle = (title, key, _this) => {
|
|
|
}
|
|
|
//处理路由
|
|
|
export const getPath = (params) => {
|
|
|
- let { src } = params;
|
|
|
+ let {
|
|
|
+ src
|
|
|
+ } = params;
|
|
|
let result = src || '/';
|
|
|
if (src.includes('http') || src.includes('https')) {
|
|
|
result = `/myiframe/urlPath?${objToform(params)}`;
|
|
@@ -390,3 +399,14 @@ export const getValue = (route) => {
|
|
|
return value;
|
|
|
}
|
|
|
// 路由处理 结束
|
|
|
+
|
|
|
+// null赋值空字符串
|
|
|
+export const nullToString = (obj) => {
|
|
|
+
|
|
|
+ Object.keys(obj).forEach(function(key) {
|
|
|
+ console.log(key, obj[key])
|
|
|
+ if (obj[key] === null) {
|
|
|
+ obj[key] = ''
|
|
|
+ }
|
|
|
+ })
|
|
|
+}
|