chinese.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. wxObjectives: [],
  19. flag: true
  20. },
  21. /* 区分答疑和分享 */
  22. distinction: function(type, columnId, pageNo, pageSize, success) {
  23. login.getOpenidSessionKey(function(res) {
  24. //console.log(res.data.data.uid);
  25. APIClient.getProductionSchedule({
  26. uid: res.data.data.uid
  27. }, {
  28. "type": type,
  29. "category": columnId,
  30. "pageNo": pageNo,
  31. "pageSize": pageSize
  32. }).success(success)
  33. }, function() {
  34. });
  35. },
  36. /*加载更多点击*/
  37. onMyEvent: function(e){
  38. let type = e.currentTarget.dataset.type;
  39. const columnId = util.column('3').columnId;
  40. if(type == 1) {
  41. this.data.num1++
  42. this.setData({
  43. num1: this.data.num1
  44. })
  45. this.distinction(type, columnId, 1, 5*this.data.num1, res => {
  46. if(res.data.success) {
  47. console.log(res.data.data)
  48. this.setData({
  49. questionsData: res.data.data
  50. })
  51. if(res.data.data) {
  52. this.setData({
  53. questionsdian: util.replyNo(res.data.data.list)
  54. })
  55. if(5*this.data.num1 > res.data.data.totalSize) {
  56. this.setData({
  57. questionsMore: ''
  58. })
  59. }
  60. }
  61. }
  62. });
  63. }
  64. },
  65. /*点击定位*/
  66. location: function (e) {
  67. const position = e.currentTarget.dataset.id;
  68. console.log(position)
  69. this.setData({
  70. position: position
  71. })
  72. },
  73. onLoad: function (options) {
  74. },
  75. onShow: function () {
  76. const columnId = util.column('3').columnId;
  77. /* 答疑 */
  78. this.distinction(1, columnId, 1, 2, res => {
  79. if(res.data.success) {
  80. console.log(res.data.data)
  81. this.setData({
  82. questionsData: res.data.data
  83. })
  84. if(res.data.data) {
  85. this.setData({
  86. questionsdian: util.replyNo(res.data.data.list)
  87. })
  88. if(res.data.data.totalSize > 2) {
  89. this.setData({
  90. questionsMore: true
  91. })
  92. }
  93. }
  94. }
  95. });
  96. /*科目信息*/
  97. login.getOpenidSessionKey((res) => {
  98. //console.log(res.data.data.uid);
  99. APIClient.getEachSchedule({
  100. uid: res.data.data.uid
  101. }, {
  102. "category": 3
  103. }).success((res) => {
  104. const lessonListLength = res.data.data.lessonPage.list.length;
  105. const previewLength = res.data.data.lessonPage.list.length;
  106. console.log(res)
  107. if(lessonListLength > 4) {
  108. this.setData({
  109. lessonListHeight: 280
  110. })
  111. }
  112. if(previewLength > 4){
  113. this.setData({
  114. previewHeight: 280
  115. })
  116. }
  117. this.setData({
  118. courseData: res.data.data,
  119. list: util.studyPageTime(res.data.data.lessonPage.list),
  120. wxObjectives: util.strategy(res.data.data.weekCourseConfig.wxObjectives)
  121. })
  122. })
  123. }, () => {
  124. this.setData({
  125. flag: !this.data.flag
  126. })
  127. });
  128. },
  129. /*获取个人信息弹框*/
  130. jurisdiction: function () {
  131. this.setData({
  132. flag: !this.data.flag
  133. })
  134. this.onShow();
  135. },
  136. })