feat: 新增账户仪表盘组件和优化投放指南操作功能
This commit is contained in:
@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<div class="chart-container">
|
||||
<a-card :bordered="false" class="echart-item-card">
|
||||
<template #title>
|
||||
<span>{{ title.name }}</span>
|
||||
<a-popover position="tl">
|
||||
<icon-question-circle />
|
||||
<template #content>
|
||||
<p style="margin: 0">{{ title.popover }}</p>
|
||||
</template>
|
||||
</a-popover>
|
||||
</template>
|
||||
<div id="echarts-line" style="width: 100%; height: 450px"></div>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps, onMounted } from 'vue';
|
||||
import * as echarts from 'echarts';
|
||||
import { Card } from '@arco-design/web-vue';
|
||||
import { IconQuestionCircle } from '@arco-design/web-vue/es/icon';
|
||||
//子组件参数传递
|
||||
const props = defineProps({
|
||||
title: {
|
||||
type: Object,
|
||||
default: {
|
||||
name: '',
|
||||
popover: '',
|
||||
},
|
||||
},
|
||||
xAxisData: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
seriesData: {
|
||||
type: Array,
|
||||
default: [],
|
||||
},
|
||||
});
|
||||
const xAxisData = props.xAxisData;
|
||||
const seriesData = props.seriesData;
|
||||
onMounted(() => {
|
||||
const myChart = echarts.init(document.getElementById('echarts-line'));
|
||||
|
||||
const option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'cross' },
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.9)',
|
||||
borderColor: '#ccc',
|
||||
borderWidth: 1,
|
||||
textStyle: { color: '#333' },
|
||||
formatter: function (params) {
|
||||
let date = params[0].axisValue;
|
||||
let tooltipHtml = `<div style="font-weight:bold;">消耗量 ${date}</div>`;
|
||||
params.forEach((item) => {
|
||||
tooltipHtml += `
|
||||
<div style="display:flex;align-items:center;">
|
||||
<span style="display:inline-block;width:10px;height:10px;border-radius:5px;margin-right:5px;background-color:${item.color}"></span>
|
||||
<span style="margin-right:10px;">${item.seriesName}</span>
|
||||
<span>${item.value}</span>
|
||||
</div>
|
||||
`;
|
||||
});
|
||||
return tooltipHtml;
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
type: 'scroll',
|
||||
orient: 'horizontal',
|
||||
top: 10, // 将图例位置调整到顶部
|
||||
itemWidth: 10,
|
||||
itemHeight: 10,
|
||||
pageButtonItemGap: 5,
|
||||
pageButtonStyle: { color: '#666' },
|
||||
textStyle: { color: '#666' },
|
||||
data: seriesData.map((item) => item.name),
|
||||
},
|
||||
grid: {
|
||||
top: 80, // 调整图表内容位置,避免与图例重叠
|
||||
left: 40,
|
||||
right: 40,
|
||||
bottom: 40,
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: xAxisData,
|
||||
axisLabel: { color: '#666' },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
axisLabel: { color: '#666' },
|
||||
splitLine: { lineStyle: { type: 'dashed', color: '#eee' } },
|
||||
},
|
||||
series: seriesData,
|
||||
};
|
||||
|
||||
myChart.setOption(option);
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
myChart.resize();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './style.scss';
|
||||
</style>
|
||||
@ -0,0 +1,7 @@
|
||||
.echart-item-card {
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
margin:13px;
|
||||
border-radius: 10px;
|
||||
|
||||
}
|
||||
@ -0,0 +1,164 @@
|
||||
<template>
|
||||
<view>
|
||||
<div class="part-div">
|
||||
<div>
|
||||
<a-tabs v-model:activeKey="tabData" class="a-tab-class" default-active-key="acctoun">
|
||||
<a-tab-pane key="acctoun" title="账户"></a-tab-pane>
|
||||
<a-tab-pane key="project">
|
||||
<template #title>项目</template>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
</div>
|
||||
<a-space size="large" direction="vertical" class="search-form">
|
||||
<a-row class="grid-demo" :gutter="{ md: 8, lg: 24, xl: 32 }">
|
||||
<a-col :span="5">
|
||||
<a-space>
|
||||
<span>项目名称</span>
|
||||
<a-select :style="{ width: '320px' }" placeholder="全部">
|
||||
<a-option>Beijing</a-option>
|
||||
<a-option>Shanghai</a-option>
|
||||
<a-option>Guangzhou</a-option>
|
||||
</a-select>
|
||||
</a-space>
|
||||
</a-col>
|
||||
<a-col :span="5">
|
||||
<a-space>
|
||||
<span>平台</span>
|
||||
<a-select :style="{ width: '320px' }" placeholder="全部">
|
||||
<a-option>Beijing</a-option>
|
||||
<a-option>Shanghai</a-option>
|
||||
<a-option>Guangzhou</a-option>
|
||||
</a-select>
|
||||
</a-space>
|
||||
</a-col>
|
||||
<a-col :span="5">
|
||||
<a-space>
|
||||
<span>运营人员</span>
|
||||
<a-select :style="{ width: '320px' }" placeholder="全部">
|
||||
<a-option>Beijing</a-option>
|
||||
<a-option>Shanghai</a-option>
|
||||
<a-option>Guangzhou</a-option>
|
||||
</a-select>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row class="grid-demo" :gutter="{ md: 8, lg: 24, xl: 32 }">
|
||||
<a-col :span="6">
|
||||
<a-space>
|
||||
<span>时间筛选</span>
|
||||
<a-range-picker
|
||||
showTime
|
||||
:time-picker-props="{
|
||||
defaultValue: ['00:00:00', '00:00:00'],
|
||||
}"
|
||||
@change="onChange"
|
||||
@select="onSelect"
|
||||
style="width: 380px"
|
||||
/>
|
||||
</a-space>
|
||||
</a-col>
|
||||
<a-col :span="5">
|
||||
<a-space>
|
||||
<a-button type="outline" class="search-btn" @click="handleSearch">
|
||||
<template #icon>
|
||||
<icon-search />
|
||||
</template>
|
||||
<template #default>搜索</template>
|
||||
</a-button>
|
||||
<a-button type="outline" class="reset-btn" @click="handleSearch">
|
||||
<template #icon>
|
||||
<icon-refresh />
|
||||
</template>
|
||||
<template #default>重置</template>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-space>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a-row class="grid-demo" :gutter="24">
|
||||
<a-col :span="12">
|
||||
<EchartsItem
|
||||
:xAxisData="xhlEcharts.xAxisData"
|
||||
:seriesData="xhlEcharts.seriesData"
|
||||
:title="{ name: '消耗量', popover: '消耗量' }"
|
||||
></EchartsItem>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<EchartsItem
|
||||
:xAxisData="xhlEcharts.xAxisData"
|
||||
:seriesData="xhlEcharts.seriesData"
|
||||
:title="{ name: '消耗量', popover: '消耗量' }"
|
||||
></EchartsItem>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</view>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import EchartsItem from './components/echarts-item/index.vue';
|
||||
|
||||
const xhlEcharts = reactive({
|
||||
xAxisData: ['06-05', '06-06', '06-07', '06-08', '06-09', '06-10', '06-11'],
|
||||
seriesData: [
|
||||
{
|
||||
name: '本地推-小庭院推广计划',
|
||||
type: 'line',
|
||||
data: [30000, 40000, 25000, 20000, 29019, 29019, 29019],
|
||||
color: '#7b68ee',
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
name: '全球旅行小助手推广',
|
||||
type: 'line',
|
||||
data: [25000, 27000, 23000, 20000, 29019, 29019, 29019],
|
||||
color: '#32c5ff',
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
name: '定向旅居推广顶级套餐',
|
||||
type: 'line',
|
||||
data: [10000, 5000, 12000, 15000, 29019, 29019, 29019],
|
||||
color: '#feb62f',
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
name: '城市探索者特惠活动',
|
||||
type: 'line',
|
||||
data: [15000, 18000, 12000, 16000, 20000, 22000, 24000],
|
||||
color: '#ff7d00',
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
name: '高端民宿精选推荐',
|
||||
type: 'line',
|
||||
data: [22000, 20000, 25000, 23000, 21000, 19000, 22000],
|
||||
color: '#f5222d',
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
name: '美食探店达人计划',
|
||||
type: 'line',
|
||||
data: [18000, 19000, 17000, 16000, 18000, 20000, 21000],
|
||||
color: '#722ed1',
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
{
|
||||
name: '户外探险装备推荐',
|
||||
type: 'line',
|
||||
data: [12000, 14000, 13000, 15000, 17000, 16000, 18000],
|
||||
color: '#13c2c2',
|
||||
emphasis: { focus: 'series' },
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@import './style.scss';
|
||||
</style>
|
||||
@ -0,0 +1,68 @@
|
||||
.part-div {
|
||||
width: 100%;
|
||||
background: var(--BG-white, white);
|
||||
overflow: hidden;
|
||||
border-radius: 8px;
|
||||
outline: 1px var(--BG-300, #E6E6E8) solid;
|
||||
outline-offset: -1px;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
display: inline-flex;
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.part-div-header {
|
||||
align-self: stretch;
|
||||
height: 64px;
|
||||
padding: 10px 24px 10px 24px;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
display: inline-flex
|
||||
}
|
||||
|
||||
:deep(.arco-select-view-single),
|
||||
:deep(.arco-select-view-multiple),
|
||||
:deep(.arco-picker),
|
||||
:deep(.arco-input-wrapper) {
|
||||
border-radius: 4px;
|
||||
border-color: #d7d7d9;
|
||||
background-color: #fff;
|
||||
width: 224px;
|
||||
height: 32px;
|
||||
|
||||
&:focus-within,
|
||||
&.arco-input-focus {
|
||||
background-color: var(--color-bg-2);
|
||||
border-color: rgb(var(--primary-6));
|
||||
box-shadow: 0 0 0 0 var(--color-primary-light-2);
|
||||
}
|
||||
}
|
||||
|
||||
.search-btn {
|
||||
// 搜索
|
||||
color: var(--Brand-6, #6d4cfe);
|
||||
font-size: 14px;
|
||||
font-family: Alibaba PuHuiTi;
|
||||
font-weight: 400;
|
||||
line-height: 22px;
|
||||
height: 32px;
|
||||
border-radius: 3px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.reset-btn {
|
||||
// 重置
|
||||
color: var(--Text-2, #3c4043);
|
||||
font-size: 14px;
|
||||
font-family: Alibaba PuHuiTi;
|
||||
font-weight: 400;
|
||||
line-height: 22px;
|
||||
height: 32px;
|
||||
border-radius: 3px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.search-form {
|
||||
margin: 20px;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user