Authored by 肖亚东

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

@@ -8,10 +8,12 @@ @@ -8,10 +8,12 @@
8 8
9 ], 9 ],
10 "window":{ 10 "window":{
11 - "backgroundTextStyle":"light",  
12 - "navigationBarBackgroundColor": "#000", 11 + "navigationBarBackgroundColor": "#3a3a3a",
13 "navigationBarTitleText": "Yoho!Buy有货", 12 "navigationBarTitleText": "Yoho!Buy有货",
14 - "navigationBarTextStyle":"white" 13 + "navigationBarTextStyle":"white",
  14 + "backgroundColor": "#fff",
  15 + "backgroundTextStyle": "dark",
  16 + "onReachBottomDistance": 100
15 }, 17 },
16 "tabBar": { 18 "tabBar": {
17 "borderStyle": "#e0e0e0", 19 "borderStyle": "#e0e0e0",

335 Bytes

@@ -200,6 +200,75 @@ Page({ @@ -200,6 +200,75 @@ Page({
200 // this.fetchRecommend(force); 200 // this.fetchRecommend(force);
201 }, 201 },
202 202
  203 + //请求(男生、女生)猜你喜欢数据
  204 + // fetchRecommend: function (force) {
  205 + // let currentChannel = this.data.selectedChannel;
  206 + // let currentChannelData = this.data.newChannels[currentChannel];
  207 + // let recommend = currentChannelData.recommend;
  208 + // if (recommend.data && recommend.data.length > 0 && !force) {
  209 + // return;
  210 + // }
  211 +
  212 + // let param = {};
  213 + // let gender = getGenderCode(currentChannel);
  214 + // let yh_channel = getChannelCode(currentChannel);
  215 + // let content_code = getRecommandContentCode(currentChannel);
  216 + // let rec_pos = getRecPosCode(currentChannel);
  217 + // param = {
  218 + // content_code,
  219 + // gender,
  220 + // yh_channel,
  221 + // rec_pos,
  222 + // };
  223 +
  224 + // let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: true, }) });
  225 + // let newChannels = this.data.newChannels;
  226 + // newChannels[currentChannel] = newChannelData;
  227 +
  228 + // this.setData({
  229 + // newChannels: newChannels,
  230 + // });
  231 +
  232 + // homeService.getProductlist(param)
  233 + // .then(json => {
  234 + // if (!json || !json.code || json.code != 200) {
  235 + // let currentChannel = this.data.selectedChannel;
  236 + // let currentChannelData = this.data.newChannels[currentChannel];
  237 + // let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: false, error: { code: json.code, message: json.message } }) });
  238 + // let newChannels = this.data.newChannels;
  239 + // newChannels[currentChannel] = newChannelData;
  240 +
  241 + // this.setData({
  242 + // newChannels: newChannels,
  243 + // });
  244 + // return;
  245 + // }
  246 +
  247 + // let data = json.data.product_list;
  248 + // data = parseBrandListData(data);
  249 + // let currentChannel = this.data.selectedChannel;
  250 + // let currentChannelData = this.data.newChannels[currentChannel];
  251 + // let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: false, data }) });
  252 + // let newChannels = this.data.newChannels;
  253 + // newChannels[currentChannel] = newChannelData;
  254 +
  255 + // this.setData({
  256 + // newChannels: newChannels,
  257 + // });
  258 + // })
  259 + // .catch(error => {
  260 + // let currentChannel = this.data.selectedChannel;
  261 + // let currentChannelData = this.data.newChannels[currentChannel];
  262 + // let newChannelData = objectAssign(currentChannelData, { recommend: objectAssign(recommend, { isLoading: false, error }) });
  263 + // let newChannels = this.data.newChannels;
  264 + // newChannels[currentChannel] = newChannelData;
  265 +
  266 + // this.setData({
  267 + // newChannels: newChannels,
  268 + // });
  269 + // });
  270 + // },
  271 +
203 jumpByRuleEvent(event) { 272 jumpByRuleEvent(event) {
204 console.log(event.detail); 273 console.log(event.detail);
205 } 274 }
1 <template name='tipTitle'> 1 <template name='tipTitle'>
2 <view class='titleContainer' 2 <view class='titleContainer'
3 style="border-bottom:{{no_line?'0.5rpx solid #ffffff':'0.5rpx solid #e0e0e0'}}"> 3 style="border-bottom:{{no_line?'0.5rpx solid #ffffff':'0.5rpx solid #e0e0e0'}}">
4 - <view class='titleView'>  
5 <view class='titleLine'></view> 4 <view class='titleLine'></view>
6 <view class='titleDesc'>{{desc}}</view> 5 <view class='titleDesc'>{{desc}}</view>
7 - <view class='titleMore' wx:if='{{more_url?true:false}}'  
8 - data-jump_rule="{{more_url}}" bindtap="jumpByRule">  
9 - <image class="titleMoreIm" src="../../images/more_ic@2x.png"></image>  
10 - </view> 6 + <view class='titleMore' wx:if='{{more_url?true:false}}' data-jump_rule="{{more_url}}" bindtap="jumpByRule">
  7 + <image class="titleMoreIm" src="../../images/more_ic@2x.png" ></image>
11 </view> 8 </view>
12 </view> 9 </view>
13 </template> 10 </template>
14 11
15 12
  13 +
  14 +<view class="container">
  15 +
  16 + <view class='newtop'>
  17 + <view class='newsearch' bindtap="searchTapped">
  18 + <image class="serachIcon" src="../../images/home_search@2x.png"></image>
  19 + <view class="serach_view_show">潮流单品搜一下</view>
  20 + </view>
  21 + <view class='scanCodeIconView'>
  22 + <image class="scanCodeIcon" catchtap="scanCodeTapped" src="../../images/home_qr_new@3x.png"></image>
  23 + </view>
  24 + <image bindtap='selectChannel' class="channelIcon" src='../../images/ceb-ic@2x.png'></image>
  25 + </view>
  26 + <image class='newTopImg' src='../../images/home-top-bg2@2x.png'></image>
  27 + <image wx:if='{{channelSelect}}' class='channelBg' src='../../images/channel-bg@2x.png'></image>
  28 + <form bindsubmit='formSubmitFromSwitchGender' report-submit='true'>
  29 +
  30 + <view class='channelContainer' wx:if='{{channelSelect}}'>
  31 +
  32 + <view class='channelItem' data-type="boy" bindtap="channelSelected">
  33 + <view class='indicator' style="background-color:{{selectedChannel=='boy' ? 'white':'transparent'}}"></view>
  34 + <view class='channelText' data-type="boy">男生
  35 + </view>
  36 + <button class='channelButton' style='top: 0rpx;'
  37 + form-type='submit' data-type="boy"></button>
  38 + </view>
  39 + <view class='channelItem' style='border-top: 1rpx solid #ececec;' bindtap="channelSelected" data-type="girl">
  40 + <view class='indicator' style="background-color:{{selectedChannel=='girl' ? 'white':'transparent'}}" ></view>
  41 + <view class='channelText' data-type="girl">女生
  42 + </view>
  43 + <button class='channelButton' style='top: 100rpx'
  44 + form-type='submit' data-type="girl"></button>
  45 + </view>
  46 +
  47 + <view class='channelItem' style='border-top: 1rpx solid #ececec;' bindtap="jumpToYohood">
  48 + <view class='channelText'>YOHOOD</view>
  49 + <button class='channelButton' style='top: 200rpx;' form-type='submit' data-type="yohood"></button>
  50 + </view>
  51 + </view>
  52 +
16 <scroll-view scroll-y="true" class="mainContainer"> 53 <scroll-view scroll-y="true" class="mainContainer">
17 54
18 <block wx:for='{{homelist}}' wx:key='{{index}}'> 55 <block wx:for='{{homelist}}' wx:key='{{index}}'>
1 -  
2 -.titleContainer {  
3 - display: flex;  
4 - flex-direction: column;  
5 - height: 100rpx;  
6 -}  
7 -.titleView{ 1 +.titleContainer{
8 background-color: white; 2 background-color: white;
9 display: flex; 3 display: flex;
10 flex-direction: row; 4 flex-direction: row;
@@ -15,7 +9,7 @@ @@ -15,7 +9,7 @@
15 width: 4rpx; 9 width: 4rpx;
16 height: 30rpx; 10 height: 30rpx;
17 background-color: #444444; 11 background-color: #444444;
18 - margin-left: 30rpx; 12 + margin-left: 20rpx;
19 } 13 }
20 .titleDesc{ 14 .titleDesc{
21 flex: 1; 15 flex: 1;
@@ -23,7 +17,7 @@ @@ -23,7 +17,7 @@
23 color: #444444; 17 color: #444444;
24 font-family: PingFang SC; 18 font-family: PingFang SC;
25 font-size:30rpx; 19 font-size:30rpx;
26 - margin-left: 20rpx; 20 + margin-left: 16rpx;
27 font-weight: 600; 21 font-weight: 600;
28 /* line-height: 2.75; */ 22 /* line-height: 2.75; */
29 } 23 }
@@ -35,7 +29,116 @@ @@ -35,7 +29,116 @@
35 align-items: center; 29 align-items: center;
36 justify-content: center; 30 justify-content: center;
37 } 31 }
  32 +
38 .titleMoreIm{ 33 .titleMoreIm{
39 width: 44rpx; 34 width: 44rpx;
40 height: 8rpx; 35 height: 8rpx;
41 } 36 }
  37 +
  38 +.newtop{
  39 + position: fixed;
  40 + top: 0;
  41 + left: 0;
  42 + height: 96rpx;
  43 + width: 100%;
  44 + /* background-color: #444444; */
  45 + display: flex;
  46 + flex-direction: row;
  47 + align-items: center;
  48 + z-index: 1000;
  49 +}
  50 +.newTopImg{
  51 + position: fixed;
  52 + top: 0;
  53 + left: 0;
  54 + height: 96rpx;
  55 + width: 100%;
  56 + z-index: 999;
  57 +}
  58 +.newsearch{
  59 + height: 70rpx;
  60 + width: 615rpx;
  61 + margin-left: 30rpx;
  62 + background-color: #ffffff;
  63 + display: flex;
  64 + flex-direction: row;
  65 + align-items: center;
  66 + border-radius: 10rpx;
  67 + top: 0rpx;
  68 + left: 0rpx
  69 +}
  70 +
  71 +.channelContainer{
  72 + width: 100%;
  73 + top: 96rpx;
  74 + position: fixed;
  75 + display: flex;
  76 + flex-direction: column;
  77 + height: wrap;
  78 + z-index: 1000;
  79 +}
  80 +.channelItem{
  81 + height: 100rpx;
  82 + width: 750rpx;
  83 + display: flex;
  84 + justify-content: center;
  85 + flex-direction: row;
  86 + align-items: center;
  87 +}
  88 +.serachIcon {
  89 + width: 30rpx;
  90 + height: 30rpx;
  91 + margin-left: 20rpx;
  92 +}
  93 +.channelBg{
  94 + position: fixed;
  95 + height: 302rpx;
  96 + width: 750rpx;
  97 + top: 96rpx;
  98 + z-index: 999;
  99 +}
  100 +.indicator{
  101 + width: 10rpx;
  102 + height: 10rpx;
  103 + background-color: white;
  104 +}
  105 +.channelText{
  106 + font-family: PingFang-SC;
  107 + font-size: 40rpx;
  108 + font-weight: 600;
  109 + text-align: left;
  110 + color: #ffffff;
  111 + margin-left: 20rpx
  112 +}
  113 +.channelIcon{
  114 + width: 48rpx;
  115 + height: 38rpx;
  116 + margin-left: 30rpx;
  117 + margin-right: 30rpx
  118 +}
  119 +.scanCodeIconView {
  120 + width: 70rpx;
  121 + height: 70rpx;
  122 + margin-left: -70rpx;
  123 + display: flex;
  124 + justify-content: center;
  125 + align-items: center;
  126 +}
  127 +
  128 +.scanCodeIcon {
  129 + width: 45rpx;
  130 + height: 45rpx;
  131 +}
  132 +
  133 +.serach_view_show {
  134 + display: block;
  135 + color: #b0b0b0;
  136 + font-size: 30rpx;
  137 + font-family: PingFang SC;
  138 + padding-left: 10rpx;
  139 +
  140 + font-weight: 500;
  141 + line-height: 2.57;
  142 + letter-spacing: 1.1px;
  143 + text-align: left;
  144 +}
@@ -13,6 +13,17 @@ export function getHomeFloorlist(params) { @@ -13,6 +13,17 @@ export function getHomeFloorlist(params) {
13 }); 13 });
14 } 14 }
15 15
  16 +export function getProductlist(params) {
  17 + return api.get({
  18 + data: {
  19 + ...params,
  20 + method: 'app.search.newLast7day',
  21 + page: 1,
  22 + limit: 50,
  23 + },
  24 + });
  25 +}
  26 +
16 export function parseHomeList(json, windowWidth, windowHeight, listImageWidth, listImageHeight){ 27 export function parseHomeList(json, windowWidth, windowHeight, listImageWidth, listImageHeight){
17 let newList=[]; 28 let newList=[];
18 let index = 1; 29 let index = 1;
@@ -133,5 +144,6 @@ export function parseHomeList(json, windowWidth, windowHeight, listImageWidth, l @@ -133,5 +144,6 @@ export function parseHomeList(json, windowWidth, windowHeight, listImageWidth, l
133 144
134 export default { 145 export default {
135 getHomeFloorlist, 146 getHomeFloorlist,
136 - parseHomeList 147 + parseHomeList,
  148 + getProductlist
137 }; 149 };