/**
* Created by fanwei on 2017/1/18.
*/
$(function() {
var sitpageurl = null;//首页地址
$('.phone').text("热线电话:400-066-5560");
/*==================加载页面底部的东西================================*/
showloadtab();
/*=====获取URL上的参数====*/
function getquerystring(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]); return null;
};
function showloadtab() {
//http://localhost:8080/web/portal/project/showprojectsit/{deptid}
var deptid = null;
if($('#indexparameter').length>0){
deptid = $('#indexparameter').val();
}else{
deptid = getquerystring('deptid');
}
if(deptid==null||deptid==''){
return;
}
$.ajax({
type:"post",
url:url+'/web/portal/project/showprojectsit/'+deptid,
success: function (data) {
/*$('.logo-list ul').find('li').remove();
$('.logo-list2 ul').find('li').remove();
var htmlq = '
首页全部课程';
$('.logo-list ul').append(htmlq);
$('.logo-list2 ul').append(htmlq);*/
sitpageurl = data.content.sitpageurl;
$.each(data.content.sitchannel, function(key,val) {
var channelName = val.channelName;
var channelPageUrl = val.channelPageUrl;
var html=''+channelName+'';
$('.logo-list ul').append(html);
$('.logo-list2 ul').append(html);
$('.h-nav ul').append(html);
$('.h-nav2 ul').append(html);
});
console.log(data);
var copyright = data.content.copyright;
var recordnumber = data.content.recordnumber;
var hottel = data.content.hottel;
var html = ''+copyright+'
';
html = html+''+recordnumber+'
';
// html = html+'电话:'+hottel+'
';
$('.footer').find('p').remove();
$('.footer').append(html);
var sitname = data.content.sitname;
var sitlogo = data.content.sitlogo;
$('.nav .logoboxes img').attr('src',url+sitlogo);
$('.naves .logobox img').attr('src',url+sitlogo);
//notworllist页面
$('.h-logo img').attr('src',url+sitlogo);
$('.h-logo2 img').attr('src',url+sitlogo);
$('.nav .logobox span').text('');
$('.nav .logobox i').remove();
$('.header .text-l').text('您好,欢迎访问'+sitname+'平台!');
$('title').text(sitname);
},
error:function(){}
});
};
/*//创建遮罩
$.createload = function createload(massage) {
if(massage == null || massage == '') {
massage = '正在加载中...';
}
var loadhtml = '
' + massage + ' ';
$('body').prepend(loadhtml);
var bodyheight = $(document.body).height();
var yscroll = document.documentElement.scrollTop;
var screenx = $(window).width();
var documenty = $(document).scrollTop();
var screeny = $(window).height();
$(".backbox").css("top", yscroll + "px");
var DialogDiv_width = $(".backbox").width();
var DialogDiv_height = $(".backbox").height();
$(".backbox").css("left", (screenx / 2 - DialogDiv_width / 2) + "px")
$(".backbox").css("top", (documenty + screeny / 2) + "px")
$('.backcolor').css("height", bodyheight + screeny + "px");
};
//移除遮罩
$.removeload = function removeload() {
$('.backcolor').remove();
$('.backbox').remove();
};*/
//创建提示框
/*$.createCustomalert = function createCustomalert(massage, onback) {
if(onback == null || onback == '') {
onback = '';
} else {
onback = 'onclick="' + onback + '"';
}
var alerthtml = '';
//这是取消按钮暂不需要取消
$('body').prepend(alerthtml);
};*/
//移除提示框
/*$('body').on('click', '.popup a', function() {
$('.bbox2').remove();
});*/
/*=====鼠标移入导航显示二级菜单====*/
$('.nav-list>ul>li').mouseover(function() {
var size = $(this).find('.nav-child').size();
if(size != 0) {
$(this).find('.nav-child').show();
}
});
$('.nav-list>ul>li').mouseout(function() {
var size = $(this).find('.nav-child').size();
if(size != 0) {
$(this).find('.nav-child').hide();
}
});
/*=====点击菜单按钮显示菜单列表====*/
$('.btn-menu').click(function() {
var isHide = $('.nav-list').is(':hidden');
if(isHide) {
$('.nav-list').slideDown(500)
} else {
$('.nav-list').slideUp(500)
}
});
/*=====点击菜单按钮显示菜单列表====*/
$('.tab-head a').click(function() {
$('.notice .tab-head a').removeClass('active');
$(this).addClass('active');
var index = $(this).index();
$('.tab-body>div').eq(index).show().siblings().hide();
});
/*==============轮播图==============*/
$(".owl-carousel").owlCarousel({
items: 1,
loop: true,
autoplay: true,
center: true,
dotsEach: true,
autoplayTimeout: 4000,
autoplayHoverPause: true,
dotData: true
});
/*==================手机点击二级菜单=====================*/
$(".a-muse").click(function() {
$(".h-nav2").animate({
height: 'toggle'
});
});
// 手机学习点击二级菜单
$(".a-muse").click(function() {
$(".logo-list2").animate({
height: 'toggle'
});
});
/*==================弹出层 右上角登陆/注册=====================*/
$('.text-r .login-box a').click(function() {
var index = $(this).index();
if(index < 2) {
$('.alert-bg').show();
$('.alert-box').show();
if(index == 1) {
$('.alert-box .tab-head span').removeClass('active');
$('.alert-box .tab-head span').eq(1).addClass('active')
$('.alert-box .tab-body .register').show();
$('.alert-box .tab-body .login').hide();
} else {
$('.alert-box .tab-head span').removeClass('active');
$('.alert-box .tab-head span').eq(0).addClass('active')
$('.alert-box .tab-body .register').hide();
$('.alert-box .tab-body .login').show();
}
}
});
/*==================弹出层 页面登陆/注册=====================*/
$('.marqueen .in-work a').click(function() {
var index = $(this).index();
if(index < 2) {
$('.alert-bg').show();
$('.alert-box').show();
if(index == 1) {
$('.alert-box .tab-head span').removeClass('active');
$('.alert-box .tab-head span').eq(1).addClass('active')
$('.alert-box .tab-body .register').show();
$('.alert-box .tab-body .login').hide();
} else {
$('.alert-box .tab-head span').removeClass('active');
$('.alert-box .tab-head span').eq(0).addClass('active')
$('.alert-box .tab-body .register').hide();
$('.alert-box .tab-body .login').show();
}
}
});
/*=====手机弹出登录====*/
$('.a-load a').click(function() {
console.log(1);
/*$('.alert-bg').show();
$('.alert-box').show();
if($(".exit").is(":hidden")&&$(".tab-head-me").is(":hidden")){
$('.alert-box .tab-head span').removeClass('active');
$('.alert-box .tab-head span').eq(0).addClass('active');
$('.alert-box .tab-body .login').show();
$('.alert-box .tab-body .register').hide();
}else{
$('.exit').show();
}*/
//2017-10-22修改手机端未登录用户弹出只显示提示。现在没有登录注册了。
//要恢复登录注册,下面代码干掉,
$('.alert-bg').show();
$('.alert-box').show();
if($(".exit").is(":hidden")&&$(".tab-head-me").is(":hidden")){
/*$('.alert-box .tab-head span').removeClass('active');
$('.alert-box .tab-head span').eq(0).addClass('active');
$('.alert-box .tab-body .login').show();
$('.alert-box .tab-body .register').hide();*/
$('.tab-head').hide();
$('.alert-box .tab-body .login').hide();
$('.alert-box .tab-body .register').hide();
$('.tab-head-ts').show();
$('.tsxx-box').show();
}else{
$('.exit').show();
}
});
/*=====登录/注册 tab切换====*/
$('.alert-box .tab-head span').click(function() {
$('.alert-box .tab-head span').removeClass('active');
$(this).addClass('active');
var index = $(this).index();
if(index == 0) {
$('.alert-box .tab-body .login').show();
$('.alert-box .tab-body .register').hide();
} else {
$('.alert-box .tab-body .register').show();
$('.alert-box .tab-body .login').hide();
}
});
/*=======绑定"我的课程"点击事件=======*/
$('.header .login-success .pro-me').click(function(){
var deptid = null;
if($('#indexparameter').length>0){
deptid = $('#indexparameter').val();
}else{
deptid = getquerystring('deptid');
}
if(deptid==null||deptid==''){
deptid=0;
}
window.location.href = url+"/online/curriculums.html?proofme=forme&deptid="+deptid;
});
/*=======绑定"我的课程"点击事件-手机=======*/
$('.exit .user-course a').click(function(){
var deptid = null;
if($('#indexparameter').length>0){
deptid = $('#indexparameter').val();
}else{
deptid = getquerystring('deptid');
}
if(deptid==null||deptid==''){
return;
}
window.location.href = url+"/online/curriculums.html?proofme=forme&deptid="+deptid;
});
/*=======绑定"首页"点击事件=======*/
$('#backindex-1').click(function(){
var deptid = getquerystring('deptid');
if(deptid==0){
window.location.href = "index.html";
}else{
window.location.href = sitpageurl;
}
});
/*=======绑定"首页"点击事件-手机=======*/
$('#backindex-2').click(function(){
var deptid = getquerystring('deptid');
if(deptid==0){
window.location.href = "index.html";
}else{
window.location.href = sitpageurl;
}
});
/*=======绑定"全部课程"点击事件=======*/
$('#logolist-1').click(function(){
var deptid = getquerystring('deptid');
window.location.href = url+"/online/curriculums.html?deptid="+deptid;
});
/*=======绑定"全部课程"点击事件-手机=======*/
$('#logolist-2').click(function(){
var deptid = getquerystring('deptid');
window.location.href = url+"/online/curriculums.html?deptid="+deptid;
});
/*=====关闭弹出层====*/
$('.close').click(function() {
$('.alert-bg').hide();
$('.alert-box').hide();
$('.exit').hide();
});
$('.alert-bg').click(function() {
$('.alert-bg').hide();
$('.alert-box').hide();
$('.exit').hide();
});
/*=====关于我们tab切换====*/
$('.abw-list ul li').click(function() {
$(this).addClass("specific-function-sy").siblings().removeClass(); //
$(".abw-cunt-lbox > div").hide().eq($('.abw-list ul li').index(this)).show();
});
$('.note-nav ul li').click(function() {
$(this).addClass("specific-function-sy").siblings().removeClass(); //
$(".note-content-box > div").hide().eq($('.note-nav ul li').index(this)).show();
});
});