Commit e1bb7d08 by biao

111111

parent 3146b935
......@@ -6,6 +6,8 @@ Page({
* 页面的初始数据
*/
data: {
page:0,
pageCount:0,
keyword: '',
faqList: []
},
......@@ -14,7 +16,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
keyword: options.key
});
//检索
},
/**
......@@ -26,7 +32,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getFaqList();
this.searchFaqList();
},
/**
......@@ -35,7 +41,7 @@ Page({
onShareAppMessage: function () {},
//获取在线答疑列表
getFaqList() {
searchFaqList() {
var that = this;
var config = wx.getStorageSync('config');
//获取用户消息列表
......@@ -46,6 +52,8 @@ Page({
},
data: {
unionId: config.unionId,
keyword: that.data.keyword,
page: that.data.page,
},
method: 'GET',
dataType: 'json',
......@@ -53,7 +61,8 @@ Page({
console.log(res.data)
if (res.statusCode == 200) {
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({
})
},
/**
* 页面上拉触底事件的处理函数
*/
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() {
if (this.data.keyword == null || this.data.keyword == '') {
wx.showToast({
......@@ -77,6 +107,8 @@ Page({
});
return;
}
this.searchFaqList();
},
//咨询详细页面
......
......@@ -3,26 +3,14 @@
<image class='background-image' src='/img/faqTop.png' mode="widthFix"></image>
</view>
<view class="title" bindtap='back'>
<image src="/img/left1.png" style="width:40px;height:40px;margin-right:5px"></image>在线答疑
</view>
<view class="titleArea">
<text>亲爱的志愿者\n欢迎来到志愿者服务大厅</text>
<image src="/img/left1.png" style="width:40px;height:40px;margin-right:5px"></image>在线答疑检索
</view>
<view class="searchArea">
<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>
<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="hotFaqs">
<view bindtap='faqDetail' wx:for="{{faqList}}" class="faqItem" data-index="{{item.id}}" wx:key="{{index}}">
......
......@@ -96,7 +96,7 @@
"scene": null
},
{
"id": -1,
"id": 7,
"name": "在线答疑",
"pathName": "pages/faq/faq",
"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