wxSupersearch.js 106 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842
  1. /*
  2. * fixed top input for zyh @date 2020/6/8
  3. * */
  4. var userReadnum = 0
  5. var vSwitch = 'f'
  6. var newUserType = false
  7. // 判断用户权限版本
  8. function getUserType() {
  9. $.ajax({
  10. type: 'POST',
  11. url: '/publicapply/subscribe/vipSwitch',
  12. success: function(res) {
  13. if (res && res.data) {
  14. vSwitch = res.data.vt || 'f'
  15. }
  16. }
  17. })
  18. }
  19. getUserType()
  20. function hiddenTips() {
  21. $('#UserTips').hide()
  22. }
  23. function gotoPay() {
  24. $('#UserTips').hide()
  25. location.href = '/areaPack/wx/page/buy?type=buy'
  26. }
  27. // 获取用户是否为新用户
  28. function getUserNewType() {
  29. window.jyAddInfo = {
  30. isUpgrade: false
  31. }
  32. $.ajax({
  33. url: '/bigmember/use/isAdd',
  34. type: 'POST',
  35. success: function (r) {
  36. if (r && r.data) {
  37. window.jyAddInfo = r.data
  38. }
  39. }
  40. })
  41. }
  42. getUserNewType()
  43. function hiddenTips2() {
  44. $('#tipsType').hide()
  45. }
  46. function updateJump2() {
  47. $('#tipsType').hide()
  48. // location.replace('/jyapp/vipsubscribe/toSubVipSetPage?vSwitch=v')
  49. $.ajax({
  50. url: '/publicapply/free/oneProvinceSet',
  51. type: 'POST',
  52. success: function (res) {
  53. location.href = '/front/vipsubscribe/toSubVipSetPage'
  54. }
  55. })
  56. }
  57. var nowClientHeight = document.documentElement.clientHeight || document.body.clientHeight
  58. // 监听banner高度变化
  59. $(function () {
  60. var GolBalTime;
  61. function listenerBannerHeight () {
  62. // fix swiper autoplay
  63. if (swiper1 && !Boolean(swiper1.translate)) {
  64. swiper1.update()
  65. swiper1.autoplay.run()
  66. }
  67. var tTop = $(document).scrollTop()
  68. if (tTop >= 12) {
  69. $('.home_search').addClass('fixed-top')
  70. } else {
  71. $('.home_search').removeClass('fixed-top')
  72. }
  73. GolBalTime = requestAnimationFrame(listenerBannerHeight)
  74. }
  75. listenerBannerHeight()
  76. $("body").on('tap longTap', '.tslist', function () {
  77. var tempS = $(this).addClass('hover')
  78. setTimeout(function() {
  79. tempS.removeClass('hover')
  80. }, 50)
  81. })
  82. })
  83. /*
  84. * money unit for zyh @date 2020/6/5
  85. * */
  86. var MoneyUnit = {
  87. levelArr: ['元', '万元', '亿元', '万亿元'],
  88. test: function (num, type, lv) {
  89. if (type === void 0) {
  90. type = 'string';
  91. }
  92. if (lv === void 0) {
  93. lv = 0;
  94. }
  95. if (num === 0) {
  96. if (type === 'string') {
  97. return '0';
  98. }
  99. if (type === 'lv') {
  100. return this.levelArr[lv];
  101. }
  102. if (type === 'number') {
  103. return 0;
  104. }
  105. if (type === 'index') {
  106. return lv;
  107. }
  108. }
  109. var result = num / Math.pow(10000, lv);
  110. if (result > 10000 && lv < 2) {
  111. return this.test(num, type, lv + 1);
  112. } else {
  113. if (type === 'string') {
  114. return String(Math.floor(result * 100) / 100).replace('.00', '') + this.levelArr[lv];
  115. }
  116. if (type === 'lv') {
  117. return this.levelArr[lv];
  118. }
  119. if (type === 'index') {
  120. return lv;
  121. }
  122. if (type === 'number') {
  123. return String(Math.floor(result * 100) / 100).replace('.00', '');
  124. }
  125. }
  126. }
  127. }
  128. function getDefaultRangeForLocal () {
  129. function changeDefaultForSearchRange (type, key, value) {
  130. var prefixForKey = 'mainSearchRangeFor'
  131. if (type === 'set') {
  132. localStorage.setItem(prefixForKey + key, value)
  133. } else {
  134. return localStorage.getItem(prefixForKey + key)
  135. }
  136. }
  137. var tempList = []
  138. if (changeDefaultForSearchRange('get', 'Title') == 'true') {
  139. tempList.push('title')
  140. }
  141. if (changeDefaultForSearchRange('get', 'Content') == 'true') {
  142. tempList.push('content')
  143. }
  144. if (!tempList.length) {
  145. tempList = ['title', 'content']
  146. }
  147. return tempList.join(',')
  148. }
  149. function showSearchTipForTimeRange () {
  150. var tempDom = $("#supersearchPage #hasNoData_tiptext>font:eq(0)")
  151. var tipMap = {
  152. 'thisyear': '近一年',
  153. 'lately-7': '近7天',
  154. 'lately-30': '近30天'
  155. }
  156. var tempStr = ''
  157. var defaultRange = sessionStorage.superSearch_publishtime || SuperSearch.reqParam.publishtime || 'thisyear'
  158. if (tipMap[defaultRange]) {
  159. tempStr = tipMap[defaultRange]
  160. } else {
  161. var tempTimeList = defaultRange.split('_')
  162. if (tempTimeList[0]) {
  163. tempStr = new Date(tempTimeList[0] * 1000).pattern('yyyy/MM/dd')
  164. }
  165. if (tempTimeList[1]) {
  166. if (tempStr.length) {
  167. tempStr += '-'
  168. }
  169. tempStr += new Date(tempTimeList[1] * 1000).pattern('yyyy/MM/dd')
  170. }
  171. }
  172. tempDom.find('span').text(tempStr)
  173. tempDom.show();
  174. }
  175. var SuperSearch = {
  176. // 筛选企业信息
  177. filterWin: {},
  178. filterBuy: {},
  179. secondFlag:"",
  180. secondList:"",
  181. secondKWS:"",
  182. isMyPage: false,
  183. initFlag: false,
  184. dropload: null,
  185. ZBADDRESS: "",
  186. s_words: "",
  187. myHistory: "",
  188. msgset: "",
  189. dyDiv: true, //显示订阅剑鱼标讯信息
  190. subtype_proposed: "拟建",
  191. requesting: false,
  192. noMoreCache: false,
  193. showNull: null,//null true false
  194. advert: null,
  195. advertIsClose: false,
  196. interceptWord: "",
  197. industry: "",
  198. sortArray: "",
  199. limitFlag: false,
  200. localFalg:false,
  201. reqParam: {
  202. "searchvalue": "",
  203. "subtype": "",
  204. "scope": "",
  205. "publishtime": "thisyear",
  206. "selectType": getDefaultRangeForLocal(),
  207. "minprice":"",
  208. "maxprice":"",
  209. "industry":"",
  210. "pageNum": 1,
  211. "winner":"",
  212. "buyerclass":""
  213. },
  214. njTipEasyPopup: null,
  215. hasHistory :false,
  216. hasSubscribe:false,
  217. isVip :false,
  218. locationCity:"",
  219. listLength:0,
  220. locationCount:0,
  221. init: function(isReload,isFocus,isPushHistory){
  222. this.dyDiv = true;
  223. // 初始化高级搜索和筛选中标企业
  224. initSearchHeader()
  225. if(!isReload){
  226. this.recoveryPage();
  227. }
  228. if (isReload && vMainSearchComponent) {
  229. sessionStorage.removeItem('superSearch_newQueryParams')
  230. sessionStorage.removeItem('superSearch_newQueryParams_components')
  231. vMainSearchComponent.resetInitStatus()
  232. }
  233. //loadTipMsg加载历史记录和我的订阅
  234. this.loadTipMsg();
  235. this.clearSessionStorage();
  236. EntSearch.isMyPage = false;
  237. this.isMyPage = true;
  238. $("#supersearchPage").addClass("absolute-hide");
  239. $("#searchIndex").addClass("hidden");
  240. $("#supersearchPage").removeClass("hidden");
  241. setTimeout(function(){
  242. $("#supersearchPage").removeClass("absolute-hide");
  243. },0);
  244. try{
  245. JyObj.hiddenBottom("0");
  246. }catch(e){}
  247. $("body").css("background-color","#fff");
  248. if(SuperSearch.dyDiv){ //首次进来是否显示订阅
  249. SuperSearch.showToOrder(false)
  250. }else{
  251. SuperSearch.showToOrder(true)
  252. }
  253. SuperSearch.canSearch();
  254. if(isReload){
  255. this.resetPage(isFocus);
  256. if(sessionStorage && history && isPushHistory){
  257. history.pushState({},"","");
  258. }
  259. this.searchKeyword();
  260. }
  261. if(this.initFlag){
  262. return;
  263. }
  264. this.initFlag = true;
  265. //localsession存储标题/全文搜索 和 列表/表格展示
  266. //if(localStorage){
  267. // if(localStorage.selectType=="allSearch"){
  268. // $("#supersearchPage #search_all").addClass("on").siblings().removeClass("on");
  269. // }else if(localStorage.selectType=="titleSearch"){
  270. //$("#supersearchPage #search_title").addClass("on").siblings().removeClass("on");
  271. // }
  272. //}
  273. $("#supersearchPage #feedback").on("tap",function(){
  274. SuperSearch.goToFeedbackPage();
  275. });
  276. $("#supersearchPage #allSearchModel").on("tap",function(){
  277. SuperSearch.allSearch();
  278. });
  279. $("#supersearchPage #search_title").on("tap",function(){
  280. SuperSearch.titleSearch();
  281. });
  282. $("#supersearchPage #search_all").on("tap",function(){
  283. SuperSearch.allSearch();
  284. });
  285. $("#supersearchPage .showType>.showlist").on("tap",function(){
  286. SuperSearch.showlist();
  287. });
  288. $("#supersearchPage .showType>.showtable").on("tap",function(){
  289. SuperSearch.showTable();
  290. });
  291. $("#supersearchPage .jyshaxuan>div").on("tap",function(){
  292. SuperSearch.inputBlur();
  293. });
  294. $("#supersearchPage .tableclose").on("tap",function(){
  295. $("#supersearchPage .TableTip").fadeOut("normal",function(){
  296. $.post('/jylab/changePro',function(r){});
  297. });
  298. });
  299. //筛选菜单展示or隐藏
  300. $("#supersearchPage").on("tap" , "#clickFilter", function(){
  301. // 企业搜索
  302. if ($(".tabs-nav .active").index() === 1 && $("#search-header-input").val().trim() != '') {
  303. $("#supersearchPage input[name=super_searchinput]").blur();
  304. window.isKeyDownToEntSearch = true
  305. if (vEntSearchComponent) {
  306. // vEntSearchComponent.toggleEntShow(true)
  307. }
  308. return
  309. }
  310. if ($(this).text().trim() !== '搜索' || $("#search-header-input").val().trim() === '') {
  311. return
  312. }
  313. if (vMainSearchComponent) {
  314. vMainSearchComponent.toggleEntShow(true)
  315. }
  316. return;
  317. hideTab();
  318. SuperSearch.inputBlur();
  319. if(SuperSearch.requesting){
  320. return;
  321. }
  322. $("#supersearchPage .inputDiv").addClass("hidden");
  323. $("#supersearchPage #super_search").toggleClass("hidden");
  324. if($("#supersearchPage #super_search").hasClass("hidden")){
  325. if(SuperSearch.interceptWord != ""){
  326. $("#supersearchPage #intercept").removeClass("hidden");
  327. }
  328. if(SuperSearch.showNull){
  329. $("#supersearchPage #selLable").removeClass("hidden");
  330. $("#supersearchPage .nullcontent").removeClass("hidden");
  331. }else{
  332. if(SuperSearch.showNull == null){
  333. $("#supersearchPage #selLable").addClass("hidden");
  334. }else{
  335. $("#supersearchPage #selLable").removeClass("hidden");
  336. }
  337. $("#supersearchPage #wrapper").removeClass("hidden");
  338. }
  339. }else{
  340. $("#supersearchPage #intercept").addClass("hidden");
  341. $("#supersearchPage #selLable").addClass("hidden");
  342. $("#supersearchPage .nullcontent").addClass("hidden");
  343. $("#supersearchPage #wrapper").addClass("hidden");
  344. }
  345. });
  346. $("#supersearchPage input[name=super_searchinput]").on("input",function(){
  347. SuperSearch.canSearch();
  348. });
  349. //是否显示提示搜索框
  350. $("#supersearchPage input[name=super_searchinput]").focus(function(){
  351. hideTab();
  352. SuperSearch.afterFocus();
  353. }).blur(function(){
  354. setTimeout(function(){
  355. $("#supersearchPage .clearInpt").addClass("hidden");
  356. },300);
  357. });
  358. //清除输入框功能
  359. $("#supersearchPage .clearInpt").on("tap",function(){
  360. $("#supersearchPage input[name=super_searchinput]").val("");
  361. $("#supersearchPage input[name=super_searchinput]").focus();
  362. SuperSearch.canSearch();
  363. });
  364. //提交查询
  365. $("#supersearchPage").on('click', "#clickFilter",function(){
  366. // 企业搜索
  367. if ($(".tabs-nav .active").index() === 1 && $("#search-header-input").val().trim() != '') {
  368. $("#supersearchPage input[name=super_searchinput]").blur();
  369. window.isKeyDownToEntSearch = true
  370. if (vEntSearchComponent) {
  371. vEntSearchComponent.toggleEntShow(true)
  372. }
  373. return
  374. }
  375. if ($(this).text().trim() !== '搜索' || $("#search-header-input").val().trim() === '') {
  376. return
  377. }
  378. sessionStorage.setItem('isSearchListPage', 'true')
  379. // SuperSearch.isSearchListPage = true
  380. $(".loading_").show();
  381. SuperSearch.formSubmit("N");
  382. });
  383. $("#supersearchPage .jyshxbottom .jydqsure").on("tap",function(){
  384. if($(this).hasClass("on")){
  385. var max=$("#supersearchPage .maxMrice").val(),min=$("#supersearchPage .minMrice").val();
  386. if(Number(max)<Number(min)&&max!=""&&min!=""){
  387. $("#supersearchPage .maxMrice").val(min);
  388. $("#supersearchPage .minMrice").val(max);
  389. }
  390. setTimeout(function(){
  391. $(".loading_").show();
  392. SuperSearch.formSubmit("N");
  393. },300)
  394. }
  395. });
  396. //清除筛选
  397. $("#supersearchPage .jydqreset").on("tap",function(){
  398. SuperSearch.resetSx();
  399. });
  400. //是否开通超级搜索服务
  401. //关闭搜索后订阅================================================================
  402. $("#supersearchPage #close_set").on("tap",function(){
  403. SuperSearch.showToOrder(false);
  404. SuperSearch.dyDiv=true;
  405. });
  406. // 获取用户信息-用于立即订阅按钮
  407. function getKeyUserInfo () {
  408. // 免费用户
  409. // --> 已设置10组关键词,订阅失败提示
  410. // --> 小于10组
  411. // --> 历史老用户-未选择区域-提示更新
  412. // --> 选择区域-关键词列表
  413. // --> 新用户-未选择区域-订阅页面
  414. // --> 选择区域-关键词列表
  415. var isOldUser = false
  416. var nowKeyLength = 8
  417. var isSelectArea = false
  418. // 获取用户关键词数据
  419. $.ajax({
  420. url: '/publicapply/free/subscribe',
  421. type: 'post',
  422. success: function (res) {
  423. if (res.error_code === 0 && res.data) {
  424. try {
  425. isSelectArea = !!res.data.area
  426. nowKeyLength = res.data.keys.length
  427. } catch (e) {
  428. console.warn('error format keys length')
  429. }
  430. }
  431. },
  432. })
  433. // S-直接订阅
  434. $("#supersearchPage #zjdy").on("tap",function(){
  435. var rFlag = false;
  436. if (SuperSearch.s_words==""){
  437. SuperSearch.s_words=$.trim($("#supersearchPage [name='super_searchinput']").val());
  438. SuperSearch.s_words=SuperSearch.s_words.replace(/\s+/g," ");
  439. }
  440. if(SuperSearch.isVip || window.jyUserPower.member){
  441. $.ajax({
  442. type: "post",
  443. url: "/publicapply/subscribe/setUserInfo",
  444. data: {
  445. pageType:'keyWords',
  446. actionType: 'directSubKWS',
  447. kws_name:SuperSearch.s_words,
  448. vSwitch: vSwitch
  449. },
  450. dataType: "json",
  451. async: false,
  452. success: function(r){
  453. if(r.flag=="y"){
  454. rFlag = true;
  455. }else if(r.flag=="o"){
  456. EasyAlert.show("您已经订阅过此关键字");
  457. }else if(r.flag=="m"){
  458. EasyAlert.show("您已经超过订阅<br>关键字上限");
  459. }
  460. },error: function(){
  461. rFlag = true;
  462. }
  463. });
  464. if(rFlag){
  465. SuperSearch.setSessionStorage();
  466. window.location.href = "/front/vipsubscribe/toSetKeyWordPage";
  467. }
  468. }else{
  469. // 免费用户
  470. isOldUser = !jyAddInfo.isUpgrade
  471. if (nowKeyLength >= 10) {
  472. return EasyAlert.show("您已经超过订阅<br>关键字上限");
  473. } else {
  474. if (isSelectArea) {
  475. // 执行下方原有逻辑
  476. } else if (isOldUser) {
  477. return $('#tipsType').show()
  478. }
  479. }
  480. $.ajax({
  481. type: "post",
  482. url: "/member/swordfish/ajaxReq",
  483. data: {keys:SuperSearch.s_words,reqType: "subscribe"},
  484. dataType: "json",
  485. async: false,
  486. success: function(r){
  487. if(r.flag=="y"){
  488. rFlag = true;
  489. }else if(r.flag=="o"){
  490. EasyAlert.show("您已经超过订阅<br>关键字上限");
  491. }
  492. },error: function(){
  493. rFlag = true;
  494. }
  495. });
  496. if(rFlag){
  497. SuperSearch.setSessionStorage();
  498. var goHref = "/front/vipsubscribe/toSetKeyWordPage";
  499. if (!isSelectArea) {
  500. goHref = "/front/vipsubscribe/toSubVipSetPage";
  501. }
  502. window.location.href = goHref
  503. }
  504. }
  505. });
  506. // E-直接订阅
  507. }
  508. getKeyUserInfo()
  509. //删除历史搜索
  510. $("#supersearchPage").on("click", " #del_history", function(){
  511. if(localStorage){
  512. localStorage.removeItem("superSearch_history");
  513. }
  514. if($("#supersearchPage .search-one-box ul.history-list-box").find("li").length >0){
  515. $.ajax({
  516. type:"post",
  517. url:"/swordfish/delWxHistorySearch",
  518. success:function(rt){
  519. $(".tabs-box .tabs-content-page").eq(0).addClass("hidden")
  520. }
  521. });
  522. }
  523. $("#supersearchPage .search-one-box ul.history-list-box").find("li").remove();
  524. });
  525. ////
  526. SuperSearch.njTipEasyPopup = new EasyPopup("nijianTip");
  527. $("#supersearchPage .q-mark").on("tap",function(){
  528. setTimeout(function(){
  529. SuperSearch.njTipEasyPopup.show();
  530. },500);
  531. });
  532. //金额点击事件
  533. $("#supersearchPage .money-dialog .btn").on("tap",function(){
  534. $(this).addClass("active");
  535. $("#supersearchPage .money-dialog .money-inp").removeClass("active");
  536. });
  537. $("#supersearchPage .money-dialog .money-inp").on("tap",function(){
  538. $(this).addClass("active");
  539. $("#supersearchPage .money-dialog .btn").removeClass("active");
  540. });
  541. var reg = /^[\u4e00-\u9fa5]+$/;
  542. var maxnum = "";
  543. $("#supersearchPage .maxMrice").on("input propertychange",function(){
  544. /*
  545. var minp = $(this).val()
  546. if(!/^[\d]{1,9}([.][\d]{0,2})?$/.test(minp)){
  547. minp = minp.substr(0,minp.length-1);
  548. $(this).val(minp)
  549. }*/
  550. var oldvalue = $(this).val();
  551. var maxp = $.trim($(this).val()).replace(/\s/g,"");
  552. if(oldvalue != maxp){
  553. $(this).val(maxp);
  554. }
  555. if(!/^[\d]{1,9}([.][\d]{0,2})?$/.test(maxp)){
  556. if((reg.test(maxp)||isNaN(maxp)||maxp.indexOf("e")>0)&&maxp.indexOf(".")<0){
  557. $(this).val(maxnum);
  558. }else{
  559. //maxp = maxp.substr(0,maxp.length-1);
  560. if(reg.test(maxp)||isNaN(maxp)||maxp.indexOf("e")>0){
  561. $(this).val(maxnum);
  562. }else{
  563. if(maxp.indexOf(".")>0){
  564. var offront = maxp.split(".")[0];
  565. var ofafter = maxp.split(".")[1];
  566. if(offront.length>9||ofafter.length>2){
  567. //if(offront.length>9){
  568. $(this).val(maxnum);
  569. // maxnum = offront.substr(0,9)+"."+ maxnum.split(".")[1].substr(0,2);
  570. //}else{
  571. // $(this).val(offront.substr(0,9)+"."+ofafter.substr(0,2))
  572. // maxnum = offront.substr(0,9)+"."+ofafter.substr(0,2);
  573. //}
  574. }else{
  575. //$(this).val(maxp);
  576. maxnum = maxp;
  577. }
  578. }else{
  579. if(maxp.length>9){
  580. $(this).val(maxnum);
  581. }else{
  582. //$(this).val(maxp);
  583. maxnum = maxp;
  584. }
  585. }
  586. }
  587. }
  588. }else{
  589. maxnum = maxp;
  590. }
  591. }).blur(function(){
  592. var max=$("#supersearchPage .maxMrice").val(),min=$("#supersearchPage .minMrice").val();
  593. if(Number(max)<Number(min)&&max!=""&&min!=""){
  594. $("#supersearchPage .maxMrice").val(min);
  595. $("#supersearchPage .minMrice").val(max);
  596. minnum = max;
  597. maxnum = min;
  598. }
  599. });
  600. var minnum = "";
  601. $("#supersearchPage .minMrice").on("input propertychange",function(){
  602. /*
  603. var minp = $(this).val()
  604. if(!/^[\d]{1,9}([.][\d]{0,2})?$/.test(minp)){
  605. minp = minp.substr(0,minp.length-1);
  606. $(this).val(minp)
  607. }*/
  608. var oldvalue = $(this).val();
  609. var minp = $.trim($(this).val()).replace(/\s/g,"");
  610. if(oldvalue != minp){
  611. $(this).val(minp);
  612. }
  613. if(!/^[\d]{1,9}([.][\d]{0,2})?$/.test(minp)){
  614. if((reg.test(minp)||isNaN(minp)||minp.indexOf("e")>0)&&minp.indexOf(".")<0){
  615. $(this).val(minnum);
  616. }else{
  617. //minp = minp.substr(0,minp.length-1);
  618. if(reg.test(minp)||isNaN(minp)||minp.indexOf("e")>0){
  619. $(this).val(minnum);
  620. }else{
  621. if(minp.indexOf(".")>0){
  622. var offront = minp.split(".")[0];
  623. var ofafter = minp.split(".")[1];
  624. if(offront.length>9||ofafter.length>2){
  625. //if(offront.length>9){
  626. $(this).val(minnum);
  627. // minnum = offront.substr(0,9)+"."+ minnum.split(".")[1].substr(0,2);
  628. //}else{
  629. // $(this).val(offront.substr(0,9)+"."+ofafter.substr(0,2))
  630. // minnum = offront.substr(0,9)+"."+ofafter.substr(0,2);
  631. //}
  632. }else{
  633. //$(this).val(minp);
  634. minnum = minp;
  635. }
  636. }else{
  637. if(minp.length>9){
  638. $(this).val(minnum);
  639. }else{
  640. //$(this).val(minp);
  641. minnum = minp;
  642. }
  643. }
  644. }
  645. }
  646. }else{
  647. minnum = minp;
  648. }
  649. }).blur(function(){
  650. var max=$("#supersearchPage .maxMrice").val(),min=$("#supersearchPage .minMrice").val();
  651. if(Number(max)<Number(min)&&max!=""&&min!=""){
  652. $("#supersearchPage .maxMrice").val(min);
  653. $("#supersearchPage .minMrice").val(max);
  654. minnum = max;
  655. maxnum = min;
  656. }
  657. });
  658. $("#supersearchPage .shaixIndustry").on("tap",function(){
  659. $(this).addClass("shaixcl");
  660. $(this).siblings().removeClass("shaixcl");
  661. $("#supersearchPage .industry-dialog").removeClass("hidden");
  662. $("#supersearchPage .jydq-dialog,#supersearchPage .jytype-dialog,#supersearchPage .jypt-dialog,#supersearchPage .money-dialog").addClass("hidden");
  663. });
  664. $("#supersearchPage .shaixMoney").on("tap",function(){
  665. $(this).addClass("shaixcl");
  666. $(this).siblings().removeClass("shaixcl");
  667. $("#supersearchPage .money-dialog").removeClass("hidden");
  668. $("#supersearchPage .jydq-dialog,#supersearchPage .jytype-dialog,#supersearchPage .jypt-dialog,#supersearchPage .industry-dialog").addClass("hidden");
  669. });
  670. //
  671. $("#supersearchPage .shaixpt").on("tap",function(){
  672. $("#supersearchPage .jypt-dialog").removeClass("hidden");
  673. $("#supersearchPage .jydq-dialog,#supersearchPage .jytype-dialog,#supersearchPage .money-dialog,#supersearchPage .industry-dialog").addClass("hidden");
  674. $(this).addClass("shaixcl");
  675. $(this).siblings().removeClass("shaixcl");
  676. });
  677. $("#supersearchPage .shaixone").on("tap",function(){
  678. $("#supersearchPage .jydq-dialog").removeClass("hidden");
  679. $("#supersearchPage .jypt-dialog,#supersearchPage .jytype-dialog,#supersearchPage .money-dialog,#supersearchPage .industry-dialog").addClass("hidden");
  680. $(this).addClass("shaixcl");
  681. $(this).siblings().removeClass("shaixcl");
  682. });
  683. $("#supersearchPage .shaixtwo").on("tap",function(){
  684. $("#supersearchPage .newest").removeClass("hidden");
  685. $("#supersearchPage .jytype-dialog").removeClass("hidden");
  686. $("#supersearchPage .jypt-dialog,#supersearchPage .jydq-dialog,#supersearchPage .money-dialog,#supersearchPage .industry-dialog").addClass("hidden");
  687. $(this).addClass("shaixcl");
  688. $(this).siblings().removeClass("shaixcl");
  689. });
  690. var dialogObj = $("#supersearchPage .contentone");
  691. dialogObj.find(".btn").on("tap",function(){
  692. if($(this).parent().index() == 0){
  693. dialogObj.find(".btn").removeClass("active");
  694. }else{
  695. dialogObj.find("ul:first li:first .btn").removeClass("active");
  696. };
  697. $(this).toggleClass("active");
  698. if(dialogObj.find(".btn.active").length == 0){
  699. dialogObj.find("ul:first li:first .btn").addClass("active");
  700. };
  701. });
  702. var dialogObjtwo = $("#supersearchPage .contenttwo");
  703. dialogObjtwo.find(".btn").on("tap",function(){
  704. if($(this).parent().index() == 0){
  705. dialogObjtwo.find('div[id="dqbtn"]').removeClass("active");
  706. dialogObjtwo.find(".btn").removeClass("active");
  707. }else{
  708. dialogObjtwo.find("ul:first li:first .btn").removeClass("active");
  709. };
  710. $(this).toggleClass("active");
  711. if ($(this).attr("class")!="active"){
  712. $(this).prevAll('div[id="dqbtn"]').removeClass("active");
  713. };
  714. if($(this).parent("li").find(".btn").length == $(this).parent("li").find(".btn.active").length){
  715. $(this).prevAll('div[id="dqbtn"]').addClass("active");
  716. dialogObjtwo.find("ul:first li:first .btn").removeClass("active");
  717. };
  718. if(dialogObjtwo.find(".btn.active").length == 0){
  719. dialogObjtwo.find("ul:first li:first .btn").addClass("active");
  720. };
  721. });
  722. dialogObjtwo.find('div[id="dqbtn"]').on("tap",function(){
  723. $(this).toggleClass("active");
  724. if ($(this).attr("class") != "active"){
  725. $(this).nextAll(".btn").removeClass("active");
  726. }else{
  727. $(this).nextAll(".btn").addClass("active");
  728. dialogObjtwo.find("ul:first li:first .btn").removeClass("active");
  729. };
  730. if(dialogObjtwo.find(".btn.active").length == 0){
  731. dialogObjtwo.find("ul:first li:first .btn").addClass("active");
  732. };
  733. });
  734. //获取输入时间
  735. $("#supersearchPage .jypt-pt button").on("tap",function(){
  736. var thisIndex = $("#supersearchPage .jypt-pt .jypt-active").index();
  737. $("#supersearchPage .jypt-pt .jypt-active").removeClass("jypt-active");
  738. if(thisIndex == $(this).index()){
  739. $(this).removeClass("jypt-active");
  740. }else{
  741. $(this).addClass("jypt-active");
  742. }
  743. if($("#supersearchPage .jypt-pt .jypt-active").length == 0){
  744. $("#supersearchPage .jypt-pt>button:first").addClass("jypt-active");
  745. }
  746. $("#supersearchPage .jypt-timeinputs").removeClass("jypt-timeinputs-active");
  747. });
  748. $("#supersearchPage .jypt-fg").on("tap",function(){
  749. $("#supersearchPage .jypt-pt .jypt-active").removeClass("jypt-active");
  750. $("#supersearchPage .jypt-timeinputs").toggleClass("jypt-timeinputs-active");
  751. if(!$("#supersearchPage .jypt-timeinputs").hasClass("jypt-timeinputs-active")){
  752. $("#supersearchPage .jypt-pt>button:first").addClass("jypt-active");
  753. }
  754. });
  755. //获取当前时间
  756. var date = (function () {
  757. var date = new Date();
  758. var year = date.getFullYear();
  759. var month = date.getMonth() + 1;
  760. var day = date.getDate();
  761. month = month < 10 ? '0' + month : month;
  762. day = day < 10 ? '0' + day : day;
  763. return year + '-' + month + '-' + day;
  764. })();
  765. // 显示记录值
  766. var nowStartTime, nowEndTime;
  767. function resetDefaultTime () {
  768. var stime = localStorage.search_starttime;
  769. var etime = localStorage.search_endtime;
  770. var regTime = new RegExp(/\d{4}年\d{2}月\d{2}日/)
  771. if (stime && regTime.test(stime)) {
  772. nowStartTime = stime.replace('日', '').split(/[年|月]/)
  773. $("#supersearchPage #starttime").val(stime).attr('data-value', new Date(nowStartTime.join('/')).getTime());
  774. } else {
  775. $("#supersearchPage #starttime").val('').attr('data-value', '');
  776. localStorage.removeItem('search_starttime')
  777. }
  778. if (etime && regTime.test(etime)) {
  779. nowEndTime = etime.replace('日', '').split(/[年|月]/)
  780. $("#supersearchPage #endtime").val(etime).attr('data-value', new Date(nowEndTime.join('/')).getTime());
  781. } else {
  782. $("#supersearchPage #endtime").val('').attr('data-value', '');
  783. localStorage.removeItem('search_endtime')
  784. }
  785. }
  786. resetDefaultTime()
  787. // 点击事件绑定datepicker
  788. $("#supersearchPage #starttime").on("click",function(){
  789. if(typeof(isWxsearchlist) != "undefined"){
  790. $("#supersearchPage .sl-jyshxbottom").addClass("hide");
  791. }
  792. weui.datePicker({
  793. id: 'start' + new Date().getTime(),
  794. start: 2000,
  795. title: '选择开始时间',
  796. end: nowEndTime ? nowEndTime.join('-') : new Date(),
  797. defaultValue: nowStartTime ? nowStartTime : date.split('-'),
  798. className: 'jymobile-datePicker start',
  799. onChange: function (result) {
  800. var nowTArr = result.map(function (v) {
  801. return v.label
  802. })
  803. $(".jymobile-datePicker.start .weui-picker__item").each(function(){
  804. var nowT = $(this).text()
  805. $(this).removeClass('is-now-select')
  806. if (nowTArr.indexOf(nowT) !== -1) {
  807. $(this).addClass('is-now-select')
  808. }
  809. })
  810. },
  811. onClose: function () {
  812. if(typeof(isWxsearchlist) != "undefined"){
  813. $("#supersearchPage .sl-jyshxbottom").removeClass("hide");
  814. }
  815. },
  816. onConfirm: function (result) {
  817. var year = result[0].value;
  818. var month = result[1].value < 10 ? '0' + result[1].value : result[1].value;
  819. var day = result[2].value < 10 ? '0' + result[2].value : result[2].value;
  820. var time_result = year + '年' + month + '月' + day + '日';
  821. var timeSec = year + '/' + month + '/' + day
  822. nowStartTime = [year, month, day]
  823. if(localStorage){
  824. localStorage.search_starttime = time_result;
  825. }
  826. $("#supersearchPage #starttime").val(time_result).attr('data-value', new Date(timeSec).getTime());
  827. SuperSearch.afterSelect();
  828. }
  829. });
  830. $(".jymobile-datePicker.start #weui-picker-confirm").text('确认')
  831. if (!nowStartTime) {return}
  832. $(".jymobile-datePicker.start .weui-half-screen-dialog__ft").prepend("<a href=\"javascript:;\" class=\"weui-btn weui-btn_disabled weui-picker__btn\" id=\"resetTime\" data-action=\"select\" style=\"text-decoration: none;\">\u91CD\u7F6E</a>");
  833. // $(".jymobile-datePicker.start .weui-half-screen-dialog__ft").prepend(`<a href="javascript:;" class="weui-btn weui-btn_disabled weui-picker__btn" id="resetTime" data-action="select" style="text-decoration: none;">重置</a>`)
  834. $(".jymobile-datePicker.start #resetTime").on('click',function () {
  835. $('.jymobile-datePicker.start .weui-mask.weui-animate-fade-in').trigger('click');
  836. $('.jymobile-datePicker.start .weui-mask.weui-animate-fade-in').click();
  837. $("#supersearchPage #starttime").attr("data-value","").val('');
  838. nowStartTime = null
  839. if(localStorage){
  840. localStorage.removeItem("search_starttime");
  841. }
  842. SuperSearch.afterOnClear();
  843. })
  844. });
  845. $("#supersearchPage #endtime").on("click",function(){
  846. if(typeof(isWxsearchlist) != "undefined"){
  847. $("#supersearchPage .sl-jyshxbottom").addClass("hide");
  848. }
  849. weui.datePicker({
  850. id: 'end' + new Date().getTime(),
  851. start: nowStartTime ? nowStartTime.join('-') : 2000,
  852. title: '选择结束时间',
  853. end: new Date(),
  854. defaultValue: nowEndTime ? nowEndTime : date.split('-'),
  855. className: 'jymobile-datePicker end',
  856. onChange: function (result) {
  857. var nowTArr = result.map(function (v) {
  858. return v.label
  859. })
  860. $(".jymobile-datePicker.end .weui-picker__item").each(function(){
  861. var nowT = $(this).text()
  862. $(this).removeClass('is-now-select')
  863. if (nowTArr.indexOf(nowT) !== -1) {
  864. $(this).addClass('is-now-select')
  865. }
  866. })
  867. },
  868. onClose: function () {
  869. if(typeof(isWxsearchlist) != "undefined"){
  870. $("#supersearchPage .sl-jyshxbottom").removeClass("hide");
  871. }
  872. },
  873. onConfirm: function (result) {
  874. var year = result[0].value;
  875. var month = result[1].value < 10 ? '0' + result[1].value : result[1].value;
  876. var day = result[2].value < 10 ? '0' + result[2].value : result[2].value;
  877. var time_result = year + '年' + month + '月' + day + '日';
  878. var timeSec = year + '/' + month + '/' + day
  879. nowEndTime = [year, month, day]
  880. if(localStorage){
  881. localStorage.search_endtime = time_result;
  882. }
  883. $("#supersearchPage #endtime").val(time_result).attr('data-value', new Date(timeSec).getTime());
  884. SuperSearch.afterSelect();
  885. }
  886. });
  887. $(".jymobile-datePicker.end #weui-picker-confirm").text('确认')
  888. if (!nowEndTime) {return}
  889. $(".jymobile-datePicker.end .weui-half-screen-dialog__ft").prepend("<a href=\"javascript:;\" class=\"weui-btn weui-btn_disabled weui-picker__btn\" id=\"resetTime\" data-action=\"select\" style=\"text-decoration: none;\">\u91CD\u7F6E</a>");
  890. // $(".jymobile-datePicker.end .weui-half-screen-dialog__ft").prepend(`<a href="javascript:;" class="weui-btn weui-btn_disabled weui-picker__btn" id="resetTime" data-action="select" style="text-decoration: none;">重置</a>`)
  891. $(".jymobile-datePicker.end #resetTime").on('click',function () {
  892. $('.jymobile-datePicker.end .weui-mask.weui-animate-fade-in').trigger('click');
  893. $('.jymobile-datePicker.end .weui-mask.weui-animate-fade-in').click();
  894. $("#supersearchPage #endtime").attr("data-value","").val('');
  895. nowEndTime = null
  896. if(localStorage){
  897. localStorage.removeItem("search_endtime");
  898. }
  899. SuperSearch.afterOnClear();
  900. })
  901. });
  902. //返回时 是否显示table的查看更多
  903. SuperSearch.isTable($(".select-show-type-group").hasClass('is-table'));
  904. },
  905. recoveryPage: function(){
  906. $("#searchIndex").addClass("hidden");
  907. $("#supersearchPage").removeClass("hidden");
  908. $("#supersearchPage #wrapper").removeClass("hidden");
  909. $("#supersearchPage .selLable").removeClass("hidden");
  910. SuperSearch.setUpLastPage();
  911. },
  912. searchKeyword: function(){
  913. if(searchWord != null && searchWord != ""){
  914. $("#supersearchPage input[name=super_searchinput]").val(searchWord);
  915. this.getIndustry();
  916. this.canSearch();
  917. SuperSearch.formSubmit("N");
  918. }
  919. },
  920. resetPage: function(flag){
  921. this.showNull = null;
  922. this.requesting = false;
  923. this.dyDiv = false;
  924. this.limitFlag = false;
  925. this.reqParam = {
  926. "searchvalue": "",
  927. "subtype": "",
  928. "scope": "",
  929. "publishtime": "thisyear",
  930. "selectType": getDefaultRangeForLocal(),
  931. "minprice":"",
  932. "maxprice":"",
  933. "industry":"",
  934. "pageNum": 1
  935. }
  936. resetTopSearch()
  937. $("#supersearchPage #list").text("");
  938. $("#supersearchPage .dropload-down").remove();
  939. $("#supersearchPage .nullcontent").addClass("hidden");
  940. $("#supersearchPage #super_search").addClass("hidden");
  941. $("#supersearchPage #wrapper").addClass("hidden");
  942. $("#supersearchPage .selLable").addClass("hidden");
  943. $("#supersearchPage input[name=super_searchinput]").val("");
  944. var thisClass = this;
  945. if(flag){
  946. if(mySysIsIos()){
  947. $("#supersearchPage input[name=super_searchinput]").focus();
  948. thisClass.afterFocus();
  949. }else{
  950. setTimeout(function(){
  951. $("#supersearchPage input[name=super_searchinput]").focus();
  952. thisClass.afterFocus();
  953. },100);
  954. }
  955. }
  956. this.getIndustry();
  957. this.resetSx();//重置筛选
  958. $("#supersearchPage .shaixIndustry").addClass("shaixcl");
  959. $("#supersearchPage .shaixIndustry").siblings().removeClass("shaixcl");
  960. $("#supersearchPage .industry-dialog").removeClass("hidden");
  961. $("#supersearchPage .jydq-dialog,.jytype-dialog,.jypt-dialog,.money-dialog").addClass("hidden");
  962. },
  963. afterFocus: function(){
  964. if($.trim($("#supersearchPage input[name=super_searchinput]").val()).length>0){
  965. $("#supersearchPage .clearInpt").removeClass("hidden");
  966. $("#supersearchPage .query").removeClass("hidden");
  967. }
  968. if(!!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){ //处理ios输入框光标无法遮盖问题
  969. $("#supersearchPage .app-layout-content-b").scrollTop(0);
  970. $("#supersearchPage .app-layout-content-b").off("scroll", SuperSearch.SuperSearchInputblur).on("scroll",SuperSearch.SuperSearchInputblur);
  971. }
  972. },
  973. limitPaging: function(me){
  974. $("#supersearchPage #list>.tslist.hidden").each(function(i){
  975. if(i >= 50){
  976. return false;
  977. }
  978. $(this).removeClass("hidden");
  979. });
  980. $("#supersearchPage #table tr.hidden").each(function(i){
  981. if(i >= 50){
  982. return false;
  983. }
  984. $(this).removeClass("hidden");
  985. });
  986. if($("#supersearchPage #list>.tslist.hidden").length == 0){
  987. SuperSearch.noMoreData();
  988. return;
  989. }
  990. me.resetload();
  991. SuperSearch.reqParam["pageNum"]++;//翻页请求
  992. },
  993. initDropload: function(hasNextPage,pgNum){
  994. $("#supersearchPage .tabs-box").addClass("hidden")
  995. $("#supersearchPage #selLable").removeClass("hidden");
  996. $("#supersearchPage #selLable").show();
  997. $(".loading_").show();
  998. $("#wrapper").css('opacity', '0')
  999. $("#supersearchPage #working").removeClass("hidden");
  1000. if(SuperSearch.limitFlag){
  1001. if($("#supersearchPage #list>.tslist.hidden").length > 0){
  1002. hasNextPage = true;
  1003. }else{
  1004. hasNextPage = false;
  1005. }
  1006. }
  1007. SuperSearch.reqParam["pageNum"] = parseInt(pgNum);
  1008. // 安卓获取高度异常临时处理方式
  1009. setTimeout(function () {
  1010. var isMaxHeight = $(".app-layout-content-b").height() - $(".selected-export-box").height()
  1011. var defaultHeight = nowClientHeight - $(".app-layout-header").height()- $(".selected-export-box").height()
  1012. if (isMaxHeight < defaultHeight) {
  1013. isMaxHeight = defaultHeight
  1014. }
  1015. $("#supersearchPage .app-layout-content-b #wrapper").css({height: isMaxHeight - 44, 'overflow-y': 'auto'})
  1016. $(".loading_").hide();
  1017. $("#supersearchPage #working").addClass("hidden");
  1018. $("#wrapper").css('opacity', 'unset')
  1019. SuperSearch.dropload = $('#supersearchPage #wrapper').dropload({
  1020. scrollArea: $("#supersearchPage .app-layout-content-b #wrapper"),
  1021. loadDownFn: function(me){
  1022. if(SuperSearch.dropload == null){
  1023. SuperSearch.dropload = me;
  1024. }
  1025. if(!hasNextPage){
  1026. SuperSearch.noMoreData();
  1027. return;
  1028. }
  1029. // 免费用户搜索结果查看大于11页时弹窗提示
  1030. // if (!vMainSearchComponent.checkNowPower() && SuperSearch.reqParam["pageNum"] > 10) {
  1031. // vMainSearchComponent.showBuyTip('招标搜索结果', '免费用户最多可查看500条招标搜素结果,可前往购买超级订阅解锁查看更多信息')
  1032. // SuperSearch.noMoreData();
  1033. // return;
  1034. // }
  1035. if(SuperSearch.limitFlag){
  1036. setTimeout(function(){
  1037. SuperSearch.limitPaging(me);
  1038. },500);
  1039. return
  1040. }
  1041. //$(".loading_").show();
  1042. if(SuperSearch.secondFlag=="T"&&SuperSearch.reqParam["pageNum"]==2){
  1043. var html = SuperSearch.getHtml(SuperSearch.secondList,SuperSearch.reqParam["pageNum"]);
  1044. // 每次数据插入,必须重置
  1045. SuperSearch.appendListHtml(html);
  1046. SuperSearch.noMoreData();
  1047. return;
  1048. }
  1049. $.ajax({
  1050. type: 'post',
  1051. url: '/swordfish/searchlist/paging',
  1052. data: SuperSearch.reqParam,
  1053. dataType: 'json',
  1054. success: function(data){
  1055. if (vSwitch === 'f') {
  1056. userReadnum += data.list.length
  1057. if (userReadnum >= 500) {
  1058. // 展示提示窗
  1059. $('#UserTips').show()
  1060. } else {
  1061. $('#UserTips').hide()
  1062. }
  1063. }
  1064. //没有数据
  1065. if(data["list"] == null || data["list"].length == 0){
  1066. SuperSearch.noMoreData();
  1067. $(".loading_").hide();
  1068. return;
  1069. }
  1070. var html = SuperSearch.getHtml(data["list"],SuperSearch.reqParam["pageNum"]);
  1071. // 每次数据插入,必须重置
  1072. SuperSearch.appendListHtml(html);
  1073. //没有下一页了||跟pc端保持一致 最多显示500条
  1074. if(!data.hasNextPage||SuperSearch.reqParam["pageNum"]==10){
  1075. SuperSearch.noMoreData();
  1076. return;
  1077. }
  1078. me.resetload();
  1079. SuperSearch.reqParam["pageNum"]++;//翻页请求
  1080. },
  1081. error: function(xhr, type){
  1082. SuperSearch.noMoreData();
  1083. }
  1084. });
  1085. }
  1086. });
  1087. //判断是否是table (2.7.5table只显示20条数据)
  1088. if(!sessionStorage.superSearch_showType){
  1089. SuperSearch.isTable($(".select-show-type-group").hasClass('is-table'));
  1090. }
  1091. if(!hasNextPage){
  1092. SuperSearch.noMoreData();
  1093. return;
  1094. }
  1095. if ($(".dropload-refresh").length) {
  1096. //SuperSearch.dropload.opts.loadDownFn(SuperSearch.dropload)
  1097. }
  1098. }, 50)
  1099. },
  1100. clearSessionStorage: function(){
  1101. if(!sessionStorage){
  1102. return;
  1103. }
  1104. // @data 2021/6/28 S-新版搜索缓存
  1105. if (vMainSearchComponent && typeof temporaryStorageForPage === 'function') {
  1106. temporaryStorageForPage(vMainSearchComponent, 'superSearch_newQueryParams', 'recover')
  1107. }
  1108. // @data 2021/6/28 E-新版搜索缓存
  1109. sessionStorage.removeItem("superSearch_filterWin");
  1110. sessionStorage.removeItem("superSearch_filterBuy");
  1111. sessionStorage.removeItem("superSearch_noMoreCache");
  1112. sessionStorage.removeItem("superSearch_listContent");
  1113. sessionStorage.removeItem("superSearch_tableContent");
  1114. sessionStorage.removeItem("superSearch_subtype");
  1115. sessionStorage.removeItem("superSearch_scope");
  1116. sessionStorage.removeItem("superSearch_buyerclass");
  1117. sessionStorage.removeItem("superSearch_winner");
  1118. sessionStorage.removeItem("superSearch_publishtime");
  1119. sessionStorage.removeItem("superSearch_pageNum");
  1120. sessionStorage.removeItem("superSearch_xScroll");
  1121. sessionStorage.removeItem("superSearch_yScroll");
  1122. sessionStorage.removeItem("superSearch_industry");
  1123. sessionStorage.removeItem("searchpageName");
  1124. sessionStorage.removeItem("superSearch_dyDiv");
  1125. sessionStorage.removeItem("superSearch_advertIsClose");
  1126. sessionStorage.removeItem("superSearch_shaxuan");
  1127. sessionStorage.removeItem("superSearch_shaxuanFlag");
  1128. sessionStorage.removeItem("superSearch_searchType");
  1129. sessionStorage.removeItem("superSearch_showType");
  1130. sessionStorage.removeItem("superSearch_interceptWord");
  1131. sessionStorage.removeItem("superSearch_hasNoData_tiptext");
  1132. sessionStorage.removeItem("superSearch_allSearchModel_isshow");
  1133. sessionStorage.removeItem("superSearch_limitFlag");
  1134. sessionStorage.removeItem("superSearch_maxprice");
  1135. sessionStorage.removeItem("superSearch_minprice");
  1136. sessionStorage.removeItem("superSearch_showNull");
  1137. sessionStorage.removeItem("superSearch_currentkws");//当前搜索关键词
  1138. },
  1139. //js 方法
  1140. resetSx: function(){ //清除筛选
  1141. $("#supersearchPage .dialog-content.contentthree ul li:eq(0) button").trigger("tap");//清除行业
  1142. $("#supersearchPage .money-dialog ul li:eq(0) .btn").trigger("tap");//清除金额
  1143. $("#supersearchPage .jypt-dialog .jypt-pt .btn:eq(0)").trigger("tap");//清除时间
  1144. $("#supersearchPage .jydq-dialog .btn:eq(0)").trigger("tap"); //清除地区
  1145. $("#supersearchPage .jytype-dialog .btn:eq(0)").trigger("tap"); //清除类别
  1146. // 清除中标企业
  1147. $("#supersearchPage #select-win-list").html('')
  1148. $("#supersearchPage #search-win-list").html('')
  1149. $("#supersearchPage #search-win-input").val('')
  1150. //console.log('没有筛选tab 01')
  1151. $("#supersearchPage div[data-open='industry']").trigger('click')
  1152. //console.log('清空 01', sessionStorage.superSearch_shaxuan)
  1153. // 隐藏企业搜索
  1154. if (vEntSearchComponent) {
  1155. vEntSearchComponent.toggleEntShow(false)
  1156. }
  1157. if (vMainSearchComponent) {
  1158. vMainSearchComponent.toggleEntShow(false)
  1159. }
  1160. SuperSearch.filterWin = {}
  1161. SuperSearch.filterBuy = {}
  1162. $('#supersearchPage .list').find('.industry_item').removeClass('active');
  1163. $('#supersearchPage .update_tips').hide();
  1164. $("#supersearchPage .industry_item.whole:not(.active)").trigger("click")
  1165. },
  1166. canSearch: function(){ //判断是否显示搜索按钮
  1167. var len=$.trim($("#supersearchPage input[name=super_searchinput]").val()).length;
  1168. if(len>0){
  1169. $("#supersearchPage .clearInpt").removeClass("hidden");
  1170. $("#supersearchPage .query").removeClass("hidden");
  1171. $("#supersearchPage .jydqsure").addClass("on");
  1172. }else{
  1173. $("#supersearchPage .clearInpt").addClass("hidden");
  1174. $("#supersearchPage .query").addClass("hidden");
  1175. $("#supersearchPage .jydqsure").removeClass("on");
  1176. }
  1177. },
  1178. beforeSubmit: function(){ //提交前,更新筛选内容至提交对象
  1179. SuperSearch.s_words=$.trim($("#supersearchPage [name='super_searchinput']").val());
  1180. SuperSearch.s_words=SuperSearch.s_words.replace(/\s+/g," ");
  1181. if(SuperSearch.s_words == ""){
  1182. return false;
  1183. }
  1184. SuperSearch.reqParam.searchvalue=SuperSearch.s_words;
  1185. //信息范围
  1186. var scope = [];
  1187. $("#supersearchPage .contentone .btn.active").each(function(){
  1188. var thisText = $(this).text();
  1189. if(thisText == "全国"){
  1190. scope.push("");
  1191. return false;
  1192. }else{
  1193. scope.push(thisText);
  1194. }
  1195. });
  1196. // SuperSearch.reqParam.scope=scope.join(",");
  1197. //行业类型
  1198. var industrySelect="";
  1199. if($("#supersearchPage .contentthree .active").hasClass("btn")){
  1200. if($("#supersearchPage .contentthree .active").text()=="全部"){
  1201. industrySelect="";
  1202. }else{
  1203. industrySelect= $("#supersearchPage .contentthree .active").attr("data-value");
  1204. }
  1205. }else{
  1206. $("#supersearchPage .contentthree .active").parent("li").find(".btn").each(function(){
  1207. industrySelect+= $(this).attr("data-value")+",";
  1208. });
  1209. industrySelect=industrySelect.substring(0,industrySelect.length-1);
  1210. }
  1211. // SuperSearch.reqParam.industry=industrySelect;
  1212. //信息类型
  1213. var selectToptypes = "";
  1214. $("#supersearchPage .contenttwo #dqbtn.active").each(function(){
  1215. var thisText = $(this).attr("data-value");
  1216. if(selectToptypes != ""){
  1217. selectToptypes += ",";
  1218. }
  1219. selectToptypes += thisText;
  1220. });
  1221. var selectSubTypes = "";
  1222. $("#supersearchPage .contenttwo .btn.active").each(function(){
  1223. if($(this).parent().index() == 0){
  1224. return true;
  1225. }
  1226. var thisText = $(this).text();
  1227. if(selectSubTypes != ""){
  1228. selectSubTypes += ",";
  1229. }
  1230. selectSubTypes += thisText;
  1231. });
  1232. // SuperSearch.reqParam.subtype=selectSubTypes;
  1233. //金额
  1234. var moneyRange=$("#supersearchPage .money-dialog .active").attr("data-value");
  1235. // if(moneyRange!="all"){
  1236. // //moneyRange=$("#supersearchPage .money-dialog .money-inp .minMrice").val()+"-"+$("#supersearchPage .money-dialog .money-inp .maxMrice").val()
  1237. // SuperSearch.reqParam.minprice=$("#supersearchPage .money-dialog .money-inp .minMrice").val();
  1238. // SuperSearch.reqParam.maxprice=$("#supersearchPage .money-dialog .money-inp .maxMrice").val()
  1239. // }else{
  1240. // SuperSearch.reqParam.minprice="";
  1241. // SuperSearch.reqParam.maxprice="";
  1242. // }
  1243. //SuperSearch.reqParam.money=moneyRange;
  1244. //日期
  1245. // SuperSearch.reqParam.publishtime=SuperSearch.setPublishtime();
  1246. //全文or标题
  1247. // if($(".newdialog .tab-box .sub-search-title").find("li.active").attr('dataVal')=="searchtitle"){
  1248. // SuperSearch.reqParam.selectType="title";
  1249. // }else{
  1250. // SuperSearch.reqParam.selectType="all";
  1251. // }
  1252. //采购单位行业
  1253. var buyerclasstypes = "";
  1254. $("#supersearchPage .choose_industry .industry_item.active").each(function(){
  1255. if($(this).parent().index() == 0){
  1256. return true;
  1257. }
  1258. var thisText = $(this).text();
  1259. if(buyerclasstypes != ""){
  1260. buyerclasstypes += ",";
  1261. }
  1262. buyerclasstypes += thisText;
  1263. });
  1264. // SuperSearch.reqParam.buyerclass=buyerclasstypes;
  1265. //中标企业
  1266. var winnertypes = "";
  1267. $("#supersearchPage #select-win-list .select").each(function(){
  1268. var thisText = $(this).text();
  1269. if(winnertypes != ""){
  1270. winnertypes += ",";
  1271. }
  1272. winnertypes += thisText;
  1273. });
  1274. SuperSearch.reqParam.winner=winnertypes;
  1275. return true;
  1276. },
  1277. //行为采集 type=1 搜索、type=2 显示列表次数统计
  1278. behaviorCollect: function (type) {
  1279. if (s_openid && SuperSearch.reqParam.searchvalue) {
  1280. var model = "lab_search";
  1281. var s_url = "/jylab/mainSearch/";
  1282. var s_model = "搜索";
  1283. var s_industry = "";//行业-单选
  1284. var s_key = "";//关键词
  1285. var i_amount = 0;//中标金额 1-含 0-不含
  1286. var i_area = 0;//地区
  1287. var i_industry = 0;//行业
  1288. var i_infotable = 0;//显示列表
  1289. var i_infotype = 0;//信息类型
  1290. var i_time = 0;//发布时间
  1291. if(type==1){
  1292. $("#supersearchPage .contentthree .btn.active").each(function(){
  1293. var thisText = $(this).text();
  1294. if(thisText != "全部"){
  1295. if($(this).attr("data-value")){
  1296. s_industry = $(this).attr("data-value").split("_")[0];
  1297. }else{
  1298. s_industry = thisText;
  1299. }
  1300. }
  1301. });
  1302. s_key = SuperSearch.reqParam.searchvalue;
  1303. if(SuperSearch.reqParam.minprice || SuperSearch.reqParam.maxprice){
  1304. i_amount = 1;
  1305. }
  1306. if(SuperSearch.reqParam.scope!=[]){
  1307. i_area = 1;
  1308. }
  1309. if(s_industry){
  1310. i_industry = 1;
  1311. }
  1312. if(SuperSearch.reqParam.subtype){
  1313. i_infotype = 1;
  1314. }
  1315. if(SuperSearch.reqParam.publishtime){
  1316. i_time = 1;
  1317. }
  1318. }else{
  1319. i_infotable = 1;
  1320. }
  1321. var content = '{"encode":"' + encode + '","model":"' + model + '","s_url":"' + s_url + '","s_model":"' + s_model + '","s_openid":"' + s_openid + '","s_industry":"' + s_industry + '","s_key":"'+s_key+'","i_amount":'+i_amount+',"i_area":'+i_area+',"i_industry":'+i_industry+',"i_infotable":'+i_infotable+',"i_infotype":'+i_infotype+',"i_time":'+i_time+'}';
  1322. $.post('/accesslog/byajax',{json:content},function(r){});
  1323. }
  1324. },
  1325. show: function() { //筛选页面和内容展示替换显示
  1326. if (SuperSearch.showNull) {
  1327. $("#supersearchPage #wrapper").addClass("hidden");
  1328. $("#supersearchPage .nullcontent").removeClass("hidden");
  1329. } else {
  1330. //判断显示信息方式 列表or表格 查询后都显示列表
  1331. $("#supersearchPage #wrapper").removeClass("hidden");
  1332. SuperSearch.showType();
  1333. }
  1334. },
  1335. formSubmit: function (nw){ //提交表单,获取数据
  1336. $(".loading_").show();
  1337. if(!SuperSearch.beforeSubmit()){
  1338. $(".loading_").hide();
  1339. return;
  1340. }
  1341. $("#supersearchPage .app-layout-content-b #wrapper").css({height: nowClientHeight, 'overflow-y': 'auto'})
  1342. // 切换显示
  1343. $("#supersearchPage .tabs-box").addClass("hidden")
  1344. $("#supersearchPage #clickFilter").text('搜索')
  1345. // 隐藏table 查看更多
  1346. $("#wrapper .shade_table").css("display","none");
  1347. $("#supersearchPage #working").removeClass("hidden");
  1348. $("#supersearchPage #intercept").addClass("hidden");
  1349. $("#supersearchPage #table").addClass("hidden");
  1350. $("#supersearchPage #list").addClass("hidden");
  1351. // if(SuperSearch.showNull){
  1352. // SuperSearch.showToOrder(false);
  1353. // }
  1354. $("#supersearchPage .nullcontent").addClass("hidden");
  1355. $("#supersearchPage .selLable").removeClass("hidden");
  1356. $("#supersearchPage #super_search").addClass("hidden");
  1357. $("#supersearchPage #wrapper .dropload-down").remove();
  1358. SuperSearch.behaviorCollect(1);
  1359. $("#supersearchPage input[name=super_searchinput]").blur();
  1360. $("#supersearchPage .clearInpt").addClass("hidden");
  1361. $("#supersearchPage .query").addClass("hidden");
  1362. var filter_winner = []
  1363. var filter_buyerclass = []
  1364. $("#select-win-list li.select").each(function(){
  1365. filter_winner.push($(this).text())
  1366. })
  1367. var buttons = $('.select-area-box .list button.active:not(.whole)');
  1368. buttons.each(function () {
  1369. filter_buyerclass.push($(this).text())
  1370. })
  1371. SuperSearch.reqParam.pageNum=1;
  1372. SuperSearch.reqParam.winner = filter_winner.join(',')
  1373. // SuperSearch.reqParam.buyerclass = filter_buyerclass.join(',')
  1374. SuperSearch.noMoreCache = false;
  1375. SuperSearch.requesting = true;
  1376. if(nw=="N"){
  1377. // SuperSearch.reqParam.selectType ="title";
  1378. $(".newdialog .sub-search-title").find("li").removeClass("active");
  1379. $(".selected-export .options .search-title").find("em").text("标题搜索");
  1380. $(".newdialog .sub-search-title").find("li[dataval='searchtitle']").addClass("active");
  1381. $(".newdialog .sub-show-list").find("li").removeClass("active");
  1382. $(".selected-export .show-list").find("em").text("列表显示");
  1383. $(".newdialog .sub-show-list").find("li[dataval='showlist']").addClass("active");
  1384. }
  1385. var IframeOnClick = {
  1386. resolution: 200,
  1387. iframes: [],
  1388. interval: null,
  1389. Iframe: function() {
  1390. this.element = arguments[0];
  1391. this.cb = arguments[1];
  1392. this.hasTracked = false;
  1393. },
  1394. track: function(element, cb) {
  1395. this.iframes.push(new this.Iframe(element, cb));
  1396. var _this = this;
  1397. this.interval = setInterval(function() { _this.checkClick(); }, this.resolution);
  1398. },
  1399. checkClick: function() {
  1400. if (document.activeElement) {
  1401. var activeElement = document.activeElement;
  1402. for (var i in this.iframes) {
  1403. if (activeElement === this.iframes[i].element) { // user is in this Iframe
  1404. if (this.iframes[i].hasTracked == false) {
  1405. this.iframes[i].cb.apply(window, []);
  1406. this.iframes[i].hasTracked = true;
  1407. $.ajax({
  1408. type: 'POST',
  1409. url: '/publicapply/adLeague/click',
  1410. data: {
  1411. client: 'WX',
  1412. id: 'ad5',
  1413. position: '搜索列表页'
  1414. },
  1415. success: function(res) {
  1416. console.log(res)
  1417. }
  1418. })
  1419. }
  1420. } else {
  1421. this.iframes[i].hasTracked = false;
  1422. }
  1423. }
  1424. }
  1425. }
  1426. };
  1427. $.ajax({
  1428. type: "post",
  1429. url: "/swordfish/searchlist/paging",
  1430. data: SuperSearch.reqParam,
  1431. dataType: "json",
  1432. success: function(data){
  1433. if (vSwitch === 'f') {
  1434. userReadnum += data.list.length
  1435. if (userReadnum >= 500) {
  1436. // 展示提示窗
  1437. $('#UserTips').show()
  1438. } else {
  1439. $('#UserTips').hide()
  1440. }
  1441. }
  1442. SuperSearch.secondList=data.secondList;
  1443. SuperSearch.secondFlag=data.secondFlag;
  1444. SuperSearch.secondKWS=data.secondKWS;
  1445. $("#supersearchPage #working").addClass("hidden");
  1446. SuperSearch.appendInterceptWord(data.interceptWord);
  1447. if(data.keyWord!=""){
  1448. SuperSearch.s_words = data.keyWord;
  1449. }
  1450. $("#supersearchPage input[name=super_searchinput]").val(SuperSearch.s_words);
  1451. SuperSearch.requesting = false;
  1452. //历史记录和我的订阅
  1453. if(data.isLogin){
  1454. if(localStorage && data["history"] != null && typeof(data["history"]) != "undefined"){
  1455. localStorage.superSearch_history = data["history"].join(",");
  1456. }
  1457. SuperSearch.htmlTipMsg(data["history"]);
  1458. }else{
  1459. //搜索历史记录保存到本地
  1460. if(localStorage){
  1461. var l_history = localStorage.superSearch_history;
  1462. var l_historys = [];
  1463. if(typeof(l_history) != "undefined"){
  1464. l_historys = l_history.split(",");
  1465. //去重
  1466. for(var i=0;i<l_historys.length;i++){
  1467. if(l_historys[i] == $.trim(SuperSearch.s_words)){
  1468. l_historys.splice(i,1);
  1469. break;
  1470. }
  1471. }
  1472. }
  1473. l_historys.push(SuperSearch.s_words);
  1474. if(l_historys.length > 5){
  1475. l_historys.shift();
  1476. }
  1477. localStorage.superSearch_history = l_historys.join(",");
  1478. SuperSearch.htmlTipMsg(l_historys,null);
  1479. }
  1480. }
  1481. //查询后显示 展示方式
  1482. $("#supersearchPage .selLable").removeClass("hidden");
  1483. //铺查询信息
  1484. $("#supersearchPage #wrapper .dropload-down").remove();
  1485. if(data["list"] == null || data["list"].length == 0){
  1486. $("#supersearchPage #hasNoData_tiptext>font").hide();
  1487. if(data.status==-1){
  1488. $("#supersearchPage #hasNoData_tiptext>font:eq(1)").show();
  1489. }else if (data.status==-2){
  1490. $("#supersearchPage #hasNoData_tiptext>font:eq(2)").show();
  1491. }else{
  1492. showSearchTipForTimeRange()
  1493. }
  1494. if($(".newdialog .tab-box .sub-search-title").find("li.active").attr('dataVal')=="searchtitle"){
  1495. $("#supersearchPage #allSearchModel").show();
  1496. }else{
  1497. $("#supersearchPage #allSearchModel").hide();
  1498. }
  1499. $("#supersearchPage #list").text("");
  1500. SuperSearch.hasNoData();
  1501. SuperSearch.show();
  1502. $(window).scrollTop(0);
  1503. if (SuperSearch.reqParam.pageNum == '1') {
  1504. $("#supersearchPage .app-layout-content-b #wrapper").scrollTop(0)
  1505. }
  1506. $(".loading_").hide();
  1507. return
  1508. }else{
  1509. SuperSearch.showNull = false;
  1510. SuperSearch.hasData();
  1511. SuperSearch.limitFlag = data["limitFlag"]
  1512. SuperSearch.replayListHtml(SuperSearch.getHtml(data["list"],1));
  1513. SuperSearch.show();
  1514. if (SuperSearch.reqParam.pageNum == '1') {
  1515. $("#supersearchPage .app-layout-content-b #wrapper").scrollTop(0)
  1516. }
  1517. $(window).scrollTop(0);
  1518. SuperSearch.initDropload(data.hasNextPage,2);
  1519. }
  1520. console.log(sessionStorage.getItem('powerStatus'), '1')
  1521. var powerStatus = sessionStorage.getItem('powerStatus')
  1522. if(powerStatus) {
  1523. powerStatus = JSON.parse(powerStatus)
  1524. if(!powerStatus.entniche && !powerStatus.member && powerStatus.vip <= 0) {
  1525. (window.slotbydup = window.slotbydup || []).push({
  1526. id: "u6603898",
  1527. container: "_07p1kp030cz7",
  1528. async: true
  1529. });
  1530. (window.slotbydup = window.slotbydup || []).push({
  1531. id: "u6603898",
  1532. container: "_fdvjfgztbn",
  1533. async: true
  1534. });
  1535. setTimeout(() => {
  1536. var frames = document.getElementById("iframeu6603898_0");
  1537. console.log(frames, 'frames')
  1538. IframeOnClick.track(frames, function() {
  1539. jQuery(document).click();
  1540. });
  1541. },1000)
  1542. $.ajax({
  1543. type: 'POST',
  1544. url: '/publicapply/adLeague/exposure',
  1545. data: {
  1546. client: 'WX',
  1547. id: 'ad5',
  1548. position: '搜索列表页'
  1549. },
  1550. success: function(res) {
  1551. console.log(res)
  1552. }
  1553. })
  1554. }
  1555. }
  1556. },
  1557. error: function(xhr,type){
  1558. $("#supersearchPage #wrapper .dropload-down").remove();
  1559. SuperSearch.requesting = false;
  1560. }
  1561. });
  1562. },
  1563. getHtml: function (list,pageNum){//生成list表单 或 table表单
  1564. // 获取收藏状态
  1565. SuperSearch.checkStartKeepStatus(list.map(function(v) {
  1566. return v._id
  1567. }))
  1568. var html ={};
  1569. var ListHtml='';
  1570. var TableHtml='';
  1571. for(var i=0;i<list.length;i++){
  1572. if(pageNum == 1 && i == 9) {
  1573. // 百青藤广告插入
  1574. ListHtml += '<div class="_07p1kp030cz7">'+'</div>'
  1575. }
  1576. if(pageNum == 1 && i == 24) {
  1577. // 百青藤广告插入
  1578. ListHtml += '<div class="_fdvjfgztbn">'+'</div>'
  1579. }
  1580. if(pageNum==1&&i==4&&!SuperSearch.advertIsClose){
  1581. ListHtml+='<div class="adv-wxsearch-center" id="E1"></div>'
  1582. }
  1583. var index = (pageNum-1)*pageSize+i+1;
  1584. var thisStyle = " style='padding-left: 15px;'";
  1585. if(index >= 10 && index < 100){
  1586. thisStyle = " style='padding-left: 26px;'";
  1587. }else if(index >= 100 && index < 1000){
  1588. thisStyle = " style='padding-left: 35px;'";
  1589. }else if(index >= 1000){
  1590. thisStyle = " style='padding-left: 45px;'";
  1591. }
  1592. var href = list[i].href;
  1593. if(!href || href.indexOf("java") > -1){
  1594. href = "";
  1595. }
  1596. var title = list[i].title;
  1597. //项目名称
  1598. var projectname=list[i].projectname==null?list[i].title:list[i].projectname;
  1599. //关键词高亮
  1600. var detail = "";
  1601. var highlight = list[i].highlight;
  1602. if(highlight){
  1603. var details = highlight.detail;
  1604. if(details && details.length > 0){
  1605. detail = details[0];
  1606. if(detail.length>100){
  1607. detail = detail.substring(0,100)//.replace(/[^\{\u4e00-\u9fa5]{1,90}{[^\}\u4e00-\u9fa5]+?}/g,"");
  1608. if (detail.indexOf("}")!=-1){
  1609. detail = detail.substring(detail.indexOf("}")+1)
  1610. }
  1611. }
  1612. }
  1613. }
  1614. if(SuperSearch.s_words != ""){
  1615. if(SuperSearch.s_words.indexOf("+")>0){
  1616. SuperSearch.s_words=SuperSearch.s_words.replace(/\+/g," ")
  1617. }
  1618. var wordsArray = SuperSearch.s_words.split(" ");
  1619. if(SuperSearch.secondFlag=="T"&&SuperSearch.secondKWS!=""){
  1620. wordsArray=wordsArray.concat(SuperSearch.secondKWS.split("+"))
  1621. }
  1622. title = keyWordHighlight(title,wordsArray,'<font class="keyword">$1</font>');
  1623. projectname = keyWordHighlight(projectname,wordsArray,'<font class="keyword">$1</font>');
  1624. if(detail != ""){
  1625. try{
  1626. $("#supersearchPage #tempDiv").html(detail);
  1627. detail = $("#supersearchPage #tempDiv").text().replace(/[^\{\u4e00-\u9fa5]{1,90}{[^\}\u4e00-\u9fa5]+?}/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;");
  1628. }catch(e){
  1629. detail = detail.replace(/[^\{\u4e00-\u9fa5]{1,90}{[^\}\u4e00-\u9fa5]+?}/g,"").replace(/</g,"&lt;").replace(/>/g,"&gt;");
  1630. }
  1631. detail = keyWordHighlight(detail,wordsArray,'<font class="keyword">$1</font>');
  1632. }
  1633. }
  1634. if(detail != ""){
  1635. // detail = "<div class='detail'"+thisStyle+">"+detail+"...</div>";
  1636. detail = "<div class='detail'>"+detail+"...</div>";
  1637. }
  1638. //
  1639. var area = list[i].area;
  1640. if(!area){
  1641. area = "";
  1642. }else{
  1643. area = $.trim(area);
  1644. area = area=="A"?"全国":area;
  1645. }
  1646. if(area != ""){
  1647. area = '<span class="location">'+area+'</span>';
  1648. }
  1649. //行业
  1650. var industry=list[i].industry;
  1651. var buyerclass = list[i].buyerclass;
  1652. if(!industry){
  1653. industry="";
  1654. }else{
  1655. industry=$.trim(industry);
  1656. }
  1657. if (SuperSearch.isVip || jyUserPower.vip > 0 || jyUserPower.member || jyUserPower.entniche) {
  1658. if (industry!=""){
  1659. industry ='<span class="industry" style="display:none;">'+industry+'</span>'
  1660. }
  1661. if (buyerclass && buyerclass!="") {
  1662. industry += '<span class="buyerclass">' + buyerclass + '</span>'
  1663. }
  1664. } else {
  1665. if (industry!=""){
  1666. industry ='<span class="industry">'+industry+'</span>'
  1667. }
  1668. }
  1669. //时间
  1670. var tdf = list[i].publishtime;
  1671. var fullTime="";
  1672. if(tdf){
  1673. tdf = utils.dateFromNow(tdf * 1000)
  1674. if(tdf != null){
  1675. tdf='<span><i class="jyapp-icon jyapp-icon-bofangjilu" style="color:#7a7a7a;margin-right:2px;"></i>'+tdf+'</span>'
  1676. }
  1677. }else{
  1678. tdf = '';
  1679. }
  1680. var datatype = "";
  1681. if(list[i].subtype){
  1682. datatype='<span class="type">'+list[i].subtype+'</span>'
  1683. }else if(list[i].toptype){
  1684. datatype='<span class="type">'+list[i].toptype+'</span>'
  1685. }else if(list[i].type){
  1686. if(list[i].type == "tender"){
  1687. datatype='<span class="type">招标</span>'
  1688. }else if(list[i].type == "bid"){
  1689. datatype='<span class="type">中标</span>'
  1690. }
  1691. }
  1692. //招标单位
  1693. var buyer=list[i].buyer==null?"":list[i].buyer;
  1694. //预算
  1695. var budget=list[i].budget==null?"":((list[i].budget)/10000+"").substring(0,5);
  1696. //开标时间
  1697. var bidopentime=""
  1698. var optim=list[i].bidopentime;
  1699. if(optim){
  1700. var openTime=new Date(Number(optim+"000"));
  1701. bidopentime=openTime.getFullYear()+"-"+((openTime.getMonth()+1)>=10?(openTime.getMonth()+1):"0"+(openTime.getMonth()+1))+"-"
  1702. +((openTime.getDate())>=10?(openTime.getDate()):"0"+(openTime.getDate()))+"<br>"+(openTime.getHours()>=10?openTime.getHours():"0"+openTime.getHours())+":"
  1703. +(openTime.getMinutes()>=10?openTime.getMinutes():"0"+openTime.getMinutes());
  1704. }
  1705. //中标单位
  1706. var winner=list[i].winner==null?"":list[i].winner;
  1707. //中标金额
  1708. var bidamount="";
  1709. if(typeof(list[i].bidamount) != "undefined" && list[i].bidamount != null && list[i].bidamount != ""){
  1710. bidamount = parseInt(list[i].bidamount)/10000;
  1711. if(bidamount.toString().length>6){
  1712. if(bidamount.toString().indexOf(".")==5){
  1713. bidamount=bidamount.toString().substr(0,7);
  1714. }else{
  1715. bidamount=bidamount.toString().substr(0,6);
  1716. }
  1717. }
  1718. }
  1719. // 金额标签
  1720. var moneyTag = '';
  1721. if(typeof(list[i].budget) != "undefined" && list[i].budget != null && list[i].budget != ""){
  1722. moneyTag = '<span class="bidamount">'+MoneyUnit.test(list[i].budget)+'</span>';
  1723. }
  1724. if(typeof(list[i].bidamount) != "undefined" && list[i].bidamount != null && list[i].bidamount != ""){
  1725. moneyTag = '<span class="bidamount">'+MoneyUnit.test(list[i].bidamount)+'</span>';
  1726. }
  1727. if(i==3&&pageNum==1){
  1728. ListHtml += '<div class="tslist" data-cl-event="c_wx_supsearch_linkclick" style="border-bottom-width:0px;">'
  1729. }else{
  1730. ListHtml += '<div class="tslist" data-cl-event="c_wx_supsearch_linkclick">'
  1731. }
  1732. ListHtml += '<div class="resnumb">'
  1733. +'<div class="one">'
  1734. +'<span class="xh">'+index+'.</span>'
  1735. +'</div>'
  1736. + '<div class="two-group">'
  1737. +'<div class="two bt-parent"'+thisStyle+'>'
  1738. +'<a class="bt" sid="'+list[i]._id+'" s="'+href+'" href="javascript:void(0);">'+title+'</a>'
  1739. +'</div>'
  1740. + '<div class="flow-start-box"><i class="icon-flow-start"></i></div>'
  1741. +'</div>'
  1742. +'</div>'
  1743. +'<div style="clear:both;"></div>'
  1744. +'<div class="restime time-diff">'
  1745. +area+industry+datatype+moneyTag+tdf
  1746. +'</div>'
  1747. +'<div style="clear:both;"></div>'
  1748. +detail
  1749. +'</div>';
  1750. if(i>=20||pageNum!=1){
  1751. continue
  1752. }
  1753. var getDefaultLine = function (key) {
  1754. if (key || key.length) {
  1755. return key
  1756. } else {
  1757. return '<span class="one-line">-</span>'
  1758. }
  1759. }
  1760. //拟建项目
  1761. if(SuperSearch.subtype_proposed==SuperSearch.reqParam.subtype){
  1762. var projectinfo = list[i].projectinfo;
  1763. //if(projectinfo){
  1764. var approvecode = "";
  1765. if(projectinfo&&projectinfo.approvecode){
  1766. approvecode = projectinfo.approvecode;
  1767. }
  1768. var approvecontent = "";
  1769. if(projectinfo&&projectinfo.approvecontent){
  1770. approvecontent = projectinfo.approvecontent;
  1771. }
  1772. var approvestatus = "";
  1773. if(projectinfo&&projectinfo.approvestatus){
  1774. approvestatus = projectinfo.approvestatus;
  1775. }
  1776. var approvetime = "";
  1777. var diff = "";
  1778. if(projectinfo&&projectinfo.approvetime){
  1779. approvetime = projectinfo.approvetime.replace(/-/g,"/");
  1780. diff = utils.dateFromNow(approvetime);
  1781. }
  1782. var industry = "";
  1783. if(projectinfo&&projectinfo.industry){
  1784. industry = projectinfo.industry;
  1785. }
  1786. TableHtml +='<tr s="'+href+'" sid="'+list[i]._id+'" i="'+industry+'">'+
  1787. '<td><div>'+index+'</div></td>'+
  1788. '<td><div style="width: 100px;text-align: center;">'+getDefaultLine(approvecode)+'</div></td>'+
  1789. '<td><div style="width: 207px;text-align: left;">'+getDefaultLine(projectname)+'</div></td>'+
  1790. '<td><div style="width: 200px;text-align: left;">'+getDefaultLine(approvecontent)+'</div></td>'+
  1791. '<td><div style="width: 75px;text-align: left;">'+getDefaultLine(approvestatus)+'</div></td>'+
  1792. '<td><div style="width: 75px;text-align: center;">'+getDefaultLine(approvetime)+'</div></td>'+
  1793. '<td><div style="width: 75px;text-align: center;">'+getDefaultLine(diff)+'</div></td>'+
  1794. '</tr>';
  1795. //}
  1796. }else{
  1797. TableHtml +='<tr s="'+href+'" sid="'+list[i]._id+'" i="'+(list[i].industry?list[i].industry:"")+'">'+
  1798. '<td><div>'+index+'</div></td>'+
  1799. '<td><div>'+getDefaultLine(projectname)+'</div></td>'+
  1800. '<td><div>'+getDefaultLine(datatype==""?"":datatype+"公告")+'</div></td>'+
  1801. '<td><div>'+getDefaultLine(budget)+'</div></td>'+
  1802. '<td><div>'+getDefaultLine(buyer)+'</div></td>'+
  1803. '<td><div>'+getDefaultLine(bidopentime)+'</div></td>'+
  1804. '<td><div>'+getDefaultLine(winner)+'</div></td>'+
  1805. '<td><div>'+getDefaultLine(bidamount)+'</div></td>'+
  1806. '<td><div>'+getDefaultLine(fullTime)+'</div></td>'+
  1807. '</tr>';
  1808. }
  1809. }
  1810. if(pageNum==1&&list.length<5&&!SuperSearch.advertIsClose){
  1811. ListHtml+='<div onclick="adv_statistics(this)" class="adv-wxsearch-center" adv_name="微信搜索列表页-中部" id="E1">E1</div>'
  1812. }
  1813. html["ListHtml"]=ListHtml;
  1814. html["TableHtml"]=TableHtml;
  1815. return html;
  1816. },
  1817. hasNoData: function(){ //搜索信息为空
  1818. SuperSearch.showNull = true;
  1819. $("#supersearchPage .nullcontent").removeClass("hidden");
  1820. $("#supersearchPage #wrapper").addClass("hidden");
  1821. },
  1822. hasData: function(){ //搜索信息不为空
  1823. $("#supersearchPage .nullcontent").addClass("hidden");
  1824. $("#supersearchPage #wrapper").removeClass("hidden");
  1825. if(SuperSearch.dyDiv){
  1826. SuperSearch.showToOrder(false)
  1827. }else{
  1828. SuperSearch.showToOrder(true);
  1829. }
  1830. },
  1831. changeKeepStatus (id, type) {
  1832. var aDom = $("p[sid='"+id+"'], a[sid='"+id+"']")
  1833. if (aDom.length) {
  1834. aDom.each(function () {
  1835. var gDom = $(this).parents('.two-group').find('.flow-start-box')
  1836. if (type) {
  1837. gDom.addClass('fill')
  1838. } else {
  1839. gDom.removeClass('fill')
  1840. }
  1841. })
  1842. }
  1843. },
  1844. checkStartKeepStatus: function (list) {
  1845. $.ajax({
  1846. url: '/publicapply/bidcoll/isColl',
  1847. type: 'POST',
  1848. data: {
  1849. bids: list.join(',')
  1850. }
  1851. }).done(function (r) {
  1852. if (r && r.error_msg == '' && r.data) {
  1853. //console.log('start', r.data)
  1854. r.data.forEach(function(v) {
  1855. SuperSearch.changeKeepStatus(v, true)
  1856. })
  1857. }
  1858. })
  1859. },
  1860. checkIsStartFn: function (event, attrData) {
  1861. var isStart = $(event.target).hasClass('.flow-start-box') || $(event.target).parents('.flow-start-box').length
  1862. //console.log(isStart, 'isStart')
  1863. if (isStart) {
  1864. event.preventDefault();
  1865. event.stopPropagation();
  1866. //console.log('收藏')
  1867. var isStartStatus = $(event.target).hasClass('.flow-start-box.fill') || $(event.target).parents('.flow-start-box.fill').length
  1868. if (vKeepComponent) {
  1869. vKeepComponent.changeBid(attrData.sid, !isStartStatus)
  1870. }
  1871. return false
  1872. }
  1873. return true
  1874. },
  1875. appendListHtml: function (html){ //下拉时展示信息
  1876. // 插入数据到页面,放到最后面
  1877. var ListHtmlObj = $(html.ListHtml);
  1878. ListHtmlObj.on("tap", function(event){
  1879. var h = $(this).find("a.bt").attr("s");
  1880. var sid = $(this).find("a.bt").attr("sid");
  1881. var industry = $(this).find(".industry").text();
  1882. if (SuperSearch.checkIsStartFn(event, { sid: sid })) {
  1883. SuperSearch.myredirect(h,sid,industry);
  1884. }
  1885. });
  1886. $('#supersearchPage #list').append(ListHtmlObj);
  1887. $(".loading_").hide();
  1888. // var TableHtmlobj=$(html.TableHtml);
  1889. // TableHtmlobj.on("tap",function(event){
  1890. // var h = $(this).attr("s");
  1891. // var sid = $(this).attr("sid");
  1892. // var industry = $(this).attr("i");
  1893. // SuperSearch.myredirect(h,sid,industry);
  1894. // });
  1895. // $("#supersearchPage #table .content").append(TableHtmlobj);
  1896. },
  1897. replayListHtml: function(html){ //搜索时替换信息
  1898. // 替换
  1899. var ListHtmlObj = $(html.ListHtml);
  1900. var TableHtmlobj=$(html.TableHtml);
  1901. var showCount = 0;
  1902. ListHtmlObj.each(function(i){
  1903. if(this.id == "E1"){
  1904. if(SuperSearch.advert == null){
  1905. SuperSearch.advert = $("#advertscript").html();
  1906. $("#advertscript").remove();
  1907. }
  1908. //$(this).html(SuperSearch.advert);
  1909. if(SuperSearch.advert!=""){
  1910. $(this).html(SuperSearch.advert);
  1911. }else{
  1912. $(this).hide();
  1913. }
  1914. }
  1915. if(SuperSearch.limitFlag&&$(this).hasClass("tslist")){
  1916. if(showCount >= 50){
  1917. $(this).addClass("hidden");
  1918. }else{
  1919. showCount++;
  1920. }
  1921. }
  1922. });
  1923. showCount = 0;
  1924. TableHtmlobj.each(function(i){
  1925. if(SuperSearch.limitFlag){
  1926. if(showCount >= 50){
  1927. $(this).addClass("hidden");
  1928. }else{
  1929. showCount++;
  1930. }
  1931. }
  1932. });
  1933. ListHtmlObj.on("tap", function(event){
  1934. var h = $(this).find("a.bt").attr("s");
  1935. var sid = $(this).find("a.bt").attr("sid");
  1936. var industry = $(this).find(".industry").text();
  1937. if (SuperSearch.checkIsStartFn(event, { sid: sid })) {
  1938. SuperSearch.myredirect(h,sid,industry);
  1939. }
  1940. });
  1941. $('#supersearchPage #list').html(ListHtmlObj);
  1942. TableHtmlobj.on("tap",function(event){
  1943. var h = $(this).attr("s");
  1944. var sid = $(this).attr("sid");
  1945. var industry = $(this).attr("i");
  1946. SuperSearch.myredirect(h,sid,industry);
  1947. });
  1948. if(SuperSearch.subtype_proposed==SuperSearch.reqParam.subtype){
  1949. $("#supersearchPage #table .content").html("<tr><td><div>序号</div></td><td><div style='width: 100px;'>项目代码</div></td><td><div style='width: 207px;'>项目名称</div></td><td><div style='width: 200px;'>审批事项</div></td><td><div style='width: 75px;'>审批结果</div></td><td><div style='width: 75px;'>审批时间</div></td><td><div style='width: 75px;'>发布时间</div></td></tr>");
  1950. }else{
  1951. $("#supersearchPage #table .content").html("<tr><td><div>序号</div></td><td><div>项目名称</div></td><td><div>公告类型</div></td><td><div>预算(万元)</div></td><td><div>招标单位</div></td><td><div>开标时间</div></td><td><div>中标单位</div></td><td>中标金额<br>(万元)</td><td><div>发布时间</div></td></tr>");
  1952. }
  1953. $("#supersearchPage #table .content").append(TableHtmlobj);
  1954. $(".loading_").hide();
  1955. },
  1956. myredirect_back: function(link, sid, industry) {
  1957. if (typeof $.fn.checkShowPopPage === 'function') {
  1958. $.fn.checkShowPopPage(function (result) {
  1959. if (result.isBindStatus) {
  1960. SuperSearch.myredirect_back(link, sid, industry)
  1961. } else {
  1962. result.showPop()
  1963. }
  1964. })
  1965. }
  1966. },
  1967. myredirect: function (link,sid,industry){ //跳转三级页
  1968. //保存当前页面至sessionStorage
  1969. SuperSearch.setSessionStorage();
  1970. if(sid!=undefined){
  1971. var sds = SuperSearch.s_words;
  1972. if(SuperSearch.secondFlag=="T"&&SuperSearch.secondKWS!=null&&SuperSearch.secondKWS!=""&&SuperSearch.secondKWS!=undefined){
  1973. sds = SuperSearch.secondKWS;
  1974. }
  1975. //跳转
  1976. link = link.replace(/\n/g,"");
  1977. if(link!=""&&!/^http/.test(link)){
  1978. link="http://"+link
  1979. }
  1980. if(sds){
  1981. if(industry!=""){
  1982. window.location.href = "/article/content/"+sid+".html?keywords="+encodeURIComponent(sds)+"&industry="+industry;
  1983. }else{
  1984. window.location.href = "/article/content/"+sid+".html?keywords="+encodeURIComponent(sds);
  1985. }
  1986. }else{
  1987. if(industry!=""){
  1988. window.location.href = "/article/content/"+sid+".html?industry="+industry;
  1989. }else{
  1990. window.location.href = "/article/content/"+sid+".html";
  1991. }
  1992. }
  1993. }
  1994. },
  1995. noMoreData: function(){
  1996. SuperSearch.noMoreCache = true;
  1997. // 锁定
  1998. try {
  1999. SuperSearch.dropload.lock();
  2000. } catch (e) {
  2001. console.warn('获取dropload错误')
  2002. }
  2003. // 无数据
  2004. SuperSearch.dropload.noData();
  2005. SuperSearch.dropload.resetload();
  2006. },
  2007. loadTipMsg: function(){
  2008. //从服务器端取
  2009. var l_superSearch_history = ""
  2010. if(localStorage.superSearch_history==null||localStorage.superSearch_history==undefined){
  2011. $.post("/jylab/mainSearch/getHK?t="+new Date().getTime(),{},function(r){
  2012. if(localStorage && r.history != null && typeof(r.history) != "undefined"){
  2013. localStorage.superSearch_history = r.history.join(",");
  2014. l_superSearch_history = localStorage.superSearch_history || '';
  2015. SuperSearch.htmlTipMsg(l_superSearch_history.split(","),null);
  2016. }
  2017. });
  2018. }
  2019. l_superSearch_history = localStorage.superSearch_history || '';
  2020. SuperSearch.htmlTipMsg(l_superSearch_history.split(","),null);
  2021. },
  2022. htmlTipMsg: function(history,msgset){
  2023. //历史信息
  2024. historyHtml = "";
  2025. if(history != null){
  2026. for(var i=history.length-1;i>=0;i--){
  2027. var hy = $.trim(history[i]).replace(/\s+/," ");
  2028. if(hy == ""){
  2029. continue;
  2030. }
  2031. historyHtml+="<li class='hover-css--slide'>"+hy+"</li>"
  2032. }
  2033. }
  2034. $("#supersearchPage .search-one-box ul.history-list-box").html(historyHtml);
  2035. if(historyHtml == ""){
  2036. $("#supersearchPage .tabs-box .tabs-content-page").eq(0).addClass("hidden");
  2037. }else{
  2038. $("#supersearchPage .tabs-box .tabs-content-page").eq(0).removeClass("hidden");
  2039. }
  2040. // 点击历史记录内容 进行搜索
  2041. $("#supersearchPage .search-one-box .history-list-box").off("click", 'li').on("click", 'li', function () {
  2042. $("#supersearchPage input[name=super_searchinput]").val($(this).text());
  2043. SuperSearch.canSearch();
  2044. SuperSearch.formSubmit("N");
  2045. });
  2046. },
  2047. //全文搜索
  2048. allSearch: function(){
  2049. $(".newdialog .sub-search-title").find("li").removeClass("active");
  2050. $(".selected-export .options .search-title").find("em").text("全文搜索");
  2051. $(".newdialog .sub-search-title").find("li[dataval='searchall']").addClass("active");
  2052. //全文检索 表格展示切换成列表展示
  2053. $(".newdialog .sub-show-list").find("li").removeClass("active");
  2054. $(".selected-export .show-list").find("em").text("列表显示");
  2055. $(".newdialog .sub-show-list").find("li[dataval='showlist']").addClass("active");
  2056. //记录
  2057. if(localStorage){
  2058. localStorage.selectType="all";
  2059. }
  2060. //将所选标签值作为参数传递
  2061. SuperSearch.formSubmit();
  2062. },
  2063. //标题搜索
  2064. titleSearch: function(){
  2065. $(".newdialog .sub-search-title").find("li").removeClass("active");
  2066. $(".selected-export .options .search-title").find("em").text("标题搜索");
  2067. $(".newdialog .sub-search-title").find("li[dataval='searchtitle']").addClass("active");
  2068. //
  2069. $(".newdialog .sub-show-list").find("li").removeClass("active");
  2070. $(".selected-export .show-list").find("em").text("列表显示");
  2071. $(".newdialog .sub-show-list").find("li[dataval='showlist']").addClass("active");
  2072. //记录
  2073. if(localStorage){
  2074. localStorage.selectType="title";
  2075. }
  2076. //将所选标签值作为参数传递
  2077. SuperSearch.formSubmit();
  2078. },
  2079. //展示方式
  2080. //1.列表展示数据
  2081. showlist: function() {
  2082. $("#supersearchPage .showlist").addClass("on").siblings().removeClass("on");
  2083. $("#supersearchPage #wrapper #table").addClass("hidden");
  2084. $("#supersearchPage #wrapper #list").removeClass("hidden");
  2085. if(SuperSearch.dropload != null){
  2086. SuperSearch.dropload.resetload();
  2087. SuperSearch.isTable(false);
  2088. }
  2089. },
  2090. //2.表格展示数据
  2091. showTable: function() {
  2092. if(!onceFlag_tablepro){
  2093. $("#supersearchPage #TableTip").fadeIn();
  2094. setTimeout(function(){
  2095. var target = document.getElementById("TableTip");
  2096. document.onclick = function(){
  2097. onceFlag_tablepro = true;
  2098. $(target).fadeOut("normal",function(){
  2099. $.post('/jylab/changePro',function(r){});
  2100. });
  2101. };
  2102. target.onclick = function(){
  2103. if(document.all){
  2104. window.event.cancelBubble = true;
  2105. }else{
  2106. event.stopPropagation();
  2107. }
  2108. }
  2109. },1000);
  2110. }
  2111. checkIsOpen();
  2112. setTimeout(function(){
  2113. SuperSearch.behaviorCollect(2);
  2114. $("#supersearchPage .showtable").addClass("on").siblings().removeClass("on");
  2115. $("#supersearchPage #wrapper #table").removeClass("hidden");
  2116. $("#supersearchPage #wrapper #list").addClass("hidden");
  2117. SuperSearch.isTable(true);
  2118. },300)
  2119. },
  2120. isTable:function(flag){
  2121. if(flag){ //table
  2122. if(SuperSearch.dropload){//表格只展示20条数据
  2123. SuperSearch.dropload.lock();
  2124. }
  2125. if($("#table .content tr").length>20){
  2126. $(".dropload-down").css("display","none");
  2127. $("#wrapper .shade_table").css("display","");
  2128. }else{
  2129. $(".dropload-down").css("display","");
  2130. $("#wrapper .shade_table").css("display","none");
  2131. }
  2132. }else{ //list
  2133. if(SuperSearch.dropload){
  2134. SuperSearch.dropload.unlock();
  2135. }
  2136. $(".dropload-down").css("display","");
  2137. $("#wrapper .shade_table").css("display","none");
  2138. }
  2139. },
  2140. goToFeedbackPage: function(){
  2141. SuperSearch.setSessionStorage();
  2142. window.location.href = '/swordfish/feedback';
  2143. },
  2144. setSessionStorage: function(){
  2145. if(sessionStorage){
  2146. // @data 2021/6/28 S-新版搜索缓存
  2147. if (vMainSearchComponent && typeof temporaryStorageForPage === 'function') {
  2148. temporaryStorageForPage(vMainSearchComponent, 'superSearch_newQueryParams', 'save')
  2149. }
  2150. // @data 2021/6/28 E-新版搜索缓存
  2151. var filter_buyerclass = []
  2152. var buttons = $('.select-area-box .list button.active:not(.whole)');
  2153. buttons.each(function () {
  2154. filter_buyerclass.push($(this).text())
  2155. })
  2156. SuperSearch.filterWin.html = $("#supersearchPage #select-win-list").html()
  2157. SuperSearch.filterBuy.select = filter_buyerclass
  2158. sessionStorage.superSearch_filterWin = JSON.stringify(SuperSearch.filterWin)
  2159. sessionStorage.superSearch_filterBuy = JSON.stringify(SuperSearch.filterBuy)
  2160. sessionStorage.superSearch_noMoreCache = SuperSearch.noMoreCache;
  2161. sessionStorage.superSearch_listContent=$("#supersearchPage #list").html();
  2162. sessionStorage.superSearch_tableContent=$("#supersearchPage #table .data .content").html();
  2163. sessionStorage.superSearch_subtype=SuperSearch.reqParam.subtype;
  2164. sessionStorage.superSearch_scope=SuperSearch.reqParam.scope;
  2165. sessionStorage.superSearch_publishtime=SuperSearch.reqParam.publishtime;
  2166. sessionStorage.superSearch_minprice=SuperSearch.reqParam.minprice;
  2167. sessionStorage.superSearch_maxprice=SuperSearch.reqParam.maxprice;
  2168. sessionStorage.superSearch_pageNum=SuperSearch.reqParam.pageNum;
  2169. sessionStorage.superSearch_buyerclass=SuperSearch.reqParam.buyerclass;
  2170. sessionStorage.superSearch_winner=SuperSearch.reqParam.winner;
  2171. sessionStorage.superSearch_xScroll=$("#supersearchPage #table .data").scrollLeft();
  2172. sessionStorage.superSearch_yScroll=$("#supersearchPage .app-layout-content-b #wrapper").scrollTop();
  2173. sessionStorage.superSearch_industry=$("#supersearchPage .contentthree").html();
  2174. sessionStorage.searchpageName="superSearch";
  2175. sessionStorage.superSearch_dyDiv=SuperSearch.dyDiv;
  2176. sessionStorage.superSearch_advertIsClose=SuperSearch.advertIsClose;
  2177. // if($("#supersearchPage .on").hasClass("showlist")){
  2178. // sessionStorage.superSearch_showType="showList";
  2179. // }else if($("#supersearchPage .on").hasClass("showtable")){
  2180. // sessionStorage.superSearch_showType="showTable";
  2181. // }
  2182. sessionStorage.superSearch_showType = $(".select-show-type-group").hasClass('is-table') ? 'showtable' : 'showlist'
  2183. var shaxuanclass = $("#supersearchPage .jyshaxuan .icon-triangle-up").parent().attr("data-open");
  2184. if(shaxuanclass){
  2185. sessionStorage.superSearch_shaxuan=shaxuanclass;
  2186. }
  2187. sessionStorage.superSearch_shaxuanFlag=!$("#supersearchPage #super_search").hasClass("hidden");
  2188. sessionStorage.superSearch_searchType=$(".newdialog .tab-box .sub-search-title").find("li.active").attr('dataVal');//$("#supersearchPage #selLable>.com-title>span.on").attr("id");
  2189. sessionStorage.superSearch_interceptWord=SuperSearch.interceptWord;
  2190. var hasNoData_tiptext_index = $("#supersearchPage #hasNoData_tiptext>font:visible").index();
  2191. if(hasNoData_tiptext_index==1){
  2192. sessionStorage.superSearch_hasNoData_tiptext="-1";
  2193. }else if(hasNoData_tiptext_index==2){
  2194. sessionStorage.superSearch_hasNoData_tiptext="-2"
  2195. }
  2196. sessionStorage.superSearch_allSearchModel_isshow=$("#supersearchPage #allSearchModel").is(":visible");
  2197. sessionStorage.superSearch_limitFlag=SuperSearch.limitFlag;
  2198. sessionStorage.superSearch_showNull=SuperSearch.showNull;
  2199. sessionStorage.superSearch_currentkws=$("input[name='super_searchinput']").val();
  2200. }
  2201. },
  2202. setUpLastPage: function() {
  2203. if(!sessionStorage){
  2204. return;
  2205. }
  2206. //console.log('win 01')
  2207. SuperSearch.filterBuy = JSON.parse(sessionStorage.superSearch_filterBuy || '{}')
  2208. SuperSearch.filterWin = JSON.parse(sessionStorage.superSearch_filterWin || '{}')
  2209. initSearchHeader(true)
  2210. $("input[name='super_searchinput']").val(sessionStorage.superSearch_currentkws)
  2211. if(sessionStorage.superSearch_showNull == "null"){
  2212. SuperSearch.showNull = null;
  2213. $("#supersearchPage .selLable").addClass("hidden");
  2214. SuperSearch.showToOrder(false);
  2215. }else{
  2216. $("#supersearchPage .clearInpt").addClass("hidden");
  2217. if(sessionStorage.superSearch_limitFlag=="true"){
  2218. SuperSearch.limitFlag = true;
  2219. }else{
  2220. SuperSearch.limitFlag = false;
  2221. }
  2222. //页面数据
  2223. if(sessionStorage.superSearch_listContent==""){
  2224. SuperSearch.hasNoData();
  2225. $("#supersearchPage #hasNoData_tiptext>font").hide();
  2226. if(sessionStorage.superSearch_hasNoData_tiptext=="-1"){
  2227. $("#supersearchPage #hasNoData_tiptext>font:eq(1)").show();
  2228. }else if(sessionStorage.superSearch_hasNoData_tiptext=="-2"){
  2229. $("#supersearchPage #hasNoData_tiptext>font:eq(2)").show();
  2230. }else{
  2231. showSearchTipForTimeRange()
  2232. }
  2233. if(sessionStorage.superSearch_allSearchModel_isshow=="true"){
  2234. $("#supersearchPage #allSearchModel").show();
  2235. }else{
  2236. $("#supersearchPage #allSearchModel").hide();
  2237. }
  2238. }else{
  2239. if(sessionStorage.superSearch_dyDiv == "false"){
  2240. SuperSearch.dyDiv = false;
  2241. $("#supersearchPage .resbm").css("position","absolute");
  2242. SuperSearch.showToOrder(true);
  2243. setTimeout(function(){
  2244. $("#supersearchPage .resbm").css("position","fixed");
  2245. },200);
  2246. }else{
  2247. SuperSearch.dyDiv = true;
  2248. SuperSearch.showToOrder(false);
  2249. }
  2250. SuperSearch.noMoreCache = sessionStorage.superSearch_noMoreCache;
  2251. SuperSearch.showNull = false;
  2252. var ListContent=$(sessionStorage.superSearch_listContent);
  2253. ListContent.on("tap", function(event){
  2254. var h = $(this).find("a.bt").attr("s");
  2255. var sid = $(this).find("a.bt").attr("sid");
  2256. var industry = $(this).find(".industry").text();
  2257. if (SuperSearch.checkIsStartFn(event, { sid: sid })) {
  2258. SuperSearch.myredirect(h,sid,industry);
  2259. }
  2260. });
  2261. $("#supersearchPage #list").html(ListContent);
  2262. //收藏处理
  2263. var listCollSessionId = sessionStorage.getItem('listCollSessionId')
  2264. if (listCollSessionId){
  2265. var listCollSessionBool = sessionStorage.getItem('listCollSessionBool');
  2266. if (listCollSessionBool=="1"){
  2267. $("a[sid='"+listCollSessionId+"']").parent().next().addClass("fill");
  2268. }else{
  2269. $("a[sid='"+listCollSessionId+"']").parent().next().removeClass("fill");
  2270. }
  2271. sessionStorage.removeItem('listCollSessionId')
  2272. sessionStorage.removeItem('listCollSessionBool')
  2273. }
  2274. //
  2275. var TableContent=$(sessionStorage.superSearch_tableContent);
  2276. TableContent.on("tap",function(event){
  2277. var h = $(this).attr("s");
  2278. var sid = $(this).attr("sid");
  2279. var industry = $(this).attr("i");
  2280. SuperSearch.myredirect(h,sid,industry);
  2281. });
  2282. $("#supersearchPage #table .data .content").html(TableContent);
  2283. //
  2284. SuperSearch.initDropload(SuperSearch.noMoreCache!="true",sessionStorage.superSearch_pageNum);
  2285. }
  2286. SuperSearch.appendInterceptWord(sessionStorage.superSearch_interceptWord);
  2287. if(sessionStorage.superSearch_advertIsClose == "false"){
  2288. SuperSearch.advertIsClose = false;
  2289. }else{
  2290. SuperSearch.advertIsClose = true;
  2291. }
  2292. var superSearch_yScroll = sessionStorage.superSearch_yScroll;
  2293. var superSearch_xScroll = sessionStorage.superSearch_xScroll;
  2294. setTimeout(function(){
  2295. $("#supersearchPage .app-layout-content-b #wrapper").scrollTop(superSearch_yScroll);
  2296. $("#supersearchPage #table .data").scrollLeft(superSearch_xScroll);
  2297. },50);
  2298. }
  2299. //筛选时间
  2300. var ptime= sessionStorage.superSearch_publishtime;
  2301. if(typeof(ptime) != "undefined" && ptime != ""){
  2302. $("#supersearchPage .jypt-pt .jypt-active").removeClass("jypt-active");
  2303. if(ptime.indexOf("_") > -1){
  2304. $("#supersearchPage .jypt-timeinputs").addClass("jypt-timeinputs-active");
  2305. spTimeArray = ptime.split("_");
  2306. if(spTimeArray[0] != ""){
  2307. $("#supersearchPage #starttime").attr('data-value',new Date(new Number(spTimeArray[0]+"000")).getTime()).val(new Date(new Number(spTimeArray[0]+"000")).Format("yyyy年MM月dd日"));
  2308. }
  2309. if(spTimeArray[1] != ""){
  2310. $("#supersearchPage #endtime").attr('data-value',new Date(new Number(spTimeArray[1]+"000")).getTime()).val(new Date(new Number(spTimeArray[1]+"000")).Format("yyyy年MM月dd日"));
  2311. }
  2312. }else{
  2313. $("#supersearchPage .jypt-pt [data-value='"+ptime+"']").addClass("jypt-active");
  2314. }
  2315. }
  2316. //信息类别
  2317. var subtype=sessionStorage.superSearch_subtype;
  2318. if(typeof(subtype) != "undefined" && subtype != "A"&&subtype != ""){
  2319. $("#supersearchPage .contenttwo").find("ul:first li:first .btn").removeClass("active");
  2320. subtype = subtype.split(",");
  2321. for(var i=0;i<subtype.length;i++){
  2322. $("#supersearchPage .contenttwo").find(".btn").each(function(){
  2323. if($(this).text() == subtype[i]){
  2324. $(this).addClass("active");
  2325. if($(this).parent("li").find(".btn").length == $(this).parent("li").find(".btn.active").length){
  2326. $(this).prevAll('div[id="dqbtn"]').addClass("active");
  2327. };
  2328. return false;
  2329. }
  2330. });
  2331. }
  2332. }
  2333. //地区
  2334. var scopes=sessionStorage.superSearch_scope;
  2335. if(typeof(scopes) != "undefined" && scopes != "A"&&scopes != ""){
  2336. $("#supersearchPage .contentone").find("ul:first li:first .btn").removeClass("active");
  2337. scopes = scopes.split(",");
  2338. for(var i=0;i<scopes.length;i++){
  2339. $("#supersearchPage .contentone").find(".btn").each(function(){
  2340. if($(this).text() == scopes[i]){
  2341. $(this).addClass("active");
  2342. return false;
  2343. }
  2344. });
  2345. }
  2346. }
  2347. //行业
  2348. var industry=sessionStorage.superSearch_industry;
  2349. $("#supersearchPage .contentthree").html(industry);
  2350. SuperSearch.industryAction();
  2351. /*if(industry != "A"&&industry != ""){
  2352. $("#supersearchPage .contentthree").find("ul:first li:first .btn").removeClass("active");
  2353. industry = industry.split(",");
  2354. if(industry.length>1){
  2355. // alert(1)
  2356. $("#supersearchPage [data-value='"+industry[0]+"']").parent("li").find("#dqbtn").addClass("active");
  2357. }else{
  2358. //alert(2)
  2359. $("#supersearchPage [data-value='"+industry[0]+"']").addClass("active");
  2360. }
  2361. /!*for(var i=0;i<industry.length;i++){
  2362. $("#supersearchPage .contentthree").find(".btn").each(function(){
  2363. if($(this).attr("data-value") == industry[i]){
  2364. $(this).addClass("active");
  2365. if($(this).parent("li").find(".btn").length == $(this).parent("li").find(".btn.active").length){
  2366. $(this).prevAll('div[id="dqbtn"]').addClass("active");
  2367. };
  2368. return false;
  2369. }
  2370. });
  2371. }*!/
  2372. }*/
  2373. //金额
  2374. var minprice = sessionStorage.superSearch_minprice;
  2375. var maxprice = sessionStorage.superSearch_maxprice;
  2376. if(minprice != "" || maxprice != ""){
  2377. $("#supersearchPage .money-dialog .btn").removeClass("active");
  2378. $("#supersearchPage .money-dialog .money-inp ").addClass("active");
  2379. minprice != "" && $("#supersearchPage .money-dialog .minMrice").val(minprice);
  2380. maxprice != "" && $("#supersearchPage .money-dialog .maxMrice").val(maxprice);
  2381. }else{
  2382. $("#supersearchPage .money-dialog .btn").addClass("active");
  2383. }
  2384. var shaxuanclass = sessionStorage.superSearch_shaxuan;
  2385. var shaxuanFlag = sessionStorage.superSearch_shaxuanFlag;
  2386. if(shaxuanFlag=="true"){
  2387. $("#supersearchPage #selLable").addClass("hidden");
  2388. $("#supersearchPage #wrapper").addClass("hidden");
  2389. $("#supersearchPage .nullcontent").addClass("hidden");
  2390. $("#supersearchPage #super_search").removeClass("hidden");
  2391. $("#supersearchPage .jyshaxuan .j-icon").removeClass("icon-triangle-up");
  2392. }
  2393. if(shaxuanclass){
  2394. //console.log('xxx', shaxuanclass)
  2395. checkFilterButtonText()
  2396. $("#supersearchPage div[data-open='"+shaxuanclass+"']").trigger('click')
  2397. } else {
  2398. //console.log('没有筛选tab')
  2399. $("#supersearchPage div[data-open='industry']").trigger('click')
  2400. }
  2401. // $("#supersearchPage #selLable>.com-title>span.on").removeClass("on");
  2402. // $("#supersearchPage #selLable>.com-title>#"+sessionStorage.superSearch_searchType).addClass("on");
  2403. $(".newdialog .sub-search-title").find("li").removeClass("active");
  2404. $(".newdialog .sub-show-list").find("li").removeClass("active");
  2405. if(sessionStorage.superSearch_searchType=="searchtitle"){
  2406. $(".selected-export .options .search-title").find("em").text("标题搜索");
  2407. $(".newdialog .sub-search-title").find("li[dataval='searchtitle']").addClass("active");
  2408. }else if(sessionStorage.superSearch_searchType=="searchall"){
  2409. $(".selected-export .options .search-title").find("em").text("全文搜索");
  2410. $(".newdialog .sub-search-title").find("li[dataval='searchall']").addClass("active");
  2411. }
  2412. SuperSearch.showType();
  2413. SuperSearch.beforeSubmit();
  2414. },
  2415. showType: function(){
  2416. if(sessionStorage.superSearch_showType=="showtable"){
  2417. $(".select-show-type-group").addClass('is-table')
  2418. $("#supersearchPage #wrapper #table").removeClass("hidden");
  2419. $("#supersearchPage #wrapper #list").addClass("hidden");
  2420. SuperSearch.isTable(true);
  2421. }else{
  2422. $(".select-show-type-group").removeClass('is-table')
  2423. $("#supersearchPage #wrapper #table").addClass("hidden");
  2424. $("#supersearchPage #wrapper #list").removeClass("hidden");
  2425. SuperSearch.isTable(false);
  2426. }
  2427. },
  2428. getIndustry: function(){
  2429. //铺设行业信息
  2430. var industryHtml="<ul><li><button class=\"btn active\">全部</button></li>";
  2431. if(SuperSearch.sortArray!=""&&SuperSearch.industry!=""){
  2432. for(var i in SuperSearch.sortArray){
  2433. industryHtml+="<li><div id=\"dqbtn\" style=\"width:81px;\">"+SuperSearch.sortArray[i]+"</div>";
  2434. var childnode=SuperSearch.industry[SuperSearch.sortArray[i]];
  2435. for(var j in childnode){
  2436. industryHtml+="<button class=\"btn\" data-value="+SuperSearch.sortArray[i]+"_"+childnode[j]+">"+childnode[j]+"</button>";
  2437. }
  2438. industryHtml+="</li>";
  2439. }
  2440. industryHtml+= "</ul>";
  2441. $("#supersearchPage .industry-dialog .contentthree").html(industryHtml);
  2442. }
  2443. SuperSearch.industryAction();
  2444. },
  2445. industryAction: function(){
  2446. //行业点击事件
  2447. var dialogObjthree = $("#supersearchPage .contentthree");
  2448. dialogObjthree.find(".btn").on("tap",function(){
  2449. if($(this).parent().index() == 0){
  2450. dialogObjthree.find('div[id="dqbtn"]').removeClass("active");
  2451. dialogObjthree.find(".btn").removeClass("active");
  2452. $(this).addClass("active");
  2453. }else{
  2454. if($(this).hasClass("active")){
  2455. dialogObjthree.find(".btn").removeClass("active");
  2456. dialogObjthree.find("div[id='dqbtn']").removeClass("active");
  2457. dialogObjthree.find("ul:first li:first .btn").addClass("active");
  2458. }else{
  2459. dialogObjthree.find("ul:first li:first .btn").removeClass("active");
  2460. dialogObjthree.find(".btn").removeClass("active");
  2461. dialogObjthree.find("div[id='dqbtn']").removeClass("active");
  2462. $(this).addClass("active");
  2463. }
  2464. };
  2465. });
  2466. dialogObjthree.find('div[id="dqbtn"]').on("tap",function(){
  2467. if($(this).hasClass("active")){
  2468. dialogObjthree.find(".btn").removeClass("active");
  2469. dialogObjthree.find("div[id='dqbtn']").removeClass("active");
  2470. dialogObjthree.find("ul:first li:first .btn").addClass("active");
  2471. }else{
  2472. dialogObjthree.find("div[id='dqbtn']").removeClass("active");
  2473. dialogObjthree.find(".btn").removeClass("active");
  2474. $(this).addClass("active");
  2475. }
  2476. });
  2477. },
  2478. afterSelect: function(){
  2479. $("#supersearchPage .jypt-timeinputs").addClass("jypt-timeinputs-active");
  2480. $("#supersearchPage .jypt-pt .jypt-active").removeClass("jypt-active");
  2481. },
  2482. afterOnClear: function(){
  2483. if($("#supersearchPage #starttime").attr("data-value") == "" && $("#supersearchPage #endtime").attr("data-value") == ""){
  2484. $("#supersearchPage .jypt-timeinputs").removeClass("jypt-timeinputs-active");
  2485. if($("#supersearchPage .jypt-pt>button.jypt-active").length == 0){
  2486. $("#supersearchPage .jypt-pt>button:first").addClass("jypt-active");
  2487. }
  2488. }
  2489. },
  2490. setPublishtime: function(){
  2491. var publishtime = $("#supersearchPage .jypt-pt .jypt-active:not(#alltime)").attr("data-value");
  2492. if(publishtime){
  2493. return publishtime;
  2494. }else{
  2495. if(!$("#supersearchPage .jypt-timeinputs").hasClass("jypt-timeinputs-active")){
  2496. return "";
  2497. }
  2498. publishtime = SuperSearch.getInputTime().join("_");
  2499. if(publishtime != "_"){
  2500. return publishtime;
  2501. }else{
  2502. return "";
  2503. }
  2504. }
  2505. },
  2506. getInputTime: function(){
  2507. var starttime = $("#supersearchPage #starttime").attr("data-value");
  2508. if(starttime){
  2509. starttime = $.trim(starttime);
  2510. starttime = starttime.substring(0,starttime.length - 3);
  2511. }else{
  2512. starttime = "";
  2513. }
  2514. var endtime = $("#supersearchPage #endtime").attr("data-value");
  2515. if(endtime){
  2516. endtime = $.trim(endtime);
  2517. endtime = endtime.substring(0,endtime.length - 3);
  2518. }else{
  2519. endtime = "";
  2520. }
  2521. return [starttime,endtime]
  2522. },
  2523. closeadv: function(obj){
  2524. SuperSearch.advertIsClose = true;
  2525. $(obj).parent().prev().css("border-bottom-width","1px");
  2526. $(obj).parent().remove();
  2527. if(SuperSearch.dropload != null){
  2528. SuperSearch.dropload.resetload();
  2529. }
  2530. //再html内点击都会存缓存 关闭广告后再刷新 会取缓存
  2531. SuperSearch.clearSessionStorage();
  2532. },
  2533. appendInterceptWord: function(word){
  2534. SuperSearch.interceptWord = word;
  2535. if(word == ""){
  2536. $("#supersearchPage #intercept").addClass("hidden");
  2537. return;
  2538. }
  2539. $("#supersearchPage #intercept").removeClass("hidden");
  2540. $("#supersearchPage #intercept>font").text("“"+word+"”");
  2541. },
  2542. inputBlur: function(){
  2543. $("#supersearchPage input[name=super_searchinput]").blur();
  2544. $("#supersearchPage .maxMrice").blur();
  2545. $("#supersearchPage .minMrice").blur();
  2546. },
  2547. showToOrder:function(flag){
  2548. if(flag){
  2549. $("#wrapper").css("padding-bottom","132px");
  2550. $("#supersearchPage .resbm").removeClass("hidden");
  2551. }else{
  2552. $("#wrapper").css("padding-bottom","52px");
  2553. $("#supersearchPage .resbm").addClass("hidden");
  2554. }
  2555. },
  2556. getHomeList:function(locationCity,nReq){
  2557. SuperSearch.locationCity = locationCity;
  2558. SuperSearch.initHomePage();
  2559. $.ajax({
  2560. type: "post",
  2561. url: "/subscribepay/index/getIndexMessage",
  2562. data: {city:SuperSearch.locationCity,nReq:nReq},
  2563. dataType: "json",
  2564. async: false,
  2565. success: function(r){
  2566. if(nReq==2){
  2567. $(".loading_Top").hide();
  2568. }
  2569. if(r.success){
  2570. SuperSearch.homePageShow(r.data);
  2571. }
  2572. },error: function(){
  2573. console.log("请求报错...")
  2574. }
  2575. });
  2576. },
  2577. locationHomeData:function(){
  2578. SuperSearch.locationCount=1;//定位只查一次
  2579. wx.getLocation({
  2580. type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
  2581. success: function (res) {
  2582. var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
  2583. var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
  2584. //生成地理位置
  2585. var point = new BMap.Point(longitude, latitude);
  2586. var geoc = new BMap.Geocoder();
  2587. geoc.getLocation(point, function(rs) {
  2588. var addComp = rs.addressComponents;
  2589. //alert('您现在所处位置:'+addComp.province + ", "+addComp.city + ", "+addComp.district + ", "+addComp.street + ", "+addComp.streetNumber);
  2590. SuperSearch.getHomeList(addComp.city,2);
  2591. });
  2592. },
  2593. cancel:function(r){
  2594. //拒绝定位 地区参数为-:空
  2595. SuperSearch.getHomeList("",2);
  2596. },
  2597. fail:function(){
  2598. //定位失败 地区参数为-:空
  2599. SuperSearch.getHomeList("",2);
  2600. }
  2601. });
  2602. },
  2603. homePageShow:function(r){
  2604. SuperSearch.hasHistory = r["hasHistory"]
  2605. SuperSearch.hasSubscribe = r["hasSubscribe"]
  2606. SuperSearch.isVip = r["isVip"]
  2607. SuperSearch.listLength = r["listLength"]
  2608. SuperSearch.myHistory = r["history"]
  2609. var list = r["list"]
  2610. if (list && list.length) {
  2611. SuperSearch.checkStartKeepStatus(list.map(function(v) {
  2612. return v._id
  2613. }))
  2614. }
  2615. var homeListHtml = '';
  2616. if(list!=null&&list.length>0){
  2617. for(var i=0;i<list.length;i++){
  2618. var _list = list[i];
  2619. var title = _list["title"];
  2620. if(SuperSearch.hasSubscribe){
  2621. if(_list["matchkeys"]!=null&&typeof(_list["matchkeys"])!="undefined"){
  2622. for(var n=0;n<_list["matchkeys"].length;n++){
  2623. var matchkeys = _list["matchkeys"][n].split("+");
  2624. for(var nn=0;nn<matchkeys.length;nn++){
  2625. title = keyWordHighlight(title,matchkeys[nn],'<font class="keyword">$1</font>');
  2626. }
  2627. }
  2628. }
  2629. }else if(SuperSearch.myHistory!=null&&SuperSearch.myHistory.length>0){
  2630. title = keyWordHighlight(title,SuperSearch.myHistory,'<font class="keyword">$1</font>');
  2631. }
  2632. homeListHtml +='<div data-cl-event="c_wx_newest_linkclick" class="list_item" onclick="SuperSearch.HomeToDetails(\''+_list["_id"]+'\', event)">'
  2633. +'<div class="list_title">'
  2634. +'<span class="serial_number">'+(i+1)+'. &nbsp;</span>'
  2635. + '<div class="two-group">'
  2636. +'<p sid="'+_list["_id"]+'">'+title+'</p>'
  2637. + '<div class="flow-start-box"><i class="icon-flow-start"></i></div>'
  2638. + '</div>'
  2639. +'</div>'
  2640. +'<div class="list_info">'
  2641. +'<div class="tags">'
  2642. var area = _list["area"];
  2643. if(area==undefined||area==""){
  2644. area='全国'
  2645. }
  2646. homeListHtml +='<div class="area">'+area+'</div>'
  2647. var industry = _list["industry"];
  2648. var subtype = _list["subtype"];
  2649. var buyerclass = _list["buyerclass"] || '';
  2650. if(SuperSearch.hasSubscribe||SuperSearch.isVip){
  2651. industry = _list["s_subscopeclass"];
  2652. subtype = _list["type"];
  2653. }
  2654. if(industry==undefined){
  2655. industry=""
  2656. }
  2657. if(subtype==undefined){
  2658. subtype = ""
  2659. }
  2660. if (SuperSearch.isVip || jyUserPower.vip > 0 || jyUserPower.member || jyUserPower.entniche) {
  2661. if (buyerclass!="") {
  2662. homeListHtml +='<div class="buyerclass">'+buyerclass+'</div>'
  2663. } else {
  2664. if (industry!=""){
  2665. homeListHtml +='<div class="industry">'+industry+'</div>'
  2666. }
  2667. }
  2668. } else {
  2669. if (industry!=""){
  2670. homeListHtml +='<div class="industry">'+industry+'</div>'
  2671. }
  2672. }
  2673. if(subtype!=""){
  2674. homeListHtml +='<div class="course">'+subtype+'</div>'
  2675. }
  2676. var moneyTag = ''
  2677. // 金额标签
  2678. if(typeof(_list.budget) != "undefined" && _list.budget != null && _list.budget != ""){
  2679. moneyTag = '<div class="bidamount">'+MoneyUnit.test(_list.budget)+'</div>';
  2680. }
  2681. if(typeof(_list.bidamount) != "undefined" && _list.bidamount != null && _list.bidamount != ""){
  2682. moneyTag = '<div class="bidamount">'+MoneyUnit.test(_list.bidamount)+'</div>';
  2683. }
  2684. homeListHtml += moneyTag
  2685. //时间
  2686. var publishtime = _list["publishtime"];
  2687. if(publishtime){
  2688. publishtime = utils.dateFromNow(Number(publishtime+"000"));
  2689. }
  2690. homeListHtml +='<div class="price hide"></div>'
  2691. +'</div>'
  2692. +'<div class="timer">'+publishtime+'</div>'
  2693. +'</div>'
  2694. +'</div>'
  2695. }
  2696. }else{
  2697. if(!SuperSearch.isVip&&!SuperSearch.hasSubscribe&&SuperSearch.locationCount==0){
  2698. var locatInterval = setInterval(function(){
  2699. if(SuperSearch.localFalg){
  2700. clearInterval(locatInterval);
  2701. SuperSearch.locationHomeData();
  2702. }
  2703. },500)
  2704. return
  2705. }
  2706. }
  2707. SuperSearch.showHomeList(homeListHtml);
  2708. },
  2709. HomeToDetails:function(id, e){
  2710. if (SuperSearch.checkIsStartFn(e, { sid: id })) {
  2711. if(id!=""){
  2712. window.location.href="/article/content/"+id+".html"
  2713. }
  2714. }
  2715. },
  2716. showHomeList:function(hh){
  2717. SuperSearch.initHomeTip();
  2718. if(hh!=""){
  2719. $(".home_data .data_list").html(hh);
  2720. }
  2721. },
  2722. initHomePage:function(){
  2723. $(".home_toset").click(function(){
  2724. if(SuperSearch.isVip){
  2725. window.location.href="/front/vipsubscribe/toSubVipSetPage"
  2726. }else{
  2727. sessionStorage.removeItem("keysetindexToHistory");
  2728. window.location.href="/swordfish/newhistorypush?msg=1"
  2729. }
  2730. })
  2731. $(".tips_all .GetAll").click(function(){
  2732. sessionStorage.removeItem("keysetindexToHistory");
  2733. window.location.href="/swordfish/newhistorypush?msg=1"
  2734. })
  2735. $(".home_todetails").click(function(){
  2736. window.location.href="/front/vipsubscribe/introducePage"
  2737. })
  2738. //直播活动
  2739. $(".home_tolive").click(function(){
  2740. window.location.href="/active/livePage/index"
  2741. })
  2742. },
  2743. initHomeTip:function(){
  2744. if(SuperSearch.listLength>0){
  2745. if(!SuperSearch.isVip){
  2746. if(SuperSearch.hasSubscribe){
  2747. if(SuperSearch.listLength>=50){
  2748. $(".home_4").show();
  2749. $(".home_todetails").show();
  2750. }else if(SuperSearch.listLength>0){
  2751. $(".home_2").show();
  2752. $(".home_toset").show();
  2753. }
  2754. }else{
  2755. $(".home_1").show();
  2756. $(".home_toset a").text("去订阅");
  2757. $(".home_toset").show();
  2758. }
  2759. }else{
  2760. if(SuperSearch.listLength>=50){
  2761. $(".tips .tips_all").show();
  2762. }else if(SuperSearch.listLength>0){
  2763. if(!SuperSearch.hasSubscribe){
  2764. $(".home_3").show();
  2765. }else{
  2766. $(".home_2").show();
  2767. }
  2768. $(".home_toset").show();
  2769. }
  2770. }
  2771. }else{
  2772. $(".no_data").show();
  2773. }
  2774. }
  2775. };