course-action-bar.wxs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. var convertCheck = function (status) {
  2. var statusText
  3. switch (status) {
  4. case 1:
  5. statusText = '已签到'
  6. break;
  7. case 2:
  8. statusText = '签到'
  9. break;
  10. case 3:
  11. statusText = '迟到'
  12. break;
  13. case 4:
  14. statusText = '请假'
  15. break;
  16. case 5:
  17. statusText = '旷课'
  18. break;
  19. default:
  20. statusText = '未知状态'
  21. }
  22. return statusText
  23. }
  24. var convertExam = function (status) {
  25. var statusText
  26. switch (status) {
  27. case 1:
  28. statusText = '已完成'
  29. break;
  30. default:
  31. statusText = '随堂考试'
  32. }
  33. return statusText
  34. }
  35. var convertQuestion = function (status) {
  36. var statusText;
  37. switch (status) {
  38. case 1:
  39. statusText = '已完成'
  40. break;
  41. default:
  42. statusText = '随堂问卷'
  43. }
  44. return statusText
  45. }
  46. var convertLive = function (status, isOp) {
  47. var statusText
  48. switch (status) {
  49. case 0:
  50. statusText = '未直播'
  51. break;
  52. case 1:
  53. if (isOp) {
  54. statusText = '观看直播'
  55. } else {
  56. statusText = '直播中'
  57. }
  58. break;
  59. case 2:
  60. statusText = '直播结束'
  61. break;
  62. default:
  63. statusText = '未知状态'
  64. }
  65. return statusText
  66. }
  67. var isShowCheck = function (item, isOnline) {
  68. if (item) { // courseType 1基地课 2面授课 3录播课
  69. return !isOnline && (item.courseType == 2 || !item.courseType);
  70. } else {
  71. return false
  72. }
  73. }
  74. var isShowExam = function (item) {
  75. if (item) {
  76. return item.isExam == 1
  77. } else {
  78. return false
  79. }
  80. }
  81. var isShowQuestion = function (item) {
  82. if (item) {
  83. return item.isEvaluate
  84. } else {
  85. return false
  86. }
  87. }
  88. var isShowLive = function (item, type) {
  89. if (type) {//11是直播
  90. return type == 11
  91. } else {
  92. return false
  93. }
  94. }
  95. module.exports = {
  96. convertCheck: convertCheck,
  97. convertExam: convertExam,
  98. convertQuestion: convertQuestion,
  99. isShowCheck: isShowCheck,
  100. isShowExam: isShowExam,
  101. isShowQuestion: isShowQuestion,
  102. isShowLive: isShowLive,
  103. convertLive: convertLive
  104. }