ropeSkipping.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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" ref="echartsRef"></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"
  35. :poster="details.video_url.replace(' ', '') + '?x-oss-process=video/snapshot,t_100,f_jpg,w_0,h_0,ar_auto'"
  36. :controls="true">
  37. 您的浏览器不支持 video 标签。
  38. </video>
  39. </div>
  40. </div>
  41. </div>
  42. </template>
  43. <script setup lang="ts">
  44. import * as echarts from 'echarts';
  45. const route = useRoute();
  46. const echartsRef = ref(null);
  47. //父值
  48. const props = defineProps({
  49. detailsData: {
  50. type: Object,
  51. default: {}
  52. },
  53. });
  54. const data = reactive<any>({
  55. details: {},
  56. query: {},
  57. typeList: [],
  58. failedList: [],
  59. fullAvgRateList: [],
  60. averageScoreList: [],
  61. lowSpeedList: [],
  62. });
  63. const { details, query, typeList, failedList, fullAvgRateList,averageScoreList, lowSpeedList } = toRefs(data);
  64. //成绩曲线
  65. const faliChart = () => {
  66. // let myChart = echarts.init(document.getElementById("faliChart"));
  67. const myChart = echarts.init(echartsRef.value);
  68. let option = {
  69. title: {
  70. text: ''
  71. },
  72. tooltip: {
  73. trigger: 'axis',
  74. },
  75. legend: {
  76. data: ['速度曲线', '您的平均速度',]
  77. },
  78. grid: {
  79. left: '3%',
  80. right: '4%',
  81. bottom: '3%',
  82. containLabel: true
  83. },
  84. xAxis: [
  85. {
  86. type: 'category',
  87. boundaryGap: false,
  88. data: typeList.value
  89. }
  90. ],
  91. yAxis: [
  92. {
  93. type: 'value'
  94. }
  95. ],
  96. series: [
  97. {
  98. name: '速度曲线',
  99. type: 'line',
  100. label: {
  101. show: true,
  102. position: 'top'
  103. },
  104. areaStyle: {
  105. color: "#e6fafa"
  106. },
  107. data: details.value
  108. },
  109. {
  110. name: '您的平均速度',
  111. type: 'line',
  112. lineStyle: {
  113. type: 'dashed'
  114. },
  115. data: averageScoreList.value
  116. },
  117. // {
  118. // name: '满分平均速度',
  119. // type: 'line',
  120. // lineStyle: {
  121. // type: 'dashed'
  122. // },
  123. // data: this.fullAvgRateList
  124. // },
  125. // {
  126. // name: '低速区',
  127. // type: 'line',
  128. // lineStyle: {
  129. // type: 'dashed'
  130. // },
  131. // areaStyle: {
  132. // color: "#ffdad1"
  133. // },
  134. // data: this.lowSpeedList
  135. // },
  136. ]
  137. };
  138. // 窗口大小自适应方案
  139. myChart.setOption(option);
  140. setTimeout(function () {
  141. window.onresize = function () {
  142. myChart.resize();
  143. };
  144. }, 200);
  145. };
  146. onBeforeMount(() => {
  147. query.value = route.query;
  148. details.value = JSON.parse(JSON.stringify(props.detailsData));
  149. let videoList = details.value.video_url.split(" ").filter((item: any) => {
  150. return item;
  151. });
  152. details.value.videoList = videoList
  153. let typeLists = [];
  154. let fullAvgRateLists = [];
  155. let averageScoreLists = [];
  156. let lowSpeedLists = [];
  157. let mySum = details.value.count_distribution.reduce((a:any, b:any) => {
  158. return a + b;
  159. }, 0);
  160. let num = details.value.count_distribution.length;
  161. let averageScore = (mySum / num).toFixed(2);
  162. for (let i = 1; i <= num; i++) {
  163. typeLists.push(i * 10)
  164. fullAvgRateLists.push(details.value.full_avg_rate)
  165. averageScoreLists.push(averageScore)
  166. lowSpeedLists.push(2)
  167. }
  168. typeList.value = typeList;
  169. fullAvgRateList.value = fullAvgRateLists;
  170. averageScoreList.value = averageScoreLists;
  171. lowSpeedList.value = lowSpeedLists;
  172. })
  173. onMounted(() => {
  174. faliChart();
  175. })
  176. </script>
  177. <style lang="scss" scoped>
  178. .chartBox {
  179. width: 100%;
  180. height: 38vh;
  181. }
  182. </style>