TpScoreBoard.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164
  1. <template>
  2. <div class="scoreboard pull-right">
  3. <div class="board-margin">
  4. <div class="first-board">
  5. <span class="title-font">操作方式切换:</span>
  6. <el-switch
  7. v-model="isMouseMode"
  8. class="pull-right"
  9. active-text="鼠标"
  10. inactive-text="键盘"
  11. active-color="#4cb0f9"
  12. inactive-color="#13ce66"
  13. ></el-switch>
  14. </div>
  15. <div class="second-board">
  16. <div class="board-title"><span>总分</span></div>
  17. <div class="board-score">
  18. <span>{{ totalScore }}分</span>
  19. </div>
  20. </div>
  21. <!-- 鼠标模式 -->
  22. <div v-if="isMouseMode">
  23. <div class="title-board"><span class="title-font">评分</span></div>
  24. <div class="itemScroll">
  25. <div
  26. v-for="(resultItemInner, index) in resultItemsData"
  27. :id="resultItemInner.markItem.id"
  28. :key="resultItemInner.markItem.id"
  29. class="pull-left scoretitle titlebutton"
  30. size="small"
  31. @click="
  32. itemClick(
  33. resultItemInner.markItem.id,
  34. $event,
  35. resultItemInner.markItem.orders
  36. )
  37. "
  38. >
  39. <div
  40. :class="{ 'active-btn': itemClass[index] }"
  41. class="title-item-top"
  42. >
  43. <span>
  44. {{ resultItemInner.markItem.mainNumber }}({{
  45. resultItemInner.markItem.orders
  46. }})
  47. </span>
  48. </div>
  49. <div
  50. class="title-item-bottom"
  51. :class="{ 'active-text': itemClass[index] }"
  52. >
  53. <span>{{ resultItemInner.score }}分</span>
  54. </div>
  55. </div>
  56. </div>
  57. <div v-if="markTypeView">
  58. <div class="step-board"></div>
  59. <div class="title-board"><span class="title-font">打分</span></div>
  60. <div class="itemScroll">
  61. <div
  62. v-for="(score, index) in itemScores"
  63. :key="score"
  64. class="pull-left scoretitle"
  65. >
  66. <div
  67. class="scorebutton"
  68. :class="{ 'score-btn': itemScoreBtn[index] }"
  69. @click="scoreClick(score, index)"
  70. >
  71. <span class="score-item">{{ score }}</span>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. <!-- 键盘模式 -->
  78. <div v-if="!isMouseMode">
  79. <div class="title-board"><span class="title-font">评分</span></div>
  80. <div>
  81. <div class="itemScroll">
  82. <div
  83. v-for="(resultItemInner, index) in resultItemsData"
  84. :key="resultItemInner.markItem.id"
  85. class="scoretitle"
  86. >
  87. <div class="box-card">
  88. <div class="item-title">
  89. <div class="pull-left item-number">
  90. {{ resultItemInner.markItem.mainNumber }}({{
  91. resultItemInner.markItem.orders
  92. }})
  93. </div>
  94. <div class="pull-left item-number2">
  95. <span>{{ resultItemInner.markItem.maxScore }}分</span>
  96. </div>
  97. <div class="pull-left item-number3">
  98. 间隔:{{
  99. itemScoreStep(resultItemInner.markItem.scoreInterval)
  100. }}
  101. </div>
  102. </div>
  103. <div class="item-score">
  104. <input
  105. :id="getItemId(resultItemInner.markItem.id)"
  106. v-model="resultItemInner.score"
  107. class="score-input"
  108. @focus="scoreFocus(resultItemInner)"
  109. @keydown.enter="scoreEnter(index, resultItemInner)"
  110. @keydown.up="scoreUp(index, resultItemInner)"
  111. @keydown.down="scoreDown(index, resultItemInner)"
  112. @change="scoreChange(index, resultItemInner.score)"
  113. />
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. <div>
  121. <div class="step-board"></div>
  122. <div class="title-board">
  123. <span class="title-font">备注</span>
  124. <div
  125. v-if="!textareaflag"
  126. class="el-icon-caret-right remark-board"
  127. @click="showTextarea"
  128. ></div>
  129. <div
  130. v-if="textareaflag"
  131. class="el-icon-caret-top remark-board"
  132. @click="showTextarea"
  133. ></div>
  134. </div>
  135. <div v-if="textareaflag" class="remark-step">
  136. <textarea
  137. id="remark"
  138. v-model="markedResultData.markRemark"
  139. type="text"
  140. rows="3"
  141. cols="35"
  142. placeholder="请输入内容"
  143. />
  144. </div>
  145. </div>
  146. <div>
  147. <div v-if="problemView">
  148. <div class="problem-button"></div>
  149. <span v-if="tagFlag">
  150. <el-radio-group
  151. v-model="markedResultData.tag"
  152. @change="processTagPaper"
  153. >
  154. <div
  155. v-for="tag in tags"
  156. :key="tag.code"
  157. class="pull-left scoretitle"
  158. >
  159. <el-radio :label="tag.code">{{ tag.name }}</el-radio>
  160. </div>
  161. </el-radio-group>
  162. </span>
  163. <span v-if="!tagFlag">
  164. <el-radio-group v-model="unusualType" @change="processTagPaper">
  165. <div
  166. v-for="tag in tags"
  167. :key="tag.code"
  168. class="pull-left scoretitle"
  169. >
  170. <el-radio :key="tag.code" :label="tag.code">{{
  171. tag.name
  172. }}</el-radio>
  173. </div>
  174. </el-radio-group>
  175. </span>
  176. </div>
  177. <div v-if="paperMark" class="pull-left btn">
  178. <el-button
  179. id="subMarkBtn"
  180. class="submit-button"
  181. type="primary"
  182. size="small"
  183. :round="true"
  184. :loading="loading"
  185. @keydown.enter="submitMark"
  186. @click="submitMark"
  187. >
  188. <span class="sub-btn">提</span> <span>交</span>
  189. </el-button>
  190. </div>
  191. <div v-if="paperMark" class="pull-left btn">
  192. <el-button
  193. type="danger"
  194. :round="true"
  195. size="small"
  196. @click="problemClick"
  197. >问题卷</el-button
  198. >
  199. </div>
  200. <div v-if="paperMark && problemView" class="pull-left btn">
  201. <el-button
  202. type="danger"
  203. :round="true"
  204. size="small"
  205. @click="resetProblem"
  206. >清除问题卷</el-button
  207. >
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. </template>
  213. <script>
  214. import { mapActions } from "vuex";
  215. import { USER_SIGNOUT } from "../../portal/store/user";
  216. import { mapState } from "vuex";
  217. import { CORE_API, MARKING_API } from "@/constants/constants";
  218. import { EVENTHUB } from "../constants/constants";
  219. export default {
  220. props: {
  221. paperMarkSign: {
  222. type: Array,
  223. default: () => [],
  224. },
  225. signScores: {
  226. type: Array,
  227. default: () => [],
  228. },
  229. signOption: {
  230. type: Object,
  231. default: () => {},
  232. },
  233. markSign: {
  234. type: Boolean,
  235. default: false,
  236. },
  237. studentPaperId: {
  238. type: Number,
  239. default: 0,
  240. },
  241. markTaskId: {
  242. type: Number,
  243. default: 0,
  244. },
  245. resultItems: {
  246. type: Array,
  247. default: () => [],
  248. },
  249. markedResult: {
  250. type: Object,
  251. default: () => {},
  252. },
  253. paperMark: {
  254. type: Boolean,
  255. default: true,
  256. },
  257. scoreStep: {
  258. type: Number,
  259. default: 0.5,
  260. },
  261. },
  262. data() {
  263. return {
  264. resultItemsData: JSON.parse(JSON.stringify(this.resultItems)),
  265. signOptionData: JSON.parse(JSON.stringify(this.signOption)),
  266. signScoresData: JSON.parse(JSON.stringify(this.signScores)),
  267. markedResultData: JSON.parse(JSON.stringify(this.markedResult)),
  268. activeName: "first",
  269. markType: "mouse",
  270. isMouseMode: true,
  271. op: "first",
  272. maxScore: 0,
  273. markItemId: "",
  274. resultItem: {
  275. markItem: {},
  276. score: 0,
  277. },
  278. markTypeView: false,
  279. problemView: false,
  280. markBack: false,
  281. markSame: false,
  282. markBlank: false,
  283. markDiff: false,
  284. curIndex: 0,
  285. steps: [],
  286. btnflag: false,
  287. textareaflag: false,
  288. tmpSignItem: this.signItem,
  289. tags: [],
  290. unusualType: "",
  291. scoreError: [],
  292. itemScoreBtn: [],
  293. loading: false,
  294. };
  295. },
  296. computed: {
  297. tagFlag() {
  298. if (this.markedResultData.id) {
  299. return true;
  300. } else {
  301. return false;
  302. }
  303. },
  304. paperKey() {
  305. if (!this.markSign) return "";
  306. return this.studentPaperId;
  307. },
  308. signScoreSum() {
  309. var sum = 0;
  310. for (let signScore of this.signScoresData) {
  311. sum += signScore;
  312. }
  313. return sum;
  314. },
  315. itemClass() {
  316. var itemClass = [];
  317. for (let resultItem of this.resultItems) {
  318. if (resultItem.score.length == 0) {
  319. itemClass.push(false);
  320. } else {
  321. itemClass.push(true);
  322. }
  323. }
  324. return itemClass;
  325. },
  326. totalScore() {
  327. var totalScore = 0;
  328. for (let resultItem of this.resultItems) {
  329. if (resultItem.score.length == 0) {
  330. totalScore = this.accAdd(totalScore, 0);
  331. } else {
  332. totalScore = this.accAdd(
  333. totalScore,
  334. Number.parseFloat(resultItem.score)
  335. );
  336. }
  337. }
  338. return totalScore;
  339. },
  340. itemScores() {
  341. var itemScores = [];
  342. var scoreInterval = this.resultItem.markItem.scoreInterval;
  343. if (this.scoreStep != null) {
  344. scoreInterval = this.scoreStep;
  345. }
  346. let i = 0;
  347. let j = 0;
  348. do {
  349. itemScores[j] = i;
  350. i = this.accAdd(i, scoreInterval);
  351. j++;
  352. } while (i <= this.resultItem.markItem.maxScore);
  353. if (
  354. itemScores[itemScores.length - 1] < this.resultItem.markItem.maxScore
  355. ) {
  356. itemScores[itemScores.length] = this.resultItem.markItem.maxScore;
  357. }
  358. return itemScores;
  359. },
  360. ...mapState({ user: (state) => state.user }),
  361. },
  362. watch: {
  363. resultItems: {
  364. immediate: false,
  365. handler(val) {
  366. this.resultItemsData = JSON.parse(JSON.stringify(val));
  367. if (!this.isMouseMode) {
  368. //切换不同考试的试卷时,光标定位要在resultItems变化之后做
  369. this.initKeyBoardMode();
  370. }
  371. },
  372. },
  373. signItem(val) {
  374. this.tmpSignItem = val;
  375. },
  376. tmpSignItem(val) {
  377. this.$emit("changeSign", val);
  378. },
  379. isMouseMode(val) {
  380. if (!val) {
  381. this.initKeyBoardMode();
  382. }
  383. },
  384. studentPaperId() {
  385. if (!this.isMouseMode) {
  386. this.initKeyBoardMode();
  387. }
  388. },
  389. },
  390. created() {
  391. this.getTags();
  392. },
  393. methods: {
  394. ...mapActions([USER_SIGNOUT]),
  395. resetProblem() {
  396. if (this.markedResultData.tag) {
  397. this.markedResultData.tag = "";
  398. }
  399. if (this.unusualType) {
  400. this.unusualType = "";
  401. }
  402. },
  403. //处理问题卷
  404. processTagPaper() {
  405. if (!this.markedResultData.id) {
  406. if (this.unusualType) {
  407. for (let resultItem of this.resultItems) {
  408. resultItem.score = 0;
  409. }
  410. }
  411. } else {
  412. if (this.markedResultData.tag) {
  413. for (let resultItem of this.resultItems) {
  414. resultItem.score = 0;
  415. }
  416. }
  417. }
  418. },
  419. getTags() {
  420. this.$http.get(MARKING_API + "/markResults/tag").then((response) => {
  421. this.tags = response.data;
  422. //移除科目错误
  423. for (let i = 0; i < this.tags.length; i++) {
  424. if (this.tags[i].code === "SUBJECT_ERROR") {
  425. this.tags.splice(i, 1);
  426. }
  427. }
  428. });
  429. },
  430. //在内存中对试卷进行标记保存
  431. saveMarkSign() {
  432. localStorage.removeItem(this.paperKey);
  433. localStorage.setItem(this.paperKey, JSON.stringify(this.paperMarkSign));
  434. },
  435. checkItemClass(resultItem) {
  436. if (resultItem.score.length > 0) {
  437. return true;
  438. } else {
  439. return false;
  440. }
  441. },
  442. itemClick(id, event, order) {
  443. this.markTypeView = true;
  444. this.resultItems.find((value, index) => {
  445. if (value.markItem.id === id) {
  446. this.maxScore = value.markItem.maxScore;
  447. this.markItemId = value.markItem.id;
  448. if (value.score.length > 0) {
  449. this.resultItem = value;
  450. } else {
  451. this.resultItem = {
  452. markItem: value.markItem,
  453. score: "",
  454. };
  455. }
  456. this.curIndex = index;
  457. }
  458. });
  459. this.showItemTitle();
  460. if (this.markSign) {
  461. this.tmpSignItem = this.resultItem.markItem;
  462. this.signScoresData.splice(0, this.signScoresData.length);
  463. }
  464. this.positionDiv(order);
  465. //重置打分板样式
  466. this.itemScoreBtn = [];
  467. },
  468. positionDiv(order) {
  469. EVENTHUB.$emit("positionDiv", order);
  470. },
  471. showItemTitle() {
  472. var title =
  473. this.resultItem.markItem.mainNumber +
  474. "(" +
  475. this.resultItem.markItem.orders +
  476. ")";
  477. this.$notify({
  478. showClose: true,
  479. message: "当前选择题目为" + title,
  480. type: "warning",
  481. });
  482. },
  483. checkSignScore(score) {
  484. var sum = 0;
  485. for (let signScore of this.signScoresData) {
  486. sum += signScore;
  487. }
  488. if (sum + score > this.maxScore) {
  489. return false;
  490. } else {
  491. return true;
  492. }
  493. },
  494. //检查每项分数是否满足要求
  495. checkScore(resultItem) {
  496. var score = resultItem.score + "";
  497. var maxScore = resultItem.markItem.maxScore + "";
  498. if (score.trim().length === 0) {
  499. this.$notify({
  500. message: "分数不能为空",
  501. type: "error",
  502. duration: 2000,
  503. });
  504. return false;
  505. } else {
  506. let regex = "^\\d+(\\.[\\d])?$";
  507. if (!score.match(regex)) {
  508. this.$notify({
  509. message: "分数必须为数字且最多一位小数",
  510. type: "error",
  511. duration: 2000,
  512. });
  513. return false;
  514. } else {
  515. if (parseFloat(score) > parseFloat(maxScore)) {
  516. this.$notify({
  517. message: "分数不能超过" + maxScore + "分",
  518. type: "error",
  519. duration: 2000,
  520. });
  521. return false;
  522. }
  523. }
  524. }
  525. //校验分数是否是间隔的倍数
  526. var scoreInterval = resultItem.markItem.scoreInterval;
  527. if (this.scoreStep != null) {
  528. scoreInterval = this.scoreStep;
  529. }
  530. if (
  531. parseFloat(score) != 0 &&
  532. parseFloat(score) != parseFloat(maxScore) &&
  533. (parseFloat(score) * 10) % (scoreInterval * 10) != 0
  534. ) {
  535. this.$notify({
  536. message: "分数必须是给分间隔的倍数或者零分、满分",
  537. type: "error",
  538. duration: 2000,
  539. });
  540. return false;
  541. }
  542. return true;
  543. },
  544. scoreClick(score, index1) {
  545. //轨迹模式处理分值问题
  546. if (this.markSign) {
  547. if (this.checkSignScore(score)) {
  548. this.signScoresData.push(score);
  549. this.signOptionData.score = score;
  550. this.resultItem.score = this.signScoreSum;
  551. this.resultItemsData[this.curIndex].score = this.signScoreSum;
  552. } else {
  553. this.$notify({
  554. message: "轨迹总分不能超过满分",
  555. type: "error",
  556. });
  557. }
  558. } else {
  559. //正常模式
  560. this.resultItem.score = score;
  561. this.resultItemsData[this.curIndex].score = score;
  562. //设置动态样式(打分板)
  563. this.itemScoreBtn = [];
  564. for (let i = 0; i < this.itemScores.length; i++) {
  565. if (i == index1) {
  566. this.itemScoreBtn.push(true);
  567. } else {
  568. this.itemScoreBtn.push(false);
  569. }
  570. }
  571. }
  572. },
  573. //键盘打分板change事件
  574. scoreChange(index, score) {
  575. this.resultItem.score = score;
  576. this.resultItemsData[index].score = score;
  577. },
  578. //键盘打分板聚焦后试卷跳转对应试题
  579. scoreFocus(resultItem) {
  580. var order = resultItem.markItem.orders;
  581. this.positionDiv(order);
  582. },
  583. //键盘打分板下键跳转下一题
  584. scoreDown(index, resultItem) {
  585. var curItemId = this.resultItemsData[index].markItem.id;
  586. var curItemInput = "item" + curItemId;
  587. if (!this.checkScore(resultItem)) {
  588. document.getElementById(curItemInput).focus();
  589. return;
  590. }
  591. if (index === this.resultItemsData.length - 1) {
  592. return;
  593. } else {
  594. var nextResultItem = this.resultItemsData[index + 1];
  595. var nextItemId = nextResultItem.markItem.id;
  596. var nextItemInput = "item" + nextItemId;
  597. var order = nextResultItem.markItem.orders;
  598. document.getElementById(nextItemInput).focus();
  599. this.positionDiv(order);
  600. }
  601. },
  602. //键盘打分板上键跳转上一题
  603. scoreUp(index, resultItem) {
  604. var curItemId = this.resultItemsData[index].markItem.id;
  605. var curItemInput = "item" + curItemId;
  606. if (!this.checkScore(resultItem)) {
  607. document.getElementById(curItemInput).focus();
  608. return;
  609. }
  610. if (index === 0) {
  611. let preResultItem = this.resultItemsData[0];
  612. let preItemId = preResultItem.markItem.id;
  613. let preItemInput = "item" + preItemId;
  614. let order = preResultItem.markItem.orders;
  615. document.getElementById(preItemInput).focus();
  616. this.positionDiv(order);
  617. } else {
  618. let preResultItem = this.resultItemsData[index - 1];
  619. let preItemId = preResultItem.markItem.id;
  620. let preItemInput = "item" + preItemId;
  621. let order = preResultItem.markItem.orders;
  622. document.getElementById(preItemInput).focus();
  623. this.positionDiv(order);
  624. }
  625. },
  626. //键盘打分板回车后跳转下一题
  627. scoreEnter(index, resultItem) {
  628. if (!this.checkScore(resultItem)) {
  629. var curItemId = this.resultItemsData[index].markItem.id;
  630. var curItemInput = "item" + curItemId;
  631. document.getElementById(curItemInput).focus();
  632. return;
  633. }
  634. if (index === this.resultItemsData.length - 1) {
  635. document.getElementById("subMarkBtn").focus();
  636. } else {
  637. var nextResultItem = this.resultItemsData[index + 1];
  638. var nextItemId = nextResultItem.markItem.id;
  639. var nextItemInput = "item" + nextItemId;
  640. var order = nextResultItem.markItem.orders;
  641. document.getElementById(nextItemInput).focus();
  642. this.positionDiv(order);
  643. }
  644. },
  645. getItemId(itemId) {
  646. return "item" + itemId;
  647. },
  648. problemClick() {
  649. this.problemView = !this.problemView;
  650. },
  651. //检查评分项
  652. checkItems() {
  653. var itemName = "";
  654. for (var resultItem of this.resultItemsData) {
  655. if (resultItem.score.length == 0) {
  656. itemName =
  657. Number.parseInt(resultItem.markItem.mainNumber) +
  658. "(" +
  659. resultItem.markItem.orders +
  660. ")";
  661. this.$notify({
  662. title: "警告",
  663. message: itemName + "没有打分,请打分",
  664. type: "warning",
  665. });
  666. if (!this.isMouseMode) {
  667. let curItemInput = "item" + resultItem.markItem.id;
  668. document.getElementById(curItemInput).focus();
  669. }
  670. return false;
  671. } else {
  672. if (!this.checkScore(resultItem)) {
  673. if (!this.isMouseMode) {
  674. let curItemInput = "item" + resultItem.markItem.id;
  675. document.getElementById(curItemInput).focus();
  676. }
  677. return false;
  678. }
  679. }
  680. }
  681. return true;
  682. },
  683. submitMark() {
  684. if (!this.checkItems()) {
  685. return;
  686. }
  687. this.processTagPaper();
  688. this.loading = true;
  689. this.$loading({ fullscreen: true });
  690. let remarkValue = "";
  691. if (document.getElementById("remark")) {
  692. remarkValue = document.getElementById("remark").value;
  693. }
  694. if (!this.markedResultData.id) {
  695. //正常提交情况
  696. this.$httpWithMsg
  697. .post(
  698. MARKING_API +
  699. "/markResults?studentPaperId=" +
  700. this.studentPaperId +
  701. "&markTaskId=" +
  702. this.markTaskId +
  703. "&tag=" +
  704. this.unusualType +
  705. "&remark=" +
  706. remarkValue,
  707. this.resultItemsData
  708. )
  709. .then(
  710. (response) => {
  711. this.saveMarkSign();
  712. if (response.data.id) {
  713. this.$notify({
  714. message: "提交成功",
  715. type: "success",
  716. });
  717. } else {
  718. this.$notify({
  719. message: "提交失败",
  720. type: "error",
  721. });
  722. }
  723. //调用Marking.vue中方法:执行的是拿取下一份试卷
  724. this.$emit("submitMark");
  725. this.loading = false;
  726. this.markTypeView = false;
  727. this.problemView = false;
  728. this.unusualType = "";
  729. },
  730. (error) => {
  731. // 响应错误回调
  732. if (error.response.data.desc) {
  733. var errorInfo = error.response.data.desc;
  734. if (errorInfo.includes("超时")) {
  735. this.$loading().close();
  736. this.loading = false;
  737. this.$alert(
  738. "该评卷任务已超时,请点击确定重新登录!",
  739. "提示",
  740. {
  741. confirmButtonText: "确定",
  742. callback: () => {
  743. this.$http
  744. .post(CORE_API + "/auth/logout")
  745. .then(() => {
  746. const orgId = this.user.rootOrgId;
  747. this.USER_SIGNOUT();
  748. window.name = "";
  749. this.$router.replace({
  750. path: "/login" + "?orgId=" + orgId,
  751. });
  752. })
  753. .catch((response) => {
  754. const orgId = this.user.rootOrgId;
  755. if (response.status == 500) {
  756. this.$notify({
  757. showClose: true,
  758. message: response.data.desc,
  759. type: "error",
  760. });
  761. }
  762. this.USER_SIGNOUT();
  763. window.name = "";
  764. this.$router.replace({
  765. path: "/login" + "?orgId=" + orgId,
  766. });
  767. });
  768. return;
  769. },
  770. }
  771. );
  772. } else {
  773. if (error.response.data.code == 403) {
  774. this.$loading().close();
  775. return;
  776. }
  777. this.$emit("submitMark");
  778. this.loading = false;
  779. this.markTypeView = false;
  780. this.problemView = false;
  781. this.unusualType = "";
  782. }
  783. } else {
  784. this.$notify({
  785. message: "提交失败",
  786. type: "error",
  787. });
  788. this.$emit("submitMark");
  789. this.loading = false;
  790. this.markTypeView = false;
  791. this.problemView = false;
  792. this.unusualType = "";
  793. }
  794. }
  795. );
  796. } else {
  797. this.markedResultData.resultItems = this.resultItemsData;
  798. this.markedResultData.remark = remarkValue;
  799. this.$httpWithMsg
  800. .put(MARKING_API + "/markResults", this.markedResultData)
  801. .then(
  802. () => {
  803. this.saveMarkSign();
  804. this.$notify({
  805. message: "提交成功",
  806. type: "success",
  807. });
  808. this.$emit("submitMark");
  809. this.loading = false;
  810. this.markTypeView = false;
  811. this.problemView = false;
  812. this.unusualType = "";
  813. },
  814. (error) => {
  815. // 响应错误回调
  816. if (error.response.data.code == 403) {
  817. this.$loading().close();
  818. return;
  819. }
  820. this.$emit("submitMark");
  821. this.loading = false;
  822. this.markTypeView = false;
  823. this.problemView = false;
  824. this.unusualType = "";
  825. }
  826. );
  827. }
  828. },
  829. initKeyBoardMode() {
  830. if (this.resultItemsData[0]) {
  831. var itemId = this.resultItemsData[0].markItem.id;
  832. var order = this.resultItemsData[0].markItem.orders;
  833. var itemInput = "item" + itemId;
  834. this.$nextTick(() => {
  835. var firstInput = document.getElementById(itemInput);
  836. if (firstInput) {
  837. firstInput.focus();
  838. }
  839. });
  840. this.positionDiv(order);
  841. }
  842. },
  843. showTextarea() {
  844. if (this.textareaflag) {
  845. this.textareaflag = false;
  846. } else {
  847. this.textareaflag = true;
  848. }
  849. },
  850. accAdd(num1, num2) {
  851. let sq1, sq2, m;
  852. try {
  853. sq1 = num1.toString().split(".")[1].length;
  854. } catch (e) {
  855. sq1 = 0;
  856. }
  857. try {
  858. sq2 = num2.toString().split(".")[1].length;
  859. } catch (e) {
  860. sq2 = 0;
  861. }
  862. m = Math.pow(10, Math.max(sq1, sq2));
  863. return (num1 * m + num2 * m) / m;
  864. },
  865. itemScoreStep(scoreInterval) {
  866. if (this.scoreStep != null) {
  867. return this.scoreStep;
  868. }
  869. return scoreInterval;
  870. },
  871. },
  872. };
  873. </script>
  874. <style scoped>
  875. .scoreboard {
  876. width: 25%;
  877. min-height: 600px;
  878. }
  879. .itemScroll {
  880. overflow: hidden;
  881. height: 140px;
  882. margin-top: 15px;
  883. }
  884. .itemScroll:hover {
  885. overflow: auto;
  886. }
  887. .itemScroll::-webkit-scrollbar {
  888. /*滚动条整体样式*/
  889. width: 8px; /*高宽分别对应横竖滚动条的尺寸*/
  890. }
  891. .itemScroll::-webkit-scrollbar-thumb {
  892. box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  893. border-radius: 5px;
  894. background: rgba(0, 0, 0, 0.2);
  895. }
  896. .itemScroll::-webkit-scrollbar-track {
  897. /*滚动条里面轨道*/
  898. box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
  899. border-radius: 0;
  900. background: rgba(0, 0, 0, 0.1);
  901. }
  902. .scoreScroll {
  903. overflow: auto;
  904. height: 100px;
  905. }
  906. .scoretitle {
  907. margin-right: 15px;
  908. margin-bottom: 15px;
  909. }
  910. li {
  911. list-style-type: none;
  912. }
  913. .actionbutton {
  914. width: 80px;
  915. height: 30px;
  916. }
  917. .second-board {
  918. color: white;
  919. margin-top: 20px;
  920. padding-bottom: 20px;
  921. border-bottom: 1px solid #ccc;
  922. }
  923. .clear {
  924. clear: both;
  925. }
  926. .board-margin {
  927. margin-left: 20px;
  928. }
  929. .sub-btn {
  930. margin-right: 15px;
  931. }
  932. .active-btn {
  933. background: rgb(85, 191, 255) !important;
  934. border-color: rgb(85, 191, 255) !important;
  935. }
  936. .score-input {
  937. border: 1px solid black;
  938. border-top: 0;
  939. border-left: 0;
  940. border-right: 0;
  941. box-sizing: border-box;
  942. color: rgb(77, 124, 196);
  943. font-size: 15px;
  944. height: 30px;
  945. width: 40px;
  946. padding: 2px 10px;
  947. transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  948. outline: none;
  949. text-align: center;
  950. }
  951. .el-switch__label {
  952. position: absolute;
  953. left: 0;
  954. top: 0;
  955. z-index: 2;
  956. }
  957. .button-border.button-small {
  958. line-height: 26px;
  959. }
  960. .button-small {
  961. font-size: 12px;
  962. }
  963. .button-border {
  964. border-width: 2px;
  965. border-style: solid;
  966. }
  967. .button-box {
  968. padding: 0 !important;
  969. border-radius: 10px;
  970. }
  971. .button-primary {
  972. border-color: #1b9af7;
  973. }
  974. .button {
  975. font-weight: 300;
  976. text-decoration: none;
  977. text-align: center;
  978. margin: 0;
  979. display: inline-block;
  980. outline: none;
  981. }
  982. .pull-left {
  983. float: left;
  984. }
  985. .pull-right {
  986. float: right;
  987. }
  988. .scorebutton {
  989. width: 40px;
  990. height: 40px;
  991. cursor: pointer;
  992. color: rgb(77, 124, 196);
  993. border-radius: 15px;
  994. font-weight: 600;
  995. border: 1px solid rgb(77, 124, 196);
  996. text-align: center;
  997. }
  998. .scorebutton:hover {
  999. background: rgb(85, 191, 255);
  1000. color: white;
  1001. border-color: rgb(85, 191, 255);
  1002. }
  1003. .titlebutton {
  1004. border-radius: 15px;
  1005. cursor: pointer;
  1006. }
  1007. .titlebutton:hover {
  1008. background: yellow;
  1009. }
  1010. .title-font {
  1011. font-size: 14px;
  1012. font-weight: 800;
  1013. }
  1014. .first-board {
  1015. margin-top: 20px;
  1016. height: 50px;
  1017. border-bottom: 1px solid #ccc;
  1018. }
  1019. .board-title {
  1020. height: 50px;
  1021. width: 80px;
  1022. background: rgb(255, 109, 109);
  1023. border: 2px solid rgb(255, 109, 109);
  1024. text-align: center;
  1025. padding-top: 20px;
  1026. font-weight: 600;
  1027. border-top-left-radius: 15px;
  1028. border-bottom-left-radius: 15px;
  1029. float: left;
  1030. font-size: 30px;
  1031. line-height: 0.5;
  1032. }
  1033. .board-score {
  1034. height: 50px;
  1035. width: 110px;
  1036. border: 2px solid rgb(255, 109, 109);
  1037. margin-left: 80px;
  1038. text-align: center;
  1039. padding-top: 20px;
  1040. font-weight: 600;
  1041. color: rgb(255, 109, 109);
  1042. border-top-right-radius: 15px;
  1043. border-bottom-right-radius: 15px;
  1044. font-size: 30px;
  1045. line-height: 0.5;
  1046. }
  1047. .title-board {
  1048. margin-top: 20px;
  1049. }
  1050. .title-item-top {
  1051. color: white;
  1052. width: 50px;
  1053. height: 25px;
  1054. border: 1px solid rgb(77, 124, 196);
  1055. text-align: center;
  1056. line-height: 2;
  1057. font-size: 12px;
  1058. border-top-left-radius: 15px;
  1059. border-top-right-radius: 15px;
  1060. background: rgb(77, 124, 196);
  1061. border-bottom: 0px;
  1062. }
  1063. .title-item-bottom {
  1064. width: 50px;
  1065. height: 30px;
  1066. border: 1px solid rgb(77, 124, 196);
  1067. text-align: center;
  1068. font-size: 12px;
  1069. line-height: 2.5;
  1070. border-bottom-left-radius: 15px;
  1071. border-bottom-right-radius: 15px;
  1072. border-top: 0px;
  1073. font-weight: 600;
  1074. color: rgb(77, 124, 196);
  1075. display: block;
  1076. }
  1077. .active-text {
  1078. color: rgb(85, 191, 255) !important;
  1079. border-color: rgb(85, 191, 255);
  1080. }
  1081. .score-item {
  1082. line-height: 2.5;
  1083. }
  1084. textarea {
  1085. background: rgb(245, 245, 245);
  1086. border-radius: 10px;
  1087. outline: none;
  1088. }
  1089. .step-board {
  1090. margin-top: 20px;
  1091. border-bottom: 1px solid #ccc;
  1092. }
  1093. .problem-button {
  1094. border-bottom: 1px solid #ccc;
  1095. margin-bottom: 15px;
  1096. margin-top: 20px;
  1097. }
  1098. .remark-step {
  1099. height: 100px;
  1100. margin-top: 15px;
  1101. }
  1102. .box-card {
  1103. width: 160px;
  1104. height: 60px;
  1105. border: 1px solid rgb(77, 124, 196);
  1106. border-radius: 10px;
  1107. }
  1108. .item-title {
  1109. background: rgb(77, 124, 196);
  1110. color: white;
  1111. height: 25px;
  1112. border-top-left-radius: 10px;
  1113. border-top-right-radius: 10px;
  1114. font-size: 12px;
  1115. text-align: center;
  1116. }
  1117. .item-score {
  1118. height: 35px;
  1119. color: rgb(77, 124, 196);
  1120. font-weight: bold;
  1121. font-size: 15px;
  1122. text-align: center;
  1123. }
  1124. .item-number {
  1125. width: 52px;
  1126. height: 22px;
  1127. text-align: center;
  1128. line-height: 1.5;
  1129. }
  1130. .item-number2 {
  1131. width: 40px;
  1132. height: 22px;
  1133. border: 1px solid rgb(77, 124, 196);
  1134. border-right-color: white;
  1135. border-left-color: white;
  1136. text-align: center;
  1137. line-height: 1.5;
  1138. }
  1139. .item-number3 {
  1140. width: 62px;
  1141. height: 22px;
  1142. text-align: center;
  1143. line-height: 1.5;
  1144. }
  1145. .btn {
  1146. margin-top: 20px;
  1147. margin-bottom: 10px;
  1148. padding-right: 1px;
  1149. }
  1150. .score-btn {
  1151. background: rgb(85, 191, 255);
  1152. color: white;
  1153. border-color: rgb(85, 191, 255);
  1154. }
  1155. .remark-board {
  1156. cursor: pointer;
  1157. }
  1158. .el-button {
  1159. outline: none;
  1160. }
  1161. </style>