<?php if ($this->qmsoft->is_mobile() == 1) { //手机端?>

<div style="height:60px;line-height:60px;clear:both;"></div>
<footer class="footer" id="footer">
  <ul class="footnav box-flex">
    <li><a href="/"><i class="fa fa-home"></i>首页</a></li>
    <li><a href="<?php echo site_url('kehu/index') ?>"><i class="fa fa-users"></i><?php echo $this->qmsoft->zf_kehu ?></a></li>
    <li><a href="<?php echo site_url('tongxunlu/index') ?>"><i class="fa fa-address-book-o"></i>通讯录</a></li>
    <li><a href="<?php echo site_url('message/index') ?>"><i class="fa fa-commenting"></i>消息</a></li>
    <li><a href="<?php echo site_url('user/info') ?>"><i class="fa fa-user-o"></i>我的</a></li>
  </ul>
</footer>
<script>

var zong_width=($(window).width()-10-10);
var dan_width=zong_width/3;

//编辑器
$(".bianjiqi").css("width","98%");

$(".icon-list").css("width",($(window).width()-5)+"px");
$(".icon-list li").css("width",dan_width+"px");


//展开高级搜索
$(".biaodan-list .input").css("min-width","80px");
$(".biaodan-list .input").css("width",(($(window).width()-100-20))+"px");
$(".biaodan-list input.rule-date-input ,.biaodan-list input.rule-shuzhi-input").css("min-width","105px");
$(".biaodan-list input.rule-date-input ,.biaodan-list input.rule-shuzhi-input").css("width",(($(window).width()-100-38)/2)+"px");


if($("#timo1 .btn-sou-gj").length>0)
{

$(" #timo1 .btn-sou-ks").css("width","50px");
$(".icon-list #timo1 li.btn-sou-gj").css("width","90px");
$(".icon-list #timo1 li.btn-sou-input").css("width",($(window).width()-70-90-20)+"px");


}else{

$(" #timo1 .btn-sou-ks").css("width","70px");
$(".icon-list #timo1 li.btn-sou-input").css("width",($(window).width()-90-15)+"px");

}



if($("#timo2").length>0){

	$("#timo2").append('<li><a class="btn2" href="/"><i class="fa fa-home"></i>返回主页</a></li>');
	$("#timo2 li").removeAttr("style");

	$('.m_menu').click(function(){
		$("#timo2").toggle('slow');
	});

}else{
	$(".m_right a .fa").removeClass("fa-bars");
	$(".m_right a .fa").addClass("fa-home");
	$('.m_menu').click(function(){
	self.location="/";
	});
}


$('.m_search').click(function(){
	$("#timo1").toggle('slow');
});


$('.view_btn').show();
$('.h30').hide();


/*$(function(){
//手机端图片放大弹出
$('.view_img').on('click',function(){
var maxwidth = $(window).width()-100;
var maxheight = $(window).height()*0.8;
var url = $(this).attr('src');
layer.open({
  type: 1,
  title: false,
  closeBtn: 0,
  area: ['auto'],
  skin: 'layui-layer-nobg', //没有背景色
  shadeClose: true,
  content: '<img src="'+url+'" width="'+maxwidth+'" />'
});
});
})*/

</script>
<?php } else { //pc端?>
<style>
.body-content{ position:relative;}
.tooltip {
  position: absolute;
  display: none;
  z-index: 9900000;
  outline: none;
  padding: 5px;
  border-width: 1px;
  border-style: solid;
  border-radius: 5px;
  -moz-border-radius: 5px 5px 5px 5px;
  -webkit-border-radius: 5px 5px 5px 5px;
  border-radius: 5px 5px 5px 5px;
}
</style>
<script>

$(".body-content").each(function(){
$(this).attr("title",$(this).text())
})

$(".biaodan-list input.rule-date-input ,.biaodan-list input.rule-shuzhi-input").css("max-width","150px");
$(".biaodan-list input.rule-date-input ,.biaodan-list input.rule-shuzhi-input").css("min-width","105px");
$(".biaodan-list input.rule-date-input ,.biaodan-list input.rule-shuzhi-input").css("width",(($(window).width()/3-32-100-15)/2)+"px");

function GetQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]);
    return null;
}

function changeURLArg(url,arg,arg_val){
   var pattern=arg+'=([^&]*)';
   var replaceText=arg+'='+arg_val;
   if(url.match(pattern)){
	   var tmp='/('+ arg+'=)([^&]*)/gi';
	   tmp=url.replace(eval(tmp),replaceText);
	   return tmp;
   }else{
	   if(url.match('[\?]')){
		   return url+'&'+replaceText;
	   }else{
		   return url+'?'+replaceText;
	   }
  }
   return url+'\n'+arg+'\n'+arg_val;
}

$("th a.paixu").each(function(){
    $(this).append('<span><i class="fa fa-caret-up"></i><i class="fa fa-caret-down"></i></span>');
	var url_pai = GetQueryString("pai");
	var url_xu = GetQueryString("xu");
	var data_pai = $(this).attr('ziduan');
	if(url_pai==data_pai){
	$(this).attr('paixu', url_xu);
	$(this).addClass('on_'+url_xu);
	}
});

$("th a.paixu").click(function(){
    var ziduan_name = $(this).attr('ziduan');
	var ziduan_paixu = $(this).attr('paixu');
	if(ziduan_paixu=='desc'){
		new_xu = 'asc';
	}else{
		new_xu = 'desc';
	}
	var old_url_full = $('.pagination .shouye a').attr('href');
	var new_url_full = changeURLArg(old_url_full,'pai',ziduan_name);
	new_url_full = changeURLArg(new_url_full,'xu',new_xu);
	self.location.href = new_url_full;

});


<?php if (intval($this->input->get('cid', TRUE)) > 0) {?>
$('.toolbar').hide();
$('.head-name').hide();
$('.body-name').hide();
$('.mian-page-div').css("padding","0");
$('.location').hide();
$('.location_b').hide();
$('.footer').hide();
$('.view_btn').show();
<?php }?>

/*$(function(){
//PC端图片放大弹出
$('.view_img').on('click',function(){
var maxwidth = $(window).width()-100;
var maxheight = $(window).height()*0.8;
var url = $(this).attr('src');
layer.open({
  type: 1,
  title: false,
  closeBtn: 0,
  area: ['auto'],
  skin: 'layui-layer-nobg', //没有背景色
  shadeClose: true,
  content: '<img src="'+url+'" height="'+maxheight+'" />'
});
});
})*/

$(".zd_datetime").each(function(){
	zd_val = $(this).text();
	if(zd_val=="1970-01-01 08:00:00"){
	    $(this).html('');
	}else{
	    $(this).addClass("bhh");
	    if(zd_val.indexOf(" ")!=-1){
		arr_val = zd_val.split(/\s+/);
		$(this).html(arr_val[0]+'<br>'+arr_val[1]);
		}
	}
});

$(".div_info dl dd , input.rule-date-input").each(function(){
   zd_val = $.trim($(this).text());
   if(zd_val=="1970-01-01 08:00:00"){
     $(this).html('');
   }
});

</script>
<?php }?>

<!--公用--> 

<script src="/theme/layui/layui.js"></script> 
<script>
layui.use('upload', function(){
var upload = layui.upload;

<?php
if (isset($ziduan_biaodan) && is_array($ziduan_biaodan) && count($ziduan_biaodan) > 0) {
    foreach ($ziduan_biaodan as $arr => $v) {
        ?>
<?php if ($v['type'] == 'upload_img' || $v['type'] == 'upload_file') { //上传 ?>
  //执行实例
  var uploadInst = upload.render({
    elem: '#<?php echo $v['name'] ?>'
    ,url: '/index.php/upload/ajax_upload'
	,exts: '<?php echo strtolower(UPLOADTYPE) ?>'
	<?php if ($v['type'] == 'upload_img') {?>
	,exts: 'jpg|png|gif|bmp|jpeg|ico'
	,acceptMime: 'image/*'
	<?php } else {?>
	,exts: '<?php echo strtolower(UPLOADTYPE) ?>'
	<?php }?>
    ,size: '<?php echo UPLOADSIZE ? UPLOADSIZE * 1024 : 10 * 1024 ?>' //限制文件大小，默认10M
    ,done: function(res){
      //上传完毕回调
	  if(res.code==100){
		//layer.msg('上传成功');
		$('#<?php echo $v['name'] ?>_data').val(res.data.client_name+'|'+res.data.url+'|'+res.data.file_size+'|'+res.data.is_image);
		$('.Validform_checktip').text('');
		$('.Validform_checktip').removeClass('Validform_wrong');

		<?php if ($v['type'] == 'upload_img') {?>
		$('#<?php echo $v['name'] ?>_view img').attr("src",res.data.url);
		$('#<?php echo $v['name'] ?>_view a').attr("href",res.data.url);
		$('#<?php echo $v['name'] ?>_view').html('<span class="upimg_show"><img class="view_img" src="'+res.data.url+'"><a href="'+res.data.url+'" target="_blank" class="upimg_view">查看</a><a class="upimg_del">删除</a></span>');
		<?php } else if ($v['type'] == 'upload_file') {?>
		$('#<?php echo $v['name'] ?>_view').html(res.data.client_name+' <a href="'+res.data.url+'" download="'+res.data.client_name+'">下载</a></span> <span class="upfile_del">删除</span>');
		$('#<?php echo $v['name'] ?>_view a').attr("href",res.data.url);
		<?php }?>

		layer.msg('上传成功',{icon:1,time:1000});

	  }else{
		layer.msg('上传失败：'+res.data.error,{icon:5,time:3000});
	  }
    }
	,error: function(){
      //请求异常回调
	  layer.msg('上传异常',{icon:5,time:3000});
    }
  });

$(document).on('click',".zd_<?php echo $v['name'] ?> .danfile .upimg_del",function(event){
	$(this).parents('span').find('.upimg_show').remove();
	$('#<?php echo $v['name'] ?>_data').val('');
	$('.Validform_checktip').text('');
	$('.Validform_checktip').removeClass('Validform_wrong');
})

$(document).on('click',".zd_<?php echo $v['name'] ?> .danfile .upfile_del",function(event){
	$(this).remove();
	$('#<?php echo $v['name'] ?>_view').html('');
	$('#<?php echo $v['name'] ?>_data').val('');
	$('.Validform_checktip').text('');
	$('.Validform_checktip').removeClass('Validform_wrong');
})

<?php }?>
<?php if ($v['type'] == 'upload_imgs' || $v['type'] == 'upload_files') { //上传 ?>
  //执行实例
  var uploadInst = upload.render({
    elem: '#<?php echo $v['name'] ?>'
    ,url: '/index.php/upload/ajax_upload'
	<?php if ($v['type'] == 'upload_imgs') {?>
	,exts: 'jpg|png|gif|bmp|jpeg|ico'
	,acceptMime: 'image/*'
	<?php } else {?>
	,exts: '<?php echo strtolower(UPLOADTYPE) ?>'
	<?php }?>
    ,size: '<?php echo UPLOADSIZE ? UPLOADSIZE * 1024 : 10 * 1024 ?>' //限制文件大小，默认10M
	,multiple: true
    ,done: function(res){
      //上传完毕回调
	  if(res.code==100){
		//layer.msg('上传成功');
		$('.Validform_checktip').text('');
		$('.Validform_checktip').removeClass('Validform_wrong');

		<?php if ($v['type'] == 'upload_imgs') {?>

		$('#<?php echo $v['name'] ?>_view ul').append('<span class="upimg_show"><input name="<?php echo $v['name'] ?>[]" type="hidden" value="'+res.data.client_name+'|'+res.data.url+'|'+res.data.file_size+'|'+res.data.is_image+'|<?php echo $v['name'] ?>" class="input int-w300" /><img class="view_img" src="'+res.data.url+'"><p><a href="'+res.data.url+'" target="_blank" class="upimg_view">查看</a><a class="upimg_del">删除</a></p></span>');

		<?php } else if ($v['type'] == 'upload_files') {?>

		$('#<?php echo $v['name'] ?>_list ul').append('<li><input name="<?php echo $v['name'] ?>[]" type="hidden" value="'+res.data.client_name+'|'+res.data.url+'|'+res.data.file_size+'|'+res.data.is_image+'|<?php echo $v['name'] ?>" class="input int-w300" /><span class="upfile_view">'+res.data.client_name+'</span> <span class="upfile_down"><a href="'+res.data.url+'" download="'+res.data.client_name+'">下载</a></span> <span class="upfile_del">删除</span></li>');

		<?php }?>

		layer.msg('上传成功',{icon:1,time:1000});

        //仅测试必填：
		var <?php echo $v['name']?>counts = $('dl.zd_<?php echo $v['name']?> ul').find('.view_img, .upfile_view').length;
		console.log(<?php echo $v['name']?>counts);
		$('#<?php echo $v['name']?>_test').val(<?php echo $v['name']?>counts);
		

	  }else{
		layer.msg('上传失败：'+res.data.error,{icon:5,time:3000});
	  }
    }
	,error: function(){
      //请求异常回调
	  layer.msg('上传异常',{icon:5,time:3000});
    }
  });

$(document).on('click',".zd_<?php echo $v['name'] ?> .duofiles .upimg_del",function(event){
	$(this).parents('span').remove();
})

$(document).on('click',".zd_<?php echo $v['name'] ?> .duofiles .upfile_del",function(event){
	$(this).parents('li').remove();
})

$(document).on('click',".zd_<?php echo $v['name'] ?> .duofiles .upfile_data_del",function(event){

	var id = $(this).attr('data-id');
	if(id>0){

	layer.alert("确定要删除这个图片/文件吗?", {
		icon: 0,
		id: id,
		btn: ["确定", "取消"],
		zIndex: parseInt(999999 + 1000),
		yes: function(index, layero) {

			$.ajax({
			type:'post',
			url:'<?php echo site_url('upload/ajax_data_del') ?>',
			data:{id:id},
			dataType:'json',
			success:function(data){
			if(data.code=='100'){
			layer.msg("删除成功");
			$('#upfile_data_'+id).parents('li').remove();
			$('#upfile_data_'+id).parents('span').remove();
			}else{
			layer.msg("删除失败");
			}
			},
			error:function(){
			layer.alert("系统错误", {icon: 0});
			},
			});

		},
		end: function() {}
	})

	}

})

<?php }?>

<?php if ($v['type'] == 'textedit') { //编辑器 ?>
layui.use('layedit', function(){
var layedit = layui.layedit;

//创建一个编辑器
layedit.build('<?php echo $v['name']?>', {
uploadImage: {
url: '/index.php/upload/ajax_upload_editor' //接口url
,type: '' //默认post
}
});

});
<?php }?>


<?php }}?>


});

//公用js代码
$(function(){

<?php if ($this->qmsoft->get_config('fuzhi_off','value',1) == 1) {?>
document.oncopy = function(){
    layer.msg('无法复制');
	return false;
}
document.oncut = function(){
    layer.msg('无法复制');
	return false;
}
<?php }?>

var vtips_idx = 0;
$(".vtip").mouseover(function(){
	tips_con=$(this).attr("vtitle");
	vtips_idx = layer.tips(tips_con, $(this), {
		tips: [1, 'rgb(58, 58, 58)'],
	time: 0
	});
});
$(".vtip").mouseout(function(){
	layer.close(vtips_idx);
});


$("dl.buguding").each(function(){
   height_max = $(this).find('dd').height()-30;
   $(this).find('dt').css("height",height_max+"px");
   $(this).find('dt').css("line-height",height_max+"px");
});

<?php if ($this->input->get('cid', TRUE) > 0) {?>
$("#headmenu").hide();
//$(".pagepostion").hide();
<?php }?>

//防止重复提交
$("#submit").click(function(){
$(this).attr("disabled","true");
$(this).removeClass("submit");
$(this).addClass("close");
$("#form1").submit();
setTimeout("$('#submit').removeAttr('disabled')",5000);
})

$(".search-toggle").click(function(){
  $(".sousuo-gj").toggle();
  $(".daochu-gj").hide();
});

$(".daochu-toggle").click(function(){
  $(".daochu-gj").toggle();
  $(".sousuo-gj").hide();
});

//单选
$(".aids").click(function(){
if($(this).prop('checked')){
	var biaoji_yanse = $(this).parents('tr').attr('biaoji_yanse');
	if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
	$(this).parents('tr').css('background','#FFFED9');
	}
}else{
	var biaoji_yanse = $(this).parents('tr').attr('biaoji_yanse');
	if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
	$(this).parents('tr').css('background-color','');
	}
}
});


//多选
$("#checkall").click(function(){
if($(this).is(':checked')==true){

	$(".aids").each(function(){
		var biaoji_yanse = $(this).prop('checked', true).parents('tr').attr('biaoji_yanse');
		if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
		$(this).prop('checked', true).parents('tr').css('background','#FFFED9');
		}
	});

}
else{

	$(".aids").each(function(){
		var biaoji_yanse = $(this).prop('checked', false).parents('tr').attr('biaoji_yanse');
		if(biaoji_yanse == "" || biaoji_yanse == null || biaoji_yanse == undefined){
		$(this).prop('checked', false).parents('tr').css('background','');
		}
	});

}
});

//免费版链接处理
var banben="<?php echo $this->qmsoft->banben ?>";
if(banben=="mfb"){
$(".freeno a , a.freeno, .freeno").each(function(){
var newurl="/theme/free.htm";
$(this).attr("href",newurl);
$(this).attr("data-title","免费版不支持");
$(this).attr("data-width","590");
$(this).attr("data-height","480");
$(this).removeAttr("onclick");
});
}

var dq_width = $(".city-picker-span").width();
$(".city-picker-dropdown").css("width",dq_width+"px");


$('.users_select').select2();


})
//关闭后返回提示并刷新
function close_reload(tips){

if(tips.indexOf("失败")>=0||tips.indexOf("错误")>=0){
icon = 2;
}else{
icon = 1;
}

layer.msg(tips,{anim:5,maxWidth:500,icon:icon,time:1000,end:function(){location.reload()}})
}

$('.body-mobile').each(function(){
var div_cid = $(this).parents('.div_info').attr('div_cid');
var div_mobile = $(this).parents('.div_info').attr('div_mobile');
//快捷发送短信
<?php if ($this->qmsoft->get_config('sms_on','value',1) == '1') {?>
if(div_mobile&&div_mobile.length==11){
	$(this).html(div_mobile+' <a class="fa fa-envelope-o fabtn color13 alert1 freeno" href="<?php echo site_url('sms/send') ?>?mobile='+div_mobile+'" data-title="发送短信" data-width="660" data-height="350" title="发送短信"></a>');
}
<?php }?>

//呼叫中心
<?php if ($this->qmsoft->get_config('call_on','value',1) == '1') {?>
$(this).append(' <a class="fa fa-fax fabtn telbtn color6 freeno" cid="'+div_cid+'" mobile="'+div_mobile+'" title="拨打电话"></a>');
<?php }?>

<?php if ($this->qmsoft->is_mobile() == 1) { //手机端?>
if(div_mobile){
	$(this).append('<a class="tel_btn" href="tel:'+div_mobile+'">一键拨号</a>');
}
<?php }?>


});


<?php if ($this->qmsoft->get_config('call_on','value',1) == '1') {?>
$('.telbtn').on('click',function(){

	var cid = $(this).attr('cid');
	var mobile = $(this).attr('mobile');

	if(mobile==null){
	layer.alert("手机号码不能为空");
	return false
	}
	layer.confirm(mobile, {
	  title: '是否立即拨号？',
	  btn: ['拨号','取消'] //按钮
	}, function(index, layero){
	  Bohao(cid,mobile);
	  layer.close(index);
	}, function(){

	});

});

function Bohao(cid,mobile){
	if(top!=this){
		parent.Bohao(cid,mobile)
	}
}
<?php }?>


$(".zd_yes").each(function(){
   zd_yes_val = $(this).text();
   if(zd_yes_val=="是"){
     $(this).html('<span class="yes_btn">'+zd_yes_val+'</span>');
   }
});

$("input[name='cp_nums[]'],input[name='kucun'],input[name='chengben'],input[name='shoujia']").each(function(){
	zd_val = $(this).val();
	if (zd_val.endsWith(".00")) {
	  zd_val = zd_val.slice(0, -3);
	  $(this).val(zd_val);
	}
});

$(".body-kucun,.body-chengben,.body-shoujia").each(function(){
	zd_val = $(this).text();
	if (zd_val.endsWith(".00")) {
	  zd_val = zd_val.slice(0, -3);
	  $(this).text(zd_val);
	}
});

$('.zd_upload_file img,.zd_upload_img img,.zd_upload_files img,.zd_upload_imgs img').on('click',function(){

	var img_url = $(this).attr('src');

	if(img_url=='/theme/qmsoft/images/nopic.png'){
	layer.msg("暂无图片")
	return false
	}
	ck_width = $(window).width();
	ck_width = ck_width-40;
	ck_height = $(window).height();
	ck_height = ck_height-40;
	layer.open({
	  type: 1,
	  title: false,
	  closeBtn: 1,
	  area: ['auto'],
	  skin: 'layui-layer-nobg', //没有背景色
	  shadeClose: true,
	  content: '<img src="'+img_url+'" style="max-width:'+ck_width+'px;max-height:'+ck_height+'px;">'
	});

});

$(document).ready(function(){
  $('form').submit(function(event) {
    var isValid = true;
    
    $('.textedit[datatype="*"]').each(function() {
      var content = $(this).val().trim();
      if (content === '') {
        isValid = false;
        return false; // 结束循环
      }
    });
    
    if (!isValid) {
      $('.textedit[datatype="*"]').siblings('.error-message').css('display', 'inline');
      event.preventDefault(); // 阻止表单提交
    }
  });
});
</script> 
