Authored by 肖亚东

搜索相关提交 — review by 黄敬囿

... ... @@ -8,10 +8,12 @@
],
"window":{
"backgroundTextStyle":"light",
"navigationBarBackgroundColor": "#000",
"navigationBarBackgroundColor": "#3a3a3a",
"navigationBarTitleText": "Yoho!Buy有货",
"navigationBarTextStyle":"white"
"navigationBarTextStyle":"white",
"backgroundColor": "#fff",
"backgroundTextStyle": "dark",
"onReachBottomDistance": 100
},
"tabBar": {
"borderStyle": "#e0e0e0",
... ...

335 Bytes

... ... @@ -200,6 +200,75 @@ Page({
// this.fetchRecommend(force);
},
//请求(男生、女生)猜你喜欢数据
// fetchRecommend: function (force) {
// let currentChannel = this.data.selectedChannel;
// let currentChannelData = this.data.newChannels[currentChannel];
// let recommend = currentChannelData.recommend;
// if (recommend.data && recommend.data.length > 0 && !force) {
// return;
// }
// let param = {};
// let gender = getGenderCode(currentChannel);
// let yh_channel = getChannelCode(currentChannel);
// let content_code = getRecommandContentCode(currentChannel);
// let rec_pos = getRecPosCode(currentChannel);
// param = {
// content_code,
// gender,
// yh_channel,
// rec_pos,
// };
// let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: true, }) });
// let newChannels = this.data.newChannels;
// newChannels[currentChannel] = newChannelData;
// this.setData({
// newChannels: newChannels,
// });
// homeService.getProductlist(param)
// .then(json => {
// if (!json || !json.code || json.code != 200) {
// let currentChannel = this.data.selectedChannel;
// let currentChannelData = this.data.newChannels[currentChannel];
// let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: false, error: { code: json.code, message: json.message } }) });
// let newChannels = this.data.newChannels;
// newChannels[currentChannel] = newChannelData;
// this.setData({
// newChannels: newChannels,
// });
// return;
// }
// let data = json.data.product_list;
// data = parseBrandListData(data);
// let currentChannel = this.data.selectedChannel;
// let currentChannelData = this.data.newChannels[currentChannel];
// let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: false, data }) });
// let newChannels = this.data.newChannels;
// newChannels[currentChannel] = newChannelData;
// this.setData({
// newChannels: newChannels,
// });
// })
// .catch(error => {
// let currentChannel = this.data.selectedChannel;
// let currentChannelData = this.data.newChannels[currentChannel];
// let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: false, error }) });
// let newChannels = this.data.newChannels;
// newChannels[currentChannel] = newChannelData;
// this.setData({
// newChannels: newChannels,
// });
// });
// },
jumpByRuleEvent(event) {
console.log(event.detail);
}
... ...
<template name='tipTitle'>
<view class='titleContainer'
style="border-bottom:{{no_line?'0.5rpx solid #ffffff':'0.5rpx solid #e0e0e0'}}">
<view class='titleView'>
<view class='titleLine'></view>
<view class='titleDesc'>{{desc}}</view>
<view class='titleMore' wx:if='{{more_url?true:false}}'
data-jump_rule="{{more_url}}" bindtap="jumpByRule">
<image class="titleMoreIm" src="../../images/more_ic@2x.png"></image>
</view>
<view class='titleMore' wx:if='{{more_url?true:false}}' data-jump_rule="{{more_url}}" bindtap="jumpByRule">
<image class="titleMoreIm" src="../../images/more_ic@2x.png" ></image>
</view>
</view>
</template>
<view class="container">
<view class='newtop'>
<view class='newsearch' bindtap="searchTapped">
<image class="serachIcon" src="../../images/home_search@2x.png"></image>
<view class="serach_view_show">潮流单品搜一下</view>
</view>
<view class='scanCodeIconView'>
<image class="scanCodeIcon" catchtap="scanCodeTapped" src="../../images/home_qr_new@3x.png"></image>
</view>
<image bindtap='selectChannel' class="channelIcon" src='../../images/ceb-ic@2x.png'></image>
</view>
<image class='newTopImg' src='../../images/home-top-bg2@2x.png'></image>
<image wx:if='{{channelSelect}}' class='channelBg' src='../../images/channel-bg@2x.png'></image>
<form bindsubmit='formSubmitFromSwitchGender' report-submit='true'>
<view class='channelContainer' wx:if='{{channelSelect}}'>
<view class='channelItem' data-type="boy" bindtap="channelSelected">
<view class='indicator' style="background-color:{{selectedChannel=='boy' ? 'white':'transparent'}}"></view>
<view class='channelText' data-type="boy">男生
</view>
<button class='channelButton' style='top: 0rpx;'
form-type='submit' data-type="boy"></button>
</view>
<view class='channelItem' style='border-top: 1rpx solid #ececec;' bindtap="channelSelected" data-type="girl">
<view class='indicator' style="background-color:{{selectedChannel=='girl' ? 'white':'transparent'}}" ></view>
<view class='channelText' data-type="girl">女生
</view>
<button class='channelButton' style='top: 100rpx'
form-type='submit' data-type="girl"></button>
</view>
<view class='channelItem' style='border-top: 1rpx solid #ececec;' bindtap="jumpToYohood">
<view class='channelText'>YOHOOD</view>
<button class='channelButton' style='top: 200rpx;' form-type='submit' data-type="yohood"></button>
</view>
</view>
<scroll-view scroll-y="true" class="mainContainer">
<block wx:for='{{homelist}}' wx:key='{{index}}'>
... ...
.titleContainer {
display: flex;
flex-direction: column;
height: 100rpx;
}
.titleView{
.titleContainer{
background-color: white;
display: flex;
flex-direction: row;
... ... @@ -15,7 +9,7 @@
width: 4rpx;
height: 30rpx;
background-color: #444444;
margin-left: 30rpx;
margin-left: 20rpx;
}
.titleDesc{
flex: 1;
... ... @@ -23,7 +17,7 @@
color: #444444;
font-family: PingFang SC;
font-size:30rpx;
margin-left: 20rpx;
margin-left: 16rpx;
font-weight: 600;
/* line-height: 2.75; */
}
... ... @@ -35,7 +29,116 @@
align-items: center;
justify-content: center;
}
.titleMoreIm{
width: 44rpx;
height: 8rpx;
}
.newtop{
position: fixed;
top: 0;
left: 0;
height: 96rpx;
width: 100%;
/* background-color: #444444; */
display: flex;
flex-direction: row;
align-items: center;
z-index: 1000;
}
.newTopImg{
position: fixed;
top: 0;
left: 0;
height: 96rpx;
width: 100%;
z-index: 999;
}
.newsearch{
height: 70rpx;
width: 615rpx;
margin-left: 30rpx;
background-color: #ffffff;
display: flex;
flex-direction: row;
align-items: center;
border-radius: 10rpx;
top: 0rpx;
left: 0rpx
}
.channelContainer{
width: 100%;
top: 96rpx;
position: fixed;
display: flex;
flex-direction: column;
height: wrap;
z-index: 1000;
}
.channelItem{
height: 100rpx;
width: 750rpx;
display: flex;
justify-content: center;
flex-direction: row;
align-items: center;
}
.serachIcon {
width: 30rpx;
height: 30rpx;
margin-left: 20rpx;
}
.channelBg{
position: fixed;
height: 302rpx;
width: 750rpx;
top: 96rpx;
z-index: 999;
}
.indicator{
width: 10rpx;
height: 10rpx;
background-color: white;
}
.channelText{
font-family: PingFang-SC;
font-size: 40rpx;
font-weight: 600;
text-align: left;
color: #ffffff;
margin-left: 20rpx
}
.channelIcon{
width: 48rpx;
height: 38rpx;
margin-left: 30rpx;
margin-right: 30rpx
}
.scanCodeIconView {
width: 70rpx;
height: 70rpx;
margin-left: -70rpx;
display: flex;
justify-content: center;
align-items: center;
}
.scanCodeIcon {
width: 45rpx;
height: 45rpx;
}
.serach_view_show {
display: block;
color: #b0b0b0;
font-size: 30rpx;
font-family: PingFang SC;
padding-left: 10rpx;
font-weight: 500;
line-height: 2.57;
letter-spacing: 1.1px;
text-align: left;
}
... ...
... ... @@ -13,6 +13,17 @@ export function getHomeFloorlist(params) {
});
}
export function getProductlist(params) {
return api.get({
data: {
...params,
method: 'app.search.newLast7day',
page: 1,
limit: 50,
},
});
}
export function parseHomeList(json, windowWidth, windowHeight, listImageWidth, listImageHeight){
let newList=[];
let index = 1;
... ... @@ -133,5 +144,6 @@ export function parseHomeList(json, windowWidth, windowHeight, listImageWidth, l
export default {
getHomeFloorlist,
parseHomeList
parseHomeList,
getProductlist
};
... ...