share-box.vue 2.85 KB
<template>
    <div>
        <div class="brand-share">
            <img class="brand-top-box" v-img-src="{src: shopInfo.shopBg, width: 750, height: 478}">
            <div v-if="shopInfo.shopLogo" class="brand-logo"><img v-img-src="{src: shopInfo.shopLogo, width: 120, height: 80}"></div>
            <div v-else class="brand-title">{{ shopInfo.shopName }}</div>
            <div class="brand-intro">{{ shopInfo.shopIntro }}</div>
            <div class="tip">进入 BLK 选购潮品</div>
            <div class="icon arrow">&#xe602;</div>
            <a href="//m.yohoblk.com"><img v-img-src="{src: shopInfo.shopBg, width: 752, height: 365}"></a>
        </div>
        <share-bottom></share-bottom>
    </div>
</template>
<style>
    .brand-share {
        .brand-top-box {
            width: 100%;
            height: 468px;
        }

        .brand-logo {
            width: 120px;
            height: 80px;
            margin: 30px;

            img {
                width: 120px;
                height: 80px;
            }
        }

        .brand-title {
            margin: 30px;
            font-weight: 700;
            font-size: 32px;
            color: #000;
            font-style: italic;
        }

        .brand-intro {
            margin: 30px;
        }

        .tip {
            width: 100%;
            text-align: center;
            font-size: 36px;
            margin: 10px 0;
        }

        .arrow {
            width: 100%;
            text-align: center;
            margin-bottom: 20px;
        }

        img {
            width: 100%;
            height: 365px;
        }
    }
</style>
<script>
    import $ from 'jquery';
    import shareBottom from 'component/tool/share-bottom.vue';
    import tip from 'common/tip';
    import share from 'common/share';

    const $share = $('#share');

    export default {

        data() {
            return {
                shopInfo: {}
            };
        },
        watch: {
            shopInfo() {
                share({
                    title: this.shopInfo.shopName,
                    link: location.href,
                    desc: this.shopInfo.shareSubTitle,
                    imgUrl: this.shopInfo.shopBg
                });
            }
        },
        methods: {

            /* 获取店铺简介相关数据 */
            getShopInfo() {
                $.get({
                    url: '/product/shop/info.json',
                    data: {
                        domain: $share.data('domain'),
                        shopId: $share.data('shopid')
                    }
                }).done(result => {
                    this.shopInfo = result;
                }).fail(() => {
                    tip('网络错误');
                });
            }
        },
        components: {
            shareBottom
        },
        created() {
            this.getShopInfo();
        }
    };
</script>