index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {
  2. getBannerList
  3. } from '~/api/global'
  4. Component({
  5. properties: {
  6. classify: {
  7. type: Number,
  8. value: 1
  9. }
  10. },
  11. data: {
  12. bannerList: []
  13. },
  14. lifetimes: {
  15. attached() {
  16. this.getBannerList()
  17. },
  18. },
  19. /**
  20. * 组件的方法列表
  21. */
  22. methods: {
  23. async getBannerList() {
  24. let bannerList = await getBannerList(this.properties.classify)
  25. this.setData({
  26. bannerList
  27. })
  28. },
  29. bannelEvent({
  30. currentTarget
  31. }) {
  32. //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
  33. let {
  34. type,
  35. id
  36. } = currentTarget.dataset
  37. if ([2, 3, 4].includes(type)) {
  38. wx.navigateTo({
  39. url: `/pages/ranking/index?id=${id}&type=${type}`,
  40. })
  41. }
  42. if (type == 5) {
  43. wx.navigateTo({
  44. url: '/pages/match/index',
  45. })
  46. }
  47. },
  48. }
  49. })