add file
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
import { API } from './../../../utils/network/api'
|
||||
const api = new API()
|
||||
const app = getApp()
|
||||
Page({
|
||||
data: {
|
||||
navbarData: {
|
||||
showCapsule: 1, //是否显示左上角图标 1表示显示 0表示不显示
|
||||
title: '患者评价', //导航栏 中间的标题
|
||||
},
|
||||
height: app.globalData.height,
|
||||
stickyProps: {
|
||||
offsetTop: app.globalData.height*2 + 20,
|
||||
zIndex: 99
|
||||
},
|
||||
doctor_id: "",
|
||||
evaluation_type: 1,
|
||||
appraise_list_1: [],
|
||||
appraise_list_2: [],
|
||||
appraise_list_3: [],
|
||||
current_page: 0,
|
||||
total: 0,
|
||||
per_page: 0,
|
||||
last_page: 0,
|
||||
total_quantity: 0,
|
||||
good_quantity: 0,
|
||||
bad_quantity: 0,
|
||||
|
||||
},
|
||||
onPullDownRefresh(){
|
||||
console.log('===下拉动作===');
|
||||
this.setData({
|
||||
current_page: 0,
|
||||
})
|
||||
this.getDoctorEvaluationList();
|
||||
},
|
||||
onReachBottom() {
|
||||
console.log('===触底了!!===');
|
||||
if(this.data.current_page < this.data.last_page){//最后一页时停止分页
|
||||
this.getDoctorEvaluationList()
|
||||
}
|
||||
},
|
||||
onLoad(option){
|
||||
console.log(option.doctor_id);
|
||||
this.setData({
|
||||
doctor_id: option.doctor_id
|
||||
})
|
||||
},
|
||||
onShow(){
|
||||
console.log("onShow");
|
||||
this.getDoctorEvaluationList();
|
||||
},
|
||||
onTabsChange(e){
|
||||
console.log(e);
|
||||
let list_name = "appraise_list_" + this.data.evaluation_type;
|
||||
this.setData({
|
||||
evaluation_type: e.detail.value,
|
||||
current_page: 0,
|
||||
last_page: 0,
|
||||
[list_name]: []
|
||||
})
|
||||
this.getDoctorEvaluationList()
|
||||
},
|
||||
onTabsClick(e){
|
||||
console.log(e);
|
||||
},
|
||||
onStickyScroll(e){
|
||||
return 1;
|
||||
},
|
||||
getDoctorEvaluationList(){
|
||||
//获取评价列表
|
||||
let params = {};
|
||||
params.page = this.data.current_page + 1;
|
||||
params.doctor_id = this.data.doctor_id;
|
||||
params.evaluation_type = this.data.evaluation_type;
|
||||
api.getDoctorEvaluation(params).then(response => {
|
||||
console.log(response);
|
||||
if(response.data.total > 0){
|
||||
let list_name = "appraise_list_" + this.data.evaluation_type;
|
||||
console.log(list_name);
|
||||
let apprise_list = this.data[list_name];
|
||||
this.setData({
|
||||
[list_name]: apprise_list.concat(response.data.data),
|
||||
current_page: response.data.current_page,
|
||||
total: response.data.total,
|
||||
per_page: response.data.per_page,
|
||||
last_page: response.data.last_page,
|
||||
total_quantity: response.data.total_quantity,
|
||||
good_quantity: response.data.good_quantity,
|
||||
bad_quantity: response.data.bad_quantity,
|
||||
})
|
||||
}
|
||||
}).catch(errors => {
|
||||
console.error(errors);
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {
|
||||
"te-nav-bar": "/commpents/te_navbar",
|
||||
"appraise-data": "/commpents/appraise_data/index",
|
||||
"t-tabs": "tdesign-miniprogram/tabs/tabs",
|
||||
"t-tab-panel": "tdesign-miniprogram/tab-panel/tab-panel"
|
||||
},
|
||||
"enablePullDownRefresh": true,
|
||||
"onReachBottomDistance": 100
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<te-nav-bar navbar-data='{{navbarData}}' ></te-nav-bar>
|
||||
<view class="container" style="height: calc(100vh - 96rpx - {{height}}px);">
|
||||
<t-tabs
|
||||
defaultValue="{{1}}"
|
||||
sticky
|
||||
stickyProps="{{stickyProps}}"
|
||||
bind:change="onTabsChange"
|
||||
bind:click="onTabsClick"
|
||||
t-class="custom-tabs"
|
||||
catch:scroll="onStickyScroll"
|
||||
theme="line"
|
||||
custom-style="font-size: 32rpx"
|
||||
>
|
||||
<t-tab-panel label="全部({{total_quantity}})" value="1">
|
||||
<view class="item_list">
|
||||
<appraise-data
|
||||
name="{{item.name_mask}}"
|
||||
start="{{item.avg_score }}"
|
||||
content="{{item.content}}"
|
||||
date="{{item.created_at}}"
|
||||
wx:for="{{appraise_list_1}}"
|
||||
/>
|
||||
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
<t-tab-panel label="好评({{good_quantity}})" value="2">
|
||||
<view class="item_list">
|
||||
<appraise-data
|
||||
name="{{item.name_mask}}"
|
||||
start="{{item.avg_score }}"
|
||||
content="{{item.content}}"
|
||||
date="{{item.created_at}}"
|
||||
wx:for="{{appraise_list_2}}"
|
||||
/>
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
|
||||
<t-tab-panel label="中/差评({{bad_quantity}})" value="3">
|
||||
<view class="item_list">
|
||||
<appraise-data
|
||||
name="{{item.name_mask}}"
|
||||
start="{{item.avg_score }}"
|
||||
content="{{item.content}}"
|
||||
date="{{item.created_at}}"
|
||||
wx:for="{{appraise_list_3}}"
|
||||
/>
|
||||
</view>
|
||||
</t-tab-panel>
|
||||
</t-tabs>
|
||||
</view>
|
||||
@@ -0,0 +1,24 @@
|
||||
.container{
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.t-tab-panel,.t-tabs__content {
|
||||
background-color: #F6F6F6;
|
||||
}
|
||||
.t-tabs__item--active{
|
||||
color: #49B9AD !important;
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
.t-tabs__item-inner--line{
|
||||
font-size: 28rpx !important;
|
||||
}
|
||||
.t-tabs__track{
|
||||
background-color: var(--td-tab-track-color, var(--td-primary-color, #49B9AD)) !important;
|
||||
}
|
||||
.item_list{
|
||||
width: 92vw;
|
||||
margin: 20rpx auto;
|
||||
background-color: #fff;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user