34 changed files with 1477 additions and 7 deletions
@ -0,0 +1,40 @@ |
|||||
|
Component({ |
||||
|
/** |
||||
|
* 组件的属性列表 |
||||
|
*/ |
||||
|
properties: { |
||||
|
questionList:{ |
||||
|
type:Array |
||||
|
}, |
||||
|
currentTab:{ |
||||
|
type:Number, |
||||
|
value:2 |
||||
|
}, |
||||
|
currentQuestion:{ |
||||
|
type:String |
||||
|
} |
||||
|
}, |
||||
|
/** |
||||
|
* 组件的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
answerInput:'' |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 组件的方法列表 |
||||
|
*/ |
||||
|
methods: { |
||||
|
handleInput(e){ |
||||
|
this.setData({ |
||||
|
answerInput:e.detail.value |
||||
|
}) |
||||
|
}, |
||||
|
openInput(e){ |
||||
|
this.triggerEvent("changeCurrentQuestion",e.currentTarget.dataset.index); |
||||
|
}, |
||||
|
changeCollapse(e){ |
||||
|
this.triggerEvent("changeCollapse",e); |
||||
|
}, |
||||
|
} |
||||
|
}) |
||||
@ -0,0 +1,4 @@ |
|||||
|
{ |
||||
|
"component": true, |
||||
|
"usingComponents": {} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
<view class="home"> |
||||
|
<view wx:for="{{questionList}}" |
||||
|
wx:for-item="item" |
||||
|
wx:for-index="index" |
||||
|
wx:key="index" |
||||
|
class="list-item"> |
||||
|
<view class="item-header"> |
||||
|
<view class="question"> |
||||
|
<text id="questionContent" class="text {{item.collapse?'text-collapse':''}}">{{item.questionContent}}</text> |
||||
|
<text style="float:right" bindtap="changeCollapse" data-index="{{index}}" wx:if="{{item.showCollapse}}" class='coll-p'>{{item.collapse?'全文':'收起'}}</text></view> |
||||
|
</view> |
||||
|
<view> |
||||
|
<view class="time">{{item.questionTime}}</view> |
||||
|
</view> |
||||
|
<view class="item-answer" style="" wx:for="{{item.answerList}}" wx:for-item="answer" wx:for-index="answerIndex"> |
||||
|
<view class="answer-content"> |
||||
|
<text id="answerContent" data-question="{{index}}" class="text {{answer.collapse?'text-collapse':''}}">{{answer.answerContent}}</text> |
||||
|
<text style="float:right" bindtap="changeCollapse" data-questionIndex="{{index}}" data-index="{{answerIndex}}" wx:if="{{answer.showCollapse}}" class='coll-p'>{{answer.collapse?'全文':'收起'}}</text> |
||||
|
</view> |
||||
|
<view class="item-header"> |
||||
|
<view class="answer-footer">{{answer.psychologistName + ' | 心理咨询师 ' +answer.answerTime}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<wxs module='tools'> |
||||
|
function toString(a){ |
||||
|
return a.toString(); |
||||
|
} |
||||
|
module.exports = { |
||||
|
toString: toString |
||||
|
} |
||||
|
</wxs> |
||||
@ -0,0 +1,122 @@ |
|||||
|
/* subpages/consult/components/questionList.wxss */ |
||||
|
.home{ |
||||
|
width: 100%; |
||||
|
} |
||||
|
.list-item{ |
||||
|
background-color: #fff; |
||||
|
margin-top: 20rpx; |
||||
|
padding: 0 20rpx; |
||||
|
} |
||||
|
.list-item .item-header{ |
||||
|
display: inline-block; |
||||
|
width: 100%; |
||||
|
} |
||||
|
.list-item .item-header .index{ |
||||
|
display: inline-block; |
||||
|
width: 4%; |
||||
|
height: 100rpx; |
||||
|
line-height: 100rpx; |
||||
|
font-size: 30rpx; |
||||
|
} |
||||
|
.list-item .item-header .question{ |
||||
|
display: inline-block; |
||||
|
line-height: 50rpx; |
||||
|
font-size: 35rpx; |
||||
|
font-weight: bold; |
||||
|
letter-spacing: 2rpx; |
||||
|
} |
||||
|
.time{ |
||||
|
display: inline-block; |
||||
|
width: 40%; |
||||
|
font-size: 25rpx; |
||||
|
color: #AAA; |
||||
|
} |
||||
|
.list-item .item-button{ |
||||
|
height: 60rpx; |
||||
|
width: 100%; |
||||
|
} |
||||
|
|
||||
|
.list-item .item-button .reply{ |
||||
|
height: 50rpx; |
||||
|
width: 20%; |
||||
|
font-size: 30rpx; |
||||
|
line-height: 50rpx; |
||||
|
text-align: center; |
||||
|
float: right; |
||||
|
} |
||||
|
.list-item .item-button .reply .button-img{ |
||||
|
height: 25rpx; |
||||
|
width: 25rpx; |
||||
|
margin-left: -5rpx; |
||||
|
} |
||||
|
.list-item .item-button .reply .button-text{ |
||||
|
color: #F71A1A; |
||||
|
font-size: 30rpx; |
||||
|
display: inline-block; |
||||
|
margin-left: 10rpx; |
||||
|
} |
||||
|
.item-reply{ |
||||
|
width: 100%; |
||||
|
height: 300rpx; |
||||
|
} |
||||
|
.item-reply .textarea{ |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
background-color: #f2f2f2; |
||||
|
} |
||||
|
.answer-content{ |
||||
|
width: 100%; |
||||
|
font-size: 30rpx; |
||||
|
color: #777; |
||||
|
margin-top: 20rpx; |
||||
|
} |
||||
|
.reply-button{ |
||||
|
border-radius: 35rpx; |
||||
|
background-color: #e02d22; |
||||
|
height: 55rpx; |
||||
|
width: 120rpx; |
||||
|
color: #fff; |
||||
|
line-height: 50rpx; |
||||
|
text-align: center; |
||||
|
margin-right: 20rpx; |
||||
|
float: right; |
||||
|
} |
||||
|
.answer-footer{ |
||||
|
padding: 20rpx 0; |
||||
|
font-size: 30rpx; |
||||
|
color: #c3c3c3; |
||||
|
} |
||||
|
page::-webkit-scrollbar { |
||||
|
width: 0; |
||||
|
height: 0; |
||||
|
color: transparent; |
||||
|
display: none; |
||||
|
} |
||||
|
.answer-content text{ |
||||
|
line-height: 50rpx; |
||||
|
display: block; |
||||
|
} |
||||
|
.question text{ |
||||
|
line-height: 50rpx; |
||||
|
} |
||||
|
|
||||
|
.answer-content text.text-collapse{ |
||||
|
display:-webkit-box; |
||||
|
-webkit-box-orient:vertical; |
||||
|
-webkit-line-clamp:3; |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
} |
||||
|
.text-collapse{ |
||||
|
display:-webkit-box; |
||||
|
-webkit-box-orient:vertical; |
||||
|
-webkit-line-clamp:2; |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
} |
||||
|
|
||||
|
.coll-p{ |
||||
|
font-size: 30rpx; |
||||
|
color: #5064A3; |
||||
|
margin-top: 10rpx; |
||||
|
} |
||||
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 367 B |
@ -0,0 +1,67 @@ |
|||||
|
const api = require('../../../../utils/api') |
||||
|
import { getTimestamp } from '../../../../utils/common' |
||||
|
import util from '../../../../utils/util' |
||||
|
const app = getApp() |
||||
|
Page({ |
||||
|
data: { |
||||
|
annonymous:false, |
||||
|
questionContent:'', |
||||
|
toConsultant:"" |
||||
|
}, |
||||
|
onLoad (options) { |
||||
|
this.setData({ |
||||
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
||||
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
||||
|
sudokuHeight:app.globalData.deviceInfo.statusHeight+app.globalData.deviceInfo.navigationHeight, |
||||
|
}) |
||||
|
if(options.toConsultant!==undefined){ |
||||
|
this.setData({ |
||||
|
toConsultant:options.toConsultant |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
naviBack(){ |
||||
|
wx.navigateBack({ |
||||
|
delta:-1, |
||||
|
}) |
||||
|
}, |
||||
|
switchChange(e){ |
||||
|
this.setData({ |
||||
|
annonymous:!this.data.annonymous |
||||
|
}) |
||||
|
}, |
||||
|
handleInput(e){ |
||||
|
this.setData({ |
||||
|
questionContent:e.detail.value |
||||
|
}) |
||||
|
}, |
||||
|
submit(){ |
||||
|
if(this.data.questionContent.trim()===''){ |
||||
|
wx.showToast({ |
||||
|
title: '请输入问题', |
||||
|
icon:'none' |
||||
|
}) |
||||
|
return false; |
||||
|
} |
||||
|
let param = { |
||||
|
anonymousFlag:this.data.annonymous?'1':'0', |
||||
|
questionContent:this.data.questionContent |
||||
|
} |
||||
|
if(this.data.toConsultant!==''){ |
||||
|
param.psychologistId=this.data.toConsultant |
||||
|
} |
||||
|
api.submitQuestion(param).then(res=>{ |
||||
|
wx.navigateBack({ |
||||
|
delta:-1, |
||||
|
complete:()=>{ |
||||
|
wx.showToast({ |
||||
|
title: '发布成功', |
||||
|
icon:'none' |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}).catch(err=>{ |
||||
|
console.log(err) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
@ -0,0 +1,8 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"completeInfo-dialog": "../../../../../components/completeInfoDialog/completeInfoDialog" |
||||
|
}, |
||||
|
"navigationBarTitleText": "发布问题", |
||||
|
"navigationStyle": "custom", |
||||
|
"navigationBarTextStyle": "white" |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
<view class="header" style="height: {{statusHeight + navigationHeight}}px;"> |
||||
|
<image class="header-bg" src="../../../../images/home/home-status.png" /> |
||||
|
<view style="height: 80rpx;position: fixed;margin-top: 60rpx;width: 70rpx;z-index: 101;" bindtap="naviBack"> |
||||
|
<image class="header-back" style="margin-top:{{statusHeight/2}}px" src="../../images/back.png"></image> |
||||
|
</view> |
||||
|
<view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;"> |
||||
|
咨询 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="home" style="margin-top: {{statusHeight + navigationHeight}}px"> |
||||
|
<view class="input" style="height:calc(100vh - {{statusHeight + navigationHeight}}px)"> |
||||
|
<textarea placeholder="请输入问题" class="textarea" maxlength="500" bindinput="handleInput" placeholder-style="color:#999"> |
||||
|
</textarea> |
||||
|
<text style="float:right;margin-top:-50rpx;font-size:30rpx;color:#999">{{util.length(questionContent)}}/500</text> |
||||
|
</view> |
||||
|
<view class="switch"> |
||||
|
<view style="width:20%;display:inline-block;margin-left:20rpx">匿名发布</view> |
||||
|
<switch color="#D71D00" style="float:right;margin-right:20rpx" type="switch" checked="{{annonymous}}" bindchange="switchChange"/> |
||||
|
</view> |
||||
|
<view class="footer"> |
||||
|
<button bindtap="submit" class="myQuestionBtn" size="defaultSize" >提交</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
<wxs module="util"> |
||||
|
function length(str){ |
||||
|
return str.length |
||||
|
} |
||||
|
module.exports = { |
||||
|
length: length |
||||
|
} |
||||
|
</wxs> |
||||
@ -0,0 +1,88 @@ |
|||||
|
page { |
||||
|
width: 100%; |
||||
|
height: auto; |
||||
|
overflow-y: auto; |
||||
|
background: #fff; |
||||
|
} |
||||
|
|
||||
|
.header { |
||||
|
position: fixed; |
||||
|
width: 100%; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
z-index: 1000; |
||||
|
} |
||||
|
.header .header-bg { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
position: absolute; |
||||
|
z-index: 10; |
||||
|
left: 0; |
||||
|
top: 0; |
||||
|
} |
||||
|
.header .navigation { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
color: rgba(255,255,255, 0.9); |
||||
|
font-size: 32rpx; |
||||
|
position: relative; |
||||
|
z-index: 100; |
||||
|
} |
||||
|
.home { |
||||
|
width: 100%; |
||||
|
} |
||||
|
.header-back{ |
||||
|
height: 33rpx; |
||||
|
width: 18rpx; |
||||
|
position: fixed; |
||||
|
margin-left: 30rpx; |
||||
|
z-index: 101; |
||||
|
} |
||||
|
.footer{ |
||||
|
width: 100%; |
||||
|
height: 98rpx; |
||||
|
background: #fff; |
||||
|
position: fixed; |
||||
|
bottom: 5%; |
||||
|
left: 0; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: flex-end; |
||||
|
} |
||||
|
.myQuestionBtn { |
||||
|
width: 70%; |
||||
|
height: 100%; |
||||
|
line-height: 98rpx; |
||||
|
text-align: center; |
||||
|
background: #cc1200; |
||||
|
font-size: 32rpx; |
||||
|
color: #fff; |
||||
|
border-radius: 40px; |
||||
|
border:none |
||||
|
} |
||||
|
|
||||
|
.input{ |
||||
|
width: 96%; |
||||
|
margin:0 auto; |
||||
|
|
||||
|
} |
||||
|
.input .textarea{ |
||||
|
width: 100%; |
||||
|
height: 65%; |
||||
|
font-size: 35rpx; |
||||
|
padding: 20rpx 0; |
||||
|
border-bottom: 0.5px solid #E7EDED; |
||||
|
padding-bottom: 45rpx; |
||||
|
} |
||||
|
.switch{ |
||||
|
width: 100%; |
||||
|
height: 98rpx; |
||||
|
background: #fff; |
||||
|
position: fixed; |
||||
|
bottom: 17%; |
||||
|
left: 0; |
||||
|
display: inline-block; |
||||
|
align-items: center; |
||||
|
} |
||||
@ -0,0 +1,160 @@ |
|||||
|
const api = require('../../../../utils/api') |
||||
|
import { getTimestamp } from '../../../../utils/common' |
||||
|
import util from '../../../../utils/util' |
||||
|
const app = getApp() |
||||
|
Page({ |
||||
|
data: { |
||||
|
statusHeight: 0, // 自定义头部状态栏高度
|
||||
|
navigationHeight: 0, // 自定义头部导航栏高度
|
||||
|
pageIndex:1, |
||||
|
pageSize:10, |
||||
|
isLoading:true, |
||||
|
loadMoreType: 'loading', |
||||
|
loadMoreVisible: true, |
||||
|
timestamp:'', |
||||
|
list:[], |
||||
|
questionList:[], |
||||
|
}, |
||||
|
onLoad (options) { |
||||
|
this.setData({ |
||||
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
||||
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
||||
|
sudokuHeight:app.globalData.deviceInfo.statusHeight+app.globalData.deviceInfo.navigationHeight, |
||||
|
}) |
||||
|
this.getConsultantList(); |
||||
|
}, |
||||
|
onShow(){ |
||||
|
this.setData({ |
||||
|
loadMoreType:'loading', |
||||
|
loadMoreVisible:true, |
||||
|
isLoading:true, |
||||
|
questionList:[], |
||||
|
pageIndex:1, |
||||
|
pageSize:10, |
||||
|
timestamp:getTimestamp() |
||||
|
}) |
||||
|
let param = { |
||||
|
pageIndex:this.data.pageIndex, |
||||
|
pageSize:this.data.pageSize, |
||||
|
timestamp:this.data.timestamp |
||||
|
} |
||||
|
this.getQuestionList(param); |
||||
|
}, |
||||
|
naviBack(){ |
||||
|
wx.navigateBack({ |
||||
|
delta:-1, |
||||
|
}) |
||||
|
}, |
||||
|
navigateToConsultDetail(e){ |
||||
|
console.log(e); |
||||
|
wx.navigateTo({ |
||||
|
url: '/subpages/safety/pages/consultantDetail/consultantDetail?id='+e.currentTarget.dataset.id, |
||||
|
}) |
||||
|
}, |
||||
|
navigateToConsultantList(){ |
||||
|
wx.navigateTo({ |
||||
|
url: '/subpages/safety/pages/consultantList/consultantList', |
||||
|
}) |
||||
|
}, |
||||
|
navigateToMyQuestion(){ |
||||
|
wx.navigateTo({ |
||||
|
url: '/subpages/safety/pages/myQuestion/myQuestion', |
||||
|
}) |
||||
|
}, |
||||
|
navigateToAddQuestion(){ |
||||
|
wx.navigateTo({ |
||||
|
url: '/subpages/safety/pages/addQuestion/addQuestion', |
||||
|
}) |
||||
|
}, |
||||
|
onReachBottom(){ |
||||
|
if(!this.data.isLoading && this.data.loadMoreType!='none'){ |
||||
|
this.setData({ |
||||
|
isLoading:true, |
||||
|
loadMoreVisible:true, |
||||
|
loadMoreType:'loading', |
||||
|
pageIndex:this.data.pageIndex+1 |
||||
|
}) |
||||
|
let param = { |
||||
|
pageIndex:this.data.pageIndex, |
||||
|
pageSize:this.data.pageSize, |
||||
|
timestamp:this.data.timestamp |
||||
|
} |
||||
|
this.getQuestionList(param); |
||||
|
} |
||||
|
}, |
||||
|
getConsultantList(){ |
||||
|
api.getConsultantList('0').then(res=>{ |
||||
|
this.setData({ |
||||
|
list:res.data |
||||
|
}) |
||||
|
}) |
||||
|
}, |
||||
|
getQuestionList(param){ |
||||
|
api.getQuestionList(param).then(res=>{ |
||||
|
this.setData({ |
||||
|
isLoading:false, |
||||
|
questionList:this.data.questionList.concat(res.data), |
||||
|
}) |
||||
|
this.setCollapse(); |
||||
|
if(res.data.length<10){ |
||||
|
this.setData({ |
||||
|
loadMoreType:'none', |
||||
|
loadMoreVisible:true, |
||||
|
}) |
||||
|
}else{ |
||||
|
this.setData({ |
||||
|
loadMoreType:"more", |
||||
|
loadMoreVisible:false |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
//判断全文收起是否展示
|
||||
|
setCollapse: function() { |
||||
|
var query = wx.createSelectorQuery(); |
||||
|
var that = this; |
||||
|
query.selectAll('#questionContent').boundingClientRect(function (rect) { |
||||
|
rect.forEach((v, i) => { |
||||
|
if (v.height > 60) { //判断高度,根据各种高度取折中
|
||||
|
var set = "questionList[" + i + "].collapse"; |
||||
|
var set1 = "questionList[" + i + "].showCollapse"; |
||||
|
that.setData({ |
||||
|
[set]: true, |
||||
|
[set1]: true, |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}).exec(); |
||||
|
query.selectAll('#answerContent').boundingClientRect(function (rect) { |
||||
|
rect.forEach((v, i) => { |
||||
|
if (v.height > 70) { |
||||
|
var set = "questionList[" + v.dataset.question + "].answerList[0].collapse"; |
||||
|
var set1 = "questionList[" + v.dataset.question + "].answerList[0].showCollapse"; |
||||
|
that.setData({ |
||||
|
[set]: true, |
||||
|
[set1]: true, |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}).exec(); |
||||
|
}, |
||||
|
//点击全文收起
|
||||
|
changeCollapse: function(e){ |
||||
|
var index = e.currentTarget.dataset.index; |
||||
|
var questionIndex=e.currentTarget.dataset.questionindex; |
||||
|
if(questionIndex===undefined){ |
||||
|
console.log('undefined') |
||||
|
var set = "questionList[" + index + "].collapse"; |
||||
|
this.setData({ |
||||
|
[set]: !this.data.questionList[index].collapse |
||||
|
}) |
||||
|
}else{ |
||||
|
console.log('not undefined') |
||||
|
var set = "questionList[" + questionIndex + "].answerList[0].collapse"; |
||||
|
console.log(set) |
||||
|
this.setData({ |
||||
|
[set]: !this.data.questionList[questionIndex].answerList[0].collapse |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
@ -0,0 +1,9 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"completeInfo-dialog": "../../../../../components/completeInfoDialog/completeInfoDialog", |
||||
|
"load-more":"../../components/loadMore/loadMore" |
||||
|
}, |
||||
|
"navigationBarTitleText": "心理咨询", |
||||
|
"navigationStyle": "custom", |
||||
|
"navigationBarTextStyle": "white" |
||||
|
} |
||||
@ -0,0 +1,69 @@ |
|||||
|
<view class="header" style="height: {{statusHeight + navigationHeight}}px;"> |
||||
|
<image class="header-bg" src="../../../../images/home/home-status.png" /> |
||||
|
<view style="height: 80rpx;position: fixed;margin-top: 60rpx;width: 70rpx;z-index: 101;" bindtap="naviBack"> |
||||
|
<image class="header-back" style="margin-top:{{statusHeight/2}}px" src="../../images/back.png"></image> |
||||
|
</view> |
||||
|
<view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;"> |
||||
|
心理咨询 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="home" style="margin-top: {{statusHeight + navigationHeight}}px;overflow-x:hidden"> |
||||
|
<view class="list" wx:if="{{list.length>0}}"> |
||||
|
<view class="list-header"> |
||||
|
<view class="title"><text space="ensp">心理咨询师专区</text></view> |
||||
|
<view class="more" bindtap="navigateToConsultantList">更多 |
||||
|
<image src="../../images/right.png" style="height:20rpx;width:15rpx"></image> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="list-content"> |
||||
|
<view class="content" |
||||
|
wx:for="{{list}}" |
||||
|
wx:for-item="item" |
||||
|
wx:for-index="index" |
||||
|
wx:key="index" |
||||
|
bindtap="navigateToConsultDetail" |
||||
|
data-id="{{item.id}}"> |
||||
|
<view class="avatar"> |
||||
|
<image src="{{item.avatar}}" class="avatar-img"></image> |
||||
|
<image src="../../images/heart.png" class="avatar-mark"></image> |
||||
|
</view> |
||||
|
<view class="name">{{item.name}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- 提问列表 --> |
||||
|
<view scroll-y class="question-list" > |
||||
|
|
||||
|
<view class="question-item" |
||||
|
wx:for="{{questionList}}" |
||||
|
wx:for-item="item" |
||||
|
wx:for-index="index" |
||||
|
wx:key="index"> |
||||
|
<view class="question-content"> |
||||
|
<text id="questionContent" style="font-size:35rpx" class="text {{item.collapse?'text-collapse':''}}">{{item.questionContent}}</text> |
||||
|
<text style="text-align:right" bindtap="changeCollapse" data-index="{{index}}" wx:if="{{item.showCollapse}}" class='coll-p'>{{item.collapse?'全文':'收起'}}</text> |
||||
|
</view> |
||||
|
<view class="question-header"> |
||||
|
<view class="avatar"><image src="{{item.userAvatar}}" class="avatar-img"></image></view> |
||||
|
<view class="name">{{item.userName}}</view> |
||||
|
</view> |
||||
|
<view class="question-answer" |
||||
|
wx:for="{{item.answerList}}" |
||||
|
wx:for-item="answer" |
||||
|
wx:for-index="index1"> |
||||
|
<view class="answer-content"> |
||||
|
<text id="answerContent" data-question="{{index}}" class="text {{answer.collapse?'text-collapse':''}}">{{answer.answerContent}}</text> |
||||
|
<text style="text-align:right" bindtap="changeCollapse" data-questionIndex="{{index}}" data-index="{{index1}}" wx:if="{{answer.showCollapse}}" class='coll-p'>{{answer.collapse?'全文':'收起'}}</text> |
||||
|
</view> |
||||
|
<view class="answer-header"> |
||||
|
<view class="name">{{answer.psychologistName+" | 心理咨询师"}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<load-more loadMoreVisible="{{loadMoreVisible}}" loadMoreType="{{loadMoreType}}"></load-more> |
||||
|
</view> |
||||
|
<view class="footer"> |
||||
|
<button bindtap="navigateToMyQuestion" class="myQuestionBtn" size="defaultSize" >我的提问</button> |
||||
|
<button bindtap="navigateToAddQuestion" class="addQuestionBtn" size="defaultSize">发布问题</button> |
||||
|
</view> |
||||
|
</view> |
||||
@ -0,0 +1,224 @@ |
|||||
|
page { |
||||
|
width: 100%; |
||||
|
height: auto; |
||||
|
overflow-y: auto; |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
.header { |
||||
|
position: fixed; |
||||
|
width: 100%; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
z-index: 1000; |
||||
|
} |
||||
|
.header .header-bg { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
position: absolute; |
||||
|
z-index: 10; |
||||
|
left: 0; |
||||
|
top: 0; |
||||
|
} |
||||
|
.header .navigation { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
color: rgba(255,255,255, 0.9); |
||||
|
font-size: 32rpx; |
||||
|
position: relative; |
||||
|
z-index: 100; |
||||
|
} |
||||
|
.home { |
||||
|
width: 100%; |
||||
|
} |
||||
|
.header-back{ |
||||
|
height: 33rpx; |
||||
|
width: 18rpx; |
||||
|
position: fixed; |
||||
|
margin-left: 30rpx; |
||||
|
z-index: 101; |
||||
|
} |
||||
|
.list{ |
||||
|
width: 100%; |
||||
|
background-color: #fff; |
||||
|
padding:20rpx 0; |
||||
|
} |
||||
|
.list-header{ |
||||
|
width: 94%; |
||||
|
height: 50rpx; |
||||
|
margin: 0 auto; |
||||
|
} |
||||
|
.list-header .title{ |
||||
|
display: inline-block; |
||||
|
font-size: 35rpx; |
||||
|
width: 80%; |
||||
|
line-height: 50rpx; |
||||
|
} |
||||
|
.list-header .more{ |
||||
|
display: inline-block; |
||||
|
float: right; |
||||
|
width: 15%; |
||||
|
line-height: 50rpx; |
||||
|
font-size: 25rpx; |
||||
|
color: #999; |
||||
|
text-align: right; |
||||
|
} |
||||
|
.list-content{ |
||||
|
width: 100%; |
||||
|
display: inline-block; |
||||
|
padding: 20rpx 0; |
||||
|
} |
||||
|
.list-content .content{ |
||||
|
width: 25%; |
||||
|
display: inline-block; |
||||
|
} |
||||
|
.list-content .content .avatar{ |
||||
|
width: 80%; |
||||
|
margin-left: 40rpx; |
||||
|
} |
||||
|
.list-content .content .avatar .avatar-img{ |
||||
|
width: 70%; |
||||
|
height: 110rpx; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
.list-content .content .avatar .avatar-mark{ |
||||
|
width: 25%; |
||||
|
height: 35rpx; |
||||
|
margin-left: -30rpx; |
||||
|
} |
||||
|
.list-content .content .name{ |
||||
|
width: 100%; |
||||
|
font-size: 30rpx; |
||||
|
text-align: center; |
||||
|
} |
||||
|
.footer{ |
||||
|
width: 100%; |
||||
|
height: 98rpx; |
||||
|
background: #fff; |
||||
|
position: fixed; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: flex-end; |
||||
|
} |
||||
|
.addQuestionBtn { |
||||
|
width: 50%; |
||||
|
height: 100%; |
||||
|
line-height: 98rpx; |
||||
|
text-align: center; |
||||
|
background: #FE4646; |
||||
|
font-size: 32rpx; |
||||
|
color: #fff; |
||||
|
border-radius: 0px; |
||||
|
border:none |
||||
|
} |
||||
|
.myQuestionBtn { |
||||
|
width: 50%; |
||||
|
height: 100%; |
||||
|
line-height: 98rpx; |
||||
|
text-align: center; |
||||
|
background: #FFB000; |
||||
|
font-size: 32rpx; |
||||
|
color: #fff; |
||||
|
border-radius: 0px; |
||||
|
border:none |
||||
|
} |
||||
|
button::after{ |
||||
|
border: none; |
||||
|
} |
||||
|
.question-list{ |
||||
|
width: 100%; |
||||
|
margin-top: 20rpx; |
||||
|
margin-bottom: 98rpx; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
.question-item{ |
||||
|
width: 94%; |
||||
|
margin-top: 20rpx; |
||||
|
border-bottom: 0.5px solid #E7EDED; |
||||
|
margin: 0 auto; |
||||
|
} |
||||
|
.question-item .question-header{ |
||||
|
width: 100%; |
||||
|
height: 80rpx; |
||||
|
display: inline-flex; |
||||
|
} |
||||
|
.question-item .question-header .avatar{ |
||||
|
width: 7%; |
||||
|
display: inline-flex; |
||||
|
height: 85rpx; |
||||
|
} |
||||
|
.question-item .question-header .avatar .avatar-img{ |
||||
|
width: 100%; |
||||
|
height: 45rpx; |
||||
|
border-radius: 50%; |
||||
|
border:0.5px solid grey; |
||||
|
display: inline-flex; |
||||
|
} |
||||
|
.question-item .question-header .name{ |
||||
|
width: 70%; |
||||
|
margin-left: 10rpx; |
||||
|
display: inline-flex; |
||||
|
font-size: 30rpx; |
||||
|
line-height: 45rpx; |
||||
|
color: #999; |
||||
|
} |
||||
|
.question-item .question-content{ |
||||
|
font-size: 40rpx; |
||||
|
padding: 20rpx 0; |
||||
|
font-weight: bold; |
||||
|
letter-spacing: 2rpx; |
||||
|
color: #333; |
||||
|
} |
||||
|
.question-answer{ |
||||
|
width: 100%; |
||||
|
margin-top: 20rpx; |
||||
|
} |
||||
|
.question-answer .name{ |
||||
|
font-size: 25rpx; |
||||
|
margin-top: 20rpx; |
||||
|
color: #c3c3c3; |
||||
|
padding-bottom: 20rpx; |
||||
|
} |
||||
|
.answer-content{ |
||||
|
font-size: 30rpx; |
||||
|
color: #777; |
||||
|
} |
||||
|
.home::-webkit-scrollbar { |
||||
|
width: 0; |
||||
|
height: 0; |
||||
|
color: transparent; |
||||
|
} |
||||
|
.answer-content text{ |
||||
|
font-size: 28rpx; |
||||
|
line-height: 40rpx; |
||||
|
display: block; |
||||
|
} |
||||
|
.question-content text{ |
||||
|
font-size: 28rpx; |
||||
|
line-height: 50rpx; |
||||
|
display: block; |
||||
|
} |
||||
|
|
||||
|
.answer-content text.text-collapse{ |
||||
|
display:-webkit-box; |
||||
|
-webkit-box-orient:vertical; |
||||
|
-webkit-line-clamp:3; |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
} |
||||
|
.question-content text.text-collapse{ |
||||
|
display:-webkit-box; |
||||
|
-webkit-box-orient:vertical; |
||||
|
-webkit-line-clamp:2; |
||||
|
overflow: hidden; |
||||
|
text-overflow: ellipsis; |
||||
|
} |
||||
|
|
||||
|
.coll-p{ |
||||
|
font-size: 30rpx; |
||||
|
color: #5064A3; |
||||
|
margin-top: 10rpx; |
||||
|
} |
||||
@ -0,0 +1,36 @@ |
|||||
|
const api = require('../../utils/api') |
||||
|
import { getTimestamp } from '../../../../utils/common' |
||||
|
import util from '../../../../utils/util' |
||||
|
const app = getApp() |
||||
|
Page({ |
||||
|
data: { |
||||
|
consultantInfo:{} |
||||
|
}, |
||||
|
onLoad (options) { |
||||
|
this.setData({ |
||||
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
||||
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
||||
|
sudokuHeight:app.globalData.deviceInfo.statusHeight+app.globalData.deviceInfo.navigationHeight, |
||||
|
}) |
||||
|
this.setData({ |
||||
|
consultantId:options.id |
||||
|
}) |
||||
|
api.getConsultantInfo(options.id).then((res)=>{ |
||||
|
this.setData({ |
||||
|
consultantInfo:res.data |
||||
|
}) |
||||
|
}).catch((err)=>{ |
||||
|
console.log(err) |
||||
|
}); |
||||
|
} , |
||||
|
naviBack(){ |
||||
|
wx.navigateBack({ |
||||
|
delta:-1, |
||||
|
}) |
||||
|
}, |
||||
|
navigateToAsk(){ |
||||
|
wx.navigateTo({ |
||||
|
url: '../addQuestion/addQuestion?toConsultant='+this.data.consultantId, |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
@ -0,0 +1,8 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"completeInfo-dialog": "../../../../../components/completeInfoDialog/completeInfoDialog" |
||||
|
}, |
||||
|
"navigationBarTitleText": "咨询师详情", |
||||
|
"navigationStyle": "custom", |
||||
|
"navigationBarTextStyle": "white" |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
<view class="header" style="height: {{statusHeight + navigationHeight}}px;"> |
||||
|
<image class="header-bg" src="../../../../images/home/home-status.png" /> |
||||
|
<view style="height: 80rpx;position: fixed;margin-top: 60rpx;width: 70rpx;z-index: 101;" bindtap="naviBack"> |
||||
|
<image class="header-back" style="margin-top:{{statusHeight/2}}px" src="../../images/back.png"></image> |
||||
|
</view> |
||||
|
<view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;"> |
||||
|
详情 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="home" style="margin-top: {{statusHeight + navigationHeight}}px"> |
||||
|
<view class="consultant-header"> |
||||
|
<image src="{{consultantInfo.avatar}}" class="consultant-pic"></image> |
||||
|
<view class="consultant-detail"> |
||||
|
<view class="consultant-name">{{consultantInfo.name}}</view> |
||||
|
<view class="consultant-number">{{consultantInfo.motto!==''?consultantInfo.motto:'暂无座右铭'}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="title"> |
||||
|
<view class="title-header">头衔</view> |
||||
|
<view class="title-content" wx:for="{{consultantInfo.titleList}}" wx:for-item="item">{{item}}</view> |
||||
|
</view> |
||||
|
<view class="title"> |
||||
|
<view class="title-header">简介</view> |
||||
|
<view class="title-content" style="height:auto">{{consultantInfo.briefIntroduction}}</view> |
||||
|
</view> |
||||
|
<view class="footer"> |
||||
|
<button bindtap="navigateToAsk" class="askBtn" size="defaultSize" >向Ta咨询</button> |
||||
|
</view> |
||||
|
</view> |
||||
@ -0,0 +1,118 @@ |
|||||
|
page { |
||||
|
width: 100%; |
||||
|
height: auto; |
||||
|
overflow-y: auto; |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
|
||||
|
.header { |
||||
|
position: fixed; |
||||
|
width: 100%; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
z-index: 1000; |
||||
|
} |
||||
|
.header .header-bg { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
position: absolute; |
||||
|
z-index: 10; |
||||
|
left: 0; |
||||
|
top: 0; |
||||
|
} |
||||
|
.header .navigation { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
color: rgba(255,255,255, 0.9); |
||||
|
font-size: 32rpx; |
||||
|
position: relative; |
||||
|
z-index: 100; |
||||
|
} |
||||
|
.home { |
||||
|
width: 100%; |
||||
|
padding-bottom: 160rpx; |
||||
|
overflow-x: hidden; |
||||
|
} |
||||
|
.header-back{ |
||||
|
height: 33rpx; |
||||
|
width: 18rpx; |
||||
|
position: fixed; |
||||
|
margin-left: 30rpx; |
||||
|
z-index: 101; |
||||
|
} |
||||
|
.home .consultant-header{ |
||||
|
background-color: #fff; |
||||
|
width: 100%; |
||||
|
padding: 0 20rpx; |
||||
|
line-height: 100rpx; |
||||
|
margin-top: 20rpx; |
||||
|
} |
||||
|
.consultant-pic{ |
||||
|
width: 120rpx; |
||||
|
height: 120rpx; |
||||
|
border-radius: 60px; |
||||
|
margin-top: 20rpx; |
||||
|
} |
||||
|
.consultant-detail{ |
||||
|
width: 68%; |
||||
|
display: inline-block; |
||||
|
padding-left: 40rpx; |
||||
|
height: 120rpx; |
||||
|
} |
||||
|
.consultant-name{ |
||||
|
font-size: 30rpx; |
||||
|
font-weight: bold; |
||||
|
height: 75rpx; |
||||
|
word-break: break-all; |
||||
|
line-height: 50rpx; |
||||
|
} |
||||
|
.consultant-number{ |
||||
|
font-size: 25rpx; |
||||
|
color: #999; |
||||
|
line-height: 45rpx; |
||||
|
} |
||||
|
.title{ |
||||
|
width: 100%; |
||||
|
background-color: #fff; |
||||
|
margin-top: 20rpx; |
||||
|
} |
||||
|
.title-header{ |
||||
|
width: 94%; |
||||
|
margin:0 auto; |
||||
|
color: #999999; |
||||
|
height: 100rpx; |
||||
|
line-height: 100rpx; |
||||
|
font-size: 28rpx; |
||||
|
border-bottom: 0.5px solid #E7EDED; |
||||
|
} |
||||
|
.title-content{ |
||||
|
width: 94%; |
||||
|
margin:0 auto; |
||||
|
height: 80rpx; |
||||
|
line-height: 80rpx; |
||||
|
color: #333; |
||||
|
font-size: 32rpx; |
||||
|
} |
||||
|
.footer{ |
||||
|
width: 100%; |
||||
|
height: 98rpx; |
||||
|
position: fixed; |
||||
|
bottom: 5%; |
||||
|
left: 0; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: flex-end; |
||||
|
} |
||||
|
.askBtn { |
||||
|
width: 70%; |
||||
|
height: 100%; |
||||
|
line-height: 98rpx; |
||||
|
text-align: center; |
||||
|
background: #cc1200; |
||||
|
font-size: 32rpx; |
||||
|
color: #fff; |
||||
|
border-radius: 40px; |
||||
|
border:none |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
const api = require('../../../../utils/api') |
||||
|
import { getTimestamp } from '../../../../utils/common' |
||||
|
import util from '../../../../utils/util' |
||||
|
const app = getApp() |
||||
|
Page({ |
||||
|
data: { |
||||
|
isLoading:true, |
||||
|
loadMoreType: 'loading', |
||||
|
loadMoreVisible: true, |
||||
|
consultantList:[] |
||||
|
}, |
||||
|
onLoad (options) { |
||||
|
this.setData({ |
||||
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
||||
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
||||
|
sudokuHeight:app.globalData.deviceInfo.statusHeight+app.globalData.deviceInfo.navigationHeight, |
||||
|
}) |
||||
|
this.getConsultantList(); |
||||
|
}, |
||||
|
onReachBottom(){ |
||||
|
// if(!this.data.isLoading && this.data.loadMoreType!='none'){
|
||||
|
// this.setData({
|
||||
|
// isLoading:true,
|
||||
|
// loadMoreVisible:true,
|
||||
|
// loadMoreType:"loading"
|
||||
|
// })
|
||||
|
// }
|
||||
|
}, |
||||
|
naviBack(){ |
||||
|
wx.navigateBack({ |
||||
|
delta:-1, |
||||
|
}) |
||||
|
}, |
||||
|
navigateToConsultDetail(e){ |
||||
|
console.log(e); |
||||
|
wx.navigateTo({ |
||||
|
url: '/subpages/safety/pages/consultantDetail/consultantDetail?id='+e.currentTarget.dataset.id, |
||||
|
}) |
||||
|
}, |
||||
|
getConsultantList(){ |
||||
|
api.getConsultantList('1').then(res=>{ |
||||
|
this.setData({ |
||||
|
isLoading:false, |
||||
|
consultantList:this.data.consultantList.concat(res.data), |
||||
|
loadMoreType:'none', |
||||
|
loadMoreVisible:false |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
@ -0,0 +1,9 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"completeInfo-dialog": "../../../../../components/completeInfoDialog/completeInfoDialog", |
||||
|
"load-more":"../../components/loadMore/loadMore" |
||||
|
}, |
||||
|
"navigationBarTitleText": "咨询师列表", |
||||
|
"navigationStyle": "custom", |
||||
|
"navigationBarTextStyle": "white" |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
<view class="header" style="height: {{statusHeight + navigationHeight}}px;"> |
||||
|
<image class="header-bg" src="../../../../images/home/home-status.png" /> |
||||
|
<view style="height: 80rpx;position: fixed;margin-top: 60rpx;width: 70rpx;z-index: 101;" bindtap="naviBack"> |
||||
|
<image class="header-back" style="margin-top:{{statusHeight/2}}px" src="../../images/back.png"></image> |
||||
|
</view> |
||||
|
<view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;"> |
||||
|
列表 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="home" style="margin-top: {{statusHeight + navigationHeight}}px"> |
||||
|
<view class="list" wx:if="{{consultantList.length>0}}"> |
||||
|
<view class="list-content"> |
||||
|
<view class="content" |
||||
|
wx:for="{{consultantList}}" |
||||
|
wx:for-item="item" |
||||
|
wx:for-index="index" |
||||
|
wx:key="index" |
||||
|
bindtap="navigateToConsultDetail" |
||||
|
data-id="{{item.id}}"> |
||||
|
<view class="avatar"> |
||||
|
<image src="{{item.avatar}}" class="avatar-img"></image> |
||||
|
<image src="../../images/heart.png" class="avatar-mark"></image> |
||||
|
</view> |
||||
|
<view style="display:table;width:80%"> |
||||
|
<view class="name">{{item.name}}</view> |
||||
|
<view class="detail">{{item.motto}}</view> |
||||
|
</view> |
||||
|
|
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- <load-more loadMoreVisible="{{loadMoreVisible}}" loadMoreType="{{loadMoreType}}"></load-more> --> |
||||
@ -0,0 +1,85 @@ |
|||||
|
page { |
||||
|
width: 100%; |
||||
|
height: auto; |
||||
|
overflow-y: auto; |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
|
||||
|
.header { |
||||
|
position: fixed; |
||||
|
width: 100%; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
z-index: 1000; |
||||
|
} |
||||
|
.header .header-bg { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
position: absolute; |
||||
|
z-index: 10; |
||||
|
left: 0; |
||||
|
top: 0; |
||||
|
} |
||||
|
.header .navigation { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
color: rgba(255,255,255, 0.9); |
||||
|
font-size: 32rpx; |
||||
|
position: relative; |
||||
|
z-index: 100; |
||||
|
} |
||||
|
.home { |
||||
|
width: 100%; |
||||
|
overflow-x: hidden; |
||||
|
} |
||||
|
.header-back{ |
||||
|
height: 33rpx; |
||||
|
width: 18rpx; |
||||
|
position: fixed; |
||||
|
margin-left: 30rpx; |
||||
|
z-index: 101; |
||||
|
} |
||||
|
.list{ |
||||
|
width: 100%; |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
.list-content{ |
||||
|
display: inline-block; |
||||
|
width: 100%; |
||||
|
} |
||||
|
.list-content .content{ |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
margin-top: 20rpx; |
||||
|
border-bottom: 0.5px solid #E7EEEE; |
||||
|
padding-bottom: 20rpx; |
||||
|
} |
||||
|
.list-content .content .avatar{ |
||||
|
width: 150rpx; |
||||
|
margin-left: 20rpx; |
||||
|
} |
||||
|
.list-content .content .avatar .avatar-img{ |
||||
|
width: 120rpx; |
||||
|
height: 120rpx; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
.list-content .content .avatar .avatar-mark{ |
||||
|
width: 35rpx; |
||||
|
height: 35rpx; |
||||
|
margin-left: -30rpx; |
||||
|
} |
||||
|
.list-content .content .name{ |
||||
|
width: 100%; |
||||
|
font-size: 32rpx; |
||||
|
} |
||||
|
.list-content .content .detail{ |
||||
|
width: 94%; |
||||
|
font-size: 28rpx; |
||||
|
white-space: nowrap; |
||||
|
text-overflow: ellipsis; |
||||
|
overflow: hidden; |
||||
|
color: #999; |
||||
|
margin-top: 40rpx; |
||||
|
} |
||||
@ -0,0 +1,116 @@ |
|||||
|
const api = require('../../../../utils/api') |
||||
|
import { getTimestamp } from '../../../../utils/common' |
||||
|
import util from '../../../../utils/util' |
||||
|
const app = getApp() |
||||
|
Page({ |
||||
|
data: { |
||||
|
loadMoreType: 'loading', |
||||
|
loadMoreVisible: true, |
||||
|
pageNo: 1, // 分页页码
|
||||
|
pageSize: 10, // 分页页长
|
||||
|
isLoading: true, |
||||
|
questionList:[], |
||||
|
timestamp:'' |
||||
|
}, |
||||
|
onLoad (options) { |
||||
|
this.setData({ |
||||
|
statusHeight: app.globalData.deviceInfo.statusHeight, |
||||
|
navigationHeight: app.globalData.deviceInfo.navigationHeight, |
||||
|
sudokuHeight:app.globalData.deviceInfo.statusHeight+app.globalData.deviceInfo.navigationHeight, |
||||
|
timestamp:getTimestamp() |
||||
|
}) |
||||
|
let param = { |
||||
|
pageIndex:this.data.pageNo, |
||||
|
pageSize:this.data.pageSize, |
||||
|
timestamp:this.data.timestamp |
||||
|
} |
||||
|
this.getMyQuestion(param); |
||||
|
}, |
||||
|
onReachBottom(){ |
||||
|
if(!this.data.isLoading && this.data.loadMoreType!='none'){ |
||||
|
this.setData({ |
||||
|
isLoading:true, |
||||
|
loadMoreVisible:true, |
||||
|
loadMoreType:'loading', |
||||
|
pageNo:this.data.pageNo+1 |
||||
|
}) |
||||
|
let param = { |
||||
|
pageIndex:this.data.pageIndex, |
||||
|
pageSize:this.data.pageSize, |
||||
|
timestamp:this.data.timestamp |
||||
|
} |
||||
|
this.getMyQuestion(param); |
||||
|
} |
||||
|
}, |
||||
|
naviBack(){ |
||||
|
wx.navigateBack({ |
||||
|
delta:-1, |
||||
|
}) |
||||
|
}, |
||||
|
getMyQuestion(param){ |
||||
|
api.getMyQuestion(param).then(res=>{ |
||||
|
this.setData({ |
||||
|
isLoading:false, |
||||
|
questionList:this.data.questionList.concat(res.data), |
||||
|
}) |
||||
|
this.setCollapse(); |
||||
|
if(res.data.length<10){ |
||||
|
this.setData({ |
||||
|
loadMoreType:'none', |
||||
|
loadMoreVisible:true, |
||||
|
}) |
||||
|
}else{ |
||||
|
this.setData({ |
||||
|
loadMoreType:"more", |
||||
|
loadMoreVisible:false |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
setCollapse: function() { |
||||
|
var query = wx.createSelectorQuery(); |
||||
|
var that = this; |
||||
|
query.in(this.selectComponent('#question-list')).selectAll('#questionContent').boundingClientRect(function (rect) { |
||||
|
rect.forEach((v, i) => { |
||||
|
if (v.height > 60) { //判断高度,根据各种高度取折中
|
||||
|
var set = "questionList[" + i + "].collapse"; |
||||
|
var set1 = "questionList[" + i + "].showCollapse"; |
||||
|
that.setData({ |
||||
|
[set]: true, |
||||
|
[set1]: true, |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}).exec(); |
||||
|
query.in(this.selectComponent('#question-list')).selectAll('#answerContent').boundingClientRect(function (rect) { |
||||
|
rect.forEach((v, i) => { |
||||
|
console.log(v) |
||||
|
console.log(v.dataset.question) |
||||
|
if (v.height > 70) { |
||||
|
var set = "questionList[" + v.dataset.question + "].answerList[0].collapse"; |
||||
|
var set1 = "questionList[" + v.dataset.question + "].answerList[0].showCollapse"; |
||||
|
that.setData({ |
||||
|
[set]: true, |
||||
|
[set1]: true, |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}).exec(); |
||||
|
}, |
||||
|
//点击全文收起
|
||||
|
changeCollapse: function(e){ |
||||
|
var index = e.detail.currentTarget.dataset.index; |
||||
|
var questionIndex=e.detail.currentTarget.dataset.questionindex; |
||||
|
if(questionIndex===undefined){ |
||||
|
var set = "questionList[" + index + "].collapse"; |
||||
|
this.setData({ |
||||
|
[set]: !this.data.questionList[index].collapse |
||||
|
}) |
||||
|
}else{ |
||||
|
var set = "questionList[" + questionIndex + "].answerList[0].collapse"; |
||||
|
this.setData({ |
||||
|
[set]: !this.data.questionList[questionIndex].answerList[0].collapse |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
@ -0,0 +1,10 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"completeInfo-dialog": "../../../../../components/completeInfoDialog/completeInfoDialog", |
||||
|
"question-list":"../../components/questionList/questionList", |
||||
|
"load-more":"../../components/loadMore/loadMore" |
||||
|
}, |
||||
|
"navigationBarTitleText": "我的提问", |
||||
|
"navigationStyle": "custom", |
||||
|
"navigationBarTextStyle": "white" |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
<view class="header" style="height: {{statusHeight + navigationHeight}}px;"> |
||||
|
<image class="header-bg" src="../../../../images/home/home-status.png" /> |
||||
|
<view style="height: 80rpx;position: fixed;margin-top: 60rpx;width: 70rpx;z-index: 101;" bindtap="naviBack"> |
||||
|
<image class="header-back" style="margin-top:{{statusHeight/2}}px" src="../../images/back.png"></image> |
||||
|
</view> |
||||
|
<view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;"> |
||||
|
我的问题 |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="home" style="margin-top: {{statusHeight + navigationHeight}}px"> |
||||
|
<question-list id="question-list" |
||||
|
style="width:100%" |
||||
|
questionList="{{questionList}}" |
||||
|
bind:changeCollapse="changeCollapse"></question-list> |
||||
|
</view> |
||||
|
<load-more loadMoreVisible="{{loadMoreVisible}}" loadMoreType="{{loadMoreType}}"></load-more> |
||||
@ -0,0 +1,42 @@ |
|||||
|
page { |
||||
|
width: 100%; |
||||
|
height: auto; |
||||
|
overflow-y: auto; |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
|
||||
|
.header { |
||||
|
position: fixed; |
||||
|
width: 100%; |
||||
|
top: 0; |
||||
|
left: 0; |
||||
|
z-index: 1000; |
||||
|
} |
||||
|
.header .header-bg { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
position: absolute; |
||||
|
z-index: 10; |
||||
|
left: 0; |
||||
|
top: 0; |
||||
|
} |
||||
|
.header .navigation { |
||||
|
width: 100%; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
color: rgba(255,255,255, 0.9); |
||||
|
font-size: 32rpx; |
||||
|
position: relative; |
||||
|
z-index: 100; |
||||
|
} |
||||
|
.home { |
||||
|
width: 100%; |
||||
|
} |
||||
|
.header-back{ |
||||
|
height: 33rpx; |
||||
|
width: 18rpx; |
||||
|
position: fixed; |
||||
|
margin-left: 30rpx; |
||||
|
z-index: 101; |
||||
|
} |
||||
Loading…
Reference in new issue