hengmei-two/pagesB/doctorDetail/doctorDetail.vue

230 lines
7.8 KiB
Vue
Raw Normal View History

2021-08-19 06:40:59 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'医生'" :statusTitle="true"></status-nav>
<!-- 自定义二级分类 -->
<!-- 列表 -->
2022-02-15 08:02:16 +00:00
<view :style="{paddingTop: statusHNH+'px'}" class=" pad-x180">
2021-08-26 01:50:19 +00:00
<view v-if="isLoading" class="bacf mar-s20 pad-s20 pad-y32 pad-x40">
<view class="disjb pad-z30">
<image class="radius10" :src="doctorObj.doctor_extra.headimg || moImg" mode="widthFix" lazy-load></image>
<!-- <image class="radius10 flexs mar-z30" :src="doctorObj.doctor_extra.headimg || moImg" style="width: 300rpx;height: 300rpx;" mode="aspectFill"></image>
2021-12-20 08:02:27 +00:00
<view class="pad-z20 width100">
2021-08-26 01:50:19 +00:00
<view class="fon28 bold col3">{{doctorObj.doctor_extra.name}}</view>
<view class="col80 fon24">
2021-08-19 06:40:59 +00:00
<view class="flexs">擅长领域</view>
<view class="dis fw">
<view class="flexs" v-for="(item,index) in doctorObj.diseases" :key="index" style="background-color: #F5F5F5;border-radius: 10rpx;padding: 6rpx 10rpx;margin-top: 10rpx;margin-right: 10rpx;">
<text class="bold pcol">{{item.disease_name}}</text>
2021-08-19 06:40:59 +00:00
</view>
</view>
2021-08-19 06:40:59 +00:00
</view>
</view> -->
2021-08-19 06:40:59 +00:00
</view>
<view class="mar-z32">
<view class="bbot mar-s30"></view>
2021-12-20 08:02:27 +00:00
<view class="fon28 bold col3 mar-sx20">医生简介</view>
<rich-text class="fon26 col3" :nodes="peopleJian"></rich-text>
</view>
<view class="mar-z32">
<view class="bbot mar-s30"></view>
<view class="fon28 bold col3 mar-sx20">医生详情</view>
<rich-text class="fon26 col3" :nodes="detailInfo"></rich-text>
2021-08-19 06:40:59 +00:00
</view>
</view>
<view id="daoh" :class="isTop?'isTop':''" class="isTops" :style="{top:(statusHNH-10)+'px'}">
<view class="bacf pad-zy32 mar-s20 pad-sx20">
<cate-pu :newCurrent="newCurrent*1" :activeb="publicColor" @choosecateEv="chooseTwo" :newbmo="'#F2F2F2'" :isCenter="false" :newcateList="cateList"></cate-pu>
</view>
</view>
2022-03-04 08:48:40 +00:00
<view class="mar-zy32 mar-s20" v-if="dataList.length!=0"><list-pu @chooseLike="chooseLike" @praise="praiseEv" @comfirmev="comfirmev" :list="dataList"></list-pu></view>
<view style="margin-top: 8%;" v-if="dataList.length==0"><list-pu :list="dataList" @praise="praiseEv"></list-pu></view>
2021-08-19 06:40:59 +00:00
</view>
2021-08-26 09:57:04 +00:00
<!-- 底部客服 -->
2022-02-15 08:02:16 +00:00
<!-- <public-customer :nbottom="100"></public-customer> -->
2022-03-04 08:48:40 +00:00
<!-- 用户信息授权手机号授权 -->
<auth-userInfo-mobileInfo></auth-userInfo-mobileInfo>
2022-02-15 08:02:16 +00:00
<!-- 底部导航 -->
<view class="posixzy">
<bottom-tab></bottom-tab>
</view>
2021-08-19 06:40:59 +00:00
</view>
</template>
<script>
import {collectionEV,cancleCollectionEV} from '@/jsFile/publicAPI.js';
2022-02-15 08:02:16 +00:00
import bottomTab from '@/components/bottom-tab.vue';
2021-08-19 06:40:59 +00:00
export default {
2022-02-15 08:02:16 +00:00
components:{
bottomTab
},
2021-08-19 06:40:59 +00:00
data() {
return {
statusHNH:uni.getStorageSync('statusHNH'),
publicColor:uni.getStorageSync('publicColor'),//主题颜色
cateList:[],
dataList:[],
2021-08-19 06:40:59 +00:00
newCurrent:0,
2021-08-22 08:53:12 +00:00
category_id:0,//栏目ID
2021-08-19 06:40:59 +00:00
moImg:'/static/public/logo.png',
doctorObj:{},//医生详情
page:1,
size:10,
total:'',//总数
isZanw:true,
chuTop:'',
isTop:false,
2021-12-02 09:31:26 +00:00
isLoading:false,
2021-12-20 08:02:27 +00:00
detailInfo:'',
peopleJian:'',
doctorId:''//医生id
2021-08-19 06:40:59 +00:00
}
},
onShareAppMessage() {
var shareObj = {
path: `/pagesB/doctorDetail/doctorDetail?invite_code=${uni.getStorageSync('invite_code')}&doctor_id=${this.doctorId}`, // 默认是当前页面,必须是以‘/’开头的完整路径
};
return shareObj;
},
2021-08-19 06:40:59 +00:00
onPageScroll(e) {
if((this.chuTop - this.statusHNH) - e.scrollTop*1 <= 0) this.isTop = true
else this.isTop = false
},
onReachBottom() {//触底事件
// console.log(this.total,this.dataList.length);
2021-08-19 06:40:59 +00:00
if(this.total!=this.dataList.length){
this.page++
if(this.category_id==0) this.category_id = this.cateList[0].id
2021-08-19 06:40:59 +00:00
this.checkConList(this.category_id)//调用自主预约列表事件
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多列表','none',1000)
this.isZanw = false
}
},
2021-08-22 08:53:12 +00:00
onShow() {
2022-03-04 08:48:40 +00:00
this.$toolAll.tools.isLogin();
if(uni.getStorageSync('phone_active')!=0){
this.checkConList(this.category_id)
}
2021-08-22 08:53:12 +00:00
},
2021-08-19 06:40:59 +00:00
onLoad(options) {
const query = wx.createSelectorQuery()
query.select('#daoh').boundingClientRect((rect) => {
this.chuTop = rect.top
}).exec()
2022-03-04 08:48:40 +00:00
this.doctorId = options.doctor_id;
if(uni.getStorageSync('phone_active')!=0){
this.checkDoD(this.doctorId)
}
2021-08-19 06:40:59 +00:00
},
methods: {
chooseLike(e){//收藏事件
// console.log(this.dataList[e].is_collected);
if(this.dataList[e].is_collected==0){
this.dataList[e].is_collected = 1;
this.dataList[e].collects++;
// 调用收藏事件
collectionEV({action:'collect',archive_id:this.dataList[e].id})
}
},
2022-03-04 08:48:40 +00:00
praiseEv(e){ // 点赞事件
// console.log(this.dataList[e].is_collected);
if(this.dataList[e].is_liked==0){
this.dataList[e].is_liked = 1;
this.dataList[e].likes++;
if(this.dataList[e].likes>1000) this.dataList[e].likes = '999+'
// 调用收藏事件
collectionEV({action:'like',archive_id:this.dataList[e].id})
}
},
comfirmev(e){//确认取消收藏事件
this.dataList[e].is_collected = 0
this.$toolAll.tools.showToast('正在取消...','loading');
this.dataList[e].collects--;
// 调用取消收藏事件
cancleCollectionEV({action:'collect',archive_id:this.dataList[e].id})
},
2021-08-19 06:40:59 +00:00
checkDoD(doctor_id){
this.$requst.post('user/doctor-info',{doctor_id:doctor_id}).then(res=>{
// console.log('医生详情:',res);
if(res.code==0){
2021-12-20 08:02:27 +00:00
this.doctorObj = res.data;
// 富文本
this.peopleJian = this.$toolAll.tools.escape2Html(this.doctorObj.doctor_extra.summary);
this.detailInfo = this.$toolAll.tools.escape2Html(this.doctorObj.doctor_extra.content);
this.isLoading = true;
2021-08-19 06:40:59 +00:00
}
},error=>{})
},
checkConList(category_id){//查询收藏列表
let params = {
category_id:category_id,
page:this.page,
size:this.size
}
2021-08-22 08:53:12 +00:00
this.$requst.post('archives/hot',params).then(res=>{
2021-08-19 06:40:59 +00:00
if(res.code==0){
// 栏目类别
if(res.data.category.length!=0){
res.data.category.forEach((item,index)=>{
let cateObj = {
id:item.id,//栏目ID
title:item.title,//栏目名称
active:item.active,//是否选中
model_id:item.model_id,//模型ID
model_name:item.model_name,//模型标识
sort:item.sort,
}
if(item.title=='日记分享') {
this.cateList.unshift(cateObj)
} else {
2021-08-19 06:40:59 +00:00
this.cateList.push(cateObj)
}
})
2021-08-19 06:40:59 +00:00
}
// 获取列表
2021-12-20 08:02:27 +00:00
if(this.page==1) {
this.dataList = [];
}
2021-08-19 06:40:59 +00:00
this.total = res.data.list.total
if(res.data.list.list.length!=0){
res.data.list.list.forEach(item=>{
2021-11-18 09:34:08 +00:00
let fabImg = '';
2021-12-20 08:02:27 +00:00
if(item.published_headimgurl!='' && item.published_headimgurl!=null) fabImg = this.$http + item.published_headimgurl
2021-08-19 06:40:59 +00:00
let tObj = {
category_id:item.category_id,//栏目ID
id:item.id,
is_collected:item.is_collected,//是否已收藏
2021-08-19 06:40:59 +00:00
collects:item.collects,//收藏量
views:item.views,//查看量
main_img:this.$http + item.cover,//封面图
video:this.$http + item.video,//视频地址
title:item.title,//标题
content:item.subtitle,//副标题
2021-12-20 08:02:27 +00:00
head_img:fabImg || '/static/public/logo.png',//发布者头像
2021-11-18 09:34:08 +00:00
name:item.published_by || '恒美植发',//发布者昵称
2022-03-04 08:48:40 +00:00
isVideo:item.video.includes(".mp4"),//是否是视频
likes:item.likes,//点赞数量
is_liked:item.is_liked//是否已点赞
2021-08-19 06:40:59 +00:00
}
2021-12-20 08:02:27 +00:00
this.dataList.push(tObj);
2021-08-19 06:40:59 +00:00
})
}
}
},error=>{})
},
chooseTwo(index){
this.newCurrent = index
this.isZanw = true
this.page = 1
this.category_id = this.cateList[index].id
this.checkConList(this.category_id)
2021-08-19 06:40:59 +00:00
},
}
}
</script>
<style>
</style>