rate.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. var app = getApp()
  2. var api = require('../../utils/api.js');
  3. Page({
  4. data: {
  5. titles: [],
  6. course_name: '',
  7. teacher: '',
  8. teachers: [],
  9. is_new: true
  10. },
  11. onLoad: function (options) {
  12. let that = this;
  13. that.setData({
  14. course_name: options.course_name,
  15. teacher: options.teacher
  16. })
  17. wx.request({
  18. url: api.getRemarkTitlesUrl,
  19. data: {
  20. id: wx.getStorageSync('pt_student').id
  21. },
  22. method: 'GET',
  23. success: res => {
  24. // console.log(res.data)
  25. that.setData({
  26. is_new: res.data.is_new,
  27. titles: res.data.titles,
  28. teachers: res.data.teachers
  29. })
  30. }
  31. })
  32. },
  33. formSubmit: function (e) {
  34. let data = e.detail.value;
  35. data.student_id = wx.getStorageSync('pt_student').id
  36. wx.request({
  37. url: api.remarkTeacherUrl,
  38. method: 'GET',
  39. data: data,
  40. success: res => {
  41. if (res.data.status == 'success') {
  42. wx.showModal({
  43. title: '评价成功',
  44. content: '感谢评价',
  45. success: function (res) {
  46. wx.switchTab({
  47. url: '/pages/userinfo/userinfo',
  48. })
  49. }
  50. })
  51. } else {
  52. wx.showToast({
  53. title: res.data.info,
  54. icon: 'none',
  55. duration: 800
  56. })
  57. }
  58. }
  59. })
  60. },
  61. onSubmit: function() {
  62. wx.navigateTo({url: '/pages/rate-review/rate-review'})
  63. }
  64. })