1.22
This commit is contained in:
@@ -0,0 +1,183 @@
|
||||
// pages/comment/comment.js
|
||||
import {
|
||||
commentList
|
||||
} from "../../../api/consultExpert"
|
||||
Page({
|
||||
data: {
|
||||
value: 3,
|
||||
page: 1,
|
||||
isTriggered:false,
|
||||
lock: false,
|
||||
evaluation_type: 1,
|
||||
allList: [],
|
||||
goodList: [],
|
||||
commonList: [],
|
||||
doctor_id: '',
|
||||
total_quantity: 0,
|
||||
good_quantity: 0,
|
||||
bad_quantity: 0,
|
||||
scrollTop: 0,
|
||||
offsetTop: 0,
|
||||
|
||||
},
|
||||
onfresh(doctor_id) {
|
||||
this.setData({
|
||||
page: 1,
|
||||
allList: [],
|
||||
goodList: [],
|
||||
commonList: [],
|
||||
lock: false
|
||||
})
|
||||
this.getEvaluationList(doctor_id);
|
||||
},
|
||||
onScroll(event) {
|
||||
wx.createSelectorQuery()
|
||||
.select('#scroller')
|
||||
.boundingClientRect((res) => {
|
||||
this.setData({
|
||||
scrollTop: event.detail.scrollTop,
|
||||
offsetTop: res.top,
|
||||
});
|
||||
})
|
||||
.exec();
|
||||
},
|
||||
handleRefresher(){
|
||||
this.setData({
|
||||
page:1,
|
||||
lock:false,
|
||||
commonList:[],
|
||||
allList:[],
|
||||
goodList:[],
|
||||
})
|
||||
this.getEvaluationList();
|
||||
},
|
||||
scrolltolower(e) {
|
||||
let {
|
||||
lock
|
||||
} = this.data;
|
||||
let addPage = this.data.page + 1;
|
||||
if (!lock) {
|
||||
this.setData({
|
||||
page: addPage
|
||||
});
|
||||
this.getEvaluationList();
|
||||
}
|
||||
},
|
||||
getEvaluationList() {
|
||||
let {
|
||||
evaluation_type,
|
||||
page,
|
||||
doctor_id
|
||||
} = this.data;
|
||||
commentList({
|
||||
doctor_id,
|
||||
page,
|
||||
per_page: 10,
|
||||
evaluation_type: evaluation_type
|
||||
}).then((res) => {
|
||||
if (res.data.length == 0) {
|
||||
this.setData({
|
||||
lock: true,
|
||||
isTriggered:false
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if (evaluation_type == 1) {
|
||||
this.setData({
|
||||
isTriggered:false,
|
||||
allList: this.data.allList.concat(res.data)
|
||||
})
|
||||
} else if (evaluation_type == 2) {
|
||||
this.setData({
|
||||
isTriggered:false,
|
||||
goodList: this.data.goodList.concat(res.data)
|
||||
})
|
||||
} else {
|
||||
|
||||
this.setData({
|
||||
isTriggered:false,
|
||||
commonList: this.data.commonList.concat(res.data)
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
total_quantity: res.total_quantity,
|
||||
good_quantity: res.good_quantity,
|
||||
bad_quantity: res.bad_quantity
|
||||
})
|
||||
})
|
||||
},
|
||||
onChange(event) {
|
||||
let currentindex = event.detail.index;
|
||||
let doctor_id = this.data.doctor_id;
|
||||
if (currentindex == 0) {
|
||||
this.setData({
|
||||
evaluation_type: 1
|
||||
});
|
||||
} else if (currentindex == 1) {
|
||||
this.setData({
|
||||
evaluation_type: 2
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
evaluation_type: 3
|
||||
});
|
||||
}
|
||||
this.onfresh(doctor_id);
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.setData({
|
||||
doctor_id: options.doctor_id
|
||||
})
|
||||
this.getEvaluationList(options.doctor_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"van-rate": "@vant/weapp/rate/index",
|
||||
"van-tab": "@vant/weapp/tab/index",
|
||||
"van-tabs": "@vant/weapp/tabs/index",
|
||||
"van-sticky": "@vant/weapp/sticky/index",
|
||||
"nav":"../../../components/nav/nav"
|
||||
},
|
||||
"navigationStyle":"custom",
|
||||
"navigationBarTitleText": "肝胆相照互联网医院"
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<!--pages/comment/comment.wxml-->
|
||||
<nav navName="患者评价"></nav>
|
||||
<!--pages/comment/comment.wxml-->
|
||||
<wxs src="../../../filters/filter.wxs" module="filter" />
|
||||
<view class="page">
|
||||
<van-tabs class="tabs" tab-class="tabdiv" wrap-class="tabwrap" custom-class="tabbox" line-width="50rpx" tab-active-class="tabactive" title-inactive-color="#1C2023;" line-height="height: 10rpx;" title-active-color="#3CC7C0" color="#3CC7C0" bind:change="onChange">
|
||||
<van-tab title="全部({{total_quantity}})" class="vantab">
|
||||
<scroll-view scroll-y class="scrollwraper" bindrefresherrefresh="handleRefresher" refresher-triggered="{{isTriggered}}" refresher-threshold="100" refresher-enabled="true" style="width: 100%;" lower-threshold="100" bindscrolltolower="scrolltolower">
|
||||
<view class="titlebox">
|
||||
<view class="title">患者评价<text> ({{total_quantity}})</text></view>
|
||||
</view>
|
||||
<view class="listbox" wx:if="{{allList.length>0}}">
|
||||
<view class="list" wx:for="{{allList}}" wx:key="evaluation_id">
|
||||
<view class="namebox">
|
||||
<view class="name">{{item.name_mask}}</view>
|
||||
<van-rate value="{{item.avg_score}}" size="{{ 18 }}" color="#ed9c00" void-icon="star" void-color="#eee" bind:change="onChange" gutter="2" readonly />
|
||||
</view>
|
||||
<view class="commment">{{item.content}}</view>
|
||||
<view class="date">{{filter.formatDate(item.created_at)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</van-tab>
|
||||
<van-tab title=" 好评({{good_quantity}})" class="vantab">
|
||||
<scroll-view scroll-y class="scrollwraper" bindrefresherrefresh="handleRefresher" refresher-triggered="{{isTriggered}}" refresher-threshold="100" refresher-enabled="true" bindscrolltolower="scrolltolower">
|
||||
<view class="titlebox">
|
||||
<view class="title">患者评价<text> ({{good_quantity}})</text></view>
|
||||
</view>
|
||||
<view class="listbox" wx:if="{{goodList.length>0}}">
|
||||
<view class="list" wx:for="{{goodList}}" wx:key="evaluation_id">
|
||||
<view class="namebox">
|
||||
<view class="name">{{item.name_mask}}</view>
|
||||
<van-rate value="{{item.avg_score}}" size="{{ 18 }}" color="#ed9c00" void-icon="star" void-color="#eee" bind:change="onChange" gutter="2" readonly />
|
||||
</view>
|
||||
<view class="commment">{{item.content}}</view>
|
||||
<view class="date">{{filter.formatDate(item.created_at)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</van-tab>
|
||||
<van-tab title="中/差评({{bad_quantity}})" class="vantab">
|
||||
<scroll-view scroll-y class="scrollwraper" bindrefresherrefresh="handleRefresher" refresher-triggered="{{isTriggered}}" refresher-threshold="100" refresher-enabled="true" lower-threshold="100" bindscrolltolower="scrolltolower">
|
||||
<view class="titlebox">
|
||||
<view class="title">患者评价<text> ({{bad_quantity}})</text></view>
|
||||
</view>
|
||||
<view class="listbox" wx:if="{{commonList.length>0}}">
|
||||
<view class="list" wx:for="{{commonList}}" wx:key="evaluation_id">
|
||||
<view class="namebox">
|
||||
<view class="name">{{item.name_mask}}</view>
|
||||
<van-rate value="{{item.avg_score}}" size="{{ 18 }}" color="#ed9c00" void-icon="star" void-color="#eee" bind:change="onChange" gutter="2" readonly />
|
||||
</view>
|
||||
<view class="commment">{{item.content}}</view>
|
||||
<view class="date">{{filter.formatDate(item.created_at)}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="nonedata" wx:else>
|
||||
暂无评价!
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</van-tab>
|
||||
</van-tabs>
|
||||
</view>
|
||||
@@ -0,0 +1,161 @@
|
||||
/* pages/comment/comment.wxss */
|
||||
.page{
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
flex-direction: column;
|
||||
}
|
||||
.tabwraper{
|
||||
flex:1;
|
||||
overflow: hidden;
|
||||
margin-top: 172rpx;
|
||||
}
|
||||
.nonedata{
|
||||
width:auto;
|
||||
box-sizing: border-box;
|
||||
margin:0 30rpx;
|
||||
background-color: #fff;
|
||||
}
|
||||
.van-tab__pane{
|
||||
flex:1;
|
||||
}
|
||||
.tabbox{
|
||||
flex:1;
|
||||
width:100%;
|
||||
height:100%;
|
||||
}
|
||||
|
||||
.van-tabs{
|
||||
width:100%;
|
||||
}
|
||||
|
||||
.tabactive{
|
||||
font-size: 32rpx!important;
|
||||
}
|
||||
.viewcell{
|
||||
display: flex;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
padding:40rpx 30rpx 30rpx;
|
||||
|
||||
border-radius: 10rpx;
|
||||
background-color: #fff;
|
||||
margin:0 32rpx 20rpx;
|
||||
}
|
||||
.tabdiv{
|
||||
height:100%;
|
||||
}
|
||||
.scrollwraper{
|
||||
height:100%;
|
||||
overflow: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
|
||||
}
|
||||
.van-tab__pane{
|
||||
margin-top: 20rpx;
|
||||
overflow: hidden;
|
||||
height:calc(100vh - 285rpx)!important;
|
||||
}
|
||||
.tabs{
|
||||
flex:1;
|
||||
margin-top: 172rpx;
|
||||
}
|
||||
.vantab{
|
||||
display: flex;
|
||||
overflow-y: hidden;
|
||||
position: relative;
|
||||
height:calc(100% - 300rpx);
|
||||
}
|
||||
.scrollwraper{
|
||||
box-sizing: border-box;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
.titlebox {
|
||||
display: flex;
|
||||
padding: 0 20rpx 0rpx;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.titlebox .title {
|
||||
margin:0 20rpx;
|
||||
font-weight: 600;
|
||||
color: #333333;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.scrollwraper .titlebox {
|
||||
border-bottom: 1rpx solid#E7E7E7;
|
||||
padding: 0 20rpx 30rpx;
|
||||
}
|
||||
|
||||
.titlebox .tag {
|
||||
height: 40rpx;
|
||||
border: 1rpx solid #3CC7C0;
|
||||
padding: 0 25rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-radius: 20rpx;
|
||||
color: #3CC7C0;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.more{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.listbox{
|
||||
background-color: #fff;
|
||||
margin:0 30rpx;
|
||||
border-radius: 0 0rpx 10rpx 10rpx;
|
||||
}
|
||||
.listbox .list:last-child{
|
||||
border: none;
|
||||
}
|
||||
.more text{
|
||||
color: #333333;
|
||||
font-size: 28rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.more image{
|
||||
width: 14rpx;
|
||||
height: 26rpx;
|
||||
}
|
||||
.scrollwraper .titlebox{
|
||||
border-radius:10rpx 10rpx 0 0;
|
||||
margin:0 30rpx;
|
||||
background-color: #fff;
|
||||
padding: 30rpx 0;
|
||||
}
|
||||
.title text{
|
||||
font-size: 28rpx;
|
||||
font-weight: normal;
|
||||
color:#666;
|
||||
}
|
||||
|
||||
.list{
|
||||
padding-top: 30rpx;
|
||||
padding-bottom: 30rpx;
|
||||
border-bottom: 1px solid #E7E7E7;
|
||||
}
|
||||
.list .namebox{
|
||||
justify-content: space-between;
|
||||
margin:0rpx 20rpx 0rpx;
|
||||
display: flex;
|
||||
}
|
||||
.list .namebox .name{
|
||||
font-weight: normal;
|
||||
font-size: 28rpx;
|
||||
color:#666;
|
||||
}
|
||||
.commment{
|
||||
margin:30rpx 20rpx 20rpx;
|
||||
color: #333333;
|
||||
font-size: 30rpx;
|
||||
word-break: break-all;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
.date{
|
||||
margin:0rpx 20rpx 0rpx;
|
||||
display: flex;
|
||||
color: #666666;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user