/**
* Created by 阳仔 on 2017-12-18.
*/
var store = window.localStorage;
var se = window.sessionStorage;
// 跳转
function goRedirect(site){
if(site==1){//电子签章
var content="
"+
"
申请体验
"+
"
提交后即可享受 5次免费使用
"+
"
"+
" "+
"
"+
""+
"
";
layer.open({
title:'电子签章'
,type: 1
,offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset
,id: 'layerDemoauto' //防止重复弹出
,content: content
,closeBtn:1
,area:"[400px,500px]"
// ,btn: '关闭全部'
,btnAlign: 'c' //按钮居中
,shade: 0 //不显示遮罩
,yes: function(){
layer.closeAll();
}
});
}else{//网址
window.open(site);
}
};
function onSealSubmit(){
var mobile = $("#trySeal_mobile").val();
var reg = /^1[0-9]{10}$/;
if(mobile.trim()==''){
layer.msg("请输入手机号",{anim: 6});
$("#trySeal_mobile").focus();
return;
}
if(!(reg.test(mobile))){
layer.msg("手机号码格式有误",{anim: 6});
return;
}
var url = "/metering/employee/add_try_emp";
var data = {mobile:mobile,type:1};
$.post(url,data,function(res){
if(!res.msg){
res.msg="提交出错,请联系客服:400-999-1762!";
}
layer.alert(res.msg, {
skin: 'layui-layer-molv' //样式类名 自定义样式
,closeBtn: 1 // 是否显示关闭按钮
,anim: 1 //动画类型
,icon: 6 // icon
,yes:function(){
layer.closeAll();
}
});
},"json");
}
$(function() {
var qiye_rz = se.getItem("qiye_rz");
var qiye_tz = se.getItem("qiye_tz");
var qiye_yd = se.getItem("qiye_yd");
$("#qiye_tz").css("display", "none");
if (qiye_rz == 1) {
$("#qiye_rz").css("display", "none");
}
if (qiye_yd == 1) {
$("#qiye_yd").css("display", "none");
}
$("#topUp").click(function() {
$('html,body').animate({
scrollTop : 0
}, 300);
});
$(".headerC").load(function() {
$(this).contents().find('.shenq').click(function() {
layer.open({
type : 2,
title : false,
shadeClose : true,
skin : 'yourclass',
closeBtn : 0,
area : [ '454px', '360px' ],
shade : 0.8,
content : 'tiyan.html',
success : function(layero, index) {
var body = layer.getChildFrame('body', index);
body.find('.closeBtn').click(function() {
layer.close(index);
})
body.find('.baoming').click(function() {
var sta = $(this).attr("ref");
var mb = body.find("#try_mobile").val();
var mobile_code = body.find("#mobile_code").val();
var reg = /^1[0-9]{10}$/;
if (sta == 0) {
if (mb == '') {
layer.msg("请输入手机号", {
anim : 6
});
body.find("#try_mobile").focus();
return;
}
if (!(reg.test(mb))) {
layer.msg("手机号码格式有误", {
anim : 6
});
return;
} else {
body.find("#get_mobile_code").click();
}
} else {
if (mobile_code == '') {
layer.msg("请填写验证码", {
anim : 6
});
return;
} else {
var url = "/metering/employee/add_try_emp";
var data = {
mobile : mb,
mobileCode : mobile_code
};
$.post(url, data, function(res) {
if (res.statu == 'success') {
body.find('.tiBot1').hide();
body.find('.tiBot2').show();
} else {
layer.msg(res.msg, {
anim : 6
});
}
});
}
}
})
body.find('.know').click(function() {
layer.close(index);
})
body.find("#get_mobile_code").click(function() {
var mobile = body.find("#try_mobile").val();
var reg = /^1[0-9]{10}$/;
if (mobile == '') {
layer.msg("请输入手机号", {
anim : 6
});
body.find("#try_mobile").focus();
return;
} else if (!(reg.test(mobile))) {
layer.msg("手机号码格式有误", {
anim : 6
});
return;
} else {
var url = "/metering/smsMessage/getSmsAuthenticationCode";
var data = {
mobile : mobile,
num : 1022
};
$.post(url, data, function(res) {
if (res.statu == 'success') {
body.find('.baoming').attr("ref", "1");
body.find(".baoming").css("margin-top", "76px");
body.find(".timian").show();
body.find(".baoming").html("确认");
body.find("#get_mobile_code").attr("disabled", "disabled");
body.find("#get_mobile_code").css({
"background" : "#b5b5b5",
"cursor" : "not-allowed"
});
countDown();
body.find("#mobile_code").focus();
} else {
layer.msg(res.msg);
}
});
}
});
var count = 30;
function countDown() {
count = count - 1;
if (count == 0) { //说明已经倒计时结束
count = 30;
body.find("#get_mobile_code").css({
"background" : "#0086cc",
"cursor" : "pointer"
});
body.find("#get_mobile_code").removeAttr("disabled");
body.find("#get_mobile_code").html("重新获取");
return;
} else {
body.find("#get_mobile_code").html("已发送 " + count);
setTimeout(function() {
countDown();
}, 1000);
}
}
}
});
})
});
$(".popOne3").on('click', function() {
var Arr = [ "0", "1", "2" ];
var n = Math.floor(Math.random() * Arr.length + 1) - 1;
if (n == 0) {
window.open("http://wpa.qq.com/msgrd?v=3&uin=1481207199&site=qq&menu=yes");
} else if (n == 1) {
window.open("http://wpa.qq.com/msgrd?v=3&uin=1063940885&site=qq&menu=yes");
} else {
window.open("http://wpa.qq.com/msgrd?v=3&uin=865494415&site=qq&menu=yes");
}
});
$('.returnBtn').click(function() {
window.history.go(-1)
})
//页面跳转
$("#aboutus").on('click',function(){//关于我们 公司简介
store.setItem("fix_menu","introduce");
window.top.location="aboutUs.html";
});
$("#refus").on('click',function(){//关于我们 联系我们
store.setItem("fix_menu","contract");
window.top.location="aboutUs.html";
});
var W,H;
W = $(window).width();
H = $(window).height();
$(function(){
homePageImg(W,H);
})
function homePageImg(W,H){
layui.use(['carousel','element', 'form'], function(){
var carousel = layui.carousel, form = layui.form;
var $ = layui.jquery, element = layui.element;
//图片轮播
var ins = carousel.render({
elem: '#lbImgId'
,width: '100%'
,height: H-212
,interval: 3000
,arrow: "none"
,anim: "fade"
});
var url = "/metering/smsMessage/getHomePagePicture";
var detail = {};
$.post(url, detail, function(res) {
var str = JSON.parse(res);
if(str.code == 0){
var siteHtml = "", lbHtml="";
var imgLogData = str.logImg;
var imgLbData = str.lbImg;
var companySet=str.companySet;
//轮播
$.each(imgLbData,function(i,item){
if(item.site){//跳转
lbHtml += "";
}else{
lbHtml += "";
}
});
$("#imgLbId").html(lbHtml);
ins.reload({elem: '#lbImgId'});//重新渲染轮播
$("#phoneLable").html(companySet.companyPhone);
$(".home_logo").attr("src","/upload/userhead/"+companySet.companyLogo);
//合作伙伴
// $.each(imgLogData,function(i,item){
// siteHtml += "