Commit 08849e02 by tangjinlin

0514

parent 7b168261
......@@ -53,7 +53,8 @@
"pages/faq/faq",
"pages/myFaq/myFaq",
"pages/faqSearch/faqSearch",
"pages/faqDetail/faqDetail"
"pages/faqDetail/faqDetail",
"pages/faqConsult/faqConsult"
],
"window": {
"backgroundTextStyle": "light",
......
......@@ -37,6 +37,15 @@
<scroll-view scroll-y="true" style='height:{{listH}}px;bottom:10rpx;' wx:if="{{erjiTab==-1}}" class="listPublicWelfare" bindscrolltolower='loadMore'>
<swiper style="width:100%;height:342rpx;border-radius: 0 0 5px 5px;" indicator-dots="true" autoplay="false" interval="2000" duration="500">
<block wx:for="{{resultList.topMediaList}}" wx:key="id">
<swiper-item>
<navigator url="">
<image src="{{item.front_image}}" style="width:100%;border-radius: 0 0 5px 5px;" mode="widthFix" />
</navigator>
</swiper-item>
</block>
</swiper>
<block wx:for="{{resultList.recommendMediaList}}" wx:for-item="rec" wx:key="resultList.recommendMediaList">
<view class='recommend' wx:if="{{rec.mediaList.length != 0}}">
<view class="topContent">
......
......@@ -8,6 +8,7 @@
border-radius: 10px;
box-shadow: 1px 1px 8px -2px rgba(0, 0, 0, 0.3);
margin-left: 5%;
margin-bottom: 10px;
}
.entrance .bgColor {
......@@ -46,7 +47,7 @@
.recommend {
display: flex;
flex-direction: column;
margin-bottom: 10px;
margin-bottom: 15px;
}
.recommend .topContent {
......
......@@ -101,7 +101,7 @@ Page({
//立即咨询
newFaq(e) {
wx.navigateTo({
url: '../newFaq/newFaq',
url: '../faqConsult/faqConsult',
})
},
......
{
"usingComponents": {},
"navigationBarTitleText": "在线答疑",
"onReachBottomDistance":100
"navigationBarTitleText": "在线答疑"
}
\ No newline at end of file
// pages/myNews/myNews.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
keyword: '',
fileList: [],
imgPaths: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {},
//
delete(event) {
const {
index
} = event.detail;
const fList = this.data[`fileList`];
const imgList = this.data[`imgPaths`];
fList.splice(index, 1);
imgList.splice(index, 1);
this.setData({
[`fileList`]: fList,
[`imgPaths`]: imgList
});
},
afterRead(event) {
const {
file
} = event.detail;
const fList = this.data[`fileList`];
let images = this.data.imgPaths;
file.forEach(item => {
images.push(item.path)
})
this.setData({
[`fileList`]: fList.concat(file),
imgPaths: images
});
},
beforeRead(event) {
const {
file,
callback
} = event.detail;
if (file[0].path.indexOf('jpg') < 0 && file[0].path.indexOf('png') < 0) {
wx.showToast({
title: '请选择图片文件上传',
icon: 'none'
});
callback(false);
return;
}
callback(true);
},
//上传素材
upload() {
var that = this;
console.log(that.data.imgPaths)
//感想必须输入
if (that.data.keyword == null || that.data.keyword.trim() == "") {
Notify('请输入文字')
return
}
var config = wx.getStorageSync('config');
wx.request({
url: app.url + 'ajax_set_faq_new.php',
data: {
unionId: config.unionId,
content: that.data.keyword,
},
header: { 'content-type': 'application/json' },
method: 'GET',
dataType: 'json',
success: function (res) {
//循环上传图片
console.log(res)
var completeCount = 0;
for (var i = 0; i < that.data.imgPaths.length; i++) {
//停顿1秒
var imgPath = that.data.imgPaths[i];
console.log(imgPath)
setTimeout(function () {
wx.uploadFile({
url: app.url + 'ajax_set_faq_new.php?unionId=' + config.unionId + "&faqId=" + res.data.result.faqDat.id,
filePath: imgPath,
name: 'images',
header: { 'content-type': 'multipart/form-data' },
success: function (res) {
},
fail: function (res) {
console.log(res, '上传失败')
},
complete: function (res) {
completeCount++;
},
})
}, 1000) //延迟时间 这里是1秒
}
//循环执行等待全部结束
var a = setInterval(function () {
//循环执行代码
if (that.data.imgPaths.length == completeCount) {
//跳转到首页
wx.showToast({
title: '上传成功!',
icon: 'success',
duration: 2000
});
clearInterval(a)
//返回上一页
wx.navigateBack({
delta: 1
})
}
}, 1000) //循环时间 这里是1秒
},
fail: function (res) { },
complete: function (res) { },
})
},
keywordInput(e) {
this.setData({
keyword: e.detail.value
})
},
back: function () {
wx.navigateBack({
delta: 1
})
},
})
\ No newline at end of file
{
"usingComponents": {},
"navigationBarTitleText": "立即咨询"
}
\ 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="content">
<view class="top">
<view class="title">
<view class="leftLine" style="background:#eb5e76"></view>
<text>文字</text>
(100字以内)
</view>
<textarea bindinput="keywordInput"></textarea>
</view>
<view class="top">
<view class="title">
<view class="leftLine" style="background:#efc04c"></view>
<text>图片</text>
(至多上传6张)
</view>
</view>
<view class="upload">
<van-uploader file-list="{{ fileList }}" max-count="6" multiple bind:after-read="afterRead" bind:before-read="beforeRead" use-before-read="{{ true }}" bind:delete="delete"/>
</view>
</view>
<view bindtap='upload' class="newFaqButton">
<view>发布</view>
</view>
\ No newline at end of file
/* pages/myNews/faq.wxss */
.content {
position: fixed;
width: 100%;
height: 100%;
}
.content .top {
padding: 0 5%;
}
.content .upload {
padding: 0 5%;
}
.content .title {
display: flex;
flex-direction: row;
align-items: center;
color: #999999;
font-size: 16px;
margin: 20px 0;
}
.content .leftLine {
width: 6px;
height: 22px;
border-radius: 3px;
background: #eb5e76;
}
.content .title text {
color: #333333;
font-size: 18px;
font-weight: bold;
margin: 0 10px;
}
.content .top textarea {
width: 100%;
height: 100px;
}
.newFaqButton {
position: fixed;
bottom: 0;
width: 100%;
display: flex;
align-items: center;
}
.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
......@@ -6,10 +6,12 @@ Page({
* 页面的初始数据
*/
data: {
faqId:0,
isOwner:false,
faqDat:null,
faqDetailList:[],
faqId: 0,
isOwner: false,
faqDat: null,
faqDetailList: [],
answerFlag: false,
answerInfo: ''
},
/**
......@@ -33,7 +35,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getFaqDetail();
// this.getFaqDetail();
},
/**
......@@ -58,7 +60,6 @@ Page({
method: 'GET',
dataType: 'json',
success: function (res) {
console.log(res.data)
if (res.statusCode == 200) {
that.setData({
isOwner: res.data.result.isOwner,
......@@ -92,8 +93,44 @@ Page({
let faqDetailId = e.currentTarget.dataset['index']
//调用接口设置最佳答案
//ajax_set_faq_best.php
wx.navigateTo({
url: '../faqDetail/faqDetail?faqId=' + faqId,
var that = this;
var config = wx.getStorageSync('config');
//获取用户消息列表
wx.request({
url: app.url + 'ajax_set_faq_best.php',
header: {
'content-type': 'application/json'
},
data: {
unionId: config.unionId,
faqId: that.data.faqId,
faqDetailId: faqDetailId
},
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.statusCode == 200) {
wx.showToast({
title: res.data.result.message,
})
that.getFaqDetail();
}
},
fail: function (res) {},
complete: function (res) {},
})
},
// 回复弹框
answerBtn() {
this.setData({
answerFlag: !this.data.answerFlag
})
},
answer_input(e) {
this.setData({
answerInfo: e.detail.value
})
},
......@@ -102,6 +139,35 @@ Page({
//调用接口设置最佳答案
//ajax_set_faq_answer.php.php
//回复以后调用接口刷新本页面
var that = this;
var config = wx.getStorageSync('config');
//获取用户消息列表
wx.request({
url: app.url + 'ajax_set_faq_answer.php',
header: {
'content-type': 'application/json'
},
data: {
unionId: config.unionId,
faqId: that.data.faqId,
content: that.data.answerInfo
},
method: 'GET',
dataType: 'json',
success: function (res) {
if (res.statusCode == 200) {
wx.showToast({
title: res.data.result.message,
})
that.getFaqDetail();
}
},
fail: function (res) {},
complete: function (res) {},
})
this.setData({
answerFlag: !this.data.answerFlag
})
},
//立即咨询
......
......@@ -2,40 +2,54 @@
<custom-navi text="咨询页面" back="{{true}}" home="{{false}}" bg1="#FFF" bg2="#FFF" bg3="#FFF"></custom-navi>
<view class="content">
<view class="faqDat">
<!--作者-->
<!--作者-->
<view class="authorRow">
<image src='{{faqDat.headImg}}' mode="widthFix"></image>
<view>{{faqDat.name}}</view>
</view>
<image src='{{faqDat.headImg}}' mode="widthFix"></image>
<view>{{faqDat.name}}</view>
</view>
<!--咨询内容-->
<view class="contentRow">
<text>{{faqDat.content}}</text>
<view class="images">
<image wx:for="{{faqDat.images}}" src='{{item}}' mode="widthFix"></image>
</view>
<view>{{faqDat.publishDate}}</view>
</view>
<!--咨询内容-->
<view class="contentRow">
<text>{{faqDat.content}}</text>
<view class="images">
<image wx:for="{{faqDat.images}}" src='{{item}}' mode="widthFix"></image>
</view>
<view>{{faqDat.publishDate}}</view>
</view>
</view>
<!--咨询回复-->
<view class="replyList">
<!--板块分割-->
<view class="replayTitle">
<view></view>评论
</view>
<view class="replyContentRow">
<view class="replyItem" wx:for="{{faqDetailList}}">
<view class="row1">
<view>
<image src='{{item.headImg}}' mode="widthFix"></image>
<view class="replyName">{{item.name}}</view>
<view wx:if="{{item.isBest}}" class="isBest">最佳答案</view>
<view wx:elif="{{isOwner}}" class="isNotBest" bindtap="setBest" data-index='{{item.id}}'>设为最佳</view>
</view>
<view class="replyTime">{{item.replyTime}}</view>
</view>
<view class="row2">
<view>{{item.content}}</view>
</view>
</view>
</view>
</view>
<view class="answer_btn" wx:if="{{answerFlag}}">
<view class="answer_cont">
<textarea bindinput="answer_input" focus="{{answerFlag}}"></textarea>
</view>
<view class="cont_btn">
<view class="cBtn" bindtap='answerBtn'>取消</view>
<view class="aBtn" bindtap="answerFaq">回复</view>
</view>
</view>
<view bindtap='answerBtn' class="newFaqButton" wx:if="{{!answerFlag}}">
<view>回复</view>
</view>
<!--咨询回复-->
<view class="replyList">
<!--板块分割-->
<view class="replayTitle">评论</view>
<view class="replyContentRow">
<view class="replyItem" wx:for="{{faqDetailList}}">
<view class="row1">
<image src='{{item.headImg}}' mode="widthFix"></image>
<view class="replyName">{{item.name}}</view>
<view wx:if="{{item.isBest && isOwwner}}" class="isBest">最佳答案</view>
<view wx:elif="{{isOwwner}}" class="isNotBest" bindtap="setBest" data-index='{{item.id}}'>设为最佳</view>
<view class="replyTime">{{item.replyTime}}</view>
</view>
<view class="row2">
<view>{{item.content}}</view>
</view>
</view>
</view>
</view>
</view>
\ No newline at end of file
......@@ -4,6 +4,7 @@
height: 100%;
position: absolute;
top: 20px;
margin-bottom: 40px;
}
.faqDat {
......@@ -25,13 +26,14 @@
}
.authorRow image {
width:40px;
height:40px;
width: 40px;
height: 40px;
border-radius: 20px;
}
.authorRow view {
margin-left: 5px;
font-size: 18px;
}
.faqDat .contentRow {
......@@ -43,13 +45,15 @@
align-items: left;
}
.faqDat .contentRow text{
width:100%;
.faqDat .contentRow text {
width: 100%;
word-break: break-all;
font-size: 18px;
font-weight: bold;
}
.faqDat .contentRow .images{
width:100%;
.faqDat .contentRow .images {
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-start;
......@@ -57,15 +61,16 @@
align-items: center;
}
.faqDat .contentRow .images image{
width:32%;
.faqDat .contentRow .images image {
width: 32%;
margin-top: 5px;
margin-right: 1%;
}
.faqDat .contentRow view{
margin-top: 5px;
width:100%;
.faqDat .contentRow view {
font-size: 15px;
margin-top: 10px;
width: 100%;
}
.replyList {
......@@ -82,78 +87,180 @@
width: 100%;
height: 20px;
line-height: 20px;
padding-left: 10px;
margin-left: 3%;
font-size: 18px;
border-left: 5px solid #9BCD9B;
display: flex;
flex-direction: row;
align-items: center;
}
.replyList .replayTitle view {
width: 6px;
height: 22px;
border-radius: 3px;
background: #9BCD9B;
margin-right: 15px;
}
.replyList .replyContentRow {
width: 100%;
margin-left: 3%;
margin: 20px 0;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: left;
}
.replyList .replyContentRow .replyItem{
.replyList .replyContentRow .replyItem {
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
}
.replyItem .row1{
.replyItem .row1 {
width: 100%;
display: flex;
flex-direction: row;
justify-content: flex-start;
justify-content: space-between;
align-items: center;
}
.replyItem .row1 view {
display: flex;
flex-direction: row;
align-items: center;
}
.replyItem .row1 image{
width:40px;
height:40px;
.replyItem .row1 image {
width: 40px;
height: 40px;
border-radius: 20px;
}
.replyItem .row1 .replyName{
margin-left: 5px;
.replyItem .row1 .replyName {
margin-left: 15px;
font-size: 18px;
color:#FF69B4;
color: #FF69B4;
}
.replyItem .row1 .isBest{
margin-left: 5px;
width: 80px;
.replyItem .row1 .isBest {
margin-left: 10px;
padding: 0 10px;
height: 20px;
line-height: 20px;
font-size: 14px;
background:pink;
color:#FFF;
background: linear-gradient(to right, #2f89c2, #7c47ca);
color: #FFF;
border-radius: 10px;
text-align: center;
}
.replyItem .row1 .isNotBest{
margin-left: 5px;
width: 80px;
.replyItem .row1 .isNotBest {
margin-left: 10px;
padding: 0 10px;
height: 20px;
line-height: 20px;
font-size: 14px;
background:#A020F0;
color:#FFF;
background: linear-gradient(to right, #2f89c2, #7c47ca);
color: #FFF;
border-radius: 10px;
text-align: center;
}
.replyItem .row1 .replyTime{
margin-left: 5px;
.replyItem .row1 .replyTime {
color: #999999;
}
.replyItem .row2{
.replyItem .row2 {
width: 100%;
margin-left: 45px;
margin-right: 20px;
margin-left: 3%;
}
.replyItem .row2 view {
margin-left: 50px;
font-size: 16px;
}
.answer_btn {
position: fixed;
bottom: 2%;
left: 5%;
width: 90%;
height: 200px;
border-radius: 10px;
border: 2px solid #ed5f77;
display: flex;
flex-direction: column;
background: #fff;
}
.answer_btn .answer_cont {
margin: 20px 20px 0;
height: 65%;
border-bottom: 1rpx solid #999999;
}
.answer_btn .answer_cont textarea {
width: 100%;
height: 90%;
}
.answer_btn .cont_btn {
padding: 8px 0;
height: 20%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.answer_btn .cont_btn .cBtn {
text-align: center;
margin: 0 10px;
width: 30%;
height: 40px;
line-height: 40px;
border-radius: 20px;
background: transparent;
color: #fb689b;
font-size: 18px;
border: 1rpx solid #fb689b;
}
.answer_btn .cont_btn .aBtn {
text-align: center;
margin: 0 10px;
width: 30%;
height: 40px;
line-height: 40px;
border-radius: 20px;
background: linear-gradient(to right, #fb689b, #e85c6d);
color: #fff;
font-size: 18px;
}
.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
......@@ -87,7 +87,7 @@
<view class='topTitle'>
<view class='leftLine' style="background-color: #eb5e76;"></view>
<text class="title">志愿要闻</text>
<view class='lookmore' bindtap='moreVolunteers'>
<view class='lookmore' bindtap=''>
<text>全部</text>
<image src="/img/right.png"></image>
</view>
......@@ -195,7 +195,7 @@
<view class='topTitle'>
<view class='leftLine' style="background-color: #9cc64d;"></view>
<text class="title">公益课堂</text>
<view class='lookmore' bindtap='moreVolunteers'>
<view class='lookmore' bindtap='mediaCourse'>
<text>全部</text>
<image src="/img/right.png"></image>
</view>
......
......@@ -87,6 +87,20 @@
"pathName": "pages/courseIndex/courseIndex",
"query": "",
"scene": null
},
{
"id": 6,
"name": "pages/faqDetail/faqDetail",
"pathName": "pages/faqDetail/faqDetail",
"query": "faqId=15",
"scene": null
},
{
"id": -1,
"name": "pages/faqConsult/faqConsult",
"pathName": "pages/faqConsult/faqConsult",
"query": "",
"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