$(function(){
//MEUN
$(".header").sticky({top:0});
//BANNER
$(".scroll_banner").flexslider({
animation: "slide",
controlNav: true,
directionNav: true,
animationSpeed: 500,
playAfterPaused: 500,
slideshowSpeed: 4000
});
//鏈嶅姟
$(".index_service_tabs").tabs({"noSwipe": true});
$('.index_service_tabs').find('li').on('opened.tabs.amui', function(e) {
$(".index_service_scroll:eq("+$(this).index()+")").slick('refresh');
})
$('.index_service_scroll').slick({
autoplay:false,
centerMode: false,
infinite: false,
pauseOnDotsHover:true,
centerPadding: 0,
slidesToShow: 3,
slidesToScroll:3,
arrows: true,
dots:true,
adaptiveHeight:true,
responsive: [
{
breakpoint: 780,
settings: {
rows:2,
slidesPerRow:2,
slidesToShow: 0,
slidesToScroll:0,
arrows: false,
dots:true
}
}]
});
//涓撲笟
$('.index_zylist').slick({
autoplay:false,
centerMode: false,
infinite: true,
pauseOnDotsHover:true,
centerPadding: 0,
slidesToShow: 4,
slidesToScroll:4,
arrows:true,
dots:false,
adaptiveHeight:true,
responsive: [
{
breakpoint: 780,
settings: {
rows:2,
slidesPerRow:2,
slidesToShow: 0,
slidesToScroll:0,
arrows: false,
dots:true
}
}]
});
//浜岀淮鐮
$(".open_weixin").click(function(){
var _this = $(this);
var clipboard1 = new Clipboard('.open_weixin');
clipboard1.on("success", function(e) {
layer.open({
time:0,
title : '娣诲姞鑰佸笀寰俊',
btnAlign:'c',
shadeClose:1,
content:"
澶嶅埗鎴愬姛
璇锋墦寮€寰俊>娣诲姞鏈嬪弸>绮樿创鏌ユ壘
寰俊鍙凤細"+_this.data("clipboard-text")+"锛?+_this.data('contact')+"锛堻/div>
"
});
});
clipboard1.on("error", function(e) {
layer.msg("澶嶅埗澶辫触锛佽鎵嬪姩澶嶅埗锛?+_this.data("clipboard-text"), {icon:2,time:0,closeBtn: 1});
});
});
$(".click_btn").click(function(){$(".open_weixin").trigger("click");})
//Msg
$(".click_link_empty").click(function() { layer.msg($(this).data("text")); });
//DIGG
$.extend({
tipsBox: function(options) {
options = $.extend({
obj: null,
str: "+1",
startSize: "16px",
endSize: "50px",
interval: 600,
color: "#00ada9",
weight: "bold",
callback: function() {}
}, options);
$("body").append("
"+ options.str +"");
var box = $(".count_digg");
var left = options.obj.offset().left + options.obj.width() / 2;
var top = options.obj.offset().top - options.obj.height() + 30;
box.css({
"position": "absolute",
"left": left + "px",
"top": top + "px",
"z-index": 9999,
"font-size": options.startSize,
"line-height": options.endSize,
"color": options.color,
"font-weight": options.weight
});
box.animate({
"font-size": options.endSize,
"opacity": "0",
"top": top - parseInt(options.endSize) + "px"
}, options.interval , function() {
box.remove();
options.callback();
});
}
});
//鐐硅禐
$(".digg_a").one('click', function() {
var $this=$(".digg_a");
$.ajax({
type: 'POST',
url: $this.data("url"),
dataType: 'json',
data: {
appid: $this.data("appid"),
timestamp: $this.data("timestamp"),
signature: $this.data("signature"),
},
success: function (response, status) {
if(response.code){
$.tipsBox({
obj: $this,
callback: function() {
$(".digg_num").each(function(){
$(this).text(parseInt($(this).text())+1);
})
$this.removeAttr("href");
}
});
}else{
//杩斿洖閿欒鏁版嵁
$.tipsBox({
obj: $this,
str: response.data,
startSize: "10px",
endSize: "20px",
weight: "normal",
callback: function() {
$this.removeAttr("href");
}
});
}
},
error:function(xhr,status,error){
//杩斿洖鏁版嵁寮傚父
alert('Error锛?);
}
});
});
//鎻愪氦琛ㄥ崟
layui.use('form', function(){
let form = layui.form;
var loadico;
form.on('radio(province)', function(data){
$(".province_select_city").text(data.value);
});
form.on('submit(form_submit)', function(data){
//鍒ゆ柇鐪佸競
data.field.province ? data.field.url="銆?+data.field.province+"銆?+data.field.url: '';
//鍒ゆ柇瀛︾
data.field.file_xk ? data.field.url="銆愪汉鍔涜祫婧愮鐞嗗笀澶囪€冭祫鏂欏绉戯細"+data.field.file_xk+"銆?+data.field.url: '';
//鍒ゆ柇绫诲瀷
if($('input[name="file_lx"]:checked').length>0){
var file_lx = [];
$('input[name="file_lx"]:checked').each(function() {
file_lx.push($(this).val());
});
data.field.url="銆愪汉鍔涜祫婧愮鐞嗗笀澶囪€冭祫鏂欑被鍨嬶細"+file_lx.join()+"銆?+data.field.url;
}
$.ajax
({
type: "POST",
url: data.form.getAttribute("data-url"),
dataType: 'json',
data: data.field,
cache: false,
beforeSend:function(){
loadico = layer.msg("鏁版嵁姝e湪鎻愪氦涓紝璇风◢鍚?..",{icon: 16, shade: 0.3});
data.elem.classList.toggle("layui-btn-disabled");
},
success: function (response, status) {
if (response.code) {
layer.msg(response.data, {icon: 1});
data.form.reset();
form.render();
data.elem.classList.toggle("layui-btn-disabled");
data.form.classList.contains('modal') ? $(".am-modal").modal('close') : '';//鍏抽棴瀵硅瘽妗
}
else {
if(response.tourl!=""){
layer.confirm('鏄惁绔嬪嵆璺宠浆鐧诲綍锛?, {icon: 3, title:'鎻愮ず'}, function(index){
location.href=response.tourl;
});
}
layer.msg(response.data, {icon: 2});
data.form.querySelector('.codeimg').click();//鏇存柊楠岃瘉鐮
data.elem.classList.toggle("layui-btn-disabled");
}
},
error: function (xhr, status, error) {
layer.close(loadico);
layer.msg('缃戠粶鏁呴殰锛屾彁浜ゅけ璐?, {icon: 0});
data.elem.classList.toggle("layui-btn-disabled");
}
});
return false;
});
});
})