1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- // pages/experienceList/experienceList.js
- const app = getApp()
- Page({
- data: {},
- onLoad: function(options) {
- console.log(options)
- this.setData({
- navH: app.globalData.navHeight,
- title: options.n,
- source: options.s
- })
- },
- onShow:function(){
- this.getList()
- },
- // 获取列表数据
- getList: function () {
- let _this = this
- // 体验课
- let isUrl = '/college/queryUserLearningExperience'
- if (_this.data.source == 2) {
- // 活动课
- isUrl = '/college/queryUserLearningPractice'
- } else if (_this.data.source == 3) {
- // 常规课
- isUrl = '/college/queryUserLearningCore'
- }
- wx.request({
- url: app.globalData.url + isUrl,
- method: 'post',
- header: {"Content-Type": "application/x-www-form-urlencoded"},
- data: { openid: app.globalData.openid, city: wx.getStorageSync('branche_code')},
- success: function (res) {
- console.log(res)
- let arr = []
- if (_this.data.source == 1) {
- arr = res.data.collegeCurriculumExperiences || []
- } else if (_this.data.source == 2) {
- arr = res.data.collegeCurriculumPractices || []
- } else {
- arr = res.data.collegeCurriculumCores_b || []
- if (res.data.collegeCurriculumCores_p && res.data.collegeCurriculumCores_p.length>0){
- arr = [...arr, ...res.data.collegeCurriculumCores_p]
- }
- }
- _this.setData({list: arr})
- // console.log(arr)
- },
- fail() {
- app.timeOut()
- }
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function() {
- }
- })
|