|
@@ -7,8 +7,8 @@
|
|
|
:body-style="{
|
|
:body-style="{
|
|
|
paddingTop: '20px',
|
|
paddingTop: '20px',
|
|
|
}"
|
|
}"
|
|
|
- title="登录统计">
|
|
|
|
|
- <sa-chart height="300px" :option="loginChartOptions" />
|
|
|
|
|
|
|
+ title="一周数据">
|
|
|
|
|
+ <sa-chart height="300px" :option="chartOptions" />
|
|
|
</a-card>
|
|
</a-card>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
@@ -16,7 +16,7 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { nextTick, onMounted, ref } from 'vue'
|
|
import { nextTick, onMounted, ref } from 'vue'
|
|
|
import { graphic } from 'echarts'
|
|
import { graphic } from 'echarts'
|
|
|
-import api from '@/api/common'
|
|
|
|
|
|
|
+import welcome from '@/views/v1/api/welcome'
|
|
|
|
|
|
|
|
function graphicFactory(side) {
|
|
function graphicFactory(side) {
|
|
|
return {
|
|
return {
|
|
@@ -36,14 +36,17 @@ const xAxis = ref([])
|
|
|
const chartsData = ref([])
|
|
const chartsData = ref([])
|
|
|
const graphicElements = ref([graphicFactory({ left: '2.6%' }), graphicFactory({ right: 0 })])
|
|
const graphicElements = ref([graphicFactory({ left: '2.6%' }), graphicFactory({ right: 0 })])
|
|
|
|
|
|
|
|
-const loginChartOptions = ref({})
|
|
|
|
|
|
|
+const chartOptions = ref({})
|
|
|
|
|
|
|
|
const getData = async () => {
|
|
const getData = async () => {
|
|
|
- const res = await api.loginChart()
|
|
|
|
|
- xAxis.value = res.data.login_date
|
|
|
|
|
- chartsData.value = res.data.login_count
|
|
|
|
|
|
|
+ const res = await welcome.chartDataApi()
|
|
|
|
|
+ xAxis.value = res.data.days
|
|
|
|
|
+ // chartsData.value = res.data.data.login_count
|
|
|
|
|
|
|
|
- loginChartOptions.value = {
|
|
|
|
|
|
|
+ chartOptions.value = {
|
|
|
|
|
+ legend: {
|
|
|
|
|
+ data: ['注册', '登录', '消耗', '充值'],
|
|
|
|
|
+ },
|
|
|
grid: {
|
|
grid: {
|
|
|
left: '2.6%',
|
|
left: '2.6%',
|
|
|
right: '0',
|
|
right: '0',
|
|
@@ -109,65 +112,51 @@ const getData = async () => {
|
|
|
},
|
|
},
|
|
|
tooltip: {
|
|
tooltip: {
|
|
|
trigger: 'axis',
|
|
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>`
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // 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>`
|
|
|
|
|
+ // },
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
graphic: {
|
|
graphic: {
|
|
|
elements: graphicElements.value,
|
|
elements: graphicElements.value,
|
|
|
},
|
|
},
|
|
|
series: [
|
|
series: [
|
|
|
{
|
|
{
|
|
|
- data: chartsData.value,
|
|
|
|
|
|
|
+ name: '注册',
|
|
|
type: 'line',
|
|
type: 'line',
|
|
|
- smooth: true,
|
|
|
|
|
- symbolSize: 12,
|
|
|
|
|
- emphasis: {
|
|
|
|
|
- focus: 'series',
|
|
|
|
|
- itemStyle: {
|
|
|
|
|
- borderWidth: 2,
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- lineStyle: {
|
|
|
|
|
- width: 3,
|
|
|
|
|
- color: new graphic.LinearGradient(0, 0, 1, 0, [
|
|
|
|
|
- {
|
|
|
|
|
- offset: 0,
|
|
|
|
|
- color: 'rgba(30, 231, 255, 1)',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- offset: 0.5,
|
|
|
|
|
- color: 'rgba(36, 154, 255, 1)',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- offset: 1,
|
|
|
|
|
- color: 'rgba(111, 66, 251, 1)',
|
|
|
|
|
- },
|
|
|
|
|
- ]),
|
|
|
|
|
- },
|
|
|
|
|
- showSymbol: false,
|
|
|
|
|
- areaStyle: {
|
|
|
|
|
- opacity: 0.8,
|
|
|
|
|
- color: new graphic.LinearGradient(0, 0, 0, 1, [
|
|
|
|
|
- {
|
|
|
|
|
- offset: 0,
|
|
|
|
|
- color: 'rgba(17, 126, 255, 0.16)',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- offset: 1,
|
|
|
|
|
- color: 'rgba(17, 128, 255, 0)',
|
|
|
|
|
- },
|
|
|
|
|
- ]),
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ stack: '总数',
|
|
|
|
|
+ data: res.data.reg,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: '登录',
|
|
|
|
|
+ type: 'line',
|
|
|
|
|
+ stack: '总数',
|
|
|
|
|
+ data: res.data.login,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: '消耗',
|
|
|
|
|
+ type: 'line',
|
|
|
|
|
+ stack: '金额',
|
|
|
|
|
+ data: res.data.cost,
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ name: '充值',
|
|
|
|
|
+ type: 'line',
|
|
|
|
|
+ stack: '金额',
|
|
|
|
|
+ data: res.data.pay,
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-getData()
|
|
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ getData()
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
<style lang="less" scoped>
|