<template>
    <view>
        <view 
            class="return-bar swan-security-padding-bottom"
            :style="boxStyle"
            @tap="onTap"
        >
            {{ text }}
        </view>
        <view style="height: 63px" class="swan-security-padding-bottom"/>
    </view>
</template>

<script>
import {navigate} from '@utils/navigate';
/**
 * @file 分会场底部返回主会场
 * @author jiaxiangju
 * @categories 业务组件
 * @tags [component]
 */

export default {
    config: {
        component: true
    },
    options: {
        addGlobalClass: true
    },
    data() {
        return {
            defaultStyle: {
                'color': '#EC201C',
                'background-image': 'linear-gradient(180deg, #FFFFFF 34%, #FFEDE5 100%)',
            }
        };
    },
    props: {
        /**
         * 文案
         */
        text: {
            type: String,
            default: '返回主会场'
        },
        /**
         * 跳转链接
         */
        url: {
            type: String,
            default: '/pages/home/index'
        },
        /**
         * 扩展样式
         */
        extendStyle: {
            type: Object,
            default: () => {
                return {};
            }
        },
        /**
         * 打点
         */
        extraKey: {
            type: String,
            default: ''
        }
    },
    computed: {
        boxStyle() {
            return Object.assign({}, this.defaultStyle, this.extendStyle);
        }
    },
    methods: {
        onTap() {
            if (this.url) {
                const isTab = ['/pages/brand/home/index', '/pages/brand/person/index', '/pages/gy/medstorehome/index'].some(url => this.url.indexOf(url) > -1);
                navigate({
                    url: this.url,
                    urlType: isTab ? 7 : 0,
                    log: {
                        type: 'clk',
                        value: `${this.extraKey}_returnPrima`,
                        ext: {
                            pd: 'act',
                        }
                    }
                });
            }
        }
    }
};
</script>
<style lang="less" scoped>
.return-bar {
    width: 95%;
    height: 44px;
    line-height: 44px;
    font-size: 16px;
    font-family: PingFangSC-Medium;
    border-radius: 22px;
    box-sizing: border-box;
    position: fixed;
    bottom: 19px;
    left: 10px;
    text-align: center;
    z-index: 99;
    // display: flex;
    // justify-content: center;
    // align-items: center;
}
</style>
