Commit 79dea6de by tangjinlin

0512

parents 53038205 e1bb7d08
......@@ -51,7 +51,8 @@
"pages/editCircle/editCircle",
"pages/editCircle2/editCircle2",
"pages/faq/faq",
"pages/myFaq/myFaq"
"pages/myFaq/myFaq",
"pages/faqSearch/faqSearch"
],
"window": {
"backgroundTextStyle": "light",
......
......@@ -77,6 +77,10 @@ Page({
});
return;
}
//跳转到检索页面
wx.navigateTo({
url: '../faqSearch/faqSearch?key=' + this.data.keyword,
})
},
//咨询详细页面
......
<!--pages/myNews/myNews.wxml-->
<view class="topBg">
<image class='background-image' src='/img/faqTop.png' mode="widthFix"></image>
</view>
<image class='background-image' src='/img/faqTop.png' mode="widthFix"></image>
<view class="title" bindtap='back'>
<image src="/img/left1.png" style="width:40px;height:40px;margin-right:5px"></image>在线答疑
</view>
......@@ -28,7 +26,7 @@
<view bindtap='faqDetail' wx:for="{{faqList}}" class="faqItem" data-index="{{item.id}}" wx:key="{{index}}">
<view class="faqContent">
<view class="faqRow1">
<view class="faqCotent">{{item.content}}</view>
<text class="faqCotent">{{item.content}}</text>
<view class="faqReplycount">回复:{{item.reply_count}}</view>
</view>
<view class="faqRow2">最佳答案:{{item.best_detail_content}}</view>
......
......@@ -57,7 +57,7 @@
.searchArea>input {
flex: 1;
margin-right:10px;
margin-right: 10px;
height: 40px;
line-height: 40px;
font-size: 14px;
......@@ -139,7 +139,7 @@
width: 100%;
height: 100%;
position: absolute;
top: 45%;
top: 47%;
}
.hotFaqs {
......@@ -175,6 +175,14 @@
word-break: break-all;
}
.faqRow1 text {
font-size: 16px;
}
.faqReplycount {
font-size: 14px;
}
.newFaqButton {
position: fixed;
bottom: 0;
......
// pages/myNews/myNews.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
page: 0,
pageCount: 0,
keyword: '',
faqList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
keyword: options.key
});
//检索
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.searchFaqList();
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {},
//获取在线答疑列表
searchFaqList() {
var that = this;
var config = wx.getStorageSync('config');
//获取用户消息列表
wx.request({
url: app.url + 'ajax_get_faq_top_dat.php',
header: {
'content-type': 'application/json'
},
data: {
unionId: config.unionId,
keyword: that.data.keyword,
page: that.data.page,
},
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res.data)
if (res.statusCode == 200) {
that.setData({
pageCount: res.data.result.pageCount,
faqList: that.data.faqList.concat(res.data.result.faqList)
})
}
},
fail: function (res) {},
complete: function (res) {},
})
},
keywordInput(e) {
this.setData({
keyword: e.detail.value
})
},
/**
* 页面上拉触底事件的处理函数
*/
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({
title: '请输入关键词',
icon: 'success',
duration: 1500
});
return;
}
this.setData({
page: 0,
faqList: []
})
this.searchFaqList();
},
//咨询详细页面
faqDetail(e) {
let faqId = e.currentTarget.dataset['index']
wx.navigateTo({
url: '../faqDetail/faqDetail?faqId=' + faqId,
})
},
//我的咨询
myFaq(e) {
wx.navigateTo({
url: '../myFaq/myFaq',
})
},
//立即咨询
newFaq(e) {
wx.navigateTo({
url: '../newFaq/newFaq',
})
},
back: function () {
wx.navigateBack({
delta: 1
})
},
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "在线答疑",
"onReachBottomDistance":100
}
\ No newline at end of file
<!--pages/myNews/myNews.wxml-->
<custom-navi text="返回" back="{{true}}" home="{{true}}" bg1="#fff" bg2="#fff" bg3="#fff"></custom-navi>
<view class="searchArea">
<text>关键词索引</text>
<input class="input" name="keyword" placeholder="搜索从这里开始" bindinput="keywordInput" placeholder-class="input_center" value='{{keyword}}'/>
<view bindtap="searchFaq">搜索</view>
</view>
<view class="content">
<view class="hotFaqs">
<view bindtap='faqDetail' wx:for="{{faqList}}" class="faqItem" data-index="{{item.id}}" wx:key="{{index}}">
<view class="faqContent">
<view class="faqRow1">
<view class="faqCotent">{{item.content}}</view>
<view class="faqReplycount">回复:{{item.reply_count}}</view>
</view>
<view class="faqRow2">最佳答案:{{item.best_detail_content}}</view>
</view>
</view>
</view>
<view bindtap='newFaq' class="newFaqButton">
<view>立即咨询</view>
</view>
</view>
\ No newline at end of file
/* pages/myNews/faq.wxss */
.searchArea {
position: fixed;
top: 8%;
width: 100%;
height: 60px;
background-color: #fff;
z-index: 190;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.searchArea text {
font-size: 16px;
font-weight: 400;
margin: 0 10px;
}
.searchArea>input {
flex: 1;
margin-right:10px;
height: 40px;
line-height: 40px;
font-size: 14px;
background: #f6f6f6;
border-radius: 30px;
text-align: center;
}
.searchArea view {
font-size: 16px;
color: #fb689b;
font-weight: 400;
margin: 0 10px;
}
.input_center {
text-align: center;
color: #bcbcbc;
}
.content {
width: 100%;
height: 100%;
position: absolute;
top: 15%;
margin-bottom: 60px;
}
.hotFaqs {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.faqItem {
width: 100%;
margin-top: 20px;
}
.faqContent {
margin: 0 3%;
padding: 3% 5%;
display: flex;
flex-direction: column;
border-radius: 10px;
box-shadow: 0 0 8px -3px rgb(0, 0, 0, 0.3);
}
.faqRow1 {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-bottom: 10px;
}
.faqRow1 .faqCotent {
width: 80%;
word-break: break-all;
}
.newFaqButton {
position: fixed;
bottom: 0;
width: 100%;
display: flex;
align-items: center;
/* background: #fff; */
}
.newFaqButton view {
text-align: center;
margin: 0 auto;
width: 80%;
height: 50px;
line-height: 50px;
border-radius: 25px;
margin-bottom: 10px;
background: linear-gradient(to right, #e85c6d, #fb689b);
color: #fff;
font-size: 18px;
}
\ No newline at end of file
......@@ -96,7 +96,7 @@
"scene": null
},
{
"id": -1,
"id": 7,
"name": "在线答疑",
"pathName": "pages/faq/faq",
"query": "",
......@@ -106,6 +106,13 @@
"id": -1,
"name": "pages/myFaq/myFaq",
"pathName": "pages/myFaq/myFaq",
"query": "",
"scene": null
},
{
"id": -1,
"name": "pages/faqSearch/faqSearch",
"pathName": "pages/faqSearch/faqSearch",
"scene": null
}
]
......
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