| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <template>
- <div class="guide-popup-stats">
- <el-card>
- <PageHeader slot="header" title="引导弹窗数据看板">
- <el-select v-model="popupId" placeholder="全部弹窗" clearable class="filter-select-220" @change="load">
- <el-option v-for="p in popups" :key="p.id" :label="p.slug" :value="p.id" />
- </el-select>
- </PageHeader>
- <el-row :gutter="16">
- <el-col :span="6"><StatCard label="总曝光" :value="stats.totalViews || 0" /></el-col>
- <el-col :span="6"><StatCard label="总点击" :value="stats.totalClicks || 0" /></el-col>
- <el-col :span="6"><StatCard label="完成率" :value="stats.completionRate || '0.0%'" /></el-col>
- </el-row>
- <div class="adm-table-wrap">
- <el-table :data="trend" border class="table-mt-16" height="100%">
- <el-table-column prop="hour" label="时段" width="120" />
- <el-table-column prop="views" label="曝光" />
- <el-table-column prop="clicks" label="点击" />
- </el-table>
- </div>
- </el-card>
- </div>
- </template>
- <script>
- import { listGuidePopup, getGuidePopupStats } from '@/api/guidePopup'
- export default {
- name: 'GuidePopupStats',
- data() {
- return { popupId: null, popups: [], stats: {}, trend: [] }
- },
- created() {
- listGuidePopup({}).then(res => { this.popups = (res && res.data) || [] })
- this.load()
- },
- methods: {
- load() {
- getGuidePopupStats({ popupId: this.popupId }).then(res => {
- const d = (res && res.data) || {}
- this.stats = d
- this.trend = d.trendByHour || []
- })
- }
- }
- }
- </script>
- <style scoped>
- /* == C 批内联清理工具类 == */
- .filter-select-220 { width: 220px; }
- .table-mt-16 { margin-top: 16px; }
- </style>
|