classList.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // pages/experienceList/experienceList.js
  2. const app = getApp()
  3. Page({
  4. data: {},
  5. onLoad: function(options) {
  6. console.log(options)
  7. this.setData({
  8. navH: app.globalData.navHeight,
  9. title: options.n,
  10. source: options.s
  11. })
  12. },
  13. onShow:function(){
  14. this.getList()
  15. },
  16. // 获取列表数据
  17. getList: function () {
  18. let _this = this
  19. // 体验课
  20. let isUrl = '/college/queryUserLearningExperience'
  21. if (_this.data.source == 2) {
  22. // 活动课
  23. isUrl = '/college/queryUserLearningPractice'
  24. } else if (_this.data.source == 3) {
  25. // 常规课
  26. isUrl = '/college/queryUserLearningCore'
  27. }
  28. wx.request({
  29. url: app.globalData.url + isUrl,
  30. method: 'post',
  31. header: {"Content-Type": "application/x-www-form-urlencoded"},
  32. data: { openid: app.globalData.openid, city: wx.getStorageSync('branche_code')},
  33. success: function (res) {
  34. console.log(res)
  35. let arr = []
  36. if (_this.data.source == 1) {
  37. arr = res.data.collegeCurriculumExperiences || []
  38. } else if (_this.data.source == 2) {
  39. arr = res.data.collegeCurriculumPractices || []
  40. } else {
  41. arr = res.data.collegeCurriculumCores_b || []
  42. if (res.data.collegeCurriculumCores_p && res.data.collegeCurriculumCores_p.length>0){
  43. arr = [...arr, ...res.data.collegeCurriculumCores_p]
  44. }
  45. }
  46. _this.setData({list: arr})
  47. // console.log(arr)
  48. },
  49. fail() {
  50. app.timeOut()
  51. }
  52. })
  53. },
  54. /**
  55. * 生命周期函数--监听页面卸载
  56. */
  57. onUnload: function() {
  58. }
  59. })