rate.js 1.3 KB

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