nurseWeChatAppletUI/pages/medicine/medicine.vue
2023-03-09 09:42:28 +08:00

344 lines
8.0 KiB
Vue

<template>
<view class="app">
<view class="background">
<!-- 轮播图 -->
<swiper :indicator-dots="false" indicator-color='#fff' indicator-active-color='#0086d6' :autoplay="autoplay"
:interval="2000" :duration="1000" class="swiper-box" :circular='true' @change="swiperChange">
<swiper-item v-for="(item ,index) in swiperImgUrls" :key="index">
<view class="swiper-item" v-show="!splits(item)" wx-if="{item}">
<image v-if="item" :src="item" mode="widthFix"></image>
</view>
<view class="swiper-item" v-show="splits(item)" v-if="item">
<video :id="'myVideo'+index" :autoplay="false" :src="item" controls show-fullscreen-btn
object-fit="fill" @play="play" @pause="pause" @ended="ended" auto-pause-if-navigate
show-play-btn :enable-progress-gesture='true' :show-center-play-btn='true'
enable-play-gesture auto-pause-if-open-native show-mute-btn></video>
</view>
</swiper-item>
</swiper>
</view>
<view class="hospital">
<view class="appointmenthospital">预约医生</view>
<view class="tabbar">
<view class="lefttabbar">
<view class="lefttabbarlist">
<view v-for="(item,index) in hospitalDepartmentList" :key="index"
:class="tabIndex==index?'actives':'active'" @tap='taptabindex(item,index)'>
{{item.hospitalName}}
</view>
</view>
</view>
<view class="righttabbar">
<view class="productlist">
<view class="content" v-for="(item,index) in HospitalPersonlist" :key="item.id">
<image class="hospitalimage" src="/static/header .png" mode=""></image>
<view class="hospitalteacher">{{item.personName}}</view>
<view class="physician">
{{ item.academicTitle=='CHIEF_PHYSICIAN'?'主任医师':''}}
{{ item.academicTitle=='DEPUTY_CHIEF_PHYSICIAN'?'副主任医师':''}}
{{ item.academicTitle=='ATTENDING_DOCTOR'?'主治医师':''}}
{{ item.academicTitle=='PHYSICIAN'?'医师':''}}
{{ item.academicTitle=='HEALER'?'医士':''}}
</view>
<view class="words">{{item.personIntroduce}}
</view>
<view class="appointment" @tap="goappointment">
预约
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
selectDepartment,
selectHospitalPerson
} from '@/api/medicine/index.js'
import baseurl from '../../api/baseurl';
export default {
data() {
return {
swiperImgUrls: [],
autoplay: true, //自动切换轮播图
hospitalDepartmentList: [], //科室
HospitalPersonlist: [], //人员
tabIndex: 0,
departmentId: null, //人员所属科室id
};
},
methods: {
//人员
selectHospitalPersonInfo() {
selectHospitalPerson(this.departmentId).then(res => {
this.HospitalPersonlist = res.rows
})
},
//tap科室
taptabindex(item, index) {
this.tabIndex = index
if (this.departmentId != item.id) {
this.departmentId = item.id
this.selectHospitalPersonInfo();
}
},
//健康咨询科室
selectDepartmentinfo() {
selectDepartment().then(res => {
this.hospitalDepartmentList = res.data.hospitalDepartmentList
res.data.poserInfoList.forEach(e => {
e.image = baseurl + e.posterPictureUrl
this.swiperImgUrls.push(e.image)
})
this.departmentId = this.hospitalDepartmentList[0].id
this.selectHospitalPersonInfo();
})
},
swiperChange(e) {
this.currentIndex = e.detail.current
let {
current,
source
} = e.detail
this.videoContext = uni.createVideoContext('myVideo' + (current - 1));
//只有手动切换时开始轮播,并且上一页视频暂停
if (source === 'touch') {
this.videoContext.pause(); //暂停
this.autoplay = true
}
},
// 获取数据
GetBanner() {},
// 处理banner返回的是是视频还是图片
splits(url) {
if (url.indexOf('.') != -1) {
var ext = url.substring(url.lastIndexOf('.') + 1);
return ['mp4', 'webm', 'mpeg4', 'ogg'].indexOf(ext) != -1
}
},
// 点击开始/继续播放
play() {
this.autoplay = false
// this.videoContext.requestFullScreen()
},
// 视频暂停
pause() {
this.autoplay = true
},
// 视频结束
ended() {
this.autoplay = true
},
goappointment() {
uni.navigateTo({
url: '/pages/Informationconfirmation/Informationconfirmation'
})
},
// 跳转预约医生界面
godoctorslist() {
// uni.navigateTo({
// url: '/pages/doctorslist/doctorslist'
// })
},
},
onLoad() {
this.baseurl = baseurl
this.selectDepartmentinfo()
},
//1.分享给朋友
onShareAppMessage(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
//2.分享到朋友圈
onShareTimeline(res) {
let pages = getCurrentPages();
let url = pages[pages.length - 1].$page.fullPath
return {
title: '泉医到家',
path: url,
}
},
}
</script>
<style lang="scss">
.app {
padding: 0%;
margin-top: 381rpx;
.background {
position: fixed;
top: 0;
width: 100%;
height: 380rpx;
z-index: 999;
.swiper-box {
width: 100%;
height: 380rpx;
}
.swiper-item {
height: 380rpx;
text-align: center;
image {
width: 100%;
height: 380rpx !important;
z-index: 999;
}
}
video {
height: 100%;
width: 100%;
}
}
.hospital {
width: 97%;
margin: 0 auto;
height: 100%;
background-color: #fff;
.appointmenthospital {
height: 90rpx;
font-size: 35rpx;
line-height: 90rpx;
border-bottom: 1rpx solid #D8D4D4;
width: 94%;
margin: 0 auto;
font-weight: 600;
}
.tabbar {
display: flex;
height: calc(100vh - 470rpx);
width: 100%;
.lefttabbar {
width: 30%;
// display: inline-block;
height: 100%;
padding-top: 20rpx;
.lefttabbarlist {
overflow: scroll;
-webkit-overflow-scrolling: touch;
height: 100%;
.actives {
width: 80%;
color: red;
font-size: 34rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin: 0 auto;
line-height: 80rpx;
border-bottom: 1rpx solid #D8D4D4;
text-align: center;
font-size: 30rpx;
// border-radius: 25rpx 0 0 25rpx;
}
.active {
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
font-size: 30rpx;
white-space: nowrap;
border-bottom: 1rpx solid #D8D4D4;
width: 80%;
margin: 0 auto;
line-height: 80rpx;
}
}
}
.righttabbar {
width: 70%;
height: 100%;
.productlist {
padding-bottom: 40rpx;
overflow: scroll;
-webkit-overflow-scrolling: touch;
width: 100%;
height: 100%;
margin: 0 auto;
border-radius: 25rpx;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
background-color: #ffffff;
.content {
position: relative;
width: 100%;
height: 450rpx;
border-bottom: 1rpx solid #D8D4D4;
.hospitalimage {
position: absolute;
width: 109rpx;
height: 111rpx;
top: 50rpx;
left: 30rpx;
}
.hospitalteacher {
font-size: 36rpx;
position: absolute;
top: 60rpx;
left: 160rpx;
}
.physician {
font-size: 24rpx;
color: #666666;
position: absolute;
top: 120rpx;
left: 160rpx;
}
.words {
position: absolute;
left: 41rpx;
width: 85%;
top: 190rpx;
text-indent: 2em;
font-size: 30rpx;
line-height: 55rpx;
}
.appointment {
position: absolute;
bottom: 25rpx;
right: 30rpx;
width: 125rpx;
height: 52rpx;
background: #F44B2F;
border-radius: 26rpx;
color: #fff;
line-height: 52rpx;
text-align: center;
}
}
}
}
}
}
}
</style>