single_subject_detail.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. const app = getApp();
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. baseImgUrl: app.globalData.baseImgUrl,
  8. thumbnail: app.globalData.thumbnail,
  9. idx: 0,
  10. isMohu:false,
  11. learningState: [
  12. // {
  13. // "name": "积极性",
  14. // "type": 1
  15. // },
  16. // {
  17. // "name": "自律性",
  18. // "type": 2
  19. // },
  20. // {
  21. // "name": "专注度",
  22. // "type": 3
  23. // },
  24. // {
  25. // "name": "作业速度",
  26. // "type": 2
  27. // }
  28. ],
  29. subjectList: []
  30. },
  31. /**
  32. * 生命周期函数--监听页面加载
  33. */
  34. onLoad: function (options) {
  35. this.setData({ options })
  36. const { subject } = options;
  37. if (subject) {
  38. wx.setNavigationBarTitle({
  39. title: `${subject}作业批改详情`,
  40. })
  41. }
  42. this.getSingleSubject()
  43. },
  44. /**
  45. * 生命周期函数--监听页面初次渲染完成
  46. */
  47. onReady: function () {
  48. },
  49. /**
  50. * 生命周期函数--监听页面显示
  51. */
  52. onShow: function () {
  53. },
  54. /**
  55. * 生命周期函数--监听页面隐藏
  56. */
  57. onHide: function () {
  58. },
  59. /**
  60. * 生命周期函数--监听页面卸载
  61. */
  62. onUnload: function () {
  63. },
  64. /**
  65. * 页面相关事件处理函数--监听用户下拉动作
  66. */
  67. onPullDownRefresh: function () {
  68. },
  69. /**
  70. * 页面上拉触底事件的处理函数
  71. */
  72. onReachBottom: function () {
  73. },
  74. /**
  75. * 用户点击右上角分享
  76. */
  77. onShareAppMessage: function () {
  78. const { vipId, date, subject } = this.data.options
  79. return {
  80. title: `${subject}作业批改详情`,
  81. path: `pages/single_subject_detail/single_subject_detail?subject=${subject}&vipId=${vipId}&date=${date}`,
  82. success: res => {
  83. wx.showToast({
  84. title: '转发成功',
  85. icon: 'success'
  86. })
  87. }
  88. }
  89. },
  90. //查看图片
  91. viewImageCtl: app.viewImageCtl,
  92. /**
  93. * 路由跳转
  94. */
  95. redirectCtl: app.redirectCtl,
  96. /**
  97. * 路由跳转
  98. */
  99. navigateCtl: app.navigateCtl,
  100. /**
  101. * 查看评语
  102. */
  103. getWords: function (e) {
  104. const { method } = e.currentTarget.dataset;
  105. wx.navigateTo({
  106. url: `../remark/remark?method=${JSON.stringify(method)}`,
  107. success: res => { },
  108. fail: res => {
  109. wx.showToast({
  110. title: '跳转失败',
  111. icon: 'none'
  112. })
  113. }
  114. })
  115. },
  116. // 获取作业报告/api/parents/parents/homeworkReport
  117. getSingleSubject: function () {
  118. const postData = { fn: this.getSingleSubject, param: { ...arguments } }
  119. const { idx, options } = this.data
  120. const { vipId, date,subject} = options;
  121. const fn = res => {
  122. if (res.data!=null){
  123. const { correctTeacherId, homeworkCommentList = [], homeworkId, homeworkList = [], relateKnowledgeList = [], subject, unfinishedList = [], wrongItemList = [], wrongQuestionCount, correctionStatus, homeworkTime} = res.data;
  124. this.setData({ correctTeacherId, homeworkCommentList, homeworkId, homeworkList, relateKnowledgeList, subject, unfinishedList, wrongItemList, wrongQuestionCount, correctionStatus, homeworkTime});
  125. var temp = {};
  126. for (var i in homeworkList) {
  127. if (homeworkList[i].isVague == 1) {
  128. this.setData({ isMohu: true })
  129. }
  130. temp[`homeworkList[${i}].photoKey`] = homeworkList[i].homeworkPictureUrl
  131. temp[`homeworkList[${i}].isVague`] =homeworkList[i].isVague
  132. }
  133. for (var i in homeworkCommentList) {
  134. temp[`homeworkCommentList[${i}].photoKey`] = homeworkCommentList[i].homeworkCommentUrl
  135. temp[`homeworkCommentList[${i}].compositionCommentModuleList`] = homeworkCommentList[i].compositionCommentModuleList
  136. temp[`homeworkCommentList[${i}].isComposition`] = homeworkCommentList[i].isComposition
  137. }
  138. this.setData(temp);
  139. }else{
  140. this.setData({ homeworkList:[]});
  141. }
  142. }
  143. app.post('/api/parents/parents/V2/correctDetail3', { vipId, date, subject}, 0, postData).then(fn)
  144. },
  145. })