File size: 2,865 Bytes
0aee47a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
<template>
<div class="shadow-container" style="text-align: left;">
<a :href="card.cover_href" target="_blank">
<img class="cover" :src="card.cover_url">
</a>
<div class="linear"></div>
<div class="show">
<a :href="card.face_href" target="_blank" style="--size: 60px; margin: 12px;">
<div class="pendant" :url="card.pendant != ''" :style="`background-image: url(${card.pendant})`">
<img :src="card.face_url" :style="`outline-color: ${card.pendant_color}`">
</div>
</a>
<strong>
<p class="title" :style="`color: ${card.title_color};`">{{ card.title }}</p>
<span class="subtitle">{{ card.subtitle }}</span>
</strong>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import axios from 'axios'
export interface userInfo {
face_href: string
face_url: string
pendant: string
pendant_color: string
cover_href: string
cover_url: string
title: string
title_color: string
subtitle: string
}
const card = ref()
axios.get(`https://aliyun.nana7mi.link/live.LiveRoom(21452505).get_room_info()`).then(res => {
let data = res.data.data
let info: userInfo = {
cover_href: `https://live.bilibili.com/${data.room_info.room_id}`,
cover_url: data.room_info.cover,
face_href: `https://space.bilibili.com/${data.room_info.uid}`,
face_url: data.anchor_info.base_info.face,
pendant: "",
pendant_color: "rgb(251, 114, 153)",
title: data.anchor_info.base_info.uname,
title_color: "rgb(251, 114, 153)",
subtitle: `粉丝 ${data.anchor_info.relation_info.attention} - 舰长 ${data.guard_info.count}`
}
card.value = info
})
</script>
<style scoped>
.shadow-container {
width: 300px;
padding: 0;
position: relative;
z-index: 1;
margin: 8px auto;
border-radius: 5px;
transition: all 0.2s;
background-color: rgba(255,255,255,0.75);
box-shadow: 0 3px 1px -2px rgb(0 0 0 / 12%),
0 2px 2px 0 rgb(0 0 0 / 14%),
0 1px 5px 0 rgb(0 0 0 / 20%);
}
.pendant {
width: var(--size);
height: var(--size);
position: relative;
background-size: contain;
}
.pendant img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: -1;
border-radius: 50%;
height: var(--size);
outline-style: solid;
outline-width: 0.0428 * var(--size);
outline-color: rgb(0, 161, 214);
}
.cover {
width: 100%;
border-radius: 5px 5px 0 0;
display: block;
}
.linear {
position: relative;
height: 20px;
z-index: 2;
margin-top: -20px;
background-image: linear-gradient(rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
}
.show {
display: flex;
align-items: center;
z-index: 2;
position: relative;
}
.title {
font-size: 1.5em;
margin: 0;
}
.subtitle {
color: grey;
font-size: 8px;
}
</style> |