recommend.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. })