var ltIE9 = (function () {
var theUA = window.navigator.userAgent.toLowerCase();
if ((theUA.match(/msie\s\d+/) && theUA.match(/msie\s\d+/)[0]) || (theUA.match(/trident\s?\d+/) && theUA.match(/trident\s?\d+/)[0])) {
var ieVersion = theUA.match(/msie\s\d+/)[0].match(/\d+/)[0] || theUA.match(/trident\s?\d+/)[0];
if (ieVersion < 9) {
return true
} else {
return false
}
}
})();
if (ltIE9) {
window.location.href = "/ie/";
}
console.log('%c WWW.SHUWON.COM', 'font-size:40px;font-weight:700;-webkit-user-select: none;background-image: -webkit-gradient(linear, 0 0, right bottom, from(rgba(203, 0, 0, 1)), to(rgba(37, 220, 222, 1)));-webkit-background-clip: text;-webkit-text-fill-color: transparent;');
var shuwon = {
init: function () {
$("body").append('
');
$("body").append('');
var $header = $('._header'),
$footer = $('._footer');
$header.load('/header/', function () {
console.log(navIndex)
navIndex += 1
console.log(navIndex)
var $nav = $('._nav');
$nav.find('ul>li').eq(navIndex).addClass('active');
$(window).scroll(function () {
if ($(window).scrollTop() >= 40) {
$header.addClass('active')
} else {
$header.removeClass('active')
}
})
var $hamburg = $('.hamburg')
$hamburg.click(function (e) {
$('._header').toggleClass('open')
})
var explorer = navigator.userAgent;
//ie
if (explorer.indexOf("MSIE") >= 0) {}
//firefox
else if (explorer.indexOf("Firefox") >= 0) {
$('._nav ul.ul').removeClass('goo')
}
});
$footer.load('/footer/', function () {})
// $.post("http://project.ishuwon.cn/api/project/stop", {
// url: window.location.origin
// }, function (data) {
// if (data.result) window.location.href = "http://www.shuwon.com/over/";
// })
shuwon.backTop();
},
loaded: function () {
wow = new WOW({
animateClass: 'animated',
});
wow.init();
$('._header').removeClass('DowActive')
},
index: function () {
var swiper = new Swiper('.swiper-container', {
loop: true,
navigation: {
prevEl: '.bannerBtnL',
nextEl: '.bannerBtnR',
},
lazy:true,
speed: 1000,
autoplay: {
delay: 3000,
stopOnLastSlide: false,
disableOnInteraction: true,
},
});
var $newsHot = $('.newsHot');
var liLength = $newsHot.find('ul li').size();
var ulHtml = $newsHot.find('ul').html();
$newsHot.find('ul').append(ulHtml);
var listTop = 0
var Timer = setInterval(function (e) {
if (listTop >= liLength - 1) {
listTop = 0
} else {
listTop++
}
gd(listTop)
}, 2000);
$newsHot.find('.btnL').click(function (e) {
if (listTop >= liLength - 1) {
listTop = 0
} else {
listTop++
}
clearInterval(Timer);
gd(listTop);
Timer = setInterval(function (e) {
if (listTop >= liLength - 1) {
listTop = 0
} else {
listTop++
}
gd(listTop)
}, 2000)
});
$newsHot.find('.btnR').click(function (e) {
if (listTop <= 0) {
listTop = liLength
} else {
listTop--
}
clearInterval(Timer);
gd(listTop);
Timer = setInterval(function (e) {
if (listTop >= liLength - 1) {
listTop = 0
} else {
listTop++
}
gd(listTop)
}, 2000)
});
function gd(listTop) {
$newsHot.find('ul').animate({
top: -listTop * 80 + 'px'
})
};
//视频
var $videoBtn = $('.videoBtn'),
$views = $('.views'),
video = document.getElementById('video');
$videoBtn.click(function (e) {
$views.addClass('active')
});
$views.find('.bnt_off').click(function (e) {
$views.removeClass('active')
video.pause()
});
},
contact: function (e) {
var $loading = $('._loading');
$loading.addClass("active");
var $starting = $('#starting'),
$end = $('#end'),
$btnSec = $('.btnSec'),
$method = $('.method'),
$results = $("#results"),
$showResults = $('#showResults');
window.onload = function () {
var map;
onLoad();
function onLoad() {
var points = [{
point:new BMap.Point(104.198435, 30.576988),
title:"成都天立学校(东区)",
info:'四川省龙泉驿区金茶路168号'
},{
point: new BMap.Point(103.951626,30.798738),
title:"成都天立学校(西区)",
info:'四川省郫都区港华路599号'
}];
var point_index = 0;
var point = points[point_index].point;
var index = 0;
var typeIndex = 0;
var transitPolicy = [
[BMAP_TRANSIT_POLICY_LEAST_TIME, BMAP_TRANSIT_POLICY_LEAST_TRANSFER, BMAP_TRANSIT_POLICY_LEAST_WALKING],
[BMAP_DRIVING_POLICY_LEAST_TIME, BMAP_DRIVING_POLICY_LEAST_DISTANCE, BMAP_DRIVING_POLICY_AVOID_HIGHWAYS]
];
map = new BMap.Map("map");
map.enableScrollWheelZoom();
map.addControl(new BMap.NavigationControl());
map.addControl(new BMap.MapTypeControl({
mapTypes: [BMAP_NORMAL_MAP, BMAP_HYBRID_MAP]
}));
points.forEach(function (item) {
addPoint(item)
})
function addPoint(item){
var marker = new BMap.Marker(item.point);
var opts = {
width: 280,
height: 90,
title:item.title
};
var infoWindow = new BMap.InfoWindow("地址:" + item.info, opts);
map.addOverlay(marker);
// marker.openInfoWindow(infoWindow);
marker.addEventListener("click", function () {
this.openInfoWindow(infoWindow)
});
item.infoWindow = infoWindow;
item.marker = marker;
}
$('.contactBox .InformationBox').eq(0).addClass('active');
$('.contactBox .InformationBox').click(function () {
$(this).addClass('active').siblings().removeClass('active');
$showResults.hide();
map.clearOverlays();
point_index = $(this).index()
point = points[point_index].point;
addPoint(points[point_index]);
map.centerAndZoom(point, 14);
points[point_index].marker.openInfoWindow(points[point_index].infoWindow);
$('#end').val('地址:' + points[point_index].info)
$('.busTips .secColor + .secColor').text(points[point_index].info)
})
setTimeout(function () {
map.centerAndZoom(point, 14);
points[point_index].marker.openInfoWindow(points[point_index].infoWindow);
},500)
map.addEventListener("tilesloaded", function () {
$(".anchorBL").hide()
});
var ac = new BMap.Autocomplete({
"input": "starting",
"location": map
});
var textStr = [
["较快捷", "少换乘", "少步行"],
["较快捷", "短距离", "避高速"]
];
if ($(window).width() < 1200) {
map.disableDragging()
}
$method.find('li').click(function () {
var btnVal = ["搜索公交线路", "搜索驾车线路"];
typeIndex = $(this).index();
$btnSec.val(btnVal[typeIndex]);
$(".roadline_result li").each(function (i) {
$(".roadline_result li").eq(i).text(textStr[typeIndex][i])
});
$(this).addClass("active").siblings().removeClass("active");
onSearchComplete($starting.val(), transitPolicy[typeIndex][index], typeIndex)
});
$(".roadline_result li").click(function () {
index = $(this).index();
$(this).addClass("cur").siblings("li").removeClass("cur");
onSearchComplete($starting.val(), transitPolicy[typeIndex][index], typeIndex)
});
$btnSec.click(function () {
$("#startadd").text($starting.val());
onSearchComplete($starting.val(), transitPolicy[typeIndex][index], typeIndex)
})
function onSearchComplete(start, route, isdrive) {
// console.log(start, route, isdrive)
if ($("#starting").val() == "") {
return false
}
$showResults.show();
$results.html("
");
map.clearOverlays();
if (isdrive) {
var transit = new BMap.DrivingRoute(map, {
renderOptions: {
map: map,
panel: "results"
},
policy: route
})
} else {
var transit = new BMap.TransitRoute(map, {
renderOptions: {
map: map,
panel: "results"
},
policy: route
})
}
transit.search(start, points[point_index].info)
}
}
}
},
recruitment: function (e) {
// var $more = $('.RecruitmentBox .more'),
// $jobmark = $('.job-mark');
// $more.click(function (e) {
// $jobmark.addClass('active')
// });
// $jobmark.find('.btn_off').click(function (e) {
// $jobmark.removeClass('active')
// })
},
backTop: function () {
var offset = 300,
offset_opacity = 1200,
scroll_top_duration = 500,
$back_to_top = $('.backTop');
$(window).scroll(function () {
($(this).scrollTop() > offset) ? $back_to_top.addClass('active'): $back_to_top.removeClass('active');
if ($(this).scrollTop() > offset_opacity) {
$back_to_top.addClass('active')
}
});
$back_to_top.on('click', function (event) {
event.preventDefault();
$('body,html').animate({
scrollTop: 0
}, scroll_top_duration)
})
},
enrollment: function (e) {
var $BriefChapterBox = $('.BriefChapterBox');
$BriefChapterBox.find('ol li').click(function (e) {
$(this).addClass('active').siblings().removeClass('active');
var index = $(this).index();
$BriefChapterBox.find('ul li').eq(index).show().siblings().hide()
});
var $AFRBox = $('.AFRBox'),
$grade = $('.grade'),
$btn_submit = $('.btn_submit'),
$required = $('.AFR .form li.required'),
styleGrade = 0;
$required.find('select').html('')
$AFRBox.find('a').click(function (e) {
$(this).addClass('active').siblings().removeClass('active');
styleGrade = $(this).index();
console.log(styleGrade);
if (styleGrade == 0) {
//$grade.find('select').html('')
$grade.find('select').html('')
$required.find('select').html('')
} else {
$grade.find('select').html('')
$required.find('select').html('')
}
})
$('#birthday').daterangepicker({
"singleDatePicker": true,
"dateLimit": {
"days": 7
},
"locale": {
"format": "YYYY-MM-DD",
"separator": " - ",
"applyLabel": "确定",
"cancelLabel": "取消",
"customRangeLabel": "Custom",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
},
"startDate": "2013-01-01",
}, function (start, end, label) {
});
$('#ITime').daterangepicker({
"singleDatePicker": true,
"timePicker": true,
"timePicker24Hour": true,
"timePickerIncrement": 30,
"dateLimit": {
"days": 7
},
"ranges": {
"Today": [
"2019-04-29T02:46:49.985Z",
"2019-04-29T02:46:49.985Z"
],
"Yesterday": [
"2019-04-28T02:46:49.985Z",
"2019-04-28T02:46:49.985Z"
],
"Last 7 Days": [
"2019-04-23T02:46:49.985Z",
"2019-04-29T02:46:49.985Z"
],
"Last 30 Days": [
"2019-03-31T02:46:49.985Z",
"2019-04-29T02:46:49.985Z"
],
"This Month": [
"2019-03-31T16:00:00.000Z",
"2019-04-30T15:59:59.999Z"
],
"Last Month": [
"2019-02-28T16:00:00.000Z",
"2019-03-31T15:59:59.999Z"
]
},
"locale": {
"format": "YYYY-MM-DD HH:mm",
"separator": " - ",
"applyLabel": "确定",
"cancelLabel": "取消",
"customRangeLabel": "Custom",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
},
"minDate": "2019-05-24 08:00",
"maxDate": "2019-05-26 08:00",
"startDate": "2013-05-24 08:00",
}, function (start, end, label) {
});
//提交
$btn_submit.click(function (e) {
var form = document.getElementById('joinForm')
if (form.userName.value == '') {
shuwon.toast('请填写姓名')
return
}
if (form.nation.value == '') {
shuwon.toast('请填写民族')
return
}
if (form.birthday.value == '') {
shuwon.toast('请填写出生日期')
return
}
if (form.old_school.value == '') {
shuwon.toast('请填写现就读学校')
return
}
//
if (form.name.value == '') {
shuwon.toast('请填写联系人姓名')
return
}
//
if (form.relationship.value == '') {
shuwon.toast('请填写与学生关系')
return
}
//
if (!shuwon.regPhone(form.mobile.value)) {
shuwon.toast('请填写正确联系电话')
return
}
if (form.mobile.value == '') {
shuwon.toast('请填写联系电话')
return
}
$.ajax({
url: '/enrollmentPost/',
type: "post",
data: {
userName: form.userName.value,
sex: form.sex.value,
nation: form.nation.value,
class: form.class.value,
birthday: form.birthday.value,
nationality: form.nationality.value,
code: form.code.value,
old_school: form.old_school.value,
know_from: form.know_from.value,
place: form.place.value,
address: form.address.value,
name: form.name.value,
relationship: form.relationship.value,
mobile: form.mobile.value,
type: styleGrade + 1,
weixin: form.wx.value,
position: form.position.value,
school_type: form.school_type.value,
remarks: form.remarks.value,
//InterviewTime:form.InterviewTime.value
},
dataType: "json",
success: function (data) {
if (data.result) {
shuwon.toast(data.msg)
form.userName.value = ''
form.nation.value = ''
form.birthday.value = ''
form.nationality.value = ''
form.code.value = ''
form.old_school.value = '',
form.place.value = ''
form.address.value = ''
form.name.value = ''
form.relationship.value = ''
form.mobile.value = ''
form.wx.value = ''
form.position.value = ''
form.remarks.value = ''
} else {
if (data.status == 2) {
$('.toast__ .box1>p').text(data.msg)
$('.toast__').show();
$('.toast__ .cancel').off('click')
$('.toast__ .cancel').click(function () {
$('.toast__').hide();
})
$('.toast__ .confirm').off('click')
$('.toast__ .confirm').click(function () {
$('.toast__').hide();
$.ajax({
url: '/enrollmentPost/',
type: "post",
data: {
userName: form.userName.value,
sex: form.sex.value,
nation: form.nation.value,
class: form.class.value,
birthday: form.birthday.value,
nationality: form.nationality.value,
code: form.code.value,
old_school: form.old_school.value,
know_from: form.know_from.value,
place: form.place.value,
address: form.address.value,
name: form.name.value,
relationship: form.relationship.value,
mobile: form.mobile.value,
type: styleGrade + 1,
weixin: form.wx.value,
position: form.position.value,
school_type: form.school_type.value,
remarks: form.remarks.value,
xiugai: 1
},
dataType: "json",
success: function (data) {
shuwon.toast(data.msg)
form.reset()
}
})
})
} else {
shuwon.toast(data.msg)
}
}
}
});
})
},
enrollmentchild: function (e) {
var $BriefChapterBox = $('.BriefChapterBox');
$BriefChapterBox.find('ol li').click(function (e) {
$(this).addClass('active').siblings().removeClass('active');
var index = $(this).index();
$BriefChapterBox.find('ul li').eq(index).show().siblings().hide()
});
var $AFRBox = $('.AFRBox'),
$grade = $('.grade'),
$btn_submit = $('.btn_submit'),
$required = $('.AFR .form li.required'),
styleGrade = 0;
$required.find('select').html('')
$AFRBox.find('a').click(function (e) {
$(this).addClass('active').siblings().removeClass('active');
styleGrade = $(this).index();
console.log(styleGrade);
if (styleGrade == 0) {
$grade.find('select').html('')
$required.find('select').html('')
} else {
}
})
$('#birthday').daterangepicker({
"singleDatePicker": true,
"dateLimit": {
"days": 7
},
"locale": {
"format": "YYYY-MM-DD",
"separator": " - ",
"applyLabel": "确定",
"cancelLabel": "取消",
"customRangeLabel": "Custom",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
},
"startDate": "2017-01-01",
}, function (start, end, label) {
});
$('#ITime').daterangepicker({
"singleDatePicker": true,
"timePicker": true,
"timePicker24Hour": true,
"timePickerIncrement": 30,
"dateLimit": {
"days": 7
},
"ranges": {
"Today": [
"2019-04-29T02:46:49.985Z",
"2019-04-29T02:46:49.985Z"
],
"Yesterday": [
"2019-04-28T02:46:49.985Z",
"2019-04-28T02:46:49.985Z"
],
"Last 7 Days": [
"2019-04-23T02:46:49.985Z",
"2019-04-29T02:46:49.985Z"
],
"Last 30 Days": [
"2019-03-31T02:46:49.985Z",
"2019-04-29T02:46:49.985Z"
],
"This Month": [
"2019-03-31T16:00:00.000Z",
"2019-04-30T15:59:59.999Z"
],
"Last Month": [
"2019-02-28T16:00:00.000Z",
"2019-03-31T15:59:59.999Z"
]
},
"locale": {
"format": "YYYY-MM-DD HH:mm",
"separator": " - ",
"applyLabel": "确定",
"cancelLabel": "取消",
"customRangeLabel": "Custom",
"daysOfWeek": ["日", "一", "二", "三", "四", "五", "六"],
"monthNames": ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
"firstDay": 1
},
"minDate": "2019-05-24 08:00",
"maxDate": "2019-05-26 08:00",
"startDate": "2013-05-24 08:00",
}, function (start, end, label) {
});
//提交
$btn_submit.click(function (e) {
var form = document.getElementById('joinForm')
if (form.userName.value == '') {
shuwon.toast('请填写姓名')
return
}
if (form.nation.value == '') {
shuwon.toast('请填写民族')
return
}
if (form.birthday.value == '') {
shuwon.toast('请填写出生日期')
return
}
// if (form.old_school.value == '') {
// shuwon.toast('请填写现就读学校')
// return
// }
//
if (form.name.value == '') {
shuwon.toast('请填写联系人姓名')
return
}
//
if (form.relationship.value == '') {
shuwon.toast('请填写与学生关系')
return
}
//
if (!shuwon.regPhone(form.mobile.value)) {
shuwon.toast('请填写正确联系电话')
return
}
if (form.mobile.value == '') {
shuwon.toast('请填写联系电话')
return
}
$.ajax({
url: '/enrollmentPost/',
type: "post",
data: {
userName: form.userName.value,
sex: form.sex.value,
nation: form.nation.value,
class: form.class.value,
birthday: form.birthday.value,
nationality: form.nationality.value,
old_school: form.old_school.value,
know_from: form.know_from.value,
place: form.place.value,
address: form.address.value,
name: form.name.value,
relationship: form.relationship.value,
mobile: form.mobile.value,
type: 2,
weixin: form.wx.value,
position: form.position.value,
//school_type: form.school_type.value,
remarks: form.remarks.value,
//InterviewTime:form.InterviewTime.value
},
dataType: "json",
success: function (data) {
if (data.result) {
shuwon.toast(data.msg)
form.userName.value = ''
form.nation.value = ''
form.birthday.value = ''
form.nationality.value = ''
form.old_school.value = '',
form.place.value = ''
form.address.value = ''
form.name.value = ''
form.relationship.value = ''
form.mobile.value = ''
form.wx.value = ''
form.position.value = ''
form.remarks.value = ''
} else {
if (data.status == 2) {
$('.toast__ .box1>p').text(data.msg)
$('.toast__').show();
$('.toast__ .cancel').off('click')
$('.toast__ .cancel').click(function () {
$('.toast__').hide();
})
$('.toast__ .confirm').off('click')
$('.toast__ .confirm').click(function () {
$('.toast__').hide();
$.ajax({
url: '/enrollmentPost/',
type: "post",
data: {
userName: form.userName.value,
sex: form.sex.value,
nation: form.nation.value,
class: form.class.value,
birthday: form.birthday.value,
nationality: form.nationality.value,
code: form.code.value,
old_school: form.old_school.value,
know_from: form.know_from.value,
place: form.place.value,
address: form.address.value,
name: form.name.value,
relationship: form.relationship.value,
mobile: form.mobile.value,
type: 2,
weixin: form.wx.value,
position: form.position.value,
//school_type: form.school_type.value,
remarks: form.remarks.value,
xiugai: 1
},
dataType: "json",
success: function (data) {
shuwon.toast(data.msg)
form.reset()
}
})
})
} else {
shuwon.toast(data.msg)
}
}
}
});
})
},
school: function (e) {
var hash = document.location.hash
if (hash == '#Course') {
$('body,html').animate({
scrollTop: $('.Course').offset().top - 100
}, 1000)
} else if (hash == '#Features') {
$('body,html').animate({
scrollTop: $('.Features').offset().top - 100
}, 1000)
} else if (hash == '#Teacher') {
$('body,html').animate({
scrollTop: $('.Teacher').offset().top - 100
}, 1000)
} else if (hash == '#AcademicTeam') {
$('body,html').animate({
scrollTop: $('.AcademicTeam').offset().top - 100
}, 1000)
} else if (hash == '#Xgnews') {
$('body,html').animate({
scrollTop: $('.Xgnews').offset().top - 100
}, 1000)
}
},
/**
* 随机返回区间值
* min:最小值
* max:最大值
*/
rand: function (min, max) {
return Math.random() * (max - min) + min;
},
/**
* 验证手机号码
* @param {obj} 传入的手机号码
* @return 正确返回true 错误返回false
*/
regPhone: function (obj) {
reg = /^(13|15|17|18|19|14)[0-9]{9}$/;
return reg.test(obj);
},
/**
* 判断验证码是否符合要求
*/
regCode: function (obj) {
if (obj.length == 0 || obj.length != 6) {
return true;
}
return false;
},
/**
*判断div是否在可见区域
*/
scrollTopDiv: function (obj) {
var scrollTop = $(obj).offset().top
if (scrollTop >= $(window).scrollTop() && scrollTop < ($(window).scrollTop() + $(window).height() - 200)) {
return true
}
return false;
},
/**
* 只能输入中英文和数字
*/
regName: function (obj) {
var reg = /^[\u4e00-\u9fa5]{2,20}$/;
return reg.test(obj);
},
/**
* 姓名 || 只能输入中英文
* @param {obj} 传入的字符
* @return 正确返回true 错误返回false
*/
regName: function (obj) {
reg = /^[\u4E00-\u9FA5A-Za-z]+$/;;
return reg.test(obj);
},
/**
* 判断身份证号码是否符合要求
*/
regID: function (obj) {
reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
return reg.test(obj);
},
/**
* 按钮点击事件
* @ele 传入的元素
*/
btnClick: function (ele) {
},
/**
* 倒计时
*/
countDownTime: function () {
isClick = false;
$('.yzmBtn').addClass("enable");
$('.yzmBtn').addClass("active").html('60秒后重新获取')
var waitTime, currTime = 59;
var interval = setInterval(function () {
shuwon.timeChange(currTime);
currTime--;
if (currTime < 0) {
clearInterval(interval);
currTime = waitTime;
}
}, 1000);
},
timeChange: function (waitTime) {
if (waitTime != 0) {
$('.yzmBtn').html(waitTime + '秒后重新获取');
} else {
$('.yzmBtn').html('获取验证码').removeClass("active");
isClick = true;
$('.yzmBtn').removeClass("enable");
}
},
/**
* 提示信息
* @msg 提示的信息
* @success true 成功 | false 失败
*/
toast: function (msg, sucess) {
$("._toast").addClass("active").find("span").html(msg);
if (!sucess) {
$("._toast").addClass("warn");
} else {
$("._toast").removeClass("warn");
}
setTimeout(function () {
$("._toast").removeClass("active")
}, 1500)
},
/**
* 获取地址栏
* @name 获取传入的参数
*/
getUrlParam: function (name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
return r ? decodeURIComponent(r[2]) : null;
},
/**
* 时间戳转时间
*
* @param {any} timer
*/
Timer: function (timer) {
var timeBpx = {
t: '',
ts: 0,
mdhm: ''
}
var current = Math.floor(new Date().getTime() / 1000);
var dd_ = 0,
hh_ = 0,
mm_ = 0,
ss_ = 0;
timeBpx.ts = timer - current;
dd_ = Math.floor(timeBpx.ts / (60 * 60 * 24)); //计算剩余的天数
hh_ = Math.floor(timeBpx.ts / (60 * 60)) - (dd_ * 24) //计算剩余的小时数
mm_ = Math.floor(timeBpx.ts / 60) - (dd_ * 24 * 60) - (hh_ * 60) //计算剩余的分钟数
ss_ = Math.floor(timeBpx.ts) - (dd_ * 24 * 60 * 60) - (hh_ * 60 * 60) - (mm_ * 60) //计算剩余的秒数
if (hh_ <= 9) hh_ = '0' + hh_;
if (mm_ <= 9) mm_ = '0' + mm_;
if (ss_ <= 9) ss_ = '0' + ss_;
//let t = '开始倒计时:' + dd_ + '天' + hh_ + '小时' + mm_ + '分' + ss_ + "秒"
timeBpx.t = dd_ + '天' + hh_ + '小时' + mm_ + '分'
timeBpx.tm = dd_ + '天' + hh_ + '小时' + mm_ + '分' + ss_ + "秒"
var time = new Date(timer * 1000)
timeBpx.mdhm = time.getMonth() + 1 + '月' + time.getDate() + '日' + time.getHours() + '时' + time.getMinutes() + '分'
timeBpx.yyr = time.getFullYear() + '-' + (time.getMonth() + 1 < 10 ? '0' + (time.getMonth() + 1) : time.getMonth() + 1) + '-' + time.getDate()
return timeBpx
},
/**
* 获取数据
* @url 传入的数据接口
* @para 传入的参数
*/
getDataForApi: function (url, para, callback) {
$.ajax({
type: "post",
data: para,
url: url,
dataType: 'json',
success: function (data) {
callback(data)
},
error: function (e) {
console.log(e, "数据加载错误")
}
})
},
//js
returnObj: function (el) {
return document.getElementById(el);
}
};
shuwon.init();