english.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. position: '',
  13. questionsdian: '',
  14. list: [],
  15. lessonListHeight: '',
  16. previewHeight: '',
  17. questionsMore: ''
  18. },
  19. /* 区分答疑和分享 */
  20. distinction: function(type, columnId, pageNo, pageSize, success) {
  21. login.getOpenidSessionKey(function(res) {
  22. //console.log(res.data.data.uid);
  23. APIClient.getProductionSchedule({
  24. uid: res.data.data.uid
  25. }, {
  26. "type": type,
  27. "columnId": columnId,
  28. "pageNo": pageNo,
  29. "pageSize": pageSize
  30. }).success(success)
  31. }, function() {
  32. wx.showModal({
  33. title: '提示',
  34. content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
  35. showCancel: false,
  36. success: function (res) {
  37. if (res.confirm) {
  38. console.log('用户点击确定')
  39. } else if (res.cancel) {
  40. console.log('用户点击取消')
  41. }
  42. }
  43. })
  44. });
  45. },
  46. /*加载更多点击*/
  47. onMyEvent: function(e){
  48. let type = e.currentTarget.dataset.type;
  49. const columnId = util.column('4').columnId;
  50. if(type == 1) {
  51. this.data.num1++
  52. this.setData({
  53. num1: this.data.num1
  54. })
  55. this.distinction(type, columnId, 1, 5*this.data.num1, res => {
  56. if(res.data.success) {
  57. console.log(res.data.data)
  58. this.setData({
  59. questionsData: res.data.data,
  60. })
  61. if(res.data.data) {
  62. this.setData({
  63. questionsdian: util.replyNo(res.data.data.list)
  64. })
  65. }
  66. }
  67. });
  68. }
  69. },
  70. /*点击定位*/
  71. location: function (e) {
  72. const position = e.currentTarget.dataset.id;
  73. console.log(position)
  74. this.setData({
  75. position: position
  76. })
  77. },
  78. onLoad: function (options) {
  79. },
  80. onShow: function () {
  81. const columnId = util.column('4').columnId;
  82. /* 答疑 */
  83. this.distinction(1, columnId, 1, 2, res => {
  84. if(res.data.success) {
  85. console.log(res.data.data)
  86. this.setData({
  87. questionsData: res.data.data,
  88. })
  89. if(res.data.data) {
  90. this.setData({
  91. questionsdian: util.replyNo(res.data.data.list)
  92. })
  93. if(res.data.data.totalSize > 2) {
  94. this.setData({
  95. questionsMore: true
  96. })
  97. }
  98. }
  99. }
  100. });
  101. /*科目信息*/
  102. login.getOpenidSessionKey((res) => {
  103. //console.log(res.data.data.uid);
  104. APIClient.getEachSchedule({
  105. uid: res.data.data.uid
  106. }, {
  107. "category": 4
  108. }).success((res) => {
  109. //console.log('科目信息' + JSON.stringify(res));
  110. const lessonListLength = res.data.data.lessonPage.list.length;
  111. const previewLength = util.preview(res.data.data.lessonPage.list).length;
  112. console.log(res)
  113. if(lessonListLength > 4) {
  114. this.setData({
  115. lessonListHeight: 280
  116. })
  117. }
  118. if(previewLength > 4){
  119. this.setData({
  120. previewHeight: 280
  121. })
  122. }
  123. this.setData({
  124. courseData: res.data.data,
  125. list: util.studyPageTime(res.data.data.lessonPage.list)
  126. })
  127. })
  128. }, function() {
  129. wx.showModal({
  130. title: '提示',
  131. content: '需要获取您的公开信息(昵称、头像等),请从小程序列表删除小学王者班后再次扫码进入,允许授权后可正常使用',
  132. showCancel: false,
  133. success: function (res) {
  134. if (res.confirm) {
  135. console.log('用户点击确定')
  136. } else if (res.cancel) {
  137. console.log('用户点击取消')
  138. }
  139. }
  140. })
  141. });
  142. },
  143. })