Skip to content

Commit

Permalink
添加搜索提示
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyzhang1992 committed Mar 12, 2019
1 parent 1385f67 commit 0f70033
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pages/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ Page({
poets: null,
sentences:null,
tags: null,
keyWord: ''
keyWord: '',
closeTips: false
},
// close tips
closeTips: function(){
wx.setStorageSync('closeTipsStatus', 'close');
this.setData({
closeTips: true
})
},
/**x
* 生命周期函数--监听页面加载
Expand All @@ -29,6 +37,12 @@ Page({
that.setData({
keyWord: options && options.keyWord ? options.keyWord : ''
});
let tipsStatus = wx.getStorageSync('closeTipsStatus');
if(tipsStatus && tipsStatus.length>0){
that.setData({
closeTips: true
})
}
http.request(app.globalData.domain+'/getsHotSearch',undefined).then(res=>{
if(res && res.succeeded){
hotKey = res.data;
Expand Down
11 changes: 11 additions & 0 deletions wxSearchView/wxSearchView.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@
</view>
</view>
</view>
<view class="divide"></view>
<view class="tip-list" wx:if="{{!closeTips}}">
<view class="wxSearchHistoryItem title">
<text class="wxSearchHistoryItemTitle">搜索提示</text>
<icon type="clear" bindtap="closeTips" size="18" />
</view>
<view class="wxSearchKeyList">
<view class="item">1. 关键词尽量简洁,不要整句搜索,也不要包含特殊字符(例如:,。《》以及空格等)</view>
<view class="item">2. 如果长的搜索词查询不到结果,可以尝试缩短搜索词,再次尝试。 </view>
</view>
</view>
<!--广告-->
<ad unit-id="adunit-271379a2a27890de"></ad>
</view>
Expand Down
14 changes: 14 additions & 0 deletions wxSearchView/wxSearchView.wxss
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,17 @@
color: #09bb07;
white-space: nowrap;
}
/**
new add
*/
.tip-list{
background-color: #fff;
}
.tip-list .title{
border-bottom: 1px solid #eee;
}
.tip-list .item{
margin-bottom: 0;
padding-left: 15px;
font-size: small;
}

0 comments on commit 0f70033

Please sign in to comment.