language.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // pages/art/art.js
  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. flag: false,
  9. questionsData: {},
  10. courseData: {},
  11. num1: 0
  12. },
  13. /* 区分答疑和分享 */
  14. distinction: function(type, columnId, pageNo, pageSize, success) {
  15. login.getOpenidSessionKey(function(res) {
  16. //console.log(res.data.data.uid);
  17. APIClient.getProductionSchedule({
  18. uid: res.data.data.uid
  19. }, {
  20. "type": type,
  21. "columnId": columnId,
  22. "pageNo": pageNo,
  23. "pageSize": pageSize
  24. }).success(success)
  25. }, function() {
  26. wx.showModal({
  27. title: '提示',
  28. content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
  29. showCancel: false,
  30. success: function (res) {
  31. if (res.confirm) {
  32. console.log('用户点击确定')
  33. } else if (res.cancel) {
  34. console.log('用户点击取消')
  35. }
  36. }
  37. })
  38. });
  39. },
  40. /*加载更多点击*/
  41. onMyEvent: function(e){
  42. let type = e.currentTarget.dataset.type;
  43. const columnId = util.column('1').columnId;
  44. if(type == 1) {
  45. this.data.num1++
  46. this.setData({
  47. num1: this.data.num1
  48. })
  49. this.distinction(type, columnId, 1, 5*this.data.num1, res => {
  50. if(res.data.success) {
  51. console.log(res.data.data)
  52. this.setData({
  53. questionsData: res.data.data,
  54. })
  55. }
  56. });
  57. }
  58. },
  59. onLoad: function (options) {
  60. },
  61. onShow: function () {
  62. const columnId = util.column('1').columnId;
  63. /* 答疑 */
  64. this.distinction(1, columnId, 1, 2, res => {
  65. if(res.data.success) {
  66. console.log(res.data.data)
  67. this.setData({
  68. questionsData: res.data.data,
  69. })
  70. }
  71. });
  72. /*科目信息*/
  73. login.getOpenidSessionKey((res) => {
  74. //console.log(res.data.data.uid);
  75. APIClient.getEachSchedule({
  76. uid: res.data.data.uid
  77. }, {
  78. "category": 1
  79. }).success((res) => {
  80. //console.log('科目信息' + JSON.stringify(res));
  81. this.setData({
  82. courseData: res.data.data
  83. })
  84. })
  85. }, function() {
  86. wx.showModal({
  87. title: '提示',
  88. content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
  89. showCancel: false,
  90. success: function (res) {
  91. if (res.confirm) {
  92. console.log('用户点击确定')
  93. } else if (res.cancel) {
  94. console.log('用户点击取消')
  95. }
  96. }
  97. })
  98. });
  99. },
  100. })