subject_detail.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. nodata: {
  31. nodataObj: {
  32. image: '../../assets/task_nodata.png',
  33. text: '没有任务哦'
  34. }
  35. },
  36. },
  37. /**
  38. * 生命周期函数--监听页面加载
  39. */
  40. onLoad: function (options) {
  41. this.setData({ options })
  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/subject_detail/subject_detail?subject=${subject}&vipId=${vipId}`,
  82. success: res => {
  83. wx.showToast({
  84. title: '转发成功',
  85. icon: 'success'
  86. })
  87. }
  88. }
  89. },
  90. //查看图片
  91. viewImageCtl: app.viewImageCtl,
  92. /**
  93. * 跳转
  94. */
  95. navigateCtl: app.navigateCtl,
  96. /**
  97. * 底部导航跳转
  98. */
  99. redirectCtl: app.redirectCtl,
  100. // 获取作业报告/api/parents/parents/homeworkReport
  101. getSingleSubject: function () {
  102. const postData = { fn: this.getSingleSubject, param: { ...arguments } }
  103. const { idx, options } = this.data
  104. const { vipId, date,subject} = options;
  105. const fn = res => {
  106. if (res.data!=null){
  107. const { correctTeacherId, homeworkCommentList = [], homeworkId, homeworkList = [], relateKnowledgeList = [], subject, unfinishedList = [], wrongItemList = [], wrongQuestionCount, correctionStatus, homeworkTime} = res.data;
  108. this.setData({ correctTeacherId, homeworkCommentList, homeworkId, homeworkList, relateKnowledgeList, subject, unfinishedList, wrongItemList, wrongQuestionCount, correctionStatus, homeworkTime});
  109. if (correctionStatus == 0 && homeworkCommentList.length==0) {
  110. wx.setNavigationBarTitle({
  111. title: `作业已提交`,
  112. })
  113. } else {
  114. wx.setNavigationBarTitle({
  115. title: `${subject}作业批改详情`,
  116. })
  117. }
  118. var temp = {};
  119. for (var i in homeworkList) {
  120. if (homeworkList[i].isVague == 1) {
  121. this.setData({ isMohu: true })
  122. }
  123. temp[`homeworkList[${i}].photoKey`] = homeworkList[i].homeworkPictureUrl
  124. temp[`homeworkList[${i}].isVague`] =homeworkList[i].isVague
  125. }
  126. for (var i in homeworkCommentList) {
  127. temp[`homeworkCommentList[${i}].photoKey`] = homeworkCommentList[i].homeworkCommentUrl
  128. temp[`homeworkCommentList[${i}].isComposition`] = homeworkCommentList[i].isComposition
  129. temp[`homeworkCommentList[${i}].compositionCommentModuleList`] = homeworkCommentList[i].compositionCommentModuleList
  130. }
  131. this.setData(temp);
  132. }else{
  133. this.setData({ homeworkList:[]});
  134. }
  135. }
  136. app.post('/api/teacher/library/V1/correctDetail3', { vipId, date, subject}, 0, postData).then(fn)
  137. },
  138. })