Commit 0ebcb590 by 施宇

111

parent a6cfca59
Showing with 98 additions and 142 deletions
;!function () {
window.IcController = {
init: function () {
this.mounted(this).handleBind(this);
},
getData: function (url, type, param, callback) {
var index = layer.load(1, {
offset: ['50%', "50%"], shade: false
})
var platform = {
source: 2,
token: '1298dc6f00a017d9e94fc1e57792625d'
}
var params = $.extend({}, platform, param);
//跨域模式切换 兼容
var dataTypeXpx = "json";
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) {
dataTypeXpx = "jsonp";
}
var cookieHostname = window.location.hostname.split(".")[1] + "." + window.location.hostname.split(".")[2];
$.ajax({
type: type,
url: url,
data: params,
dataType: dataTypeXpx,
xhrFields: {
withCredentials: true
;
! function () {
window.IcController = {
init: function () {
this.mounted(this).handleBind(this);
},
success: function (data) {
typeof callback == 'function' && callback(data);
layer.close(index);
return false;
getData: function (url, type, param, callback) {
var index = layer.load(1, {
offset: ['50%', "50%"],
shade: false
})
var platform = {
source: 2,
token: '1298dc6f00a017d9e94fc1e57792625d'
}
var params = $.extend({}, platform, param);
//跨域模式切换 兼容
var dataTypeXpx = "json";
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) {
dataTypeXpx = "jsonp";
}
var cookieHostname = window.location.hostname.split(".")[1] + "." + window.location.hostname.split(".")[2];
$.ajax({
type: type,
url: url,
data: params,
dataType: dataTypeXpx,
xhrFields: {
withCredentials: true
},
success: function (data) {
typeof callback == 'function' && callback(data);
layer.close(index);
return false;
},
error: function () {
layer.close(index);
layer.msg('网络出现问题,请重试!');
return false;
}
});
},
error: function () {
layer.close(index);
layer.msg('网络出现问题,请重试!');
return false;
}
});
},
mounted: function (opt) {
//导航栏
var isShow = $('.xbj_li').find('dl').css('display');
if (isShow == 'none') {
$('.xbj_li').find('.li_right').removeClass('iconjuxing15').addClass('iconjuxing12')
} else {
$('.xbj_li').find('.li_right').removeClass('iconjuxing12').addClass('iconjuxing15')
}
return this;
},
handleBind: function (opt) {
//导航栏
$('.xbj_li').on('click', function () {
var isShow = $(this).find('dl').css('display');
if (isShow == 'none') {
$(this).find('dl').slideDown();
$('.xbj_li').find('.li_right').removeClass('iconjuxing12').addClass('iconjuxing15')
} else {
$(this).find('dl').slideUp();
$('.xbj_li').find('.li_right').removeClass('iconjuxing15').addClass('iconjuxing12')
}
$
})
return this;
},
}, $(function () {
IcController.init();
})
mounted: function (opt) {
//导航栏
var isShow = $('.xbj_li').find('dl').css('display');
if (isShow == 'none') {
$('.xbj_li').find('.li_right').removeClass('iconjuxing15').addClass('iconjuxing12')
} else {
$('.xbj_li').find('.li_right').removeClass('iconjuxing12').addClass('iconjuxing15')
}
return this;
},
handleBind: function (opt) {
//导航栏
$('.xbj_li').on('click', function () {
var isShow = $(this).find('dl').css('display');
if (isShow == 'none') {
$(this).find('dl').slideDown();
$('.xbj_li').find('.li_right').removeClass('iconjuxing12').addClass('iconjuxing15')
} else {
$(this).find('dl').slideUp();
$('.xbj_li').find('.li_right').removeClass('iconjuxing15').addClass('iconjuxing12')
}
$
})
return this;
},
}, $(function () {
IcController.init();
})
}();
//工具类
......@@ -147,7 +149,7 @@
* @param val
* @returns {string}
*/
getDateStr:function (val) {
getDateStr: function (val) {
var dd = new Date();
dd.setDate(dd.getDate() + val);
var y = dd.getFullYear();
......@@ -155,77 +157,30 @@
var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
return y + "-" + m + "-" + d;
}
}
return "";
},
/**
* 删除cookie
* @param name
*/
delCookie: function (name) {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval = this.getCookie(name);
if (cval != null) document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
},
/**
* 获取参数
* @param value
* @returns {*}
*/
getRequest: function (value) {
if (window.location.pathname == "/s/") {
var url = unescape(location.search);
} else {
var url = decodeURI(location.search);
}
var object = {};
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
object[strs[i].split("=")[0]] = strs[i].split("=")[1]
}
}
return object[value];
},
/**
* 根据参数获取时间
* @param val
* @returns {string}
*/
getDateStr: function (val) {
var dd = new Date();
dd.setDate(dd.getDate() + val);
var y = dd.getFullYear();
var m = (dd.getMonth() + 1) < 10 ? "0" + (dd.getMonth() + 1) : (dd.getMonth() + 1);
var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
return y + "-" + m + "-" + d;
};
if (typeof define === "function" && define.amd) {
return Util;
} else {
window.Util = Util;
}
};
if (typeof define === "function" && define.amd) {
return Util;
} else {
window.Util = Util;
}
})(window);
//form序列化json
$.fn.serializeJson = function () {
var serializeObj = {};
var array = this.serializeArray();
var str = this.serialize();
$(array).each(function () {
if (serializeObj[this.name]) {
if ($.isArray(serializeObj[this.name])) {
serializeObj[this.name].push(this.value);
} else {
serializeObj[this.name] = [serializeObj[this.name], this.value];
}
} else {
serializeObj[this.name] = this.value;
}
});
return serializeObj;
var serializeObj = {};
var array = this.serializeArray();
var str = this.serialize();
$(array).each(function () {
if (serializeObj[this.name]) {
if ($.isArray(serializeObj[this.name])) {
serializeObj[this.name].push(this.value);
} else {
serializeObj[this.name] = [serializeObj[this.name], this.value];
}
} else {
serializeObj[this.name] = this.value;
}
});
return serializeObj;
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment