share-box.vue 2.75 KB
<template>
    <div class="brand-share">
        <img class="brand-top-box" v-bind:src="shopInfo.shopBg | resize 750 478">
        <div v-if="shopInfo.shopLogo" class="brand-logo"><img v-bind:src="shopInfo.shopLogo | resize 120 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-bind:src="shopInfo.shopBg | resize 752 365"></a>
    </div>
    <share-bottom></share-bottom>
</template>
<style>
    .brand-share {
        .brand-top-box {
            width: 100%;
        }

        .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>
    const $ = require('jquery');
    const shareBottom = require('component/tool/share-bottom.vue');
    const tip = require('common/tip');
    const share = require('common/share');

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

    module.exports = {

        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>