index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import {
  2. getBannerList
  3. } from '~/api/global'
  4. Component({
  5. properties: {
  6. // banner的classify是:1:官方推荐;2:作品展播;3:官方活动;4:关注作品;5:我的作品;
  7. classify: {
  8. type: Number,
  9. value: 1,
  10. observer(newVal) {
  11. this.getBannerList()
  12. }
  13. }
  14. },
  15. data: {
  16. bannerList: [],
  17. current: 0
  18. },
  19. methods: {
  20. async getBannerList() {
  21. let bannerList = await getBannerList(this.properties.classify)
  22. this.setData({
  23. bannerList,
  24. current: 0
  25. })
  26. },
  27. bannelEvent({
  28. currentTarget
  29. }) {
  30. console.log(currentTarget);
  31. //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
  32. let {
  33. type,
  34. content
  35. } = currentTarget.dataset
  36. if ([2, 3, 4].includes(type)) {
  37. wx.navigateTo({
  38. url: `/pages/ranking/index?id=${content}&type=${type}`,
  39. })
  40. } else if (type == 5) {
  41. wx.navigateTo({
  42. url: '/pages/match/index',
  43. })
  44. } else if (type == 1) {
  45. wx.navigateTo({
  46. url: `/pages/rankIntro/index?img=${content}`,
  47. })
  48. }
  49. },
  50. }
  51. })