GuidePopupStats.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <template>
  2. <div class="guide-popup-stats">
  3. <el-card>
  4. <PageHeader slot="header" title="引导弹窗数据看板">
  5. <el-select v-model="popupId" placeholder="全部弹窗" clearable class="filter-select-220" @change="load">
  6. <el-option v-for="p in popups" :key="p.id" :label="p.slug" :value="p.id" />
  7. </el-select>
  8. </PageHeader>
  9. <el-row :gutter="16">
  10. <el-col :span="6"><StatCard label="总曝光" :value="stats.totalViews || 0" /></el-col>
  11. <el-col :span="6"><StatCard label="总点击" :value="stats.totalClicks || 0" /></el-col>
  12. <el-col :span="6"><StatCard label="完成率" :value="stats.completionRate || '0.0%'" /></el-col>
  13. </el-row>
  14. <div class="adm-table-wrap">
  15. <el-table :data="trend" border class="table-mt-16" height="100%">
  16. <el-table-column prop="hour" label="时段" width="120" />
  17. <el-table-column prop="views" label="曝光" />
  18. <el-table-column prop="clicks" label="点击" />
  19. </el-table>
  20. </div>
  21. </el-card>
  22. </div>
  23. </template>
  24. <script>
  25. import { listGuidePopup, getGuidePopupStats } from '@/api/guidePopup'
  26. export default {
  27. name: 'GuidePopupStats',
  28. data() {
  29. return { popupId: null, popups: [], stats: {}, trend: [] }
  30. },
  31. created() {
  32. listGuidePopup({}).then(res => { this.popups = (res && res.data) || [] })
  33. this.load()
  34. },
  35. methods: {
  36. load() {
  37. getGuidePopupStats({ popupId: this.popupId }).then(res => {
  38. const d = (res && res.data) || {}
  39. this.stats = d
  40. this.trend = d.trendByHour || []
  41. })
  42. }
  43. }
  44. }
  45. </script>
  46. <style scoped>
  47. /* == C 批内联清理工具类 == */
  48. .filter-select-220 { width: 220px; }
  49. .table-mt-16 { margin-top: 16px; }
  50. </style>