|
@@ -141,6 +141,7 @@ var entAssoc = {
|
|
|
}
|
|
|
|
|
|
var searchHistory = {
|
|
|
+ isHaveSearch: false,
|
|
|
preSearch: {
|
|
|
hover: false,
|
|
|
focus: false
|
|
@@ -149,9 +150,15 @@ var searchHistory = {
|
|
|
browseList: [],
|
|
|
init: function () {
|
|
|
var _this = this
|
|
|
- _this.getSearchHistory()
|
|
|
+ setTimeout(function () {
|
|
|
+ _this.getSearchHistory()
|
|
|
+ }, 300)
|
|
|
// 控制list显示隐藏
|
|
|
$('#keywords').on('focus', function () {
|
|
|
+ if(!_this.isHaveSearch) {
|
|
|
+ // 如果初始化时没拿到登录状态(没查询历史记录),获取焦点时再查询一次
|
|
|
+ _this.getSearchHistory()
|
|
|
+ }
|
|
|
_this.preSearch.focus = true
|
|
|
_this.checkListShow()
|
|
|
}).on('blur', function () {
|
|
@@ -268,6 +275,7 @@ var searchHistory = {
|
|
|
data: { type: type },
|
|
|
success: function (res) {
|
|
|
if (res.error_code === 0) {
|
|
|
+ _this.isHaveSearch = true
|
|
|
_this.searchList = res.data.search
|
|
|
if (res.data.browse) {
|
|
|
// 格式化浏览历史数据(企业画像浏览记录跳转需要企业id, 存历史记录的时候保存格式为“企业名称_企业id”, 取的时候要分割开)
|