Skip to content

Commit 337b80c

Browse files
committed
Vue3 重构:REVIEW 公众号统计
1 parent 80b690b commit 337b80c

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/views/mp/statistics/index.vue

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<!-- 搜索工作栏 -->
33
<content-wrap>
4-
<el-form ref="queryForm" class="-mb-15px" :inline="true" label-width="68px">
4+
<el-form class="-mb-15px" ref="queryForm" :inline="true" label-width="68px">
55
<el-form-item label="公众号" prop="accountId">
6-
<el-select v-model="accountId" @change="getSummary">
6+
<el-select v-model="accountId" @change="getSummary" class="!w-240px">
77
<el-option
88
v-for="item in accountList"
99
:key="item.id"
@@ -15,13 +15,12 @@
1515
<el-form-item label="时间范围" prop="dateRange">
1616
<el-date-picker
1717
v-model="dateRange"
18-
style="width: 260px"
1918
type="daterange"
20-
range-separator="-"
2119
start-placeholder="开始日期"
2220
end-placeholder="结束日期"
23-
:default-time="defaultTime"
21+
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
2422
@change="getSummary"
23+
class="!w-240px"
2524
/>
2625
</el-form-item>
2726
</el-form>
@@ -75,22 +74,17 @@
7574
</template>
7675

7776
<script setup lang="ts" name="MpStatistics">
78-
import * as StatisticsApi from '@/api/mp/statistics'
7977
import { formatDate, addTime, betweenDay, beginOfDay, endOfDay } from '@/utils/formatTime'
78+
import * as StatisticsApi from '@/api/mp/statistics'
8079
import * as MpAccountApi from '@/api/mp/account'
8180
const message = useMessage() // 消息弹窗
8281
83-
// 默认时间 开始时间00:00:00 结束时间23:59:59
84-
const defaultTime = ref<[Date, Date]>([
85-
new Date(2000, 1, 1, 0, 0, 0),
86-
new Date(2000, 2, 1, 23, 59, 59)
87-
])
8882
// 默认开始时间是当前日期-7,结束时间是当前日期-1
8983
const dateRange = ref([
9084
beginOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24 * 7)),
9185
endOfDay(new Date(new Date().getTime() - 3600 * 1000 * 24))
9286
])
93-
const accountId = ref()
87+
const accountId = ref() // 选中的公众号编号
9488
const accountList = ref<MpAccountApi.AccountVO[]>([]) // 公众号账号列表
9589
9690
const xAxisDate = ref([] as any[]) // X 轴的日期范围
@@ -269,6 +263,7 @@ const getSummary = () => {
269263
initUpstreamMessageChart()
270264
interfaceSummaryChart()
271265
}
266+
272267
/** 用户增减数据 */
273268
const initUserSummaryChart = async () => {
274269
userSummaryOption.xAxis.data = []
@@ -297,6 +292,7 @@ const initUserSummaryChart = async () => {
297292
})
298293
} catch {}
299294
}
295+
300296
/** 累计用户数据 */
301297
const initUserCumulateChart = async () => {
302298
userCumulateOption.xAxis.data = []
@@ -314,6 +310,7 @@ const initUserCumulateChart = async () => {
314310
})
315311
} catch {}
316312
}
313+
317314
/** 消息概况数据 */
318315
const initUpstreamMessageChart = async () => {
319316
upstreamMessageOption.xAxis.data = []
@@ -333,6 +330,7 @@ const initUpstreamMessageChart = async () => {
333330
})
334331
} catch {}
335332
}
333+
336334
/** 接口分析数据 */
337335
const interfaceSummaryChart = async () => {
338336
interfaceSummaryOption.xAxis.data = []

0 commit comments

Comments
 (0)