//获取应用实例 const app = getApp() const util = require('../../utils/util.js'); const APIClient = require('../../utils/APIClient.js'); const login = require('../../utils/loginSchedule.js'); Page({ data: { recommendData: {}, metalsStrategy: [], wxObjectives: '' }, onLoad: function (options) { }, onShow: function () { login.getOpenidSessionKey(res => { APIClient.getRecommendSchedule({ uid: res.data.data.uid }).success(res => { console.log(res.data) this.setData({ recommendData: res.data.data, metalsStrategy:util.strategy(res.data.data.weekPageThemeConfig.metalsStrategy), wxObjectives: util.strategy(res.data.data.weekPageThemeConfig.wxObjectives) }) }) }, function() { wx.showModal({ title: '提示', content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除勋章战士后再次扫码进入,允许授权后可正常使用', showCancel: false, success: function (res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) }); }, })