Commit 6afdfa32 by HouTiZhuo

全网搜功能开发

parent 402a60ed
......@@ -16,7 +16,8 @@ Component({
data: {
backgroundColor : '',
borderColor : '',
placeholderValue : ''
placeholderValue : '',
searchScopeFlag: 0
},
ready(){
this.setData({
......@@ -47,10 +48,26 @@ Component({
methods: {
toSearchPage(e){
app.trackCpn(e, this.data.datas.componentName)
app.$themeToLink({
type: 1,
link: '/contentSearch/contentSearch?placeHolderText=' + (this.data.datas.componentData["placeHolderVal"] || '')
})
const placeHolderText = this.data.datas.componentData["placeHolderVal"] || "";
let query = `?placeHolderText=${placeHolderText}`;
if (this.data.datas.componentData['searchModel'] == 1) {
query += `&searchScopeFlag=${this.data.searchScopeFlag}`;
// 重置默认全网搜
this.setData({ searchScopeFlag: 0 });
}
let link = `/contentSearch/contentSearch${query}`;
if (this.data.datas.componentData['searchModel'] == 1 && this.data.searchScopeFlag == 0) {
link = `/goodsSearch/searchAllGoods${query}`;
}
app.$themeToLink({ type: 1, link });
},
// 本店搜
handleSearchLocal() {
this.setData({ searchScopeFlag: 1 });
},
// 全网搜
handleSearchAll() {
this.setData({ searchScopeFlag: 0 });
}
}
})
......@@ -5,5 +5,9 @@
<i class="iconfont-common common-iconsousuo"></i>
<input style="width:{{placeholderValue.length*40}}rpx" disabled type="text" placeholder="{{placeholderValue}}">
</input>
<view class="flex search-btn" wx:if="{{datas.componentData['searchModel'] == 1}}">
<view class="search-btn__local" style="color:{{datas.componentData.leftBtn.color}};background-color:{{datas.componentData['leftBtn'].backgroundColor}};font-size:{{datas.componentData['leftBtn'].fontSize*2}}rpx;padding:{{datas.componentData['leftBtn'].paddingTop*2}}rpx {{datas.componentData['leftBtn'].paddingRight*2}}rpx {{datas.componentData['leftBtn'].paddingBottom*2}}rpx {{datas.componentData['leftBtn'].paddingLeft*2}}rpx;margin:{{datas.componentData['leftBtn'].marginTop*2}}rpx {{datas.componentData['leftBtn'].marginRight*2}}rpx {{datas.componentData['leftBtn'].marginBottom*2}}rpx {{datas.componentData['leftBtn'].marginLeft*2}}rpx;" bindtap="handleSearchLocal">搜本店</view>
<view class="search-btn__all" style="color:{{datas.componentData['rightBtn'].color}};background-color:{{datas.componentData['rightBtn'].backgroundColor}};font-size:{{datas.componentData['rightBtn'].fontSize*2}}rpx;padding:{{datas.componentData['rightBtn'].paddingTop*2}}rpx {{datas.componentData['rightBtn'].paddingRight*2}}rpx {{datas.componentData['rightBtn'].paddingBottom}}rpx {{datas.componentData['rightBtn'].paddingLeft*2}}rpx;margin:{{datas.componentData['rightBtn'].marginTop*2}}rpx {{datas.componentData['rightBtn'].marginRight*2}}rpx {{datas.componentData['rightBtn'].marginBottom*2}}rpx {{datas.componentData['rightBtn'].marginLeft*2}}rpx;" bindtap="handleSearchAll">搜全网</view>
</view>
</view>
</view>
......@@ -31,3 +31,20 @@
.goods-search .textCenter{
justify-content: center;
}
.search-btn {
position: absolute;
right: 0;
justify-content: end;
margin-right: 2px;
}
.search-btn .search-btn__local {
border: none;
border-radius: 2em 0 0 2em;
}
.search-btn .search-btn__all {
border: none;
border-radius: 0 2em 2em 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment