<!doctype html>
|
<html>
|
<head>
|
<meta charset="utf-8">
|
[#include "/business/wechat/include/title.html" /]
|
[#include "/business/wechat/include/wheader.html" /]
|
<script type="text/javascript" src="${common_static}/static/wechat/style/js/usingle.js"></script>
|
|
</head>
|
|
<body>
|
<header class="worklistsearch">
|
<span id="showName" v="1">知识</span><label><input type="text" name="kw" id="kw" value="${kw}"/><input type="button" onclick="query();" /></label>
|
|
<div class="wlsdrop">
|
<a href="javascript:void(0);" v="1"><p>知识</p></a>
|
<a href="javascript:void(0);" v="2"><p>工单</p></a>
|
</div>
|
</header>
|
|
<div id="history" style="display:none;">
|
<h2 class="wlstit">搜索历史</h2>
|
<section class="wlslist" id="historyItem">
|
</section>
|
<a href="#"><div class="wlsclear" onclick="clearHistory()">清除搜索记录</div></a>
|
</div>
|
|
|
<div id="main"></div>
|
<div id="pagination" class="loadmore"></div>
|
|
</body>
|
|
|
<script type="text/javascript">
|
|
var key = "historyUSearch";
|
|
function changeKw(msg) {
|
$("#kw").val(msg);
|
query();
|
}
|
|
//获取存储信息
|
function getStorage() {
|
var v = localStorage.getItem(key);
|
return v;
|
}
|
|
//设置存储信息
|
function setStorage(msg) {
|
var v = getStorage();
|
if(v != null && !$.util.isEmpty(v)) {
|
var pos = v.indexOf(msg);
|
if(pos<0) {
|
var array = v.split(",");
|
array.push(msg);
|
localStorage.setItem(key,array);
|
}
|
} else {
|
localStorage.setItem(key,msg);
|
}
|
}
|
|
//显示搜索历史
|
function showHistory() {
|
var msg = getStorage();
|
if(msg != null && !$.util.isEmpty(msg)) {
|
var array = msg.split(",");
|
array.reverse();
|
var historyHtml = "";
|
$.each(array, function(i, n){
|
if(i<5) {
|
historyHtml += '<a href="javascript:changeKw(\''+n+'\')"><p>'+n+'</p></a>';
|
}
|
});
|
|
$("#historyItem").html(historyHtml);
|
$("#history").show();
|
}
|
}
|
|
//清除历史记录
|
function clearHistory() {
|
localStorage.setItem(key,"");
|
$("#history").hide();
|
}
|
|
showHistory();
|
|
var kw = $.trim($("#kw").val());
|
if(!$.util.isEmpty(kw) && kw.length > 1) {
|
query();
|
}
|
|
function query() {
|
$("#main").empty();
|
var kw = $.trim($("#kw").val());
|
|
if($.util.isEmpty(kw) || kw.length == 1) {
|
popupTips("关键词至少为2个字");
|
return;
|
}
|
$("#history").hide();
|
setStorage(kw);
|
|
|
var bigCategory = $("#showName").attr("v");
|
|
var params = {"kw":kw,"type":2,"pageSize":5,"type":bigCategory};
|
$("#pagination").wsinglePagination({
|
base:"${base}",
|
durl:"${base}/uwyw/ufulltext/uOrderData.html",
|
pdiv:"pagination",
|
mdiv:"main",
|
perPage : 10,
|
param:params
|
});
|
}
|
|
/*下拉*/
|
$(function(){
|
var searchBtn = $('.worklistsearch span'),
|
searchCon = $('div.wlsdrop');
|
searchBtn.click(function(){
|
searchCon.animate({height:'toggle'});
|
return false;
|
});
|
searchCon.children('a').click(function(){
|
var v = $(this).attr("v");
|
var showName = $(this).text();
|
|
$("#showName").attr("v",v).text(showName);
|
searchCon.slideUp();
|
});
|
$(document).click(function(){
|
searchCon.slideUp();
|
});
|
|
|
})
|
</script>
|
|
|
</html>
|