Commit e1bb7d08 by biao

111111

parent 3146b935
...@@ -6,6 +6,8 @@ Page({ ...@@ -6,6 +6,8 @@ Page({
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
page:0,
pageCount:0,
keyword: '', keyword: '',
faqList: [] faqList: []
}, },
...@@ -14,7 +16,11 @@ Page({ ...@@ -14,7 +16,11 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
keyword: options.key
});
//检索
}, },
/** /**
...@@ -26,7 +32,7 @@ Page({ ...@@ -26,7 +32,7 @@ Page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
this.getFaqList(); this.searchFaqList();
}, },
/** /**
...@@ -35,7 +41,7 @@ Page({ ...@@ -35,7 +41,7 @@ Page({
onShareAppMessage: function () {}, onShareAppMessage: function () {},
//获取在线答疑列表 //获取在线答疑列表
getFaqList() { searchFaqList() {
var that = this; var that = this;
var config = wx.getStorageSync('config'); var config = wx.getStorageSync('config');
//获取用户消息列表 //获取用户消息列表
...@@ -46,6 +52,8 @@ Page({ ...@@ -46,6 +52,8 @@ Page({
}, },
data: { data: {
unionId: config.unionId, unionId: config.unionId,
keyword: that.data.keyword,
page: that.data.page,
}, },
method: 'GET', method: 'GET',
dataType: 'json', dataType: 'json',
...@@ -53,7 +61,8 @@ Page({ ...@@ -53,7 +61,8 @@ Page({
console.log(res.data) console.log(res.data)
if (res.statusCode == 200) { if (res.statusCode == 200) {
that.setData({ that.setData({
faqList: res.data.result.faqList pageCount: res.data.result.pageCount,
faqList: that.data.faqList.concat(res.data.result.faqList)
}) })
} }
}, },
...@@ -68,6 +77,27 @@ Page({ ...@@ -68,6 +77,27 @@ Page({
}) })
}, },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
//触底以后加载更多
if ((this.data.page + 1) < this.data.pageCount) {
var pageIndex = this.data.page + 1
this.setData({
page: pageIndex
})
this.searchFaqList();
} else {
wx.showToast({
title: '没有更多咨询啦。',
icon: 'success',
duration: 2000
});
}
},
//点击检索
searchFaq() { searchFaq() {
if (this.data.keyword == null || this.data.keyword == '') { if (this.data.keyword == null || this.data.keyword == '') {
wx.showToast({ wx.showToast({
...@@ -77,6 +107,8 @@ Page({ ...@@ -77,6 +107,8 @@ Page({
}); });
return; return;
} }
this.searchFaqList();
}, },
//咨询详细页面 //咨询详细页面
......
...@@ -3,26 +3,14 @@ ...@@ -3,26 +3,14 @@
<image class='background-image' src='/img/faqTop.png' mode="widthFix"></image> <image class='background-image' src='/img/faqTop.png' mode="widthFix"></image>
</view> </view>
<view class="title" bindtap='back'> <view class="title" bindtap='back'>
<image src="/img/left1.png" style="width:40px;height:40px;margin-right:5px"></image>在线答疑 <image src="/img/left1.png" style="width:40px;height:40px;margin-right:5px"></image>在线答疑检索
</view>
<view class="titleArea">
<text>亲爱的志愿者\n欢迎来到志愿者服务大厅</text>
</view> </view>
<view class="searchArea"> <view class="searchArea">
<text>关键词索引</text> <text>关键词索引</text>
<input class="input" name="keyword" placeholder="搜索从这里开始" bindinput="keywordInput" placeholder-class="input_center" /> <input class="input" name="keyword" placeholder="搜索从这里开始" bindinput="keywordInput" placeholder-class="input_center" value='{{keyword}}'/>
<view bindtap="searchFaq">搜索</view> <view bindtap="searchFaq">搜索</view>
</view> </view>
<view class='topTitle'>
<view class='leftTitle'>
<view class='leftLine'></view>
<text class="hot_title">热门资讯</text>
</view>
<view class='rightTitle' bindtap='myFaq'>
<text>我的咨询</text>
<view></view>
</view>
</view>
<view class="content"> <view class="content">
<view class="hotFaqs"> <view class="hotFaqs">
<view bindtap='faqDetail' wx:for="{{faqList}}" class="faqItem" data-index="{{item.id}}" wx:key="{{index}}"> <view bindtap='faqDetail' wx:for="{{faqList}}" class="faqItem" data-index="{{item.id}}" wx:key="{{index}}">
......
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
"scene": null "scene": null
}, },
{ {
"id": -1, "id": 7,
"name": "在线答疑", "name": "在线答疑",
"pathName": "pages/faq/faq", "pathName": "pages/faq/faq",
"query": "", "query": "",
......
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