<template>
    <van-image width="100%" :src="require('@assets/yaoqingtupian.png')" fit="cover" class="hold_privileged_information_con_img" />
    <!-- <div class="news-btn btns-only"> -->
        <!-- https://nanjingnft.oss-cn-hangzhou.aliyuncs.com/image/2022-05-14-12-33-10fKfpWPti.jpg -->
            <!-- <div class="share-content" @click="like">
                <img v-if="info.liked" src="../../assets/like.png" alt="" />
                <img v-else src="../../assets/icon-dianzan1.png" alt="" />
                <span>{{ info.likes }}</span>
            </div> -->
            <!-- <div class="share-content" @click="share">
                <img src="../../assets/icon-fenxiang.png" alt="" />
                <span>分享</span>
            </div> -->
        <!-- </div> -->
</template>

<script>
import resolveUrl from 'resolve-url';
export default {
    data() {},
    computed: {
        shareText() {
            return `${resolveUrl(this.$baseUrl, '9th//mineAccountSecurity')}`;
        }
    },
    methods: {
        like() {
            this.checkLogin().then(() => {
                if (this.info.liked) {
                    this.$http.get(`newsLike/${this.info.id}/unlike`).then(res => {
                        this.$toast.success('取消成功');
                        this.info.liked = false;
                        this.info.likes--;
                    });
                } else {
                    this.$http.get(`newsLike/${this.info.id}/like`).then(res => {
                        this.$toast.success('点赞成功');
                        this.info.liked = true;
                        this.info.likes++;
                    });
                }
            });
        },
        share() {
            this.$copyText(this.shareText).then(
                e => {
                    this.$dialog.alert({
                        title: '链接已复制',
                        message: this.shareText,
                        confirmButtonText: '去微信粘贴给好友'
                    });
                    console.log(e);
                },
                e => {
                    this.$toast('复制失败');
                    console.log(e);
                }
            );
        }
    }
};
</script>

<style lang="less" scoped>
.news-btn {
    position: fixed;
    z-index: 20;
    background: @bg3;
    padding: 9px 16px 9px 16px;
    .flex();
    left: 0;
    right: 0;
    bottom: 0;
    .bottom(9px);

    /deep/.van-button {
        &.van-button--disabled {
            background: #303133;
            color: #939599;
            opacity: 1;
        }
    }

    .van-button + .share-content {
        margin-left: 20px;
    }
}
.share-content {
    .flex();
    justify-content: center;
    white-space: nowrap;
    min-width: 60px;
    img {
        width: 24px;
        height: 24px;
        display: block;
    }
    span {
        font-size: 14px;
        color: #939599;
        margin-left: 3px;
        line-height: 32px;
    }
}

.btns-only {
    .share-content {
        width: 50%;
    }
}
</style>
