| @@ -21,30 +21,37 @@ Page({ | |||||
| /** | /** | ||||
| * 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
| */ | */ | ||||
| onShow: function() { | |||||
| onShow: function () { | |||||
| let that = this; | let that = this; | ||||
| Http.get({ | Http.get({ | ||||
| url: config.api.scoreLevelInfo, | url: config.api.scoreLevelInfo, | ||||
| data: {} | data: {} | ||||
| }) | }) | ||||
| .then(res=>{ | |||||
| that.setData({ | |||||
| flags: 'have', | |||||
| rules: JSON.parse(res.data.score.rules), | |||||
| rules1: JSON.parse(res.data.score.rules)[1].childs, | |||||
| levelList: res.data.levelList | |||||
| .then(res => { | |||||
| let childs = [] | |||||
| JSON.parse(res.data.score.rules).forEach(item => { | |||||
| if (item.id == 2) { | |||||
| childs = item.childs | |||||
| } | |||||
| }) | |||||
| that.setData({ | |||||
| flags: 'have', | |||||
| rules: JSON.parse(res.data.score.rules), | |||||
| rules1: childs || [], | |||||
| levelList: res.data.levelList | |||||
| }) | |||||
| console.log(that.data.rules) | |||||
| console.log(that.data.rules1) | |||||
| }) | }) | ||||
| console.log(that.data.rules) | |||||
| }) | |||||
| .catch(res=>{ | |||||
| that.setData({ | |||||
| flags: 'nothave' | |||||
| .catch(res => { | |||||
| that.setData({ | |||||
| flags: 'nothave' | |||||
| }) | |||||
| }) | }) | ||||
| }) | |||||
| }, | }, | ||||
| // 点击跳转到我的特享优惠 | // 点击跳转到我的特享优惠 | ||||
| gotospecialcourtesy:function(){ | |||||
| gotospecialcourtesy: function () { | |||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url: '/pages/specialcourtesy/specialcourtesy', | url: '/pages/specialcourtesy/specialcourtesy', | ||||
| }) | }) | ||||