chinese.js 3.3 KB

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