var token = ''; var qs = parseQueryString(window.location.href); var cityList = []; if (qs.token) { token = qs.token; } function deleteSearch () { $("#search input").val("") $("#city_02 .container ul").html(""); $("#search").addClass("search"); $("#search").removeClass("search_02"); $(".searchBox").css({ 'padding-bottom': '0', 'background': '#f3f3f3' }) $("#city_02").css("display",'none') $("#city_01").css("display",'block') } /** * [getLoginInfo 获取城市登录信息] */ function getLoginInfo() { $.ajax({ type: "GET", url: BASEURL + '/city_list?type=fund&sort=true&token=' + token + '&time=' + Math.round(Date.now() / 1000), contentType: 'application/json;charset=utf-8', success: function(data) { cityList = data; return renderLoginInfo(cityList); }, error: function(err) { return showMsg('获取城市信息失败:' + JSON.parse(err.responseText).error); } }); } /** * [renderLoginInfo 渲染城市登录信息] * @param {[type]} cityInfo [城市登录信息] */ function renderLoginInfo(cityInfo) { var bind_name = 'input'; if (navigator.userAgent.indexOf("MSIE") != -1){ bind_name = 'propertychange'; } $("#search input").bind(bind_name, function(){ var searchName = $("#search input").val().trim(); var html = ''; if(searchName != ""){ $("#search").removeClass("search"); $("#search").addClass("search_02"); $(".searchBox").css({ 'padding-bottom': '0.2rem', 'background': '#ffffff' }) $("#city_02").css("display",'block') $("#city_01").css("display",'none') $("#search em").css("display","block") for(key in cityInfo){ if(key != "hot"){ cityInfo[key].forEach(function (item,index) { if(item.region.indexOf(searchName) != -1){ html += `