cmsMixins.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // 统计数据
  2. // 统计类型 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表
  3. import Vue from 'vue'
  4. const cmsMixins = {
  5. computed: {
  6. },
  7. methods: {
  8. cmsSysStatistics(cmsSysType,bannerId) {
  9. this.ProductService.sYsStatisticsTypesSatisticsNumber({typeId:cmsSysType,bannerId:bannerId})
  10. .then(response => {
  11. const map = {
  12. 1: '首页轮播',
  13. 2: '直播模块',
  14. 3: '最新活动',
  15. 4: '热门文章',
  16. 5: '新品橱窗',
  17. 6: '活动列表'
  18. }
  19. const sYsText = map[cmsSysType]
  20. console.log(`<-------${sYsText}统计数据成功------>`)
  21. })
  22. .catch(error => {
  23. console.log(`<-------统计${sYsText}数据异常------>`)
  24. })
  25. },
  26. // 模块点击量统计
  27. async cmsMoudleHits(type, authorId) {
  28. try {
  29. await this.ProductService.cmsMoudleHits({type, authorId})
  30. console.log('<-------统计数据成功------>')
  31. } catch(e) {
  32. console.log('<-------统计数据异常------>')
  33. }
  34. },
  35. // 搜索词统计
  36. async cmsKeywordHits(keyword) {
  37. try {
  38. await this.ProductService.cmsKeywordHits(keyword)
  39. console.log('<-------统计数据成功------>')
  40. } catch(e) {
  41. console.log('<-------统计数据异常------>')
  42. }
  43. }
  44. }
  45. }
  46. export default cmsMixins