workData.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  1. <template>
  2. <div>
  3. <div class="cp_title" v-if="false">
  4. <span>{{ dataJson.title }}</span>
  5. </div>
  6. <div class="cp_title" v-if="false">
  7. <span>{{ "教师姓名:" + dataJson.uname }}</span>
  8. </div>
  9. <div class="data_body" v-if="false">
  10. <div class="data_c">
  11. <WorkData :workJson="workJson" :chapters="chapters"></WorkData>
  12. </div>
  13. <div class="data_c">
  14. <ProblelmData
  15. :problemJson="problemJson"
  16. :chapters="chapters"
  17. ></ProblelmData>
  18. </div>
  19. <div class="data_c">
  20. <ToolsData :toolsJson="toolsJson" :tools="tools"></ToolsData>
  21. </div>
  22. <div class="data_c">
  23. <ScoreData :scoreJson="scoreJson"></ScoreData>
  24. </div>
  25. </div>
  26. <div class="sd_class" v-if="false">
  27. <div class="sd_tTitle">课堂表现</div>
  28. <div class="wd_class_body">
  29. <div class="wd_module">
  30. <div class="sd_module_content">
  31. <div
  32. class="sd_module_children"
  33. style="
  34. font-size: 25px;
  35. padding: 0 25px;
  36. box-sizing: border-box;
  37. text-align: center;
  38. "
  39. >
  40. <span>课程人数:共100人,已完成人数{{ randomNum(50, 100) }}人</span>
  41. </div>
  42. <div class="sd_module_children">
  43. <span class="s">课堂时长</span>
  44. <span class="s2">
  45. <span>{{ randomNum(5, 15) }}</span
  46. >次 <span>{{ randomNum(1, 60) }}</span
  47. >分 <span>{{ randomNum(1, 59) }}</span
  48. >秒
  49. </span>
  50. <span>已经击败99%教师</span>
  51. </div>
  52. <div class="sd_module_children">
  53. <span class="s">课堂节数</span>
  54. <span class="s2">
  55. <span>{{ randomNum(5, 20) }}</span
  56. >节
  57. </span>
  58. <span>已经击败99%教师</span>
  59. </div>
  60. </div>
  61. <div style="width: 45%; position: relative">
  62. <div
  63. id="gauge_canvas"
  64. class="echart"
  65. style="width: 100%; height: 100%"
  66. ></div>
  67. <div
  68. style="
  69. position: absolute;
  70. bottom: 25px;
  71. display: flex;
  72. justify-content: space-between;
  73. font-size: 20px;
  74. width: 100%;
  75. padding: 0 100px;
  76. box-sizing: border-box;
  77. "
  78. >
  79. <span>教师为中心</span>
  80. <span>学生为中心</span>
  81. </div>
  82. </div>
  83. <div class="sd_module_content">
  84. <div class="sd_module_children">
  85. <span class="s">课堂互动</span>
  86. <span class="s2">
  87. <span>{{ randomNum(10, 20) }}</span
  88. >次
  89. </span>
  90. <span>已经击败99%教师</span>
  91. </div>
  92. <div class="sd_module_children">
  93. <span class="s">课堂生成</span>
  94. <span class="s2">
  95. <span>{{ randomNum(7, 15) }}</span
  96. >节
  97. </span>
  98. <span>已经击败99%教师</span>
  99. </div>
  100. <div class="sd_module_children">
  101. <span class="s">自主活动</span>
  102. <span class="s2">
  103. <span>{{ randomNum(10, 20) }}</span
  104. >分 <span>{{ randomNum(10, 59) }}</span
  105. >秒
  106. </span>
  107. <span>已经击败99%教师</span>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="wd_bottom">
  112. <div class="bdiv">
  113. <div
  114. id="line_canvas"
  115. class="echart"
  116. style="width: 100%; height: 100%"
  117. ></div>
  118. </div>
  119. <div class="bdiv">
  120. <div
  121. id="bar_canvas"
  122. class="echart"
  123. style="width: 100%; height: 100%"
  124. ></div>
  125. </div>
  126. </div>
  127. </div>
  128. <!-- <img src="../../../assets/data/tu1.png" alt style="width:100%" /> -->
  129. </div>
  130. <div class="sd_class">
  131. <div class="sd_tTitle" v-if="false">班级学生能力分析</div>
  132. <div style="background: #fff; padding: 10px 0">
  133. <div class="sd_person_button" v-if="false">
  134. <span @click="setType(1)" :class="{ active: type == 1 }">语文</span>
  135. <span @click="setType(2)" :class="{ active: type == 2 }">数学</span>
  136. <span @click="setType(3)" :class="{ active: type == 3 }">英语</span>
  137. <span @click="setType(4)" :class="{ active: type == 4 }"
  138. >信息科技</span
  139. >
  140. <span @click="setType(5)" :class="{ active: type == 5 }">艺术</span>
  141. <span @click="setType(6)" :class="{ active: type == 6 }"
  142. >跨学科素养</span
  143. >
  144. </div>
  145. <div style="display: flex; flex-wrap: wrap">
  146. <div style="width: 50%; height: 500px" v-if="false">
  147. <div
  148. id="sunburst_canvas"
  149. class="echart"
  150. style="width: 100%; height: 100%"
  151. ></div>
  152. </div>
  153. <div style="width: 50%; height: 500px" v-if="false">
  154. <div
  155. id="scatter_canvas"
  156. class="echart"
  157. style="width: 100%; height: 100%"
  158. ></div>
  159. </div>
  160. <div style="width: 100%">
  161. <div style="display: flex;align-items: center;padding-bottom: 15px;font-size: 14px;color: rgba(0, 0, 0, 0.4);">
  162. <span @click="pageBack" style="height: 100%;cursor: pointer;">评价管理</span>
  163. <span style="margin: 0 5px;">
  164. <i class="el-icon-arrow-right"></i>
  165. </span>
  166. <span @click="pageBack" style="height: 100%;cursor: pointer;">查看课程</span>
  167. <span style="margin: 0 5px;">
  168. <i class="el-icon-arrow-right"></i>
  169. </span>
  170. <div style="font-weight: 600;color: rgba(0, 0, 0, 0.9);">{{ dataJson.title }}</div>
  171. </div>
  172. <div class="JsonTit">
  173. <div style="width:94%;margin: 0 auto;font-size: 26px;">{{ dataJson.title }}</div>
  174. <div class="JsonTitBtn" v-if="dialogVisible">
  175. <!-- <el-button @click="exportWorkPdf" type="primary" size="small"
  176. >一键导出</el-button
  177. > -->
  178. <el-button @click="exportData" type="primary" size="small"
  179. >自定义导出</el-button
  180. >
  181. <el-button style="margin-left: 20px;" @click="retPage" type="primary" size="small">返回</el-button>
  182. <!-- <el-button
  183. type="primary"
  184. size="small"
  185. @click="
  186. goTo(
  187. '/worksDetail?cid=' +
  188. dataJson.courseId +
  189. '&userid=' +
  190. userid +
  191. '&oid=' +
  192. oid
  193. )
  194. "
  195. >查看作业</el-button
  196. >-->
  197. </div>
  198. </div>
  199. <!-- <div style="width:94%;margin: 0 auto;font-size: 26px;">{{ dataJson.title }}</div> -->
  200. <WorksDetail2 ref="WorksDetail2Ref" :DState="dataJson.state" :cid="cid" :uid="uid" :ooid="ooid"></WorksDetail2>
  201. <!-- <el-table
  202. ref="table"
  203. :data="tableData"
  204. border
  205. :height="500"
  206. :fit="true"
  207. style="width: 100%; height: 60%"
  208. :header-cell-style="{ background: '#f1f1f1' }"
  209. :row-class-name="tableRowClassName"
  210. >
  211. <el-table-column prop="name" label="姓名" min-width="20%" align="center"></el-table-column>
  212. <el-table-column prop="number" label="学号" min-width="20%" align="center"></el-table-column>
  213. <el-table-column prop="class" label="班级" min-width="20%" align="center"></el-table-column>
  214. <el-table-column prop="score" label="分数" min-width="20%" align="center"></el-table-column>
  215. <el-table-column label="操作" min-width="20%">
  216. <template>
  217. <el-button type="primary" size="small">查看</el-button>
  218. </template>
  219. </el-table-column>
  220. </el-table>-->
  221. </div>
  222. <!-- <img src="../../../assets/data/tu3.png" alt style="width:50%" />
  223. <img src="../../../assets/data/tu2.png" alt style="width:50%" />-->
  224. <!-- <img src="../../../assets/data/tu4.png" alt style="width:100%" /> -->
  225. </div>
  226. </div>
  227. </div>
  228. </div>
  229. </template>
  230. <script>
  231. import WorkData from "./data/workData";
  232. import ProblelmData from "./data/problelmData";
  233. import ToolsData from "./data/toolsData";
  234. import ScoreData from "./data/scoreData";
  235. import WorksDetail2 from "./worksDetail2";
  236. export default {
  237. props: ["dataJson", "cid", "uid", "ooid","dialogVisible","dialogVisibleBao"],
  238. components: {
  239. WorkData,
  240. ProblelmData,
  241. ToolsData,
  242. ScoreData,
  243. WorksDetail2,
  244. },
  245. data() {
  246. return {
  247. tableData: [
  248. {
  249. name: "卓曾向",
  250. number: "202205311",
  251. class: "三年级七班",
  252. score: "100",
  253. },
  254. {
  255. name: "王志成",
  256. number: "202205411",
  257. class: "四年级一班",
  258. score: "99",
  259. },
  260. {
  261. name: "李沛郡",
  262. number: "202205361",
  263. class: "三年级六班",
  264. score: "89",
  265. },
  266. {
  267. name: "李世昌",
  268. number: "202205321",
  269. class: "三年级二班",
  270. score: "88",
  271. },
  272. {
  273. name: "李佳薇",
  274. number: "202205471",
  275. class: "四年级七班",
  276. score: "69",
  277. },
  278. {
  279. name: "叶玉卿",
  280. number: "202205671",
  281. class: "六年级七班",
  282. score: "78",
  283. },
  284. {
  285. name: "冯翊泽",
  286. number: "202205571",
  287. class: "五年级七班",
  288. score: "68",
  289. },
  290. { name: "乐舞", number: "202205372", class: "三年级七班", score: "77" },
  291. {
  292. name: "关晓辉",
  293. number: "202205475",
  294. class: "四年级七班",
  295. score: "68",
  296. },
  297. {
  298. name: "谭晶陈",
  299. number: "202205271",
  300. class: "二年级七班",
  301. score: "79",
  302. },
  303. ],
  304. Course: this.dataJson,
  305. courseId: "",
  306. tools: [],
  307. chapters: [],
  308. workJson: [], //多少人提交作业数据
  309. scoreJson: [], //量规评分数据
  310. problemJson: [], //问答数据
  311. toolsJson: [], //工具数据
  312. type: 6,
  313. chartObj: null,
  314. chartObj2: null,
  315. chartObj3: null,
  316. chartObj4: null,
  317. chartObj5: null,
  318. gaugeOption: {
  319. series: [
  320. {
  321. type: "gauge",
  322. radius: "100%",
  323. axisLine: {
  324. lineStyle: {
  325. width: 10,
  326. color: [
  327. [
  328. 100,
  329. {
  330. type: "linear",
  331. x: 0,
  332. y: 0,
  333. x2: 0,
  334. y2: 1,
  335. colorStops: [
  336. {
  337. offset: 1,
  338. color: "rgb(240,50,243)", // 0% 处的颜色
  339. },
  340. {
  341. offset: 0,
  342. color: "rgb(37,61,249)", // 100% 处的颜色
  343. },
  344. ],
  345. global: false, // 缺省为 false
  346. },
  347. ],
  348. ],
  349. },
  350. },
  351. pointer: {
  352. width: 8,
  353. length: "65%",
  354. itemStyle: {
  355. color: "auto",
  356. },
  357. },
  358. axisLabel: {
  359. color: "auto",
  360. distance: 20,
  361. fontSize: 20,
  362. },
  363. detail: {
  364. valueAnimation: true,
  365. formatter: "{value}",
  366. },
  367. data: [
  368. {
  369. value: 60,
  370. name: "課堂類型",
  371. title: {
  372. offsetCenter: [0, "80%"],
  373. fontSize: 30,
  374. },
  375. },
  376. ],
  377. },
  378. ],
  379. },
  380. lineOption: {
  381. title: {
  382. text: "課堂時間",
  383. },
  384. tooltip: {
  385. trigger: "axis",
  386. },
  387. legend: {
  388. data: ["課堂時長", "麻吉星時長"],
  389. },
  390. grid: {
  391. left: "3%",
  392. right: "4%",
  393. bottom: "3%",
  394. containLabel: true,
  395. },
  396. toolbox: {
  397. // feature: {
  398. // saveAsImage: {},
  399. // },
  400. },
  401. xAxis: {
  402. type: "category",
  403. data: ["05-25", "05-26", "05-27", "05-28", "05-29", "05-30", "05-31"],
  404. },
  405. yAxis: {
  406. type: "value",
  407. axisLabel: {
  408. formatter: "{value}M",
  409. },
  410. },
  411. series: [
  412. {
  413. name: "課堂時長",
  414. type: "line",
  415. data: [10, 20, 30, 11, 15, 16, 18],
  416. },
  417. {
  418. name: "麻吉星時長",
  419. type: "line",
  420. data: [22, 16, 18, 15, 19, 28, 17],
  421. },
  422. ],
  423. },
  424. barOption: {
  425. title: {
  426. text: "任教班級",
  427. },
  428. tooltip: {
  429. trigger: "axis",
  430. axisPointer: {
  431. // Use axis to trigger tooltip
  432. type: "shadow", // 'shadow' as default; can also be 'line' or 'shadow'
  433. },
  434. },
  435. legend: {},
  436. grid: {
  437. left: "3%",
  438. right: "4%",
  439. bottom: "3%",
  440. containLabel: true,
  441. },
  442. xAxis: {
  443. type: "category",
  444. data: ["中山五年5班", "中山五年5班"],
  445. },
  446. yAxis: {
  447. type: "value",
  448. },
  449. series: [
  450. {
  451. name: "圖片",
  452. type: "bar",
  453. data: [220, 150],
  454. },
  455. {
  456. name: "視頻",
  457. type: "bar",
  458. data: [120, 132],
  459. },
  460. {
  461. name: "互動",
  462. type: "bar",
  463. data: [110, 132],
  464. },
  465. {
  466. name: "投票",
  467. type: "bar",
  468. data: [120, 132],
  469. },
  470. {
  471. name: "挑戰",
  472. type: "bar",
  473. data: [221, 110],
  474. },
  475. {
  476. name: "評估",
  477. type: "bar",
  478. data: [120, 133],
  479. },
  480. {
  481. name: "棄權",
  482. type: "bar",
  483. data: [105, 132],
  484. },
  485. ],
  486. },
  487. sunburstOption: {
  488. //color:colors,
  489. tooltip: {
  490. trigger: "item",
  491. },
  492. legend: {
  493. left: "50",
  494. top: "center",
  495. },
  496. series: {
  497. type: "sunburst",
  498. data: [],
  499. radius: [20, "90%"],
  500. itemStyle: {
  501. borderRadius: 7,
  502. borderWidth: 2,
  503. },
  504. label: {
  505. show: true,
  506. color: "#fff",
  507. },
  508. },
  509. },
  510. scatterOption: {
  511. xAxis: {
  512. type: "category",
  513. data: ["问题意识", "科学探究", "实践创新", "工程思维", "学习反思"],
  514. splitLine: {
  515. show: true,
  516. },
  517. axisLine: {
  518. show: false,
  519. },
  520. name: "能力指标",
  521. },
  522. yAxis: {
  523. type: "value",
  524. name: "分值",
  525. minInterval: 1,
  526. max: 5,
  527. axisLine: {
  528. show: false,
  529. },
  530. },
  531. grid: {
  532. left: 100,
  533. bottom: 50,
  534. right: 100,
  535. top: 70,
  536. },
  537. legend: {
  538. color: "rgb(222,126,62)",
  539. left: "right",
  540. top: "0%",
  541. },
  542. series: [
  543. {
  544. name: "学生百分数(单位:%)",
  545. type: "scatter",
  546. symbolSize: function (val) {
  547. return val[2] * 1.5;
  548. },
  549. color: "rgb(222,126,62,.5)",
  550. data: [[1, 2, 50]],
  551. label: {
  552. color: "rgb(222,126,62)",
  553. show: true,
  554. position: "inside",
  555. fontSize: 16,
  556. formatter: function (a, b, c) {
  557. return a.data[2];
  558. },
  559. },
  560. animationDelay: function (idx) {
  561. return idx * 5;
  562. },
  563. },
  564. ],
  565. },
  566. };
  567. },
  568. methods: {
  569. tableRowClassName({ row, rowIndex }) {
  570. if ((rowIndex + 1) % 2 === 0) {
  571. return "even_row";
  572. } else {
  573. return "";
  574. }
  575. },
  576. retPage(){
  577. console.log('666');
  578. this.$emit('cancel');
  579. },
  580. exportWorkPdf(){
  581. this.$refs.WorksDetail2Ref.exportPdfSetAllWork()
  582. },
  583. exportData(){
  584. this.$emit("update:dialogVisibleBao", true);
  585. },
  586. pageBack(){
  587. // console.log('666');
  588. this.$emit("update:dialogVisible", false);
  589. },
  590. getData() {
  591. let params = {
  592. cid: this.courseId,
  593. };
  594. this.ajax
  595. .get(this.$store.state.api + "getWorkData", params)
  596. .then((res) => {
  597. let _data = res.data[1]; //所有作业数据
  598. let _data2 = res.data[2]; //问答提交数据
  599. let _data3 = res.data[3]; //工具使用数据
  600. let workJson = [];
  601. let scoreJson = [];
  602. let problemJson = [];
  603. let toolsJson = [];
  604. _data.forEach((item, index) => {
  605. workJson.push({ stage: item.stage, userid: item.userid });
  606. scoreJson.push({ rate: JSON.parse(item.rate) });
  607. });
  608. _data2.forEach((item, index) => {
  609. problemJson.push({ stage: item.chapterid });
  610. });
  611. _data3.forEach((item, index) => {
  612. toolsJson.push({ tools: item.tools, count: item.count });
  613. });
  614. this.workJson = workJson;
  615. this.scoreJson = scoreJson;
  616. this.problemJson = problemJson;
  617. this.toolsJson = toolsJson;
  618. this.$forceUpdate();
  619. })
  620. .catch((err) => {
  621. console.error(err);
  622. });
  623. },
  624. setChart() {
  625. // 雷达图显示的标签
  626. let newPromise = new Promise((resolve) => {
  627. resolve();
  628. });
  629. //然后异步执行echarts的初始化函数
  630. newPromise.then(() => {
  631. const chartObj = this.$echarts.init(
  632. //劳动课程
  633. this.$el.querySelector("#gauge_canvas")
  634. );
  635. this.gaugeOption.series[0].data[0].value = this.randomNum(10, 100);
  636. const chartObj2 = this.$echarts.init(
  637. //劳动课程
  638. this.$el.querySelector("#line_canvas")
  639. );
  640. var _array1 = [];
  641. var _array2 = [];
  642. for (let index = 0; index < 7; index++) {
  643. _array1.push(this.randomNum(40, 50));
  644. _array2.push(this.randomNum(40, 50));
  645. }
  646. this.lineOption.series[0].data = _array1;
  647. this.lineOption.series[1].data = _array2;
  648. const chartObj3 = this.$echarts.init(
  649. //劳动课程
  650. this.$el.querySelector("#bar_canvas")
  651. );
  652. var _arraybar1 = [];
  653. var _arraybar2 = [];
  654. var _arraybar3 = [];
  655. var _arraybar4 = [];
  656. var _arraybar5 = [];
  657. var _arraybar6 = [];
  658. var _arraybar7 = [];
  659. for (let index = 0; index < 7; index++) {
  660. _arraybar1.push(this.randomNum(20, 70));
  661. _arraybar2.push(this.randomNum(20, 70));
  662. _arraybar3.push(this.randomNum(20, 70));
  663. _arraybar4.push(this.randomNum(20, 70));
  664. _arraybar5.push(this.randomNum(20, 70));
  665. _arraybar6.push(this.randomNum(20, 70));
  666. _arraybar7.push(this.randomNum(20, 70));
  667. }
  668. this.barOption.series[0].data = _arraybar1;
  669. this.barOption.series[1].data = _arraybar2;
  670. this.barOption.series[2].data = _arraybar3;
  671. this.barOption.series[3].data = _arraybar4;
  672. this.barOption.series[4].data = _arraybar5;
  673. this.barOption.series[5].data = _arraybar6;
  674. this.barOption.series[6].data = _arraybar7;
  675. const chartObj4 = this.$echarts.init(
  676. //劳动课程
  677. this.$el.querySelector("#sunburst_canvas")
  678. );
  679. this.sunburstOption.series.data = [
  680. {
  681. name: "学习反思能力",
  682. value: 15,
  683. children: [
  684. {
  685. name: "终生学习",
  686. value: this.randomNum(1, 5),
  687. },
  688. {
  689. name: "自我进步",
  690. value: this.randomNum(1, 5),
  691. },
  692. {
  693. name: "自我反思",
  694. value: this.randomNum(1, 5),
  695. },
  696. ],
  697. },
  698. {
  699. name: "工程思维能力",
  700. value: 15,
  701. children: [
  702. {
  703. name: "工程思维能力",
  704. value: this.randomNum(1, 15),
  705. },
  706. ],
  707. },
  708. {
  709. name: "实践创新能力",
  710. value: 15,
  711. children: [
  712. {
  713. name: "实践创新能力",
  714. value: this.randomNum(5, 15),
  715. },
  716. ],
  717. },
  718. {
  719. name: "科学探究能力",
  720. value: 15,
  721. children: [
  722. {
  723. name: "科学探究能力",
  724. value: this.randomNum(5, 15),
  725. },
  726. ],
  727. },
  728. {
  729. name: "问题意识",
  730. value: 15,
  731. children: [
  732. {
  733. name: "问题意识",
  734. value: this.randomNum(5, 15),
  735. },
  736. ],
  737. },
  738. ];
  739. const chartObj5 = this.$echarts.init(
  740. //劳动课程
  741. this.$el.querySelector("#scatter_canvas")
  742. );
  743. var scatterArray = [];
  744. for (var i = 0; i < 5; i++) {
  745. scatterArray[i] = [];
  746. var a = 0;
  747. for (var j = 0; j < 5; j++) {
  748. var b = this.randomNum(0, 20);
  749. a += b;
  750. if (j == 4) {
  751. scatterArray[i].push(100 - a);
  752. scatterArray[i].sort(function () {
  753. return Math.random() - 0.5;
  754. });
  755. } else {
  756. scatterArray[i].push(b);
  757. }
  758. }
  759. }
  760. var _arrayScatter = [];
  761. for (var i = 0; i < 5; i++) {
  762. for (var j = 1; j < 6; j++) {
  763. var x = i;
  764. var y = j;
  765. // var z = this.randomNum(0, 100);
  766. var z = scatterArray[i][j - 1];
  767. _arrayScatter.push([x, y, z]);
  768. }
  769. }
  770. this.scatterOption.series[0].data = _arrayScatter;
  771. // 初始化雷达图
  772. this.chartObj = chartObj;
  773. this.chartObj2 = chartObj2;
  774. this.chartObj3 = chartObj3;
  775. this.chartObj4 = chartObj4;
  776. this.chartObj5 = chartObj5;
  777. this.chartObj.setOption(this.gaugeOption);
  778. this.chartObj2.setOption(this.lineOption);
  779. this.chartObj3.setOption(this.barOption);
  780. this.chartObj4.setOption(this.sunburstOption);
  781. this.chartObj5.setOption(this.scatterOption);
  782. this.tableData = this.tableData.sort(function () {
  783. return Math.random() - 0.5;
  784. });
  785. });
  786. },
  787. randomNum(minNum, maxNum) {
  788. switch (arguments.length) {
  789. case 1:
  790. return parseInt(Math.random() * minNum + 1, 10);
  791. break;
  792. case 2:
  793. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  794. break;
  795. default:
  796. return 0;
  797. break;
  798. }
  799. },
  800. setType(type) {
  801. this.type = type;
  802. this.sunburstOption.series.data = [
  803. {
  804. name: "学习反思能力",
  805. value: 15,
  806. children: [
  807. {
  808. name: "终生学习",
  809. value: this.randomNum(1, 5),
  810. },
  811. {
  812. name: "自我进步",
  813. value: this.randomNum(1, 5),
  814. },
  815. {
  816. name: "自我反思",
  817. value: this.randomNum(1, 5),
  818. },
  819. ],
  820. },
  821. {
  822. name: "工程思维能力",
  823. value: 15,
  824. children: [
  825. {
  826. name: "工程思维能力",
  827. value: this.randomNum(5, 15),
  828. },
  829. ],
  830. },
  831. {
  832. name: "实践创新能力",
  833. value: 15,
  834. children: [
  835. {
  836. name: "实践创新能力",
  837. value: this.randomNum(5, 15),
  838. },
  839. ],
  840. },
  841. {
  842. name: "科学探究能力",
  843. value: 15,
  844. children: [
  845. {
  846. name: "科学探究能力",
  847. value: this.randomNum(5, 15),
  848. },
  849. ],
  850. },
  851. {
  852. name: "问题意识",
  853. value: 15,
  854. children: [
  855. {
  856. name: "问题意识",
  857. value: this.randomNum(5, 15),
  858. },
  859. ],
  860. },
  861. ];
  862. var scatterArray = [];
  863. for (var i = 0; i < 5; i++) {
  864. scatterArray[i] = [];
  865. var a = 0;
  866. for (var j = 0; j < 5; j++) {
  867. var b = this.randomNum(0, 20);
  868. a += b;
  869. if (j == 4) {
  870. scatterArray[i].push(100 - a);
  871. scatterArray[i].sort(function () {
  872. return Math.random() - 0.5;
  873. });
  874. } else {
  875. scatterArray[i].push(b);
  876. }
  877. }
  878. }
  879. var _arrayScatter = [];
  880. for (var i = 0; i < 5; i++) {
  881. for (var j = 1; j < 6; j++) {
  882. var x = i;
  883. var y = j;
  884. // var z = this.randomNum(0, 100);
  885. var z = scatterArray[i][j - 1];
  886. _arrayScatter.push([x, y, z]);
  887. }
  888. }
  889. this.scatterOption.series[0].data = _arrayScatter;
  890. this.chartObj4.setOption(this.sunburstOption);
  891. this.chartObj5.setOption(this.scatterOption);
  892. },
  893. },
  894. watch: {
  895. // 使用监听的方式,监听数据的变化
  896. dataJson(val) {
  897. this.Course = val;
  898. this.courseId = val.courseId;
  899. var _chapters = JSON.parse(val.chapters);
  900. this.chapters = [];
  901. this.tools = [];
  902. _chapters.forEach((element) => {
  903. this.chapters.push({
  904. name: element.dyName,
  905. id: element.chapterInfo[0].chapterid,
  906. });
  907. if (element.chapterInfo[0].toolChoose) {
  908. this.tools.push(...element.chapterInfo[0].toolChoose);
  909. }
  910. });
  911. this.tools.push(...[1, 1, 1, 1, 2, 2, 2, 2]);
  912. this.tools = Array.from(new Set(this.tools)).sort();
  913. this.getData();
  914. },
  915. },
  916. mounted() {
  917. this.courseId = this.dataJson.courseId;
  918. var _chapters = JSON.parse(this.dataJson.chapters);
  919. this.chapters = [];
  920. this.tools = [];
  921. _chapters.forEach((element) => {
  922. this.chapters.push({
  923. name: element.dyName,
  924. id: element.chapterInfo[0].chapterid,
  925. });
  926. if (element.chapterInfo[0].toolChoose) {
  927. this.tools.push(...element.chapterInfo[0].toolChoose);
  928. }
  929. });
  930. this.tools = Array.from(new Set(this.tools)).sort();
  931. this.getData();
  932. this.setChart();
  933. },
  934. };
  935. </script>
  936. <style scoped>
  937. .cp_title {
  938. font-size: 24px;
  939. margin: 0 auto;
  940. width: 95%;
  941. }
  942. .data_body {
  943. display: flex;
  944. flex-wrap: wrap;
  945. }
  946. .data_body .data_c {
  947. width: 50%;
  948. }
  949. .sd_class {
  950. width: 95%;
  951. margin: 0 auto;
  952. }
  953. .sd_tTitle {
  954. width: 100%;
  955. background: rgb(199, 217, 212);
  956. padding: 10px 10px;
  957. border-radius: 5px;
  958. border: 1px solid rgb(165, 182, 177);
  959. font-size: 18px;
  960. font-weight: 500;
  961. margin: 20px 0;
  962. box-sizing: border-box;
  963. font-weight: 600;
  964. }
  965. .sd_person_button {
  966. font-size: 16px;
  967. display: flex;
  968. margin-bottom: 10px;
  969. }
  970. .sd_person_button span {
  971. margin-left: 20px;
  972. padding: 0 0 6px;
  973. cursor: pointer;
  974. }
  975. .sd_person_button .active {
  976. border-bottom: 2px solid rgb(30, 146, 255);
  977. color: rgb(30, 146, 255);
  978. }
  979. .sd_module_content {
  980. width: calc(50% / 2);
  981. display: flex;
  982. flex-direction: column;
  983. align-items: center;
  984. }
  985. .sd_module_content:nth-child(1) .sd_module_children:nth-child(1) {
  986. background: rgb(68, 228, 116);
  987. }
  988. .sd_module_content:nth-child(1) .sd_module_children:nth-child(2) {
  989. background: rgb(244, 132, 101);
  990. }
  991. .sd_module_content:nth-child(1) .sd_module_children:nth-child(3) {
  992. background: rgb(99, 205, 156);
  993. }
  994. .sd_module_content:nth-child(3) .sd_module_children:nth-child(1) {
  995. background: rgb(253, 183, 184);
  996. }
  997. .sd_module_content:nth-child(3) .sd_module_children:nth-child(2) {
  998. background: rgb(60, 174, 254);
  999. }
  1000. .sd_module_content:nth-child(3) .sd_module_children:nth-child(3) {
  1001. background: rgb(61, 223, 234);
  1002. }
  1003. .sd_module_children {
  1004. width: 100%;
  1005. height: 130px;
  1006. position: relative;
  1007. border-radius: 5px;
  1008. color: #fff;
  1009. display: flex;
  1010. flex-direction: column;
  1011. align-items: center;
  1012. justify-content: center;
  1013. }
  1014. .sd_module_children + .sd_module_children {
  1015. margin-top: 20px;
  1016. }
  1017. .sd_module_children .s {
  1018. position: absolute;
  1019. font-size: 16px;
  1020. top: 10px;
  1021. left: 10px;
  1022. }
  1023. .sd_module_children .s2 span {
  1024. font-size: 45px;
  1025. margin-right: 3px;
  1026. }
  1027. .wd_class_body {
  1028. background: rgb(242, 242, 242);
  1029. padding: 20px 0;
  1030. border-radius: 5px;
  1031. }
  1032. .wd_module {
  1033. display: flex;
  1034. justify-content: space-between;
  1035. width: 95%;
  1036. margin: 0 auto;
  1037. }
  1038. .wd_bottom {
  1039. display: flex;
  1040. justify-content: space-between;
  1041. height: 500px;
  1042. margin: 20px 0 0 0;
  1043. width: 95%;
  1044. margin: 20px auto 0;
  1045. }
  1046. .wd_bottom .bdiv {
  1047. width: 48%;
  1048. }
  1049. .el-table >>> .even_row {
  1050. background-color: #f1f1f1;
  1051. }
  1052. .JsonTit{
  1053. width: 100%;
  1054. padding: 20px 0 0;
  1055. display: flex;
  1056. justify-content: space-between;
  1057. align-items: center;
  1058. }
  1059. .JsonTitBtn{
  1060. display: flex;
  1061. align-items: center;
  1062. }
  1063. </style>