rate.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. that.setData({
  21. titles: res.data.titles
  22. })
  23. }
  24. }
  25. })
  26. },
  27. formSubmit: function (e) {
  28. let data = e.detail.value;
  29. data.student_id = wx.getStorageSync('pt_student').id
  30. wx.request({
  31. url: api.remarkTeacherUrl,
  32. method: 'GET',
  33. data: data,
  34. success: res => {
  35. if (res.data.status == 'success') {
  36. wx.showModal({
  37. title: '评价成功',
  38. content: '感谢评价',
  39. success: function (res) {
  40. wx.switchTab({
  41. url: '/pages/userinfo/userinfo',
  42. })
  43. }
  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. })