|
@@ -2,7 +2,6 @@ require('./../css/searchStaticList.less');
|
|
|
|
|
|
const $ = require("jquery");
|
|
|
const { post,config,getUrlArgObject,openNewWin } = require('./promise.js');
|
|
|
-const { renderRecommendInfo, renderMultRecommendInfo, renderTreat, renderRecommendConditTips, renderTipsInfo ,renderKnowledgeInfo,renderScaleInfo} = require('./indexVertDom.js');
|
|
|
|
|
|
let searchType = 0,inputStr = '',curPage=1,size=10;
|
|
|
searchType = getUrlArgObject('type') || 0
|
|
@@ -17,17 +16,39 @@ require('./../images/nolis.png').replace(/^undefined/g, '')
|
|
|
|
|
|
$(function(){
|
|
|
initData()
|
|
|
- changeTab()
|
|
|
+ getAllTypes()
|
|
|
getSearchList()
|
|
|
getTabData(curPage)
|
|
|
});
|
|
|
-//tab切换
|
|
|
-function changeTab(){
|
|
|
- $(".staticTopTab li").click(function(){
|
|
|
- searchType = $(this).attr('data-id')
|
|
|
- $(this).css({color:'#2A9BD5'}).siblings().css({color:'#333'})
|
|
|
- })
|
|
|
-}
|
|
|
+//tab
|
|
|
+function renderTab(data){
|
|
|
+ let str = '';
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ const element = data[i];
|
|
|
+ str += `<li class="${i==0?'tabFst':''}" data-id="${element.val}">${element.name}</li>`
|
|
|
+ }
|
|
|
+ $('.staticTopTab ul').html(str)
|
|
|
+ $(".staticTopTab li").click(function(){
|
|
|
+ searchType = $(this).attr('data-id')
|
|
|
+ $(this).css({color:'#2A9BD5'}).siblings().css({color:'#333'})
|
|
|
+ })
|
|
|
+ }
|
|
|
+//获取字典信息
|
|
|
+function getAllTypes(){
|
|
|
+ const allTypes = localStorage.getItem('allTypes')&&JSON.parse(localStorage.getItem('allTypes'))||[];
|
|
|
+ if(allTypes.length>0){
|
|
|
+ renderTab(allTypes)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ post(config.dictionaryInfo, {}).then((res) => {
|
|
|
+ const result = res.data
|
|
|
+ if(result.code==='0'){
|
|
|
+ const data = result.data[7]||[];
|
|
|
+ localStorage.setItem('allTypes',JSON.stringify(data))
|
|
|
+ renderTab(data)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
function getSearchList(){
|
|
|
$(".searchBtn").click(function(){
|
|
|
$(".resultItemWrap,.pagination").html("");
|