Commit b856ff3ca7ae96f109e4723f73862667f0525afd

Authored by vking
1 parent 1e7489a7

search

// components/common/feedback.js
const mans=[
'oB-xJ5KJCIasaEdgMRckqoL1cwg8',
'oB-xJ5BjnTvdgQGLHsjioNHH0eE8',
//'oB-xJ5BjnTvdgQGLHsjioNHH0eE8',
'oB-xJ5MEi2mTMrBTiYImD9cpGH6o',
'oB-xJ5OE1pM_17vNyWSMGqLH1vOg', //驴肉火烧多少钱一斤 MI 8
'oB-xJ5DIWrC6MECaXfql2GvTmQTU', //红旗 Redmi Note 7 Pro
... ...
... ... @@ -13,6 +13,10 @@ Component({
type:String,
value:"",
},
hasHistory:{
type:Boolean,
value:false,
},
},
/**
... ...
<!--components/reserve/search/item.wxml-->
<view class="item item{{item.type}} flex-ll" bindtap="detailGo">
<view class="history flex-lr" bindtap="detailGo" wx:if="{{hasHistory}}">
<view class="icon icon{{item.type}}"></view>
<view class="text">{{item.title}}</view>
</view>
<view class="item item{{item.type}} flex-ll" bindtap="detailGo" wx:else="">
<view class="icon"></view>
<view class="flex-lr item-info">
<view class="info">
... ...
... ... @@ -35,7 +35,8 @@
margin-right: 20rpx;
width: 22rpx;
height:26rpx;
background-image: url("http://qn.colorcun.com/custom/lite-online/image/addr.png");
background-image: url("http://qn.colorcun.com/reserve/images/addr.png");
background-size: 100% 100%;
}
.item-1 .info{
width: calc(100% - 140rpx);
... ... @@ -48,7 +49,7 @@
padding: 20rpx;
}
.item-1 .icon {
background-color: #C0A369;
background-image: url("http://qn.colorcun.com/reserve/images/sea-se.png");
width: 36rpx;
height: 36rpx;
min-width: 36rpx;
... ... @@ -66,4 +67,31 @@
text-align: center;
min-width: 120rpx;
margin-left: 20rpx;
}
.history{
line-height: 50rpx;
font-size: 28rpx;
height:50rpx;
background:rgba(245,245,245,1);
border-radius:4px;
font-weight:500;
float: left;
padding: 0 10rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
}
.history .icon{
background-size: 100% 100%;
margin-right: 10rpx;
width: 20rpx;
height: 22rpx;
min-width: 22rpx;
background-image: url("http://qn.colorcun.com/reserve/images/addr.png");
}
.history .icon-1{
width: 24rpx;
height: 18rpx;
min-width: 24rpx;
background-image: url("http://qn.colorcun.com/reserve/images/his-se.png");
}
\ No newline at end of file
... ...
... ... @@ -8,8 +8,6 @@ var qqmapsdk = new QQMapWX({
});
import util from '../../utils/util';
import App from '../../utils/api';
const {regeneratorRuntime} = global
const search_history_cache_key='SEARCH_HISTORY_CACHE_KEY';
Page({
/**
... ... @@ -60,26 +58,24 @@ Page({
},
getHistory(){
App.Customer.GetHistorySearch().then(res=>{
let mks=[]
res.data.forEach(h=>{
mks.push({ // 获取返回结果,放到mks数组中
title: h.name,
id: h.sid,
addr: '',
city: '',
district: 0,
latitude: h.latitude,
longitude: h.longitude,
type:h.type==1?-1:h.type,
})
})
this.setData({
history:res.data
history:mks
})
})
},
setHistory(item){
let newca=[item];
let ca=this.data.history;
let maxL=20;
for(let i=0;i<ca.length;i++){
if(ca[i].id!=item.id){
newca.push(ca[i]);
}
if(newca.length>maxL) break;
}
util.cache(search_history_cache_key,newca);
this.setData({
history:newca,
})
},
//在Page({})中使用下列代码
//数据回填方法
backfill: function (e) {
... ... @@ -87,7 +83,6 @@ Page({
for (var i = 0; i < this.data.suggestion.length; i++) {
if (i == id) {
console.log('backfill,this.data.suggestion[i]:',this.data.suggestion[i])
this.setHistory(this.data.suggestion[i])
let pages = getCurrentPages();
let p = pages[pages.length - 2];
p.setSuggestion(this.data.suggestion[i])
... ... @@ -99,25 +94,6 @@ Page({
}
}
},
backHistoryFill: function (e) {
var i = util.attr(e,'index');
let item=this.data.history[i];
item.title=item.name
console.log(item)
if(item.type==1){
}else{
}
this.setData({
backfill: item.title
});
let pages = getCurrentPages();
let p = pages[pages.length - 2];
p.setSuggestion(item)
wx.navigateBack();
},
inputVal:'',
//触发关键词输入提示事件
getsuggest: function (e) {
... ... @@ -283,4 +259,7 @@ Page({
})
}
},
historyEmpty(){
App.Customer.DelHistorySearch()
},
})
\ No newline at end of file
... ...
... ... @@ -24,16 +24,11 @@
<view class="pages">
<view class="flex-lr">
<view class="history-title">最近搜索</view>
<view class="history-empty"></view>
<view class="history-empty" bindtap="historyEmpty"></view>
</view>
<view class="history-list">
<view class="flex-ll item" wx:for="{{history}}" wx:key="history.key"
bindtap="backHistoryFill" data-index="{{index}}">
<view class="icon-view icon-view-{{item.type}}"></view>
<view class="info">{{item.name}}</view>
</view>
<block wx:for="{{history}}" wx:key="history.key">
<search-item item="{{item}}" bindclick="searchItemClick"></search-item>
<search-item item="{{item}}" hasHistory bindclick="searchItemClick"></search-item>
</block>
</view>
</view>
... ...
... ... @@ -33,18 +33,7 @@
.res-view{
margin-top: 110rpx;
}
.res-item{
width: 100%;
border-bottom: 2rpx solid #cccccc;
padding: 20rpx 0;
}
.res-item .label{
font-size: 30rpx;
}
.res-item .address{
font-size: 24rpx;
color:#4C4E4F;
}
.search-but{
min-width: 140rpx;
color:#000000;
... ... @@ -65,41 +54,7 @@
font-weight:600;
margin-bottom: 20rpx;
}
.hr-one{
height: 2rpx;
background-color: #F5F5F5;
width: 110%;
margin: 18rpx -5% 0;
}
.history .item{
line-height: 50rpx;
font-size: 28rpx;
height:50rpx;
background:rgba(245,245,245,1);
border-radius:4px;
font-weight:500;
float: left;
padding: 0 10rpx;
margin-right: 20rpx;
margin-bottom: 20rpx;
}
.history .icon-view{
width: 20rpx;
height: 22rpx;
min-width: 22rpx;
margin-right: 10rpx;
background-image: url("http://qn.colorcun.com/custom/lite-online/image/addr.png");
background-size: 100% 100%;
}
.history .icon-view-1{
width: 24rpx;
height: 18rpx;
min-width: 24rpx;
margin-right: 10rpx;
background-image: none;
background-color: #999;
background-size: 100% 100%;
}
.see-more{
width: 100%;
height: 34rpx;
... ... @@ -138,5 +93,6 @@
.history-empty{
width: 28rpx;
height: 28rpx;
background-color: #999;
background-image: url("http://qn.colorcun.com/reserve/images/empty.png");
background-size: 100% 100%;
}
\ No newline at end of file
... ...
... ... @@ -329,7 +329,9 @@ export default {
openid:'openid'
},
//搜索相关
'App.Customer.DelHistorySearch':null,
'App.Customer.DelHistorySearch':{
openid:'openid'
},
//搜索相关
'App.Customer.GetHistorySearch':{
openid:'openid',
... ...