recommend.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. //获取应用实例
  2. const app = getApp()
  3. const util = require('../../utils/util.js');
  4. const APIClient = require('../../utils/APIClient.js');
  5. const login = require('../../utils/loginSchedule.js');
  6. Page({
  7. data: {
  8. recommendData: {},
  9. metalsStrategy: [],
  10. wxObjectives: ''
  11. },
  12. onLoad: function (options) {
  13. },
  14. onShow: function () {
  15. login.getOpenidSessionKey(res => {
  16. APIClient.getRecommendSchedule({
  17. uid: res.data.data.uid
  18. }).success(res => {
  19. console.log(res.data)
  20. this.setData({
  21. recommendData: res.data.data,
  22. metalsStrategy:util.strategy(res.data.data.weekPageThemeConfig.metalsStrategy),
  23. wxObjectives: util.strategy(res.data.data.weekPageThemeConfig.wxObjectives)
  24. })
  25. })
  26. }, function() {
  27. wx.showModal({
  28. title: '提示',
  29. content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
  30. showCancel: false,
  31. success: function (res) {
  32. if (res.confirm) {
  33. console.log('用户点击确定')
  34. } else if (res.cancel) {
  35. console.log('用户点击取消')
  36. }
  37. }
  38. })
  39. });
  40. },
  41. })