score.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. <template>
  2. <div class="pb_content">
  3. <div class="pb_content_body">
  4. <div class="body_student">
  5. <div class="student_head">
  6. <div class="box_course">
  7. <div class="wheel">
  8. <video-player
  9. class="video-player vjs-custom-skin"
  10. ref="videoPlayer"
  11. :playsinline="true"
  12. :options="playerO"
  13. @play="onPlayerPlay($event)"
  14. style="width: 100%; height: 100%"
  15. ></video-player>
  16. </div>
  17. <div style="font-size: 18px; margin: 15px">
  18. {{
  19. chapInfo.length > 0
  20. ? chapInfo[parseInt(this.stage)].dyName
  21. : "暂无标题"
  22. }}
  23. </div>
  24. </div>
  25. </div>
  26. <div class="student_body">
  27. <div class="myProject">我的评分</div>
  28. <div
  29. class="project_box"
  30. style="display: flex"
  31. v-if="
  32. chapInfo.length > 0 &&
  33. chapInfo[parseInt(this.stage)].tname != null &&
  34. chapInfo[parseInt(this.stage)].tname != ''
  35. "
  36. >
  37. <div class="mywd_rate_leida">
  38. <!-- <img src="../../assets/icon/leida.png" alt="" /> -->
  39. <div
  40. id="radar_canvas"
  41. class="echart"
  42. style="width: 100%; height: 100%"
  43. ></div>
  44. </div>
  45. <div style="display: flex; align-items: center; width: 20%">
  46. <span style="margin: 20px 10px 0 0">综合评分</span>
  47. <el-rate
  48. v-model="countPoint"
  49. disabled
  50. show-score
  51. text-color="#ff9900"
  52. score-template="{value}"
  53. class="stars"
  54. >
  55. </el-rate>
  56. </div>
  57. <!-- <div class="star"><img src="../assets/starts.png" alt="" /></div> -->
  58. </div>
  59. <div class="project_box" v-else>老师暂未评分</div>
  60. </div>
  61. <div class="student_body1">
  62. <div
  63. style="
  64. padding: 20px 0px;
  65. border-bottom: 1px solid #ccc;
  66. margin: 0 0 15px 35px;
  67. width: 95%;
  68. "
  69. >
  70. 评价
  71. </div>
  72. <div class="two_ete_box">
  73. <div
  74. class="other_evaluate"
  75. v-if="
  76. chapInfo.length > 0 &&
  77. chapInfo[parseInt(this.stage)].tname != null &&
  78. chapInfo[parseInt(this.stage)].tname != ''
  79. "
  80. >
  81. <div class="evaluate"><img src="../assets/tx.png" alt="" /></div>
  82. <div class="right_ete">
  83. <div class="first_other_ete">
  84. <div class="ete_name">
  85. {{
  86. chapInfo.length > 0
  87. ? chapInfo[parseInt(this.stage)].tname
  88. : "暂无名称"
  89. }}
  90. </div>
  91. <div class="ete_time">
  92. {{
  93. chapInfo.length > 0
  94. ? chapInfo[parseInt(this.stage)].tTime
  95. : "暂无评价"
  96. }}
  97. </div>
  98. </div>
  99. <div class="ete_content">
  100. {{
  101. chapInfo.length > 0
  102. ? chapInfo[parseInt(this.stage)].rate.content
  103. : "暂无评价"
  104. }}
  105. </div>
  106. </div>
  107. </div>
  108. <div class="other_evaluate" v-else>老师暂未评价</div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. export default {
  117. data() {
  118. return {
  119. chapInfo: [],
  120. res: "",
  121. courseId: this.$route.query.courseId,
  122. userid: this.$route.query.userid,
  123. stage: this.$route.query.stage,
  124. myCourse: [],
  125. countPoint: 0,
  126. playerOptions: {
  127. playbackRates: [0.7, 1.0, 1.5, 2.0], //播放速度
  128. autoplay: false, //如果true,浏览器准备好时开始回放。
  129. muted: false, // 默认情况下将会消除任何音频。
  130. loop: false, // 导致视频一结束就重新开始。
  131. preload: "auto", // 建议浏览器在<video>加载元素后是否应该开始下载视频数据。auto浏览器选择最佳行为,立即开始加载视频(如果浏览器支持)
  132. language: "zh-CN",
  133. aspectRatio: "16:9", // 将播放器置于流畅模式,并在计算播放器的动态大小时使用该值。值应该代表一个比例 - 用冒号分隔的两个数字(例如"16:9"或"4:3")
  134. fluid: true, // 当true时,Video.js player将拥有流体大小。换句话说,它将按比例缩放以适应其容器。
  135. sources: [
  136. {
  137. type: "video/mp4", //这里的种类支持很多种:基本视频格式、直播、流媒体等,具体可以参看git网址项目 || "video/ogg"|| "video/webm"
  138. src: "", //url地址require("../../assets/media/aaa.mp4")
  139. },
  140. ],
  141. // poster: require("../../assets/tu31.png"), //你的封面地址
  142. // poster: dataRes.imgUrl, //你的封面地址
  143. notSupportedMessage: "此视频暂无法播放,请稍后再试", //允许覆盖Video.js无法播放媒体源时显示的默认信息。
  144. controlBar: {
  145. timeDivider: true, //当前时间和持续时间的分隔符
  146. durationDisplay: true, //显示持续时间
  147. remainingTimeDisplay: false, //是否显示剩余时间功能
  148. fullscreenToggle: true, //全屏按钮
  149. },
  150. },
  151. playerO: {},
  152. rate: {
  153. ca: 0,
  154. sia: 0,
  155. eta: 0,
  156. pia: 0,
  157. lra: 0,
  158. },
  159. // 雷达图的数据
  160. radarOption: {
  161. splitNumber: 5,
  162. // tooltip: {
  163. // triggerOn: "mousemove",
  164. // //雷达图的tooltip不会超出div,也可以设置position属性,position定位的tooltip 不会随着鼠标移动而位置变化,不友好
  165. // confine: true,
  166. // enterable: true, //鼠标是否可以移动到tooltip区域内
  167. // backgroundColor: "rgba(255,255,255,0.7)",
  168. // textStyle: {
  169. // // 文字样式
  170. // align: "left",
  171. // },
  172. // left: "right",
  173. // top: "bottom",
  174. // },
  175. radar: {
  176. shape: "circle",
  177. center: ["50%", "50%"],
  178. name: {
  179. formatter: function (value, indicator) {
  180. return "{a|" + value + "}" + "{b|(" + indicator.value + ")}";
  181. }, //富文本编辑 修改文字展示样式
  182. rich: {
  183. a: {
  184. color: "rgb(58,155,83)",
  185. fontSize: 12,
  186. align: "center",
  187. width: "200px",
  188. },
  189. b: {
  190. color: "rgb(58,155,83)",
  191. fontSize: 12,
  192. align: "center",
  193. },
  194. },
  195. textStyle: {
  196. // 文字样式
  197. color: "rgb(58,155,83)",
  198. },
  199. },
  200. indicator: [
  201. // 雷达图的指示器,用来指定雷达图中的多个变量(维度)
  202. {
  203. name: "意识能力",
  204. max: 5,
  205. },
  206. {
  207. name: "科学探究能力",
  208. max: 5,
  209. },
  210. {
  211. name: "实践创新能力",
  212. max: 5,
  213. },
  214. {
  215. name: "学习反思能力",
  216. max: 5,
  217. },
  218. {
  219. name: "工程思维能力",
  220. max: 5,
  221. },
  222. ],
  223. },
  224. // 雷达图背景的颜色,在这儿随便设置了一个颜色,完全不透明度为0,就实现了透明背景
  225. splitArea: {
  226. show: true,
  227. areaStyle: {
  228. color: "rgba(255,0,0,0)", // 图表背景的颜色
  229. },
  230. },
  231. splitLine: {
  232. show: true,
  233. lineStyle: {
  234. width: 1,
  235. color: "rgba(131,141,158,.1)", // 设置网格的颜色
  236. },
  237. },
  238. series: [
  239. {
  240. name: "能力图", // tooltip中的标题
  241. type: "radar", // 表示是雷达图
  242. symbol: "circle", // 拐点的样式,还可以取值'rect','angle'等
  243. symbolSize: 8, // 拐点的大小
  244. areaStyle: {
  245. normal: {
  246. width: 1,
  247. opacity: 0.2,
  248. },
  249. },
  250. data: [
  251. {
  252. // 设置各个指标原始值
  253. value: [0, 0, 0, 0, 0, 0],
  254. // 设置区域边框和区域的颜色
  255. itemStyle: {
  256. normal: {
  257. color: "rgba(78,187,101)",
  258. lineStyle: {
  259. color: "rgba(78,187,101)",
  260. },
  261. },
  262. },
  263. },
  264. ],
  265. },
  266. ],
  267. },
  268. };
  269. },
  270. methods: {
  271. selectMyCourse() {
  272. let params = {
  273. uid: this.userid,
  274. };
  275. this.ajax
  276. .get(this.$store.state.api + "selectMyCourse", params)
  277. .then((res) => {
  278. this.myCourse = res.data[0];
  279. })
  280. .catch((err) => {
  281. console.error(err);
  282. });
  283. },
  284. selectWorksDetail() {
  285. let params = {
  286. uid: this.userid,
  287. cid: this.courseId,
  288. };
  289. this.ajax
  290. .get(this.$store.state.api + "selectWorksDetail", params)
  291. .then((res) => {
  292. this.chapInfo = JSON.parse(res.data[0][0].chapters);
  293. var worksDetail = res.data[1];
  294. this.chapInfo.filter((value, index, array) => {
  295. for (var i = 0; i < worksDetail.length; i++) {
  296. if (index == worksDetail[i].stage) {
  297. var c = JSON.parse(worksDetail[i].content)[0];
  298. var d =
  299. worksDetail[i].rate != null && worksDetail[i].rate != ""
  300. ? JSON.parse(worksDetail[i].rate)
  301. : { ca: 0, sia: 0, eta: 0, pia: 0, lra: 0, content: "" };
  302. var e =
  303. worksDetail[i].rate != null && worksDetail[i].rate != ""
  304. ? 0
  305. : 1;
  306. var f = worksDetail[i].tTime;
  307. var g = worksDetail[i].tname;
  308. value.rateWrong = e;
  309. value.content = c.content;
  310. value.rate = d;
  311. value.tTime = f;
  312. value.tname = g;
  313. this.countPoint = Math.round(
  314. (d.ca + d.sia + d.eta + d.pia + d.lra) / 5
  315. );
  316. // this.rateList = d;
  317. // this.rateList = value.rate;
  318. value.cover = c.cover;
  319. value.upVedio = c.upVedio;
  320. break;
  321. }
  322. }
  323. });
  324. this.switchVideo();
  325. this.leidaPic();
  326. })
  327. .catch((err) => {
  328. console.error(err);
  329. });
  330. },
  331. leidaPic() {
  332. // this.chapInfo[parseInt(this.stage)].forEach((cn) => {
  333. var rate = this.chapInfo[parseInt(this.stage)].rate;
  334. this.rate.ca += rate.ca;
  335. this.rate.sia += rate.sia;
  336. this.rate.eta += rate.eta;
  337. this.rate.pia += rate.pia;
  338. this.rate.lra += rate.lra;
  339. // });
  340. this.rate.ca = this.rate.ca;
  341. this.rate.sia = this.rate.sia;
  342. this.rate.eta = this.rate.eta;
  343. this.rate.pia = this.rate.pia;
  344. this.rate.lra = this.rate.lra;
  345. this.leida();
  346. },
  347. leida() {
  348. // 雷达图显示的标签
  349. let newPromise = new Promise((resolve) => {
  350. resolve();
  351. });
  352. //然后异步执行echarts的初始化函数
  353. newPromise.then(() => {
  354. const chartObj = this.$echarts.init(
  355. this.$el.querySelector("#radar_canvas")
  356. // document.getElementById("radar_canvas")
  357. );
  358. // var rate = JSON.parse(this.res.rate);
  359. this.radarOption.radar.indicator.filter((value, index, array) => {
  360. if (value.name == "意识能力") {
  361. value.value = this.rate.ca;
  362. }
  363. if (value.name == "科学探究能力") {
  364. value.value = this.rate.sia;
  365. }
  366. if (value.name == "实践创新能力") {
  367. value.value = this.rate.eta;
  368. }
  369. if (value.name == "学习反思能力") {
  370. value.value = this.rate.pia;
  371. }
  372. if (value.name == "工程思维能力") {
  373. value.value = this.rate.lra;
  374. }
  375. });
  376. this.radarOption.series[0].data[0].value[0] = this.rate.ca; //意识能力
  377. this.radarOption.series[0].data[0].value[1] = this.rate.sia; //科学探究能力
  378. this.radarOption.series[0].data[0].value[2] = this.rate.eta; //实践创新能力
  379. this.radarOption.series[0].data[0].value[3] = this.rate.pia; //学习反思能力
  380. this.radarOption.series[0].data[0].value[4] = this.rate.lra; //工程思维能力
  381. //格式tooltip
  382. this.radarOption.tooltip = {
  383. // triggerOn: "mousemove",
  384. //雷达图的tooltip不会超出div,也可以设置position属性,position定位的tooltip 不会随着鼠标移动而位置变化,不友好
  385. confine: true,
  386. enterable: true, //鼠标是否可以移动到tooltip区域内
  387. backgroundColor: "rgba(255,255,255,0.7)",
  388. textStyle: {
  389. // 文字样式
  390. align: "left",
  391. },
  392. left: "right",
  393. top: "bottom",
  394. formatter: function (params) {
  395. let relVal = "<ul>" + params.name + params.seriesName;
  396. var a = [
  397. "意识能力",
  398. "科学探究能力",
  399. "实践创新能力",
  400. "学习反思能力",
  401. "工程思维能力",
  402. ];
  403. for (let i = 0; i < params.data.value.length - 1; i++) {
  404. relVal +=
  405. "<li>" +
  406. `<span style="display:inline-block;vertical-align:middle;margin-right:8px;margin-left:3px;border-radius:4px;width:4px;height:4px;background-color:rgba(78,187,101);"></span>` +
  407. `<span style="font-size:14px;color:#666;font-weight:400;margin-left:2px">${a[i]}</span>` +
  408. `<span style="float:right;margin-left:20px;font-size:14px;color:#666;">${
  409. params.data.value[i] + " 星"
  410. }</span>` +
  411. "</li>";
  412. }
  413. relVal += "</ul>";
  414. return relVal;
  415. },
  416. };
  417. // 初始化雷达图
  418. chartObj.setOption(this.radarOption);
  419. });
  420. },
  421. switchVideo() {
  422. this.playerO = {};
  423. this.playerOptions.poster = "";
  424. this.playerOptions.sources[0].src =
  425. this.chapInfo[parseInt(this.stage)].upVedio.length > 0
  426. ? this.chapInfo[parseInt(this.stage)].upVedio[0].url
  427. : require("../assets/icon/kc1.png");
  428. this.playerO = this.playerOptions;
  429. },
  430. onPlayerPlay() {},
  431. },
  432. created() {
  433. this.selectWorksDetail();
  434. this.selectMyCourse();
  435. },
  436. };
  437. </script>
  438. <style scoped>
  439. .body_student {
  440. margin: 0px auto;
  441. width: 98%;
  442. height: 100%;
  443. }
  444. .student_head {
  445. width: 100%;
  446. margin: 0 auto;
  447. background: #fff;
  448. }
  449. .wheel > img,
  450. .project > img,
  451. .star > img,
  452. .evaluate > img {
  453. width: 100%;
  454. height: 100%;
  455. }
  456. .box_course {
  457. display: flex;
  458. flex-direction: column;
  459. }
  460. .wheel {
  461. width: 100%;
  462. }
  463. .right_box {
  464. display: flex;
  465. flex-direction: column;
  466. margin-left: 30px;
  467. justify-content: space-around;
  468. }
  469. .right_box_title {
  470. font-size: 23px;
  471. }
  472. .people {
  473. display: flex;
  474. }
  475. .student_body,
  476. .student_body1 {
  477. width: 100%;
  478. margin: 0 auto;
  479. background: #fff;
  480. margin-top: 20px;
  481. padding: 0 0 20px;
  482. }
  483. .project {
  484. width: 165px;
  485. }
  486. .project_box {
  487. margin: 80px 0 10px 30px;
  488. }
  489. .star {
  490. width: 50%;
  491. min-width: 400px;
  492. margin: 0 auto;
  493. }
  494. .evaluate {
  495. width: auto;
  496. height: 65px;
  497. border-radius: 100%;
  498. overflow: hidden;
  499. }
  500. .two_ete_box {
  501. padding: 0px 0 5px 30px;
  502. }
  503. .other_evaluate {
  504. display: flex;
  505. margin-bottom: 25px;
  506. }
  507. .right_ete {
  508. margin-left: 15px;
  509. }
  510. .first_other_ete {
  511. display: flex;
  512. }
  513. .ete_time {
  514. margin-left: 10px;
  515. line-height: 21px;
  516. font-size: 13px;
  517. color: #999;
  518. margin-bottom: 10px;
  519. }
  520. .ete_content {
  521. height: auto;
  522. word-wrap: break-word;
  523. word-break: break-all;
  524. overflow: hidden;
  525. width: 500px;
  526. line-height: 20px;
  527. font-size: 14px;
  528. padding-top: 10px;
  529. }
  530. .mywd_rate_leida {
  531. width: 80%;
  532. text-align: center;
  533. height: 300px;
  534. display: flex;
  535. align-items: center;
  536. justify-content: center;
  537. }
  538. .mywd_rate_leida img {
  539. width: inherit;
  540. }
  541. .myProject {
  542. padding: 20px 20px 10px 0;
  543. border-bottom: 1px solid #ccc;
  544. margin-left: 20px;
  545. width: 95%;
  546. color: #61d3b3;
  547. }
  548. .stars >>> .el-rate__icon {
  549. font-size: 40px !important;
  550. }
  551. .stars >>> .el-rate__text {
  552. font-size: 25px !important;
  553. }
  554. </style>