index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  1. <template>
  2. <el-dialog title="学生报告" :visible.sync="dataDialog" :append-to-body="true" :before-close="handleClose"
  3. class="dialog_diy">
  4. <div>
  5. <div class="whiteBox">
  6. <div>{{ title }}</div>
  7. <div class="data_progress">
  8. <div class="depth">
  9. <div>
  10. <el-progress :width="80" type="circle" :percentage="score.Pronunciation" :stroke-width="15" :format="format" color="#40b640"></el-progress>
  11. </div>
  12. <span>Pronunciation score</span>
  13. </div>
  14. <div class="depth">
  15. <div>
  16. <el-progress :width="80" type="circle" :percentage="score.Accuracy" :stroke-width="15" :format="format" color="#bc66c3"></el-progress>
  17. </div>
  18. <span>Accuracy score</span>
  19. </div>
  20. <div class="depth">
  21. <div>
  22. <el-progress :width="80" type="circle" :percentage="score.Fluency" :stroke-width="15" :format="format" color="#e871bc"></el-progress>
  23. </div>
  24. <span>Fluency score</span>
  25. </div>
  26. <div class="depth">
  27. <div>
  28. <el-progress :width="80" type="circle" :percentage="score.Completeness" :stroke-width="15" :format="format" color="#697bda"></el-progress>
  29. </div>
  30. <span>Completeness score</span>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="whiteBox" v-if="wordArray.length">
  35. <div class="word_box" v-for="(item, index) in wordArray" :key="index">
  36. <div class="word"><span>{{ index + 1 }}.</span><span>{{ item.content }}</span></div>
  37. <div class="star_box" v-if="item.work && item.work.score">
  38. <div class="star" v-for="index2 in 5" :key="'star' + index2" :class="{ starA: item.work.score >= (index2) }">
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="whiteBox" v-if="sentenceArray.length">
  44. <div class="setenceBox" v-for="(item, index) in sentenceArray" :key="index">
  45. <div class="setence">
  46. <div class="title">{{ index+1 }}.原文:</div>
  47. <div class="content">{{ item.content }}</div>
  48. </div>
  49. <div class="star_box" style="margin: 10px 0;" v-if="item.work && item.work.score">
  50. <div class="star" v-for="index2 in 5" :key="'star' + index2" :class="{ starA: item.work.score >= (index2) }">
  51. </div>
  52. </div>
  53. <div class="setence">
  54. <div class="title">录音译文:</div>
  55. <span>{{ (item.work && item.work.text) ? item.work.text : '无' }}</span>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="whiteBox" v-if="QAArray.length">
  60. <div class="setenceBox" v-for="(item, index) in QAArray" :key="index">
  61. <div class="setence">
  62. <div class="title">{{ index+1 }}.问题:</div>
  63. <div class="content">{{ item.content }}</div>
  64. </div>
  65. <!-- <div class="star_box" style="margin: 10px 0;">
  66. <div class="star" v-for="index2 in 5" :key="'star' + index2" :class="{ starA: 3 >= (index2) }">
  67. </div>
  68. </div> -->
  69. <div class="setence">
  70. <div class="title">录音回答译文:</div>
  71. <span>{{ (item.work && item.work.text) ? item.work.text : '无' }}</span>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="whiteBox" v-if="themeArray.length">
  76. <div class="setenceBox" v-for="(item, index) in themeArray" :key="index">
  77. <div class="setence">
  78. <div class="title">{{ index+1 }}.要点:</div>
  79. <div class="content2">
  80. <span>{{ item.content }}</span>
  81. <span>{{ item.content2 }}</span>
  82. </div>
  83. </div>
  84. <!-- <div class="star_box" style="margin: 10px 0;">
  85. <div class="star" v-for="index2 in 5" :key="'star' + index2" :class="{ starA: 3 >= (index2) }">
  86. </div>
  87. </div> -->
  88. <div class="setence">
  89. <div class="title">录音回答译文:</div>
  90. <div class="content2">
  91. <!-- <span>{{ item.content }}</span> -->
  92. <span>{{ (item.work && item.work.text) ? item.work.text : '无' }}</span>
  93. </div>
  94. </div>
  95. </div>
  96. </div>
  97. <div class="whiteBox" v-if="createRoleArray.length">
  98. <div class="setenceBox" v-for="(item, index) in createRoleArray" :key="index">
  99. <div class="setence">
  100. <div class="title">{{ index+1 }}.对话:</div>
  101. <div class="content2" v-if="item.work && item.work.length">
  102. <testRole :checkJson="item.work"></testRole>
  103. </div>
  104. <div class="content2" v-else>
  105. 暂未对话
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. </el-dialog>
  112. </template>
  113. <script>
  114. import testRole from "../component/testRole.vue";
  115. export default {
  116. components: {
  117. testRole
  118. },
  119. props: {
  120. dataDialog: {
  121. type: Boolean,
  122. default: false
  123. },
  124. englishVoiceJson: {
  125. type: Object,
  126. default: () => { }
  127. },
  128. commentDetail: {
  129. type: Object,
  130. default: () => { }
  131. }
  132. },
  133. data() {
  134. return {
  135. checkJson: [],
  136. title: "",
  137. detail: "",
  138. checkType: 0,
  139. work: [],
  140. wScore2: 0,
  141. scoreDetail2: "",
  142. wordArray: [],
  143. sentenceArray: [],
  144. QAArray: [],
  145. themeArray: [],
  146. createRoleArray: [],
  147. score:{
  148. Pronunciation: 0,
  149. Accuracy: 0,
  150. Fluency: 0,
  151. Completeness: 0,
  152. }
  153. };
  154. },
  155. methods: {
  156. handleClose(done) {
  157. this.close();
  158. done();
  159. },
  160. close() {
  161. this.$emit("update:dataDialog", false);
  162. },
  163. close2() {
  164. this.$emit("update:dataDialog", false);
  165. },
  166. confirm() {
  167. this.close2();
  168. },
  169. setVoiceJson(val) {
  170. let score = {
  171. Pronunciation: 0,
  172. Accuracy: 0,
  173. Fluency: 0,
  174. Completeness: 0,
  175. }
  176. let scoreCont = 0
  177. let a = JSON.parse(JSON.stringify(val));
  178. this.title = a.title;
  179. this.detail = a.detail;
  180. this.checkJson = a.array;
  181. this.checkType = 0;
  182. this.work.length = a.array.length;
  183. let works = JSON.parse(
  184. JSON.parse(JSON.stringify(this.commentDetail.works))
  185. );
  186. for(var i = 0; i < works.length; i++){
  187. if (i > (this.checkJson.length - 1)) {
  188. break
  189. }
  190. if(works[i] && works[i].star){
  191. scoreCont++
  192. score.Pronunciation += works[i].star.PronScore
  193. score.Accuracy += works[i].star.AccuracyScore
  194. score.Fluency += works[i].star.FluencyScore
  195. score.Completeness += works[i].star.CompletenessScore
  196. }
  197. }
  198. this.score = {
  199. Pronunciation: parseInt((score.Pronunciation / scoreCont).toFixed(0)),
  200. Accuracy: parseInt((score.Accuracy / scoreCont).toFixed(0)),
  201. Fluency: parseInt((score.Fluency / scoreCont).toFixed(0)),
  202. Completeness: parseInt((score.Completeness / scoreCont).toFixed(0)),
  203. }
  204. for (var i = 0; i < this.checkJson.length; i++) {
  205. this.checkJson[i].work = ''
  206. if (i > (works.length - 1)) {
  207. break
  208. }
  209. this.checkJson[i].work = works[i];
  210. }
  211. let wordArray = []
  212. let sentenceArray = []
  213. let QAArray = []
  214. let themeArray = []
  215. let createRoleArray = []
  216. for (var i = 0; i < this.checkJson.length; i++) {
  217. if (this.checkJson[i].type == 'word') {
  218. wordArray.push(this.checkJson[i])
  219. } else if (this.checkJson[i].type == 'sentence') {
  220. sentenceArray.push(this.checkJson[i])
  221. } else if (this.checkJson[i].type == 'QA') {
  222. QAArray.push(this.checkJson[i])
  223. } else if (this.checkJson[i].type == 'theme') {
  224. themeArray.push(this.checkJson[i])
  225. } else if (this.checkJson[i].type == 'createRole') {
  226. createRoleArray.push(this.checkJson[i])
  227. }
  228. }
  229. this.wordArray = wordArray
  230. this.sentenceArray = sentenceArray
  231. this.QAArray = QAArray
  232. this.themeArray = themeArray
  233. this.createRoleArray = createRoleArray
  234. this.$forceUpdate()
  235. },
  236. format(percentage) {
  237. return percentage;
  238. },
  239. },
  240. watch: {
  241. dataDialog: {
  242. handler: function (newVal, oldVal) {
  243. if (newVal) {
  244. this.setVoiceJson(this.englishVoiceJson);
  245. }
  246. },
  247. deep: true
  248. }
  249. },
  250. mounted() {
  251. this.setVoiceJson(this.englishVoiceJson);
  252. }
  253. };
  254. </script>
  255. <style scoped>
  256. .dialog_diy>>>.el-dialog {
  257. width: 100%;
  258. max-width: 1000px;
  259. height: 100%;
  260. margin: 0vh auto !important;
  261. }
  262. .dialog_diy>>>.el-dialog__header {
  263. background: #454545 !important;
  264. padding: 15px;
  265. }
  266. .dialog_diy>>>.el-dialog__body {
  267. height: calc(100% - 54px);
  268. box-sizing: border-box;
  269. padding: 15px;
  270. }
  271. .dialog_diy>>>.el-dialog__title {
  272. color: #fff;
  273. }
  274. .dialog_diy>>>.el-dialog__headerbtn {
  275. top: 19px;
  276. }
  277. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close {
  278. color: #fff;
  279. }
  280. .dialog_diy>>>.el-dialog__headerbtn .el-dialog__close:hover {
  281. color: #fff;
  282. }
  283. .dialog_diy>>>.el-dialog__body,
  284. .dialog_diy>>>.el-dialog__footer {
  285. background: #f0f4fa;
  286. overflow: auto;
  287. }
  288. .whiteBox {
  289. background: #fff;
  290. /* margin-bottom: 15px; */
  291. padding: 15px 30px;
  292. border-radius: 5px;
  293. width: 100%;
  294. box-sizing: border-box;
  295. }
  296. .whiteBox +.whiteBox {
  297. margin-top: 15px;
  298. }
  299. .word_box {
  300. font-size: 14px;
  301. font-weight: bold;
  302. display: flex;
  303. color: #000;
  304. }
  305. .word_box+.word_box {
  306. margin-top: 10px;
  307. }
  308. .word_box>.word {
  309. width: 250px;
  310. }
  311. .star_box {
  312. display: flex;
  313. align-items: center;
  314. }
  315. .star_box>.star {
  316. width: 20px;
  317. height: 20px;
  318. display: block;
  319. background-image: url('../../../assets/icon/englishVoice/star-no.png');
  320. background-size: 100% 100%;
  321. }
  322. .star_box>.star+.star {
  323. margin-left: 5px;
  324. }
  325. .star_box>.starA {
  326. background-image: url('../../../assets/icon/englishVoice/star.png');
  327. }
  328. .setenceBox{}
  329. .setenceBox + .setenceBox{
  330. margin-top: 15px;
  331. }
  332. .setenceBox > .setence{
  333. color: #000;
  334. }
  335. .setenceBox > .setence > .title{
  336. font-size: 16px;
  337. margin-bottom: 10px;
  338. font-weight: bold;
  339. }
  340. .setenceBox > .setence > .content{
  341. word-break: break-word;
  342. white-space: pre-line;
  343. font-size: 14px;
  344. }
  345. .setenceBox > .setence > .content2{
  346. font-size: 14px;
  347. }
  348. .setenceBox > .setence > .content2 > span{
  349. display: block;
  350. }
  351. .setenceBox > .setence > .content2 > span:nth-child(1){
  352. font-size: 14px;
  353. }
  354. .setenceBox > .setence > .content2 > span:nth-child(2){
  355. word-break: break-word;
  356. white-space: pre-line;
  357. font-size: 14px;
  358. margin-top: 10px;
  359. }
  360. .data_progress{
  361. margin-top: 10px;
  362. display: flex;
  363. justify-content: space-between;
  364. }
  365. .data_progress > .depth{
  366. display: flex;
  367. flex-direction: column;
  368. align-items: center;
  369. justify-content: center;
  370. width: calc(100% / 4);
  371. }
  372. .data_progress > .depth > div{
  373. display: flex;
  374. justify-content: center;
  375. }
  376. .data_progress > .depth > span{
  377. font-size: 14px;
  378. font-weight: bold;
  379. color: #000;
  380. margin-top: 5px;
  381. }
  382. </style>