evaluatResult.ts 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import Image1 from "./icons/5.png";
  2. import Image2 from "./icons/4.png";
  3. import Image3 from "./icons/3.png";
  4. import Image4 from "./icons/2.png";
  5. import Image5 from "./icons/1.png";
  6. import clx1 from "./icons/clx5.svg";
  7. import clx2 from "./icons/clx4.svg";
  8. import clx3 from "./icons/clx3.svg";
  9. import clx4 from "./icons/clx2.svg";
  10. import clx5 from "./icons/clx1.svg";
  11. import scoreIcon from "./scoreIcon.json";
  12. export interface IScoreItem {
  13. color: string;
  14. icon: string;
  15. score: string | number;
  16. leve: number | number;
  17. measureIndex?: number;
  18. measureRenderIndex?: number;
  19. show: boolean;
  20. }
  21. export interface IEvaluatings {
  22. [_key: number]: IScoreItem;
  23. }
  24. export const leveByScoreMeasureIcons = [
  25. {
  26. icon: scoreIcon.bad,
  27. text: "bad",
  28. color: "#EE4C6A",
  29. },
  30. {
  31. icon: scoreIcon.good,
  32. text: "good",
  33. color: "#FF958B",
  34. },
  35. {
  36. icon: scoreIcon.great,
  37. text: "great",
  38. color: "#FF8E5A",
  39. },
  40. {
  41. icon: scoreIcon.perfect,
  42. text: "perfect",
  43. color: "#516AFF",
  44. },
  45. ];
  46. const icons = [
  47. {
  48. img: Image1,
  49. tips: "你的演奏不太好,再练一练吧~",
  50. mome: "敢于尝试",
  51. clxImg: clx1,
  52. clxtip: "你的演奏不太好,音准和完整性还需加强,再练一练吧~",
  53. djytip: "你的演奏不太好,节奏还需加强,再练一练吧~",
  54. clxmome: "敢于尝试"
  55. },
  56. {
  57. img: Image2,
  58. tips: "你的演奏还不熟练,加紧训练才能有好成绩哦~",
  59. mome: "还要加油哦~",
  60. clxImg: clx2,
  61. clxtip: "你的演奏还不熟练,音准和完整性还需加强,加紧训练才能有好成绩哦~",
  62. djytip: "你的演奏还不熟练,节奏把握不太理想,加紧训练才能有好成绩哦~",
  63. clxmome: "还要加油哦~"
  64. },
  65. {
  66. img: Image3,
  67. tips: "你的演奏还不流畅,科学的练习才能更完美哦~",
  68. mome: "突破自我",
  69. clxImg: clx3,
  70. clxtip: "你的演奏还不流畅,音准和节奏还需加强,科学的练习才能更完美哦~",
  71. djytip: "你的演奏还不流畅,部分节奏需要勤加练习,科学的练习才能更完美哦~",
  72. clxmome: "突破自我"
  73. },
  74. {
  75. img: Image4,
  76. tips: "你的演奏还不错,继续加油吧,离完美就差一步啦~",
  77. mome: "崭露头角",
  78. clxImg: clx4,
  79. clxtip: "你的演奏还不错,继续加油吧,加强音准,离完美就差一步啦~",
  80. djytip: "你的演奏还不错,节奏还有些小瑕疵,离完美就差一步啦~",
  81. clxmome: "崭露头角"
  82. },
  83. {
  84. img: Image5,
  85. tips: "你的演奏完美无缺,继续努力吧~",
  86. mome: "你很棒",
  87. clxImg: clx5,
  88. clxtip: "你的演奏非常不错,音准的把握和节奏稍有瑕疵,完整性把握的很好~",
  89. djytip: "你的演奏非常不错,距离完成仅有一步之遥~",
  90. clxmome: "你很棒"
  91. },
  92. ];
  93. export const getLeveByScore = (score?: number) => {
  94. if (!score && typeof score !== "number") {
  95. return {};
  96. }
  97. let leve: any = 0;
  98. if (score > 20 && score <= 40) {
  99. leve = 1;
  100. } else if (score > 40 && score <= 60) {
  101. leve = 2;
  102. } else if (score > 60 && score <= 80) {
  103. leve = 3;
  104. } else if (score > 80) {
  105. leve = 4;
  106. }
  107. return {
  108. ...icons[leve],
  109. leve
  110. };
  111. };
  112. export const getLeveByScoreMeasure = (score?: number) => {
  113. if (!score && typeof score !== "number") {
  114. return {};
  115. }
  116. let leve: any = 0;
  117. if (score >= 40 && score < 70) {
  118. leve = 1;
  119. } else if (score >= 70 && score < 90) {
  120. leve = 2;
  121. } else if (score >= 90) {
  122. leve = 3;
  123. }
  124. return leve;
  125. };