var token = ''; var path = ''; var qs = parseQueryString(window.location.href); var cityList = []; if (qs.token) { token = qs.token; } if(qs.path){ path = qs.path; } //自动唤起键盘 $(".search input").trigger("click").focus() //返回上一页 $("nav #back").click(function () { window.history.go(-1) }) function deleteSearch () { $(".search input").val("") $(".container ul").html("") } /** * [getLoginInfo 获取城市登录信息] */ function getLoginInfo() { var regionCode = $('.city-name').attr('data-code'); $.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 em").css("display","block") for(key in cityInfo){ if(key != "hot"){ cityInfo[key].forEach(function (item,index) { if(item.region.indexOf(searchName) != -1){ html += `