hengmei-two/pagesB/doctorDetail/doctorDetail.vue

334 lines
10 KiB
Vue
Raw Normal View History

2021-08-19 06:40:59 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'医生'" :statusTitle="true"></status-nav>
<!-- 自定义二级分类 -->
<!-- 列表 -->
<view :style="{paddingTop: statusHeight+'px'}" class=" pad-x180">
2022-07-12 07:17:50 +00:00
<!-- 新闻视频 -->
<view class="news-video-img" v-if="video!=''">
2022-07-14 07:02:18 +00:00
<image :src="videoImg==''?doctorObj.doctor_extra.headImg:videoImg" mode="widthFix"></image>
2022-07-12 07:17:50 +00:00
<view class="news-video-btn" @tap.stop="playEv(video)">
<image src="/static/public/video.png" mode="widthFix"></image>
</view>
</view>
<view v-if="isLoading" class="bacf mar-s20 pad-s20 pad-x40" :style="{'margin-top':video==''?'20rpx':0}">
<view class=""></view>
<view class="pad-zy20">
2021-12-20 08:02:27 +00:00
<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:(statusHeight-10)+'px'}">
2021-08-19 06:40:59 +00:00
<view class="bacf pad-zy32 mar-s20 pad-sx20">
<cate-pu :isaaaa="1" :newCurrent="newCurrent*1" :activeb="publicColor" @choosecateEv="chooseTwo" :newbmo="'#F2F2F2'" :isCenter="false" :newcateList="cateList"></cate-pu>
2021-08-19 06:40:59 +00:00
</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>
2022-07-12 07:17:50 +00:00
<!-- 分享 -->
<view @tap="shareImgEv" class="detail-cart-box" style="display: flex;justify-content: center;align-items: center;width: 112rpx;height: 112rpx;border-radius: 100%;background-color: #0fac29;bottom: 160rpx;color: #FFFFFF;">
<image class="zanw-img" src="/static/public/share-pyq.png" mode="aspectFill" style="width: 64rpx;height: 81rpx;"></image>
</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';
2022-07-12 07:17:50 +00:00
import { base64ToPath } from '@/jsFile/base64-src.js';
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 {
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:'',
2022-07-12 07:17:50 +00:00
doctorId:'',//医生id
shareFlag:true, //分享
2022-07-14 07:02:18 +00:00
videoImg:'', //视频封面图
video:'', //视频链接
shareImg:'', //分享图
2021-08-19 06:40:59 +00:00
}
},
computed: {
// 主题颜色
publicColor() {
return this.$store.state.publicColor
},
statusHeight() {
return this.$store.state.statusHeight
}
},
2022-07-14 07:02:18 +00:00
onShareAppMessage(e) {
if(e.from == 'menu'){
if(this.shareImg!==''){
let shareObj = {
title: this.doctorObj.doctor_extra.name,
path: `/pagesB/doctorDetail/doctorDetail?invite_code=${uni.getStorageSync('invite_code')}&doctor_id=${this.doctorId}`, // 默认是当前页面,必须是以‘/’开头的完整路径
imageUrl: this.$hostApi + this.shareImg,
};
return shareObj;
}else{
let shareObj = {
title: this.doctorObj.doctor_extra.name,
path: `/pagesB/doctorDetail/doctorDetail?invite_code=${uni.getStorageSync('invite_code')}&doctor_id=${this.doctorId}`, // 默认是当前页面,必须是以‘/’开头的完整路径
};
return shareObj;
}
}
if(e.from == 'button'){
let 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-21 01:44:07 +00:00
if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
2022-03-04 08:48:40 +00:00
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;
2022-03-21 01:44:07 +00:00
if(uni.getStorageSync('phone_active')!=0 && uni.getStorageSync('is_active')!=0){
2022-03-04 08:48:40 +00:00
this.checkDoD(this.doctorId)
}
2021-08-19 06:40:59 +00:00
},
methods: {
2022-07-12 07:17:50 +00:00
// 全屏播放
playEv(url){
uni.navigateTo({
url: '/pagesB/video/playVideo?src='+ this.$hostApi + url
})
},
// 分享图分享
shareImgEv(){
this.$toolAll.tools.showToast('分享图生成中...','none',10000);
if(this.shareFlag){
this.shareFlag = false;
this.$requst.post('staff/doctor-share',{id:this.doctorId}).then(res=>{
base64ToPath(res.data.share_img).then(path=>{
uni.hideToast();
this.$toolAll.tools.showToast('正在调起分享...');
wx.showShareImageMenu({
path: path,
success:(res=>{
this.shareFlag = true;
this.$requst.post('user/record', {
type: 'doctor',
action: 'share',
id: this.doctorId
}).then(res => {
console.log('分享成功:', res);
}, error => {})
// 调用tools.js中的种植埋点事件
this.$toolAll.tools.plantPoint(4);
}),
fail:(err=>{
this.shareFlag = true;
})
})
})
})
} else {this.$toolAll.tools.showToast('请勿重复点击');}
},
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=>{
2022-07-12 07:17:50 +00:00
console.log('医生详情:',res);
2021-08-19 06:40:59 +00:00
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);
2022-07-12 07:17:50 +00:00
this.video = this.doctorObj.doctor_extra.video;
2022-07-14 07:02:18 +00:00
if(this.doctorObj.doctor_extra.video_img){
this.videoImg = this.$hostApi + this.doctorObj.doctor_extra.video_img;
}
this.shareImg = this.doctorObj.doctor_extra.share_img;
2022-07-12 07:17:50 +00:00
// console.log('视频链接',this.video,this.videoImg)
2021-12-20 08:02:27 +00:00
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){
// 栏目类别
this.cateList = [];
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>
2022-07-12 07:17:50 +00:00
<style scoped>
.news-video-img{
height: 500rpx;
position: relative;
overflow: hidden;
}
.news-video-img>image{
width: 100%;
min-height: 500rpx;
}
.news-video-btn{
width: 118rpx;
height: 118rpx;
border-radius: 100%;
overflow: hidden;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
}
.news-video-btn image{
width: 100%;
height: 100%;
}
.news-video-content{
width: 100vw;
height: 100vh;
background-color: rgba(0,0,0,.5);
position: fixed;
left: 0;
top: 0;
z-index: 9;
}
video#my-video{
width: 100vw;
min-height: 400rpx;
position: fixed;
left: 0;
top: 50%;
transform: translateY(-50%);
z-index: 999;
}
2021-08-19 06:40:59 +00:00
</style>