| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760 |
- <template>
- <view class="container" >
- <view class="swiper">
- <view class="swiper-box">
- <swiper circular="true" autoplay="true" @change="swiperChange">
- <swiper-item v-for="swiper in banner" :key="swiper.id">
- <image :src="swiper.pic"></image>
- </swiper-item>
- </swiper>
- <view class="indicator">
- <view class="dots" v-for="(swiper, index) in banner" :class="[swiperCurrent >= index ? 'on' : '']"
- :key="index"></view>
- </view>
- </view>
- </view>
- <view class="Live-list">
- <view class="list-name flex" @click="ToLive">
- <view class="list-tip">
- <view class="tip"></view>
- 正在直播
- </view>
- <view class="list-more">
- 更多
- <text class="iconfont iconenter"></text>
- </view>
- </view>
- <scroll-view class="floor-list" scroll-x>
- <view class="scoll-wrapper position-relative">
- <view class="floor-item" v-for="ls in broadList" @click="ToLiveDetails(ls)">
- <view class="img-box">
- <image class="list-image" :src="ls.image"></image>
- <view class="tip">好评</view>
- </view>
- <view class="title clamp">{{ls.title}}</view>
- <view class="tip-box flex_item">
- <view v-for="item in ls.label" class="tip">{{item}}</view>
- </view>
- <view class="info ellipsis">{{ls.abstract}}</view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view class="Live-list">
- <view class="list-name flex" @click="ToCourse">
- <view class="list-tip">
- <view class="tip"></view>
- 精选好课
- </view>
- <view class="list-more">
- 更多
- <text class="iconfont iconenter"></text>
- </view>
- </view>
- <view id="list-box" class="list-box">
- <view class="guess-section flex">
- <view class="guess-item" v-for="ls in courseList" @click="ToCourseDetails(ls)">
- <view class="imagewrapper">
- <image :src="ls.image"></image>
- </view>
- <text class="title clamp">{{ls.title}}</text>
- <view class="tip-box flex_item">
- <view v-for="item in ls.label" class="tip">{{item}}</view>
- </view>
- <view class="info clamp">¥{{ls.money}}</view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapMutations
- } from 'vuex';
- import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
- import {
- getDoctorList
- } from '@/api/doctor.js';
- import {
- course_list
- } from '@/api/course.js';
- import {
- saveUrl,
- interceptor
- } from '@/utils/loginUtils.js';
- export default {
- onPageScroll(e) {
- this.navP = e.scrollTop / 200;
- if (e.scrollTop > 10) {
- this.addr_color = '#333333';
- } else {
- this.addr_color = '#ffffff';
- }
- },
- data() {
- return {
- header_color: 'linear-gradient(52deg, rgba(151,143,250,1) 0%, rgba(126,153,254,1) 100%)', //轮播图背景色渐变
- navP: 0, // 导航栏透明度
- DoctorList: [],
- limit: 10, //每次加载数据条数
- page: 1, //当前页数
- loadingType: 'more', //加载更多状态
- loading: 0, //判断是否为点击搜索按钮跳转加载
- addr_color: '',
- swiperCurrent: 0, //轮播图
- swiperHeight: 300,
- banner: '', //轮播图
- recommend: '', //列表数据
- courseList: '', //专题列表
- broadList: '', //直播列表
- };
- },
- onLoad(option) {
- if (option.spread) {
- // 存储邀请人
- this.spread = option.spread;
- uni.setStorageSync('spread', option.spread);
- }
- this.getDoctorList();
- this.loadData();
- },
- computed: {
- ...mapState(['userInfo', 'hasLogin'])
- },
- onShow() {
- let obj = this
- saveUrl()
- console.log(this.userInfo, 55);
- // 1是病人 2是医生 3是机构
- if (obj.userInfo.type == 2) {
- uni.setTabBarItem({
- index: 0,
- text: '首页',
- iconPath: 'static/tabBar/tab-home.png',
- selectedIconPath: 'static/tabBar/tab-home-current.png'
- });
- uni.setTabBarItem({
- index: 1,
- text: '我的病人',
- iconPath: 'static/tabBar/tab-cate.png',
- selectedIconPath: 'static/tabBar/tab-cate-current.png',
- visible: true
- });
- uni.setTabBarItem({
- index: 2,
- text: '科普学习',
- iconPath: 'static/tabBar/tab-study.png',
- selectedIconPath: 'static/tabBar/tab-study-current.png',
- visible: false
- });
- uni.setTabBarItem({
- index: 3,
- text: '接单',
- iconPath: 'static/tabBar/jd.png',
- selectedIconPath: 'static/tabBar/jd-act.png',
- pagePath: '/pages/dd/dd'
- })
- uni.setTabBarItem({
- index: 4,
- text: '我的',
- iconPath: 'static/tabBar/tab-my.png',
- selectedIconPath: 'static/tabBar/tab-my-current.png'
- });
- }
- if (obj.userInfo.type == 1) {
- uni.setTabBarItem({
- index: 0,
- text: '首页',
- iconPath: 'static/tabBar/tab-home.png',
- selectedIconPath: 'static/tabBar/tab-home-current.png'
- });
- uni.setTabBarItem({
- index: 1,
- text: '咨询记录',
- iconPath: 'static/tabBar/tab-cate.png',
- selectedIconPath: 'static/tabBar/tab-cate-current.png',
- visible: true
- });
- uni.setTabBarItem({
- index: 2,
- text: '科普学习',
- iconPath: 'static/tabBar/tab-study.png',
- selectedIconPath: 'static/tabBar/tab-study-current.png',
- visible: true
- });
- uni.setTabBarItem({
- index: 3,
- text: '接单',
- iconPath: 'static/tabBar/jd.png',
- selectedIconPath: 'static/tabBar/jd-act.png',
- visible: false
- })
- uni.setTabBarItem({
- index: 4,
- text: '我的',
- iconPath: 'static/tabBar/tab-my.png',
- selectedIconPath: 'static/tabBar/tab-my-current.png'
- });
- }
- if (obj.userInfo.type == 3) {
- uni.setTabBarItem({
- index: 0,
- text: '首页',
- iconPath: 'static/tabBar/tab-home.png',
- selectedIconPath: 'static/tabBar/tab-home-current.png'
- });
- uni.setTabBarItem({
- index: 1,
- text: '咨询记录',
- iconPath: 'static/tabBar/tab-cate.png',
- selectedIconPath: 'static/tabBar/tab-cate-current.png'
- });
- uni.setTabBarItem({
- index: 2,
- text: '科普学习',
- iconPath: 'static/tabBar/tab-study.png',
- selectedIconPath: 'static/tabBar/tab-study-current.png',
- visible: false
- });
- uni.setTabBarItem({
- index: 3,
- text: '发布订单',
- iconPath: 'static/tabBar/jd.png',
- selectedIconPath: 'static/tabBar/jd-act.png',
- pagePath: '/pages/dd/dd'
- })
- uni.setTabBarItem({
- index: 4,
- text: '我的',
- iconPath: 'static/tabBar/tab-my.png',
- selectedIconPath: 'static/tabBar/tab-my-current.png'
- });
- }
- },
- //下拉刷新
- onPullDownRefresh() {
- this.page = 1;
- this.getDoctorList('refresh');
- },
- methods: {
- // onShowLog(){
- // this.$log.showLog()
- // },
- //加载专题列表
- loadData() {
- let obj = this;
- course_list({
- page: obj.page,
- limit: obj.limit
- })
- .then(data => {
- obj.banner = data.data.banner;
- obj.recommend = data.data.recommend;
- obj.courseList = data.data.recommend['精品课程排行'].list;
- if (data.data.recommend['在线直播'].list) {
- obj.broadList = data.data.recommend['在线直播'].list;
- }
- })
- .catch(e => {
- console.log(e.message);
- });
- },
- //获取医生列表
- getDoctorList(type) {
- let obj = this;
- //这里是将订单挂载到tab列表下
- if (type !== 'refresh') {
- //没有更多数据直接跳出方法
- if (obj.loadingType === 'nomore') {
- return;
- } else {
- // 设置当前为数据载入中
- obj.loadingType = 'loading';
- }
- } else {
- //当重新加载数据时更新状态为可继续添加数据
- obj.loadingType = 'more';
- }
- getDoctorList({
- hospital: '',
- keyword: '',
- sort: '',
- page: obj.page,
- limit: obj.limit
- })
- .then(data => {
- if (type === 'refresh') {
- obj.DoctorList = [];
- }
- obj.DoctorList = obj.DoctorList.concat(data.data.list);
- //判断是否还有下一页,有是more 没有是nomore
- if (obj.limit == obj.DoctorList.length) {
- obj.page++;
- obj.loadingType = 'more';
- } else {
- obj.loadingType = 'nomore';
- }
- // 判断是否为刷新数据
- if (type === 'refresh') {
- // 判断是否为点击搜索按钮跳转加载
- if (obj.loading == 1) {
- uni.hideLoading();
- } else {
- uni.stopPullDownRefresh();
- }
- }
- })
- .catch(e => {
- console.log(e.message);
- if (e.message == '请登录') {
- uni.showModal({
- title: '提示',
- content: '您未登录,是否马上登陆',
- success: function(res) {
- if (res.confirm) {
- interceptor();
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- obj.loadingType = 'nomore';
- // obj.$api.msg(e.message);
- uni.hideLoading();
- });
- },
- //专题列表
- ToCourse() {
- let recommend = this.recommend['精品课程排行'];
- uni.navigateTo({
- url: '/pages/course/course?recommend_id=' + recommend.id + '&type=' + recommend.type +
- '&title=' + recommend.title + '&typesetting=' + recommend.typesetting
- });
- },
- //专题详情
- ToCourseDetails(item) {
- console.log(item)
- let id = item.link_id;
- uni.navigateTo({
- url: '/pages/course/detail?id=' + id
- });
- },
- //医生详情
- ToExpert(item) {
- uni.navigateTo({
- url: '/pages/doctor/expert?id=' + item
- });
- },
- //医生列表
- ToDoclist() {
- uni.navigateTo({
- url: '/pages/doctor/doclist'
- });
- },
- //直播列表
- ToLive() {
- console.log(this.recommend)
- let recommend = this.recommend['在线直播'];
- uni.navigateTo({
- url: '/pages/live/list?recommend_id=' + recommend.id + '&type=' + recommend.type +
- '&title=' +
- recommend.title + '&typesetting=' + recommend.typesetting
- });
- },
- //直播详情
- ToLiveDetails(ls) {
- console.log(ls)
- uni.navigateTo({
- url: '/pages/live/details?id=' + ls.link_id
- });
- },
- //轮播图
- swiperChange(e) {
- const index = e.detail.current;
- this.swiperCurrent = index;
- }
- }
- };
- </script>
- <style lang="scss">
- page {
- background: #f5f5f5;
- }
- .top_header {
- padding: 25rpx 0rpx;
- .top-address {
- position: fixed;
- top: 0;
- width: 100% !important;
- z-index: 999;
- padding-bottom: 25rpx;
- //地址
- .header {
- width: 100%;
- padding: 0 4%;
- height: 100rpx;
- display: flex;
- align-items: center;
- .addr {
- height: 60rpx;
- flex-shrink: 0;
- display: flex;
- align-items: center;
- font-size: 36rpx;
- font-weight: bold;
- width: 90%;
- color: #ffffff;
- .icon {
- height: 60rpx;
- margin-right: 15rpx;
- display: flex;
- align-items: center;
- font-size: 42rpx;
- color: #ffffff;
- }
- }
- .config {
- width: 120rpx;
- height: 60rpx;
- flex-shrink: 0;
- display: flex;
- .message {
- width: 65rpx;
- height: 65rpx;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- font-size: 42rpx;
- color: #ffffff;
- }
- }
- }
- }
- .zhanwei {
- width: 100% !important;
- height: 60rpx;
- }
- }
- .search-box {
- height: 120rpx;
- }
- //搜索框
- .input-box {
- width: 80%;
- margin-left: 25rpx;
- height: 70rpx;
- background-color: #ffffff;
- border-radius: 50rpx;
- position: relative;
- display: flex;
- align-items: center;
- .icon {
- display: flex;
- align-items: center;
- position: absolute;
- top: 0;
- left: 35rpx;
- width: 60rpx;
- height: 70rpx;
- font-size: 34rpx;
- color: #c0c0c0;
- }
- input {
- padding-left: 100rpx;
- height: 28rpx;
- font-size: 28rpx;
- }
- }
- .queding {
- color: #ffffff;
- font-size: 35rpx;
- padding: 25rpx 25rpx;
- }
- //轮播图
- .swiper {
- width: 100%;
- display: flex;
- justify-content: center;
- .swiper-box {
- width: 100%;
- height: 346rpx;
- overflow: hidden;
- // box-shadow: 0upx 8upx 25upx rgba(0, 0, 0, 0.2);
- //兼容ios,微信小程序
- position: relative;
- z-index: 1;
- swiper {
- width: 100%;
- height: 346rpx;
- swiper-item {
- image {
- width: 100%;
- height: 346rpx;
- }
- }
- }
- .indicator {
- position: absolute;
- bottom: 20upx;
- left: 20upx;
- background-color: rgba(255, 255, 255, 0.4);
- width: 150upx;
- height: 5upx;
- border-radius: 3upx;
- overflow: hidden;
- display: flex;
- .dots {
- width: 0upx;
- background-color: rgba(255, 255, 255, 1);
- transition: all 0.3s ease-out;
- &.on {
- width: (100%/3);
- }
- }
- }
- }
- }
- //正在直播
- .Live-list {
- margin-top: 25rpx;
- width: 100%;
- background-color: #ffffff;
- font-size: 24rpx;
- padding: 35rpx 35rpx;
- .list-name {
- padding-bottom: 35rpx;
- .list-tip {
- position: relative;
- padding-left: 25rpx;
- color: #6786fb;
- font-size: 32rpx;
- .tip {
- position: absolute;
- left: 0rpx;
- width: 10rpx;
- height: 45rpx;
- background-color: #6786fb;
- border-radius: 25rpx;
- }
- }
- .list-more {
- color: #999999;
- font-size: 24rpx;
- }
- }
- }
- .scoll-wrapper {
- display: flex;
- align-items: flex-start;
- .floor-item {
- width: 220rpx;
- font-size: $font-sm + 2rpx;
- margin-right: 25rpx;
- .img-box {
- position: relative;
- .list-image {
- width: 220rpx;
- height: 144rpx;
- border-radius: 15rpx;
- box-shadow: 0px 6px 10px 0px rgba(0, 0, 0, 0.04);
- }
- .tip {
- position: absolute;
- right: 15rpx;
- top: 0rpx;
- background: #ff6700;
- width: 45rpx;
- text-align: center;
- font-size: 18rpx;
- color: #ffffff;
- padding: 10rpx 0rpx;
- border-bottom-left-radius: 25rpx;
- border-bottom-right-radius: 25rpx;
- }
- }
- .tip-box {
- display: flex;
- flex-wrap: wrap;
- padding-top: 5rpx;
- .tip {
- background: rgba(103, 134, 251, 0.18);
- color: #6786FB;
- margin-right: 15rpx;
- margin-top: 10rpx;
- padding: 2rpx 10rpx;
- }
- }
- .title {
- font-size: 26rpx !important;
- font-weight: 500;
- }
- .info {
- color: #999999;
- font-size: 24rpx;
- padding-top: 15rpx;
- }
- }
- }
- /*公用边框样式*/
- %icon {
- margin-right: 10rpx;
- display: inline-block;
- padding: 2rpx 10rpx;
- border: 1rpx solid $color-yellow;
- color: $color-yellow;
- line-height: 1;
- font-size: $font-base;
- border-radius: 10rpx;
- }
- //精选好课
- .guess-section {
- display: flex;
- flex-wrap: wrap;
- .guess-item {
- position: relative;
- overflow: hidden;
- display: flex;
- flex-direction: column;
- width: 47%;
- margin-bottom: 2%;
- background-color: white;
- padding-bottom: 30rpx;
- // &:nth-child(2n + 1) {
- // margin-right: 15rpx;
- // }
- }
- .tip-box {
- display: flex;
- flex-wrap: wrap;
- padding-top: 5rpx;
- .tip {
- background: rgba(103, 134, 251, 0.18);
- color: #6786FB;
- margin-right: 15rpx;
- margin-top: 10rpx;
- padding: 2rpx 10rpx;
- }
- }
- .imagewrapper {
- width: 100%;
- height: 204rpx;
- margin-bottom: 15rpx;
- image {
- border-radius: 15rpx;
- width: 100%;
- height: 100%;
- }
- }
- .title {
- font-size: 30rpx;
- color: $font-color-dark;
- }
- .info {
- color: #e73932;
- padding-top: 15rpx;
- font-size: 30rpx;
- }
- }
- .preferred_centent {
- width: 100%;
- .preferred_item {
- width: 100%;
- height: 100%;
- border-top: 1px solid #f0f0f0;
- padding: 35rpx 0rpx;
- .goods_image image {
- width: 140rpx;
- height: 140rpx;
- border-radius: 100%;
- }
- .goods_name {
- padding-left: 25rpx;
- width: 50%;
- .goods_title {
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- font-size: 30rpx;
- font-weight: 400;
- }
- .goods_info {
- padding-top: 15rpx;
- font-size: 24rpx;
- color: #999999;
- }
- }
- .btn-tpl {
- margin-left: 10rpx;
- border: 2rpx solid #305cec;
- padding: 13rpx 20rpx;
- color: #6786fb;
- border-radius: 15rpx;
- .tpl-img {
- padding-right: 10rpx;
- image {
- margin-top: 8rpx;
- width: 35rpx;
- height: 35rpx;
- }
- }
- }
- }
- }
- </style>
|