Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wxapp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
亲子游项目
wxapp
Commits
133e2d7c
Commit
133e2d7c
authored
Sep 26, 2018
by
汪睦雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
10f2a528
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
179 additions
and
27 deletions
+179
-27
components/search-filter/index.js
+31
-6
components/search-filter/index.wxml
+38
-12
components/search-filter/index.wxss
+106
-6
images/icon_filter_selected.png
+0
-0
pages/search/index.json
+1
-0
pages/search/index.wxml
+1
-1
pages/search/index.wxss
+2
-2
No files found.
components/search-filter/index.js
View file @
133e2d7c
// components/search-filter/index.js
import
api
from
'../../utils/Api.js'
const
app
=
getApp
()
Component
({
/**
...
...
@@ -14,14 +13,23 @@ Component({
* 组件的初始数据
*/
data
:
{
types
:
[],
catalogs
:
[],
regions
:
[],
tags
:
[],
filter_idx
:
0
},
/**
* 组件
的初始数据
* 组件
渲染完后的方法
*/
ready
(){
api
.
home
.
banner
({
token
:
app
.
globalData
.
token
}).
then
(
res
=>
{
console
.
log
(
res
)
api
.
search
.
filter
().
then
(
res
=>
{
this
.
setData
({
types
:
res
.
data
.
type
,
catalogs
:
res
.
data
.
catalog_id
,
regions
:
res
.
data
.
city
,
tags
:
res
.
data
.
tags
})
})
},
...
...
@@ -29,10 +37,27 @@ Component({
* 组件的方法列表
*/
methods
:
{
firstTap
:
function
(){
filterTap
:
function
(
event
){
let
idx
=
event
.
target
.
dataset
.
idx
;
if
(
idx
==
this
.
data
.
filter_idx
){
this
.
setData
({
filter_idx
:
0
})
}
else
{
this
.
setData
({
filter_idx
:
idx
})
}
if
(
idx
==
1
){
}
else
if
(
idx
==
2
)
{
}
var
myEventDetail
=
{
test
:
"helloworld"
}
// detail对象,提供给事件监听函数
var
myEventOption
=
{}
// 触发事件的选项
this
.
triggerEvent
(
'change'
,
myEventDetail
,
myEventOption
)
},
closeFilter
:
function
(
event
){
this
.
setData
({
filter_idx
:
0
})
},
preventEvent
:
function
(
event
)
{
}
}
})
components/search-filter/index.wxml
View file @
133e2d7c
<!--components/search-filter/index.wxml-->
<i-row i-class='row-filter'>
<view class='filter-wrapper'>
<i-row i-class='row-filter'>
<i-col span="6">
<view class="filter-item" bindtap='firstTap'
>
<text class='active'
>全部项目</text>
<image class="search-icon" src='/images/icon-down-select.png'
></image>
<view class="filter-item"
>
<text class="{{filter_idx==1?'active':''}}" catchtap='filterTap' data-idx="1"
>全部项目</text>
<image class="search-icon" src="/images/icon-down-select{{filter_idx==1?'ed':''}}.png"
></image>
</view>
</i-col>
<i-col span="6" i-class="col-class">
<view class="filter-item">
<text
>分类</text>
<image class="search-icon" src='/images/icon-down-select.png'
></image>
<text class="{{filter_idx==2?'active':''}}" catchtap='filterTap' data-idx="2"
>分类</text>
<image class="search-icon" src="/images/icon-down-select{{filter_idx==2?'ed':''}}.png"
></image>
</view>
</i-col>
<i-col span="6" i-class="col-class">
<view class="filter-item">
<text
>地域</text>
<image class="search-icon" src='/images/icon-down-select.png'
></image>
<text class="{{filter_idx==3?'active':''}}" catchtap='filterTap' data-idx="3"
>地域</text>
<image class="search-icon" src="/images/icon-down-select{{filter_idx==3?'ed':''}}.png"
></image>
</view>
</i-col>
<i-col span="6" i-class="col-class">
<view class="filter-item">
<text
>标签</text>
<image class="search-icon" src='/images/icon-down-select.png'
></image>
<text class="{{filter_idx==4?'active':''}}" catchtap='filterTap' data-idx="4"
>标签</text>
<image class="search-icon" src="/images/icon-down-select{{filter_idx==4?'ed':''}}.png"
></image>
</view>
</i-col>
</i-row>
<view>
</i-row>
<view catchtap='closeFilter' class='filter-content-wrapper' wx:if="{{filter_idx>0}}">
<view class="row-content" catchtap='preventEvent'>
<view wx:if="{{filter_idx==1}}" class='filter-row' wx:for="{{types}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id">
<text>{{n.name}}</text>
<image class='f-selected' src='/images/icon_filter_selected.png'></image>
</view>
<view wx:if="{{filter_idx==2}}" class='filter-row' wx:for="{{catalogs}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id">
<text>{{n.name}}</text>
<image class='f-selected' src='/images/icon_filter_selected.png'></image>
</view>
<view wx:if="{{filter_idx==3}}" class='filter-row' wx:for="{{regions}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id">
<text>{{n.name}}</text>
<image class='f-selected' src='/images/icon_filter_selected.png'></image>
</view>
<view class="tags-wrapper" wx:if="{{filter_idx==4}}">
<view class="tag-item {{n.selected==1?'active':''}}" wx:for="{{tags}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id">
{{n.name}}
</view>
<view class="tag-btn-wrapper">
<button class="btn cancel">取消选择</button>
<button class="btn ensure">确定</button>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
components/search-filter/index.wxss
View file @
133e2d7c
/* components/search-filter/index.wxss */
.row-filter{
padding: 36rpx 0px;
.filter-wrapper {
position: relative;
width: 100%;
}
.row-filter {
height: 56px;
line-height: 56px;
}
.filter-item{
.filter-item {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.filter-item > image{
.filter-item > image {
width: 12rpx;
height: 10rpx;
margin-left: 12rpx;
}
.filter-item > text{
.filter-item > text {
color: rgb(51, 51, 51);
font-size: 28rpx;
}
.filter-item > text.active{
.filter-item > text.active {
color: rgb(43, 163, 215);
}
.filter-content-wrapper {
position: fixed;
width: 100%;
top: 96px;
left: 0;
bottom: 0;
right: 0;
background: rgba(0, 0, 0, 0.3);
}
.row-content {
position: relative;
border-top: 1px solid #f4f4f4;
background: white;
width: 100%;
padding: 34rpx 30rpx;
padding-right: 50rpx;
box-sizing: border-box;
}
.filter-row {
width: 100%;
display: flex;
align-items: center;
box-sizing: border-box;
justify-content: space-between;
font-size: 28rpx;
color: rgb(191, 191, 191);
margin-bottom: 46rpx;
}
.filter-row:last-child {
margin-bottom: 0rpx;
}
.filter-row > .f-selected {
height: 27rpx;
width: 23rpx;
}
.tags-wrapper {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-items: center;
}
.tag-item {
min-width: 120rpx;
padding: 0 10rpx 0 10rpx;
height: 75rpx;
border: 1px solid #f4f4f4;
color: rgb(102, 102, 102);
font-size: 26rpx;
display: flex;
align-items: center;
justify-content: center;
margin: 10rpx;
border-radius: 2rpx;
}
.tag-btn-wrapper {
display: block;
width: 100%;
margin-top: 30rpx;
text-align: center;
}
.tag-btn-wrapper > button.btn {
display: inline-block;
background: none;
font-size: 14px;
height: 60rpx;
border-radius: 30rpx;
line-height: 60rpx;
outline-style: none;
}
.tag-btn-wrapper > button.cancel {
border: 1px solid #eee;
color: rgb(102, 102, 102);
margin-right: 30rpx;
}
.tag-btn-wrapper > button.ensure {
border: 1px solid rgb(43, 163, 215);
color: rgb(43, 163, 215);
}
images/icon_filter_selected.png
0 → 100755
View file @
133e2d7c
672 Bytes
pages/search/index.json
View file @
133e2d7c
{
"navigationBarTitleText"
:
"搜索"
,
"usingComponents"
:
{
"search-filter"
:
"/components/search-filter/index"
}
...
...
pages/search/index.wxml
View file @
133e2d7c
<!--pages/search/index.wxml-->
<view class="
head
er">
<view class="
page-wrapp
er">
<view class='search-wrapper'>
<image class="search-icon" src='/images/icon_search.png'></image>
<view class='search-input'>关键词如地名、游泳等</view>
...
...
pages/search/index.wxss
View file @
133e2d7c
/* pages/search/index.wxss */
.
head
er{
.
page-wrapp
er{
background: white;
}
.search-wrapper{
...
...
@@ -10,7 +10,7 @@
background: rgb(247, 247, 247);
box-sizing: border-box;
border: 4rpx;
height:
80r
px;
height:
40
px;
padding-left: 20rpx;
}
.search-icon{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment