ropeSkipping.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <div>
  3. <div class="column" v-if="details._comments.speed">
  4. <div class="column-title">成绩曲线</div>
  5. <div class="column-con">
  6. <div class="item">
  7. <div class="item-title">速度
  8. <i v-if="details._comments.speed.level == 0" class="cha">差</i>
  9. <i v-if="details._comments.speed.level == 1" class="liang">良</i>
  10. <i v-if="details._comments.speed.level == 2" class="you">优</i>
  11. </div>
  12. <div class="item-con">
  13. <div class="item-con-li">
  14. <!--图表开始-->
  15. <div class="chartBox" id="faliChart"></div>
  16. <!--图表结束-->
  17. </div>
  18. <div class="item-con-li">
  19. <div class="item-con-li-title">
  20. 节奏点评
  21. </div>
  22. <div class="item-con-li-con">
  23. <div class="item-con-li-con-strong">{{ details._comments.speed.comments }}</div>
  24. <div v-for="(item,index) in details._comments.speed.recms" :key="index" v-html="item"></div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="column" v-if="details.video_url">
  32. <div class="column-title">测评视频</div>
  33. <div>
  34. <video :src="details.video_url" :poster="details.video_url.replace(' ','') + '?x-oss-process=video/snapshot,t_100,f_jpg,w_0,h_0,ar_auto'" :controls="true">
  35. 您的浏览器不支持 video 标签。
  36. </video>
  37. </div>
  38. </div>
  39. </div>
  40. </template>
  41. <script>
  42. import * as echarts from 'echarts';
  43. export default {
  44. name: 'ropeSkipping',
  45. props: {
  46. details: { type: Object, default: function () { return {} } },
  47. },
  48. data() {
  49. return {
  50. query: {},
  51. typeList: [],
  52. failedList: [],
  53. fullAvgRateList: [],
  54. averageScoreList: [],
  55. lowSpeedList: [],
  56. };
  57. },
  58. created() {
  59. this.query = this.$route.query;
  60. },
  61. mounted() {
  62. let videoList = this.details.video_url.split(" ").filter((item) => {
  63. return item;
  64. });
  65. this.$set(this.details, 'videoList', videoList);
  66. let typeList = [];
  67. let fullAvgRateList = [];
  68. let averageScoreList = [];
  69. let lowSpeedList = [];
  70. let mySum = this.details.count_distribution.reduce((a, b) => {
  71. return a + b;
  72. }, 0);
  73. let num = this.details.count_distribution.length;
  74. let averageScore = (mySum / num).toFixed(2);
  75. for (let i = 1; i <= num; i++) {
  76. typeList.push(i * 10)
  77. fullAvgRateList.push(this.details.full_avg_rate)
  78. averageScoreList.push(averageScore)
  79. lowSpeedList.push(2)
  80. }
  81. this.typeList = typeList;
  82. this.fullAvgRateList = fullAvgRateList;
  83. this.averageScoreList = averageScoreList;
  84. this.lowSpeedList = lowSpeedList;
  85. this.$nextTick(()=>{
  86. this.faliChart();
  87. })
  88. },
  89. methods: {
  90. //成绩曲线
  91. faliChart() {
  92. let myChart = echarts.init(document.getElementById("faliChart"));
  93. let option = {
  94. title: {
  95. text: ''
  96. },
  97. tooltip: {
  98. trigger: 'axis',
  99. },
  100. legend: {
  101. data: ['速度曲线', '您的平均速度', ]
  102. },
  103. grid: {
  104. left: '3%',
  105. right: '4%',
  106. bottom: '3%',
  107. containLabel: true
  108. },
  109. xAxis: [
  110. {
  111. type: 'category',
  112. boundaryGap: false,
  113. data: this.typeList
  114. }
  115. ],
  116. yAxis: [
  117. {
  118. type: 'value'
  119. }
  120. ],
  121. series: [
  122. {
  123. name: '速度曲线',
  124. type: 'line',
  125. label: {
  126. show: true,
  127. position: 'top'
  128. },
  129. areaStyle: {
  130. color: "#e6fafa"
  131. },
  132. data: this.details.count_distribution
  133. },
  134. {
  135. name: '您的平均速度',
  136. type: 'line',
  137. lineStyle: {
  138. type: 'dashed'
  139. },
  140. data: this.averageScoreList
  141. },
  142. // {
  143. // name: '满分平均速度',
  144. // type: 'line',
  145. // lineStyle: {
  146. // type: 'dashed'
  147. // },
  148. // data: this.fullAvgRateList
  149. // },
  150. // {
  151. // name: '低速区',
  152. // type: 'line',
  153. // lineStyle: {
  154. // type: 'dashed'
  155. // },
  156. // areaStyle: {
  157. // color: "#ffdad1"
  158. // },
  159. // data: this.lowSpeedList
  160. // },
  161. ]
  162. };
  163. // 窗口大小自适应方案
  164. myChart.setOption(option);
  165. setTimeout(function () {
  166. window.onresize = function () {
  167. myChart.resize();
  168. };
  169. }, 200);
  170. },
  171. },
  172. };
  173. </script>
  174. <style lang="scss" scoped>
  175. .chartBox {
  176. width: 100%;
  177. height: 38vh;
  178. }
  179. </style>