<template>
    <view class="c-gap-bottom-large">
        <view class="detail-header__title">
            {{title}}
        </view>
        <view class="detail-header__date">
            <text v-if="date" class="c-gap-right-small">{{date}}</text>
            <text v-if="readNum">{{readNum}}人阅读</text>
        </view>
        <doctor-info
            v-if="doctorInfo"
            :doctor-data="{
                docImg: doctorInfo.doctorImage,
                docName: doctorInfo.doctorName,
                jobTitle: doctorInfo.information,
                department: doctorInfo.department,
                legalName: doctorInfo.hospital,
                homepage: doctorInfo.doctorHomepage,
                tags: tagList
            }"
        />
    </view>
</template>
<script>

/**
 *  @file 落地页头部
 *  @author yantingxi
 */
import DoctorInfo from './DoctorInfo';
export default {
    config: {
        component: true
    },
    props: {
        title: {
            type: String,
            default: ''
        },
        date: {
            type: String,
            default: ''
        },
        readNum: {
            type: String,
            default: ''
        },
        doctorInfo: {
            type: Object,
            default: () => {}
        },
        tags: {
            type: [Array, String],
            default: () => []
        }
    },
    computed: {
        tagList() {
            if (this.tags && Array.isArray(this.tags)) {
                return this.tags;
            } else if (this.tags) {
                return [this.tags];
            }
            return;
        }
    },
    components: {
        DoctorInfo
    }
};
</script>

<style lang="less" scoped>
.detail-header {
    &__title {
        font-size: .24rem;
        line-height: .32rem;
        font-weight: 700;
        padding-top: 0.11rem;
    }
    &__date {
        font-size: .13rem;
        color: #999;
        line-height: .2rem;
        margin-top: .01rem;
    }
}
</style>
