1
0
go-view-fetch/src/packages/components/Charts/MyComponents/SceneDistribution/index.vue

117 lines
2.8 KiB
Vue
Raw Normal View History

2025-08-20 12:09:24 +08:00
<template>
<div class="go-scene-distribution">
<div class="header">
<div class="title">
<svg-icon icon-class="rocket" class="title-icon"></svg-icon>
<span :style="{ color: option.titleColor, fontSize: option.titleSize + 'px' }">{{ option.title }}</span>
</div>
<a class="link" :style="{ color: option.linkColor }">{{ option.linkText }}</a>
</div>
<div class="content">
<div v-for="(item, index) in option.dataset" :key="index" class="scene-item">
<div class="item-label" :style="{ color: option.labelColor, fontSize: option.labelSize + 'px' }">{{ item.label }}</div>
<div class="cube-container">
2025-08-21 09:19:33 +08:00
<img :src="getImageUrl(item.image)" class="cube-image" />
2025-08-20 12:09:24 +08:00
</div>
<div class="item-value" :style="{ color: option.valueColor, fontSize: option.valueSize + 'px' }">{{ item.value }}</div>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { PropType, computed } from 'vue'
import { option as configOption } from './config'
const props = defineProps({
chartConfig: {
type: Object as PropType<{ option: typeof configOption }>,
required: true
}
})
const option = computed(() => props.chartConfig.option)
2025-08-21 09:19:33 +08:00
const getImageUrl = (name: string) => {
return new URL(`./assets/${name}`, import.meta.url).href
}
2025-08-20 12:09:24 +08:00
</script>
<style lang="scss" scoped>
.go-scene-distribution {
width: 100%;
height: 100%;
background-color: #0F1C3D;
padding: 15px;
box-sizing: border-box;
display: flex;
flex-direction: column;
.header {
display: flex;
justify-content: space-between;
align-items: center;
2025-08-21 09:19:33 +08:00
background: linear-gradient(to right, #1A385A, #2A588A, #1A385A);
border: 1px solid #00E5FF;
2025-08-20 12:09:24 +08:00
border-radius: 5px;
2025-08-21 09:19:33 +08:00
padding: 5px 15px;
2025-08-20 12:09:24 +08:00
margin-bottom: 20px;
2025-08-21 09:19:33 +08:00
box-shadow: 0 0 10px #00E5FF;
2025-08-20 12:09:24 +08:00
.title {
display: flex;
align-items: center;
.title-icon {
font-size: 24px;
margin-right: 10px;
color: #00E5FF;
}
}
.link {
cursor: pointer;
font-size: 14px;
}
}
.content {
flex: 1;
display: flex;
justify-content: space-around;
align-items: center;
}
.scene-item {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
.item-label {
margin-bottom: 20px;
}
.cube-container {
position: relative;
2025-08-21 09:19:33 +08:00
width: 150px;
height: 150px;
2025-08-20 12:09:24 +08:00
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20px;
.cube-image {
2025-08-21 09:19:33 +08:00
width: 100%;
height: 100%;
object-fit: contain;
2025-08-20 12:09:24 +08:00
}
}
.item-value {
font-weight: bold;
2025-08-21 09:19:33 +08:00
font-family: 'DS-Digital', 'Arial', sans-serif;
text-shadow: 0 0 10px #00E5FF;
2025-08-20 12:09:24 +08:00
}
}
}
2025-08-21 09:19:33 +08:00
</style>