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
620c3116
Commit
620c3116
authored
Sep 27, 2018
by
汪睦雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
fa9a74f2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
17 deletions
+53
-17
components/search-filter/index.js
+8
-1
pages/search/index.js
+44
-16
pages/search/index.wxss
+1
-0
No files found.
components/search-filter/index.js
View file @
620c3116
...
...
@@ -20,6 +20,7 @@ Component({
filter_idx
:
0
,
selected
:
{
type
:
'0'
,
city
:
'0'
,
catalog
:
'0'
,
region
:
'0'
,
tags
:
[]
...
...
@@ -74,7 +75,13 @@ Component({
_selected
.
catalog
=
idx
_selected_titles
.
catalog
=
name
}
else
if
(
this
.
data
.
filter_idx
==
3
)
{
_selected
.
region
=
idx
if
(
name
==
'国内'
||
name
==
'国外'
)
{
// 国内国外筛选
_selected
.
region
=
idx
}
else
{
// 城市筛选
_selected
.
city
=
idx
}
_selected_titles
.
region
=
name
}
this
.
setData
({
...
...
pages/search/index.js
View file @
620c3116
...
...
@@ -17,23 +17,47 @@ Page({
currentPage
:
1
,
loading
:
true
,
hasMore
:
true
,
filters
:
{
type
:
'0'
,
catalog
:
'0'
,
city
:
'0'
,
region
:
'0'
,
tags
:
[]
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
onLoad
:
function
(
options
)
{
this
.
getListData
()
},
/**
* 加载
*/
getListData
:
function
(
callback
)
{
getListData
:
function
(
callback
)
{
const
p
=
this
.
data
.
currentPage
api
.
search
.
index
({
p
}).
then
(
res
=>
{
let
params
=
{
p
:
p
}
if
(
this
.
data
.
filters
.
tags
.
length
>
0
)
{
params
[
'tags'
]
=
JSON
.
stringify
(
this
.
data
.
filters
.
tags
)
}
if
(
parseInt
(
this
.
data
.
filters
.
city
)
>
0
)
{
params
[
'city'
]
=
this
.
data
.
filters
.
city
}
if
(
parseInt
(
this
.
data
.
filters
.
region
)
>
0
)
{
params
[
'region_type'
]
=
this
.
data
.
filters
.
region
}
if
(
parseInt
(
this
.
data
.
filters
.
type
)
>
0
)
{
params
[
'type'
]
=
this
.
data
.
filters
.
type
}
if
(
parseInt
(
this
.
data
.
filters
.
catalog
)
>
0
)
{
params
[
'catalog_id'
]
=
this
.
data
.
filters
.
catalog
}
// 请求数据接口
api
.
search
.
index
(
params
).
then
(
res
=>
{
if
(
res
.
code
)
{
this
.
setData
({
hasMore
:
false
,
...
...
@@ -55,38 +79,37 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady
:
function
()
{
onReady
:
function
()
{
},
/**
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
onShow
:
function
()
{
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide
:
function
()
{
onHide
:
function
()
{
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload
:
function
()
{
onUnload
:
function
()
{
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh
:
function
()
{
onPullDownRefresh
:
function
()
{
this
.
setData
({
projects
:
[],
loading
:
true
,
hasMore
:
true
,
currentPage
:
1
...
...
@@ -105,7 +128,7 @@ Page({
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom
:
function
()
{
onReachBottom
:
function
()
{
let
that
=
this
if
(
that
.
data
.
loading
||
!
that
.
data
.
hasMore
)
{
return
;
...
...
@@ -123,14 +146,18 @@ Page({
/**
* 用户点击右上角分享
*/
onShareAppMessage
:
function
()
{
onShareAppMessage
:
function
()
{
},
/**
* 用户进行了筛选操作
*/
filterChange
:
function
(
event
){
console
.
log
(
event
)
filterChange
:
function
(
event
)
{
let
_filters
=
event
.
detail
.
filters
this
.
setData
({
filters
:
_filters
})
wx
.
startPullDownRefresh
()
}
})
\ No newline at end of file
pages/search/index.wxss
View file @
620c3116
/* pages/search/index.wxss */
.page-wrapper{
}
.search-header{
background: white;
...
...
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