Authored by zhangxiaoru

index

@@ -128,6 +128,8 @@ const index = (req, res, next) => { @@ -128,6 +128,8 @@ const index = (req, res, next) => {
128 }), 128 }),
129 pageFooter: true, 129 pageFooter: true,
130 search: { 130 search: {
  131 + defaultTerms: result[0].content || '',
  132 + url: helpers.urlFormat('', null, 'search'),
131 hotTerms: result 133 hotTerms: result
132 } 134 }
133 135
@@ -170,6 +170,9 @@ const getAllBrandNames = () => { @@ -170,6 +170,9 @@ const getAllBrandNames = () => {
170 }); 170 });
171 }; 171 };
172 172
  173 +/**
  174 + * 获取热门搜索
  175 + **/
173 const getSearchIndex = () => { 176 const getSearchIndex = () => {
174 return api.get('', { 177 return api.get('', {
175 method: 'app.search.getTerms' 178 method: 'app.search.getTerms'
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 {{# search}} 2 {{# search}}
3 <input type="hidden" value="{{defaultTerms}}" id="default-terms"> 3 <input type="hidden" value="{{defaultTerms}}" id="default-terms">
4 <div id="search-input" class="search-input"> 4 <div id="search-input" class="search-input">
5 - <form id="search-form" action={{url}} method="get"> 5 + <form id="search-form" action="{{url}}" method="get">
6 <i class="search-icon iconfont">&#xe60f;</i> 6 <i class="search-icon iconfont">&#xe60f;</i>
7 <input type="text" placeholder="{{#if defaultTerms}}{{defaultTerms}}{{else}}搜索商品、品牌{{/if}}" name="query" data-bp-id="search_page_input_1" class="buriedpoint" autocomplete="off"> 7 <input type="text" placeholder="{{#if defaultTerms}}{{defaultTerms}}{{else}}搜索商品、品牌{{/if}}" name="query" data-bp-id="search_page_input_1" class="buriedpoint" autocomplete="off">
8 <input type="hidden" name="from" value="search"> 8 <input type="hidden" name="from" value="search">
@@ -64,6 +64,7 @@ chHammer.on('tap', function() { @@ -64,6 +64,7 @@ chHammer.on('tap', function() {
64 function GoSearch(query) { 64 function GoSearch(query) {
65 // 保存搜索的内容 65 // 保存搜索的内容
66 writeSearch.setHistoryValFun(query); 66 writeSearch.setHistoryValFun(query);
  67 + console.log(searchUrl)
67 document.location.href = searchUrl + '?query=' + query; 68 document.location.href = searchUrl + '?query=' + query;
68 } 69 }
69 70