<template>
    <view class="category">
        <view v-if="contentList">
            <view v-if="contentList.title" :class="'category_title_' + level">{{ contentList.title }}</view>
            <view v-if="contentList.description" :class="'category_description_' + level">
                <view v-for="(desc, index) in contentList.description" :key="index">
                    <view>{{ desc }}</view>
                </view>
            </view>
            <view v-if="contentList.image" :class="'category_image_' + level">
                <scroll-view :scroll-y="true" class="scroll-view">
                    <view v-for="(item, i) in contentList.image" :key="i">
                        <view
                            class="method_image_container"
                            :style="{backgroundImage: 'url(' + (item.src ? item.src : item.poster) + ')'}"
                        ></view>
                    </view>
                </scroll-view>
            </view>
        </view>
    </view>
</template>
<script>
/**
 *  @file category
 *  @author lixue
 */
// import videoPopup from './videoPopup';
import Popup from '@baidu/med-ui/components/Popup/Popup';
import Icon from '@baidu/med-ui/components/Icon/Icon';
import {getSystemInfo} from '@baidu/med-utils/lib/Mars/system';

import * as log from '../../utils/log';

export default {
    config: {
        component: true
    },
    props: ['contentList', 'level'],
    data() {
        return {
            env: 'swan',
            scrollViewHeight: '0px',
            show: false,
            play: true,
            lazyLoad: false
        };
    },
    components: {
        'c-popup': Popup,
        'c-icon': Icon
    },
    created() {
        const systemInfo = getSystemInfo();         
        this.scrollViewHeight = systemInfo.screenHeight + 'px';
    },
    mounted() {
        if (process.env.MARS_ENV === 'swan') {
            this.lazyLoad = true;
        }
    },
    methods: {}
};
</script>
<style lang="less" scoped>
.method_image_container {
    margin-top: 0.15rem;
    width: 100%;
    padding-top: 66.67%;
    border-radius: 8px;
    background-size: cover;
}
.method_display {
    display: none;
}
.method_video {
    position: relative;
    width: 100%;
    padding-bottom: 56.14%;
    margin-top: 0.15rem;
}
.category {
    color: #333;
    .category_title_level1 {
        font-size: 0.21rem;
    }
    .category_title_level3 {
        margin-top: 0.1rem;
        font-size: 0.18rem;
        font-weight: bold;
        line-height: 0.31rem;
    }
    .category_title_level2 {
        margin-top: 0.113rem;
        margin-bottom: 0.05rem;
        font-size: 0.17rem;
        line-height: 0.31rem;
    }
    .category_title_level2::before {
        content: '';
        display: inline-block;
        height: 0.21rem;
        width: 4px;
        margin-right: 0.096rem;
        border: 0 solid #b1eff0;
        border-radius: 0.12rem;
        background-color: #b1eff0;
        vertical-align: -3px;
    }
    .category_title_level4 {
        margin-top: 0.076rem;
        font-size: 0.17rem;
    }
    .category_title_level4::before {
        content: '\2022';
        font-weight: 900;
        padding-right: 0.096rem;
    }
    .category_description_level1,
    .category_description_level3 {
        margin-top: 0.09rem;
        font-size: 0.17rem;
        line-height: 0.31rem;
    }
    .category_description_level2,
    .category_description_level4 {
        font-size: 0.17rem;
        line-height: 0.31rem;
    }
    .category_video_text {
        margin: 0.1rem;
        text-align: center;
        font-size: 0.17rem;
    }
}
</style>
