TpScoreBoard.vue 33 KB

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