<template>
    <van-collapse-item name="hashCode" class="goods-info">
        <template #title>
            <div class="page-title"><img src="@assets/icon-lianshangxinxi(3).png" alt="" />ANTCHAIN</div>
        </template>
        <div class="page-text" v-if="info.txHash">
            <div class="text-info">
                <span class="text1">Hash地址：</span>
                <span class="flex1"></span>
                <img @click="copy(info.txHash)" src="@assets/svgs/copy_icon.svg" alt="" />
                <span class="van-ellipsis">{{ getShort(info.txHash) }}</span>
            </div>
            <div class="text-info">
                <span class="text1">区块高度： </span>
                <span class="flex1"></span>
                <span>{{ info.blockNumber }}</span>
            </div>
            <div class="text-info">
                <span class="text1">令牌ID： </span>
                <span class="flex1"></span>
                <img @click="copy(info.tokenId)" src="@assets/svgs/copy_icon.svg" alt="" />
                <span class="van-ellipsis">{{ getShort(info.tokenId) }}</span>
            </div>
            <div class="text-info" v-if="pageType === 'asset'">
                <span class="text1">IPFS地址： </span>
                <span class="flex1"></span>
                <img @click="copy(info.ipfsUrl)" src="@assets/svgs/copy_icon.svg" alt="" />
                <span class="van-ellipsis">{{ getShort(info.ipfsUrl) }}</span>
            </div>
        </div>
        <div v-else class="textName">铸造者未设置</div>
    </van-collapse-item>

    <van-collapse-item name="hchashCode" class="goods-info" v-if="info.hcTxHash">
        <template #title>
            <div class="page-title"><img src="@assets/icon-lianshangxinxi(3).png" alt="" />CRC华储链</div>
        </template>
        <div class="page-text" v-if="info.hcTxHash">
            <div class="text-info">
                <span class="text1">Hash地址：</span>
                <span class="flex1"></span>
                <img @click="copy(info.hcTxHash)" src="@assets/svgs/copy_icon.svg" alt="" />
                <span class="van-ellipsis">{{ getShort(info.hcTxHash) }}</span>
            </div>
            <div class="text-info">
                <span class="text1">区块高度： </span>
                <span class="flex1"></span>
                <span>{{ info.hcBlockNumber }}</span>
            </div>
            <div class="text-info">
                <span class="text1">令牌ID： </span>
                <span class="flex1"></span>
                <img @click="copy(info.hcTokenId)" src="@assets/svgs/copy_icon.svg" alt="" />
                <span class="van-ellipsis">{{ getShort(info.hcTokenId) }}</span>
            </div>
            <!-- <div class="text-info" v-if="pageType === 'asset'">
                <span class="text1">IPFS地址： </span>
                <span class="flex1"></span>
                <img @click="copy(info.hcIpfsUrl)" src="@assets/svgs/copy_icon.svg" alt="" />
                <span class="van-ellipsis">{{ getShort(info.hcIpfsUrl) }}</span>
            </div> -->
        </div>
        <div v-else class="textName">暂无链上信息</div>
    </van-collapse-item>
</template>

<script>
import product from '../../mixins/product';
export default {
    props: {
        info: {
            type: Object,
            default: () => {
                return {};
            }
        },
        pageType: {
            type: String,
            default: 'product'
        }
    },
    mixins: [product],
    methods: {
        copy(text) {
            this.$copyText(text).then(
                e => {
                    this.$toast.success('复制成功');
                    console.log(e);
                },
                e => {
                    this.$toast('复制失败');
                    console.log(e);
                }
            );
        }
    }
};
</script>

<style lang="less" scoped>
/deep/.goods-info {
    .van-cell {
        // padding: 0 0;
        &::after {
            content: none;
        }
    }
}
.page-title {
    // padding: 0 16px;
    font-size: @font2;
    font-weight: bold;
    color: #ffffff;
    line-height: 28px;
    span {
        color: @text3;
        font-size: @font1;
    }
}

.page-title {
    font-size: @font2;
    font-weight: bold;
    color: #ffffff;
    line-height: 24px;
    display: flex;
    align-items: center;
    &:not(:first-child) {
        padding-top: 16px;
    }
    img {
        width: 18px;
        height: 18px;
        margin-right: 6px;
    }
}
.page-text {
    font-size: @font2;
    color: @text3;
    line-height: 28px;
    word-break: break-all;
    // margin-top: 10px;
    // p {
    //     font-size: @font2;
    //     color: #ffffff;
    //     line-height: 28px;
    //     // margin-top: 10px;
    //     word-break: break-all;
    // }

    .text-info {
        .flex();
        .text1 {
            min-width: 80px;
        }
        .van-ellipsis {
            // width: 200px;
            text-align: right;
        }

        img {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
            margin-right: 6px;
        }
    }
}
</style>
