Commit 45c2d2cc by ArronYR

Merge branch 'master' of 123.56.28.111:qz-tour/wxapp

parents 8863f108 bf7ad3e3
...@@ -20,6 +20,7 @@ Component({ ...@@ -20,6 +20,7 @@ Component({
filter_idx: 0, filter_idx: 0,
selected: { selected: {
type: '0', type: '0',
city: '0',
catalog: '0', catalog: '0',
region: '0', region: '0',
tags: [] tags: []
...@@ -74,7 +75,13 @@ Component({ ...@@ -74,7 +75,13 @@ Component({
_selected.catalog = idx _selected.catalog = idx
_selected_titles.catalog = name _selected_titles.catalog = name
} else if (this.data.filter_idx == 3) { } else if (this.data.filter_idx == 3) {
_selected.region = idx if (name == '国内' || name == '国外') {
// 国内国外筛选
_selected.region = idx
} else {
// 城市筛选
_selected.city = idx
}
_selected_titles.region = name _selected_titles.region = name
} }
this.setData({ this.setData({
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
.filter-content-wrapper { .filter-content-wrapper {
position: fixed; position: fixed;
width: 100%; width: 100%;
top: 96px; top: 110px;
left: 0; left: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
......
...@@ -17,23 +17,47 @@ Page({ ...@@ -17,23 +17,47 @@ Page({
currentPage: 1, currentPage: 1,
loading: true, loading: true,
hasMore: true, hasMore: true,
filters: {
type: '0',
catalog: '0',
city: '0',
region: '0',
tags: []
}
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function(options) {
this.getListData() this.getListData()
}, },
/** /**
* 加载 * 加载
*/ */
getListData: function (callback){ getListData: function(callback) {
const p = this.data.currentPage const p = this.data.currentPage
api.search.index({ let params = {
p p: p
}).then(res => { }
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) { if (res.code) {
this.setData({ this.setData({
hasMore: false, hasMore: false,
...@@ -55,38 +79,37 @@ Page({ ...@@ -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({ this.setData({
projects: [], projects: [],
loading: true, loading: true,
hasMore: true, hasMore: true,
currentPage: 1 currentPage: 1
...@@ -105,7 +128,7 @@ Page({ ...@@ -105,7 +128,7 @@ Page({
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function() {
let that = this let that = this
if (that.data.loading || !that.data.hasMore) { if (that.data.loading || !that.data.hasMore) {
return; return;
...@@ -123,14 +146,18 @@ Page({ ...@@ -123,14 +146,18 @@ Page({
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () { onShareAppMessage: function() {
}, },
/** /**
* 用户进行了筛选操作 * 用户进行了筛选操作
*/ */
filterChange: function (event){ filterChange: function(event) {
console.log(event) let _filters = event.detail.filters
this.setData({
filters: _filters
})
wx.startPullDownRefresh()
} }
}) })
\ No newline at end of file
/* pages/search/index.wxss */ /* pages/search/index.wxss */
.page-wrapper{ .page-wrapper{
} }
.search-header{ .search-header{
background: white; background: white;
padding-top: 14px;
} }
.search-wrapper{ .search-wrapper{
display: flex; display: flex;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment