<div class="pop-schwrap">
<div class="ui-scrollview">
<div class="mui-bar mui-bar-nav clone">
<a class="btn btn-back" href="javascript:;"></a>
<div class="top-sch-box flex-col">
<div class="centerflex">
<input class="sch-input mui-input-clear" type="text" name="" id="search-keyword" placeholder="万千优惠券等待您去发现" />
</div>
</div>
<a class="mui-btn sch-submit" href="javascript:void(0)" onclick="searchGood()">搜索</a>
</div>
<div class="scroll-wrap">
<div class="mui-scroll">
<div class="sch-cont">
<div class="section ui-border-b">
<div class="tit"><i class="iconfont icon-hot"></i>热门搜索</div>
<div class="tags">
<span class="tag" name="tag-keyword">外套</span><span class="tag" name="tag-keyword">连衣裙</span><span class="tag">运动鞋</span><span class="tag" name="tag-keyword">睡衣</span>
<span class="tag" name="tag-keyword">面膜</span><span class="tag" name="tag-keyword">保健</span><span class="tag">皮鞋</span><span class="tag" name="tag-keyword">西装</span>
<span class="tag" name="tag-keyword">棉服</span><span class="tag" name="tag-keyword">手套</span><span class="tag" name="tag-keyword">口红</span>
</div>
</div>
<div class="section">
<div class="tit"><i class="iconfont icon-time"></i>最近搜索</div>
<div class="tags">
<span class="tag">外套</span><span class="tag">连衣裙</span><span class="tag">运动鞋</span><span class="tag">睡衣</span>
<span class="tag">外套</span><span class="tag">连衣裙</span><span class="tag">运动鞋</span><span class="tag">睡衣</span>
<span class="tag">外套</span><span class="tag">连衣裙</span><span class="tag">运动鞋</span>
</div>
</div>
</div>
<div class="sch-clear">
<a href="javascript:void"><i class="iconfont icon-shanchu"></i>清除搜索历史</a>
</div>
</div>
</div>
</div>
</div>

 

 

var btns = document.getElementsByTagName("span");
for(var i = 0; i < btns.length; i++) {
btns[i].onclick = function(){
var classname = btns[i].getAttribute('class');
if(classname == 'tag'){
$('#search-keyword').val(this.innerHTML);
}
}
}
function searchGood(){
if($('#search-keyword').val() == ''){
mui.toast('查询关键词为空');
}else{
mui.ajax(__test_api_url+'/Tbk/optionalMaterial', {
data:{
'token':__tbk_token,
'page':1,
'adzoneId':__adzone_id,
'keyword':$('#search-keyword').val(),
},
dataType: 'json',
type: 'post',
async: false,
headers: {'Content-Type': 'application/json'},
success: function (jsondata) {
console.log(jsondata);
},
});
}
}

posted on 2019-01-17 11:40  baraka  阅读(419)  评论(0编辑  收藏  举报