|
@@ -7,63 +7,67 @@
|
|
|
:body-style="{
|
|
:body-style="{
|
|
|
paddingTop: '20px',
|
|
paddingTop: '20px',
|
|
|
}"
|
|
}"
|
|
|
- title="一周数据">
|
|
|
|
|
|
|
+ title="一周数据"
|
|
|
|
|
+ >
|
|
|
<sa-chart height="300px" :option="chartOptions" />
|
|
<sa-chart height="300px" :option="chartOptions" />
|
|
|
</a-card>
|
|
</a-card>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { nextTick, onMounted, ref } from 'vue'
|
|
|
|
|
-import { graphic } from 'echarts'
|
|
|
|
|
-import welcome from '@/views/v1/api/welcome'
|
|
|
|
|
|
|
+import { nextTick, onMounted, ref } from "vue";
|
|
|
|
|
+import { graphic } from "echarts";
|
|
|
|
|
+import welcome from "@/views/v1/api/welcome";
|
|
|
|
|
|
|
|
function graphicFactory(side) {
|
|
function graphicFactory(side) {
|
|
|
return {
|
|
return {
|
|
|
- type: 'text',
|
|
|
|
|
- bottom: '8',
|
|
|
|
|
|
|
+ type: "text",
|
|
|
|
|
+ bottom: "8",
|
|
|
...side,
|
|
...side,
|
|
|
style: {
|
|
style: {
|
|
|
- text: '',
|
|
|
|
|
- textAlign: 'center',
|
|
|
|
|
- fill: '#4E5969',
|
|
|
|
|
|
|
+ text: "",
|
|
|
|
|
+ textAlign: "center",
|
|
|
|
|
+ fill: "#4E5969",
|
|
|
fontSize: 12,
|
|
fontSize: 12,
|
|
|
},
|
|
},
|
|
|
- }
|
|
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const xAxis = ref([])
|
|
|
|
|
-const chartsData = ref([])
|
|
|
|
|
-const graphicElements = ref([graphicFactory({ left: '2.6%' }), graphicFactory({ right: 0 })])
|
|
|
|
|
|
|
+const xAxis = ref([]);
|
|
|
|
|
+const chartsData = ref([]);
|
|
|
|
|
+const graphicElements = ref([
|
|
|
|
|
+ graphicFactory({ left: "2.6%" }),
|
|
|
|
|
+ graphicFactory({ right: 0 }),
|
|
|
|
|
+]);
|
|
|
|
|
|
|
|
-const chartOptions = ref({})
|
|
|
|
|
|
|
+const chartOptions = ref({});
|
|
|
|
|
|
|
|
const getData = async () => {
|
|
const getData = async () => {
|
|
|
- const res = await welcome.chartDataApi()
|
|
|
|
|
- xAxis.value = res.data.days
|
|
|
|
|
|
|
+ const res = await welcome.chartDataApi();
|
|
|
|
|
+ xAxis.value = res.data.days;
|
|
|
// chartsData.value = res.data.data.login_count
|
|
// chartsData.value = res.data.data.login_count
|
|
|
|
|
|
|
|
chartOptions.value = {
|
|
chartOptions.value = {
|
|
|
legend: {
|
|
legend: {
|
|
|
- data: ['注册', '登录', '消耗', '充值'],
|
|
|
|
|
|
|
+ data: ["注册", "登录", "消耗", "充值"],
|
|
|
},
|
|
},
|
|
|
grid: {
|
|
grid: {
|
|
|
- left: '2.6%',
|
|
|
|
|
- right: '0',
|
|
|
|
|
- top: '10',
|
|
|
|
|
- bottom: '30',
|
|
|
|
|
|
|
+ left: "2.6%",
|
|
|
|
|
+ right: "0",
|
|
|
|
|
+ top: "10",
|
|
|
|
|
+ bottom: "30",
|
|
|
},
|
|
},
|
|
|
xAxis: {
|
|
xAxis: {
|
|
|
- type: 'category',
|
|
|
|
|
|
|
+ type: "category",
|
|
|
offset: 2,
|
|
offset: 2,
|
|
|
data: xAxis.value,
|
|
data: xAxis.value,
|
|
|
boundaryGap: false,
|
|
boundaryGap: false,
|
|
|
axisLabel: {
|
|
axisLabel: {
|
|
|
- color: '#4E5969',
|
|
|
|
|
|
|
+ color: "#4E5969",
|
|
|
formatter(value, idx) {
|
|
formatter(value, idx) {
|
|
|
- if (idx === 0) return ''
|
|
|
|
|
- if (idx === xAxis.value.length - 1) return ''
|
|
|
|
|
- return `${value}`
|
|
|
|
|
|
|
+ if (idx === 0) return "";
|
|
|
|
|
+ if (idx === xAxis.value.length - 1) return "";
|
|
|
|
|
+ return `${value}`;
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
axisLine: {
|
|
axisLine: {
|
|
@@ -75,51 +79,43 @@ const getData = async () => {
|
|
|
splitLine: {
|
|
splitLine: {
|
|
|
show: true,
|
|
show: true,
|
|
|
interval: (idx) => {
|
|
interval: (idx) => {
|
|
|
- if (idx === 0) return false
|
|
|
|
|
- if (idx === xAxis.value.length - 1) return false
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ if (idx === 0) return false;
|
|
|
|
|
+ if (idx === xAxis.value.length - 1) return false;
|
|
|
|
|
+ return true;
|
|
|
},
|
|
},
|
|
|
lineStyle: {
|
|
lineStyle: {
|
|
|
- color: '#E5E8EF',
|
|
|
|
|
|
|
+ color: "#E5E8EF",
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
axisPointer: {
|
|
axisPointer: {
|
|
|
show: true,
|
|
show: true,
|
|
|
lineStyle: {
|
|
lineStyle: {
|
|
|
- color: '#23ADFF',
|
|
|
|
|
|
|
+ color: "#23ADFF",
|
|
|
width: 2,
|
|
width: 2,
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
yAxis: {
|
|
yAxis: {
|
|
|
- type: 'value',
|
|
|
|
|
|
|
+ type: "value",
|
|
|
axisLine: {
|
|
axisLine: {
|
|
|
show: false,
|
|
show: false,
|
|
|
},
|
|
},
|
|
|
axisLabel: {
|
|
axisLabel: {
|
|
|
formatter(value, idx) {
|
|
formatter(value, idx) {
|
|
|
- if (idx === 0) return value
|
|
|
|
|
- return `${value}`
|
|
|
|
|
|
|
+ if (idx === 0) return value;
|
|
|
|
|
+ return `${value}`;
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
splitLine: {
|
|
splitLine: {
|
|
|
show: true,
|
|
show: true,
|
|
|
lineStyle: {
|
|
lineStyle: {
|
|
|
- type: 'dashed',
|
|
|
|
|
- color: '#E5E8EF',
|
|
|
|
|
|
|
+ type: "dashed",
|
|
|
|
|
+ color: "#E5E8EF",
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
- trigger: 'axis',
|
|
|
|
|
- // formatter(params) {
|
|
|
|
|
- // return `<div class="login-chart">
|
|
|
|
|
- // <p class="tooltip-title">${params[0].axisValueLabel}</p>
|
|
|
|
|
- // <div class="content-panel"><span>登录次数</span><span class="tooltip-value">${Number(
|
|
|
|
|
- // params[0].value
|
|
|
|
|
- // ).toLocaleString()}</span></div>
|
|
|
|
|
- // </div>`
|
|
|
|
|
- // },
|
|
|
|
|
|
|
+ trigger: "axis",
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
graphic: {
|
|
graphic: {
|
|
@@ -127,36 +123,40 @@ const getData = async () => {
|
|
|
},
|
|
},
|
|
|
series: [
|
|
series: [
|
|
|
{
|
|
{
|
|
|
- name: '注册',
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- stack: '总数',
|
|
|
|
|
|
|
+ name: "注册",
|
|
|
|
|
+ type: "line",
|
|
|
|
|
+ stack: "总数",
|
|
|
data: res.data.reg,
|
|
data: res.data.reg,
|
|
|
|
|
+ smooth: true,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- name: '登录',
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- stack: '总数',
|
|
|
|
|
|
|
+ name: "登录",
|
|
|
|
|
+ type: "line",
|
|
|
|
|
+ stack: "总数",
|
|
|
data: res.data.login,
|
|
data: res.data.login,
|
|
|
|
|
+ smooth: true,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- name: '消耗',
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- stack: '金额',
|
|
|
|
|
|
|
+ name: "消耗",
|
|
|
|
|
+ type: "line",
|
|
|
|
|
+ stack: "金额",
|
|
|
data: res.data.cost,
|
|
data: res.data.cost,
|
|
|
|
|
+ smooth: true,
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- name: '充值',
|
|
|
|
|
- type: 'line',
|
|
|
|
|
- stack: '金额',
|
|
|
|
|
|
|
+ name: "充值",
|
|
|
|
|
+ type: "line",
|
|
|
|
|
+ stack: "金额",
|
|
|
data: res.data.pay,
|
|
data: res.data.pay,
|
|
|
|
|
+ smooth: true,
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
- }
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ };
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- getData()
|
|
|
|
|
-})
|
|
|
|
|
|
|
+ getData();
|
|
|
|
|
+});
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|