<form class="layui-form tableSerachForm" id="searchFormMarketOpnion"> <div class="layui-panel layui-form-item zxPanel zx_filtraterBox" style="position:relative;"> <div class="layui-inline widthStyle" style="width: 400px;"> <#-- //0 全部 7:一周内 8 一月内 9一年内 10 自定义--> <label class="layui-panel-label zx_filtraterTitle">时间类型 <i class="fa fa-angle-right"></i></label> <div class="layui-btn-container checkBoxBtn1"> <a class="layui-btn layui-btn-sm active">全部 <input type="hidden" value="" checked name=""/></a> <a class="layui-btn layui-btn-sm ">近一周 <input type="hidden" value="7" checked name="dateType1"/></a> <a class="layui-btn layui-btn-sm">近一月 <input type="hidden" value="8" checked name="dateType2"/></a> <a class="layui-btn layui-btn-sm">近一年 <input type="hidden" value="9" checked name="dateType3"/></a> <a class="layui-btn layui-btn-sm">自定义 <input type="hidden" value="10" checked name="dateType4"/></a> </div> </div> <div class="layui-inline timeSelect" style="height: 38px;display: none;"> <div class="layui-input-inline" style="width:110px;"> <input type="" style="height: 30px;" readonly class="layui-input date" name="startTime" id="startTime" placeholder="开始日期" autocomplete="off"> </div> <label class="layui-panel-label zx_filtraterTitle">-</label> <div class="layui-input-inline" style="width:110px;"> <input type="" style="height: 30px;" readonly class="layui-input date" name="endTime" id="endTime" placeholder="结束日期" autocomplete="off"> </div> </div> <button type="submit" class="layui-btn zxBtnSrh zx_filtraterBtn" style="position:absolute; height: 30px;line-height: 30px;"><i class="fa fa-search zx_button_serach_icon"></i>搜索 </button> </div> </form>
// 时间选择active $('.checkBoxBtn1 a').click(function(){ $('.checkBoxBtn1 a').removeClass('active'); $(this).addClass('active'); if($(this).text().trim() == "自定义"){ $(".timeSelect").css('display', 'inline-block') }else{ $(".timeSelect").css('display', 'none') } }) lay('.date').each(function () { laydate.render({ elem: this, trigger: 'click' }); });
function reloadFormMarketOpnion() { function getInitParam() { var dateType = $('.checkBoxBtn1').find('a.active').find('input').val(); var param = {}; if (dateType === '10') { var startTime = $('#startTime').val(); var endTime = $('#endTime').val(); param.publishTimeStart = startTime; param.publishTimeEnd = endTime; } param.timeType = dateType; param.wxCode = $("#wxCode").val(); return param; } var param = getInitParam(); queryWeChatArticle(param); }