|
@@ -3,7 +3,7 @@ require('./../css/searchStaticList.less');
|
|
|
const $ = require("jquery");
|
|
|
const { post,config,getUrlArgObject,openNewWin } = require('./promise.js');
|
|
|
|
|
|
-let searchType = 0,inputStr = '',curPage=1,size=10;
|
|
|
+let searchType = 0, inputStr = '', curPage = 1, size = 10, totalPage = 1;
|
|
|
searchType = getUrlArgObject('type') || 0
|
|
|
inputStr = getUrlArgObject('inputStr') || ''
|
|
|
|
|
@@ -13,6 +13,7 @@ require('./../images/staticBgS.png').replace(/^undefined/g, '')
|
|
|
require('./../images/staticLogo.png').replace(/^undefined/g, '')
|
|
|
require('./../images/staticBg.png').replace(/^undefined/g, '')
|
|
|
require('./../images/nolis.png').replace(/^undefined/g, '')
|
|
|
+require('./../images/warn.png').replace(/^undefined/g, '')
|
|
|
|
|
|
$(function(){
|
|
|
initData()
|
|
@@ -60,6 +61,11 @@ function getSearchList(){
|
|
|
}
|
|
|
function getTabData(){
|
|
|
let vals = $('.searchStr').val();
|
|
|
+ if (!vals) {
|
|
|
+ $(".staticResult .loading").hide();
|
|
|
+ toggleWarnBox('检索词不能为空!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
let param = {
|
|
|
size,
|
|
|
current:curPage,
|
|
@@ -71,7 +77,7 @@ function getTabData(){
|
|
|
if(result.code == 0) {
|
|
|
const data = result.data;
|
|
|
tabList = data.records;
|
|
|
- const totalPage = data.pages;
|
|
|
+ totalPage = data.pages;
|
|
|
const totalNum = data.total;
|
|
|
renderList(tabList);
|
|
|
if(totalNum > 0){
|
|
@@ -126,6 +132,15 @@ function initData(){
|
|
|
$(".searchStr").val(inputStr)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+function toggleWarnBox(text) {
|
|
|
+ if (text) {
|
|
|
+ $(".warning-box .content span").text(text);
|
|
|
+ $(".warning-box").show();
|
|
|
+ } else {
|
|
|
+ $(".warning-box").hide();
|
|
|
+ }
|
|
|
+}
|
|
|
// 分页
|
|
|
function renderPagination(totalPage,activePage,totalNum){
|
|
|
let str = `<span class="totalSum">共${totalNum}条</span>
|
|
@@ -200,8 +215,19 @@ function renderPagination(totalPage,activePage,totalNum){
|
|
|
getTabData()
|
|
|
})
|
|
|
$('.goNum input').change(function(){
|
|
|
- curPage = $(this).val()
|
|
|
+ const n = $(this).val()
|
|
|
+ if (totalPage < n) {
|
|
|
+ toggleWarnBox("输入页数不能大于最大页数");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ curPage = n;
|
|
|
getTabData()
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+$(function () {
|
|
|
+ $(".warning-box .confirm,.warning-box .close").click(function () {
|
|
|
+ toggleWarnBox();
|
|
|
+ })
|
|
|
+})();
|
|
|
+
|