多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
​ 1.搜索模板 在对应的index.html页面添加搜索模板到最底部 ~~~html <script id="customformtpl" type="text/html"> <!--form表单必须添加form-commsearch这个类--> <form action="" class="form-commonsearch"> <div style="border-radius:2px;margin-bottom:10px;background:#f5f5f5;padding:15px 20px;"> <!--<h4>自定义搜索表单</h4>--> <hr> <div class="row"> <div class="col-xs-3 col-sm-3 col-md-3"> <div class="form-group"> <!--<input type="hidden" class="operate" data-name="city" value="="/>--> <label class="control-label">用户选择</label> <div> <input id="user_id" data-rule="required" data-source="user/index" data-field="nick_name" class="form-control selectpage" placeholder="请选择用户" name="user_id" type="text" value="0"> </div> </div> </div> <!--<div class="col-xs-3 col-sm-3 col-md-3">--> <!--<div class="form-group">--> <!--<label class="control-label">日期筛选</label>--> <!--<div>--> <!--<input type="text" autocomplete="off" class="form-control datetimerange" id="dktime" placeholder="" value="" name="dktime"/>--> <!--</div>--> <!--</div>--> <!--</div>--> <div class="col-xs-6 col-sm-6 col-md-3"> <div class="form-group"> <label class="control-label"></label> <div class="row"> <div class="col-xs-3"> <input type="button" id="tj" class="btn btn-success btn-block" value="提交"/> </div> <div class="col-xs-3"> <input type="reset" class="btn btn-primary btn-block" value="重置"/> </div> </div> </div> </div> </div> </div> </form> </script> ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "点击并拖拽以移动") > (补充):在对应的js里面加上    searchFormTemplate: 'customformtpl', 搜索采用该模板,跟关闭搜索的地方写在一起 2.js调整,在对应的js的index方法里面添加点击事件 ~~~javascript $('#tj').click(function () { var upload = ""; upload = layer.msg('检索中。。。', { icon: 16 , shade: 0.2, time: false }); // layer.msg('修正中'); var user_id = $("#user_id").val(); var dktime = $("#dktime").val(); $.ajax({ type:'POST', // url:"Ajax/setdkSession", url:"Ajax/setwrongquestionSession", dataType:'json', data:{user_id:user_id,dktime:dktime}, async:false, success:function (ret) { $(".btn-refresh").trigger("click"); layer.close(upload); },error:function (e) { } }) }) ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "点击并拖拽以移动") 3.缓存处理 上面对应的控制器方法   当前控制器里面的 Ajax/setwrongquestionSession ~~~php /*设置错题查找用户打卡session*/ public function setwrongquestionSession(){ $param=$this->request->param(); session('searchwrongquestion',$param); $this->success('',null,$param); } ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "点击并拖拽以移动") 4.控制器处理 在    if ($this->request->isAjax()) {  下面添加如下所示的代码即可,然后再加上两个where($map)条件即可 ~~~php $map=array(); if(session('searchwrongquestion')){ if(session('searchwrongquestion')['user_id']!=0){ $map['user_id']=session('searchwrongquestion')['user_id']; } } ~~~ ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "点击并拖拽以移动") 效果图: ![](https://img-blog.csdnimg.cn/20200821153845855.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM0MDUwMzYw,size_16,color_FFFFFF,t_70)![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw== "点击并拖拽以移动")​编辑 ​