Picture.vue 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139
  1. <!-- -->
  2. <template>
  3. <div :class="['Big-Book-PictureBox']" v-if="isShowTemp">
  4. <!-- <ul class="Big-Book-PictureBox-item" v-for="(item,index) in curQue.queList" :key="index"> -->
  5. <h2>{{curQue.title}}</h2>
  6. <li v-for="(items, indexs) in curQue.option" :key="indexs">
  7. <span class="xuhao" v-if="items.xuhao">{{items.xuhao}}</span>
  8. <template v-if="ChildType != 'image_gdcy' && items.hanziSite == 'top'">
  9. <div class="hanzi-box hanzi-box-top" v-if="items.pinyin || items.hanzi">
  10. <span
  11. v-if="
  12. items.pinyin && (!items.pinyinSite || items.pinyinSite == 'top')
  13. "
  14. class="pinyin"
  15. >{{ items.pinyin }}</span
  16. >
  17. <p v-if="items.hanzi">{{ items.hanzi }}</p>
  18. <span
  19. v-if="items.pinyin && items.pinyinSite == 'bottom'"
  20. class="pinyin"
  21. >{{ items.pinyin }}</span
  22. >
  23. </div>
  24. </template>
  25. <div v-for="(itemss, indexss) in items.img_list" :key="indexss">
  26. <el-image
  27. :src="itemss.id"
  28. fit="scale-down"
  29. class="img_url"
  30. @click="playmicrophone(items.mp3_list[0].id, 'mp3')"
  31. >
  32. <div slot="placeholder" class="image-slot">
  33. <img src="../../../assets/common/icon-imgloading.png" />
  34. </div>
  35. </el-image>
  36. </div>
  37. <template
  38. v-if="
  39. ChildType != 'image_gdcy' &&
  40. (!items.hanziSite || items.hanziSite == 'bottom')
  41. "
  42. >
  43. <div class="hanzi-box" v-if="items.pinyin || items.hanzi">
  44. <span
  45. v-if="
  46. items.pinyin && (!items.pinyinSite || items.pinyinSite == 'top')
  47. "
  48. class="pinyin"
  49. >{{ items.pinyin }}</span
  50. >
  51. <p v-if="items.hanzi">{{ items.hanzi }}</p>
  52. <span
  53. v-if="items.pinyin && items.pinyinSite == 'bottom'"
  54. class="pinyin"
  55. >{{ items.pinyin }}</span
  56. >
  57. </div>
  58. </template>
  59. <template
  60. v-if="
  61. ChildType == 'image_input' ||
  62. ChildType == 'image_input_three' ||
  63. ChildType == 'image_wordInput'
  64. "
  65. >
  66. <template v-if="judgeAnswer == 'standardAnswer'">
  67. <input
  68. v-model="curQue.correct[0].input[0]"
  69. placeholder=""
  70. @blur="handleInput('input', 0)"
  71. :readonly="TaskModel == 'ANSWER'"
  72. maxlength="200"
  73. :class="['singleInput', 'userRight', inputAnswerClass('input', 0)]"
  74. />
  75. </template>
  76. <template v-else>
  77. <input
  78. v-model="curQue.Bookanswer[0].input.input[0].value"
  79. placeholder=""
  80. @blur="handleInput('input', 0)"
  81. :readonly="TaskModel == 'ANSWER'"
  82. maxlength="200"
  83. :class="['singleInput', inputAnswerClass('input', 0)]"
  84. />
  85. </template>
  86. </template>
  87. <!-- <input class="singleInput" placeholder="输入" @blur="handleInput(index,indexs)" v-if="fn_list_obj[index]&&fn_list_obj[index].indexOf('input')>-1"> -->
  88. <!-- 补齐输入 -->
  89. <template v-if="ChildType == 'image_gdcy'">
  90. <div class="fill-box">
  91. <b v-if="items.hanzi">{{ items.hanzi }}</b>
  92. <template v-if="judgeAnswer == 'standardAnswer'">
  93. <input
  94. v-model="curQue.correct[0].input[0]"
  95. placeholder=""
  96. @blur="handleInput('input', 0)"
  97. :readonly="true"
  98. maxlength="200"
  99. :class="inputAnswerClass('input', 0)"
  100. />
  101. </template>
  102. <template v-else>
  103. <input
  104. v-model="curQue.Bookanswer[0].input.input[0].value"
  105. placeholder=""
  106. @blur="handleInput('input', 0)"
  107. :readonly="TaskModel == 'ANSWER'"
  108. maxlength="200"
  109. :class="inputAnswerClass('input', 0)"
  110. />
  111. </template>
  112. </div>
  113. </template>
  114. <!-- 双输入 -->
  115. <template v-if="ChildType == 'image_dobleinput'">
  116. <div class="DoubleInput-box">
  117. <template v-if="judgeAnswer == 'standardAnswer'">
  118. <input
  119. placeholder=""
  120. v-model="curQue.correct[0].input[0]"
  121. :readonly="true"
  122. maxlength="200"
  123. :class="inputAnswerClass('input', 0)"
  124. />
  125. <input
  126. placeholder=""
  127. v-model="curQue.correct[0].input[1]"
  128. :readonly="true"
  129. maxlength="200"
  130. :class="inputAnswerClass('input', 1)"
  131. />
  132. </template>
  133. <template v-else>
  134. <input
  135. placeholder=""
  136. @blur="handleInput('input', 0)"
  137. v-model="curQue.Bookanswer[0].input.input[0].value"
  138. :readonly="TaskModel == 'ANSWER'"
  139. maxlength="200"
  140. :class="inputAnswerClass('input', 0)"
  141. />
  142. <input
  143. placeholder=""
  144. @blur="handleInput('input', 1)"
  145. v-model="curQue.Bookanswer[0].input.input[1].value"
  146. :readonly="TaskModel == 'ANSWER'"
  147. maxlength="200"
  148. :class="inputAnswerClass('input', 1)"
  149. />
  150. </template>
  151. </div>
  152. </template>
  153. <!-- 判断 -->
  154. <template v-if="ChildType == 'image_judge'">
  155. <div class="judge-box">
  156. <a
  157. :class="[
  158. 'right-btn',
  159. TaskModel != 'ANSWER' ? 'right-btn-hover' : '',
  160. judgeAnswerClass('true'),
  161. ]"
  162. @click="handleSelectJudge('true')"
  163. ></a>
  164. <a
  165. :class="[
  166. 'error-btn',
  167. TaskModel != 'ANSWER' ? 'error-btn-hover' : '',
  168. judgeAnswerClass('false'),
  169. ]"
  170. @click="handleSelectJudge('false')"
  171. ></a>
  172. </div>
  173. </template>
  174. <template
  175. v-if="ChildType == 'image_single' || ChildType == 'image_checkBox'"
  176. >
  177. <div class="option_main">
  178. <div
  179. v-for="(itemss, indexss) in items.option"
  180. :key="'op' + indexss"
  181. :class="[
  182. 'xxoption',
  183. 'option' + curQue.numberList.con,
  184. singleAnswerClass(indexss),
  185. checkBoxAnswerClass(indexss),
  186. ]"
  187. >
  188. <template v-if="judgeAnswer == 'standardAnswer'">
  189. <!-- 单选 -->
  190. <template v-if="ChildType == 'image_single'">
  191. <el-radio
  192. v-model="curQue.correct[0].single[0]"
  193. :label="indexss"
  194. :disabled="TaskModel == 'ANSWER'"
  195. @input="changeSingle"
  196. >
  197. <div
  198. class="hanzi-box hanzi-box-top"
  199. v-if="itemss.pinyin || itemss.hanzi"
  200. >
  201. <span
  202. v-if="
  203. itemss.pinyin &&
  204. (!items.pinyinSite || items.pinyinSite == 'top')
  205. "
  206. class="pinyin"
  207. >{{ itemss.pinyin }}</span
  208. >
  209. <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
  210. <span
  211. v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
  212. class="pinyin"
  213. >{{ itemss.pinyin }}</span
  214. >
  215. </div>
  216. </el-radio>
  217. </template>
  218. <!-- 复选 -->
  219. <template v-if="ChildType == 'image_checkBox'">
  220. <el-checkbox
  221. v-model="curQue.correct[0].checkBox"
  222. :label="indexss"
  223. :disabled="TaskModel == 'ANSWER'"
  224. >
  225. <div
  226. class="hanzi-box hanzi-box-top"
  227. v-if="itemss.pinyin || itemss.hanzi"
  228. >
  229. <span
  230. v-if="
  231. itemss.pinyin &&
  232. (!items.pinyinSite || items.pinyinSite == 'top')
  233. "
  234. class="pinyin"
  235. >{{ itemss.pinyin }}</span
  236. >
  237. <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
  238. <span
  239. v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
  240. class="pinyin"
  241. >{{ itemss.pinyin }}</span
  242. >
  243. </div>
  244. </el-checkbox>
  245. </template>
  246. </template>
  247. <template v-else>
  248. <!-- 单选 -->
  249. <template v-if="ChildType == 'image_single'">
  250. <el-radio
  251. v-model="curQue.Bookanswer[0].single[0].value"
  252. :label="indexss"
  253. :disabled="TaskModel == 'ANSWER'"
  254. @input="changeSingle"
  255. @click.native.prevent="overallClick(indexss)"
  256. >
  257. <div
  258. class="hanzi-box hanzi-box-top"
  259. v-if="itemss.pinyin || itemss.hanzi"
  260. >
  261. <span
  262. v-if="
  263. itemss.pinyin &&
  264. (!items.pinyinSite || items.pinyinSite == 'top')
  265. "
  266. class="pinyin"
  267. >{{ itemss.pinyin }}</span
  268. >
  269. <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
  270. <span
  271. v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
  272. class="pinyin"
  273. >{{ itemss.pinyin }}</span
  274. >
  275. </div>
  276. </el-radio>
  277. </template>
  278. <!-- 复选 -->
  279. <template v-if="ChildType == 'image_checkBox'">
  280. <el-checkbox
  281. v-model="curQue.Bookanswer[0].checkBox[0].value"
  282. :label="indexss"
  283. :disabled="TaskModel == 'ANSWER'"
  284. @change="changeCheckBox"
  285. >
  286. <div
  287. class="hanzi-box hanzi-box-top"
  288. v-if="itemss.pinyin || itemss.hanzi"
  289. >
  290. <span
  291. v-if="
  292. itemss.pinyin &&
  293. (!items.pinyinSite || items.pinyinSite == 'top')
  294. "
  295. class="pinyin"
  296. >{{ itemss.pinyin }}</span
  297. >
  298. <p v-if="itemss.hanzi">{{ itemss.hanzi }}</p>
  299. <span
  300. v-if="itemss.pinyin && items.pinyinSite == 'bottom'"
  301. class="pinyin"
  302. >{{ itemss.pinyin }}</span
  303. >
  304. </div>
  305. </el-checkbox>
  306. </template>
  307. </template>
  308. </div>
  309. </div>
  310. </template>
  311. <!-- 三件套 -->
  312. <div
  313. class="luyinVoice-box"
  314. v-if="
  315. items.mp3_list.length > 0 ||
  316. (fn_list_obj && fn_list_obj.indexOf('image_record') > -1) ||
  317. items.RecordControl
  318. "
  319. >
  320. <template v-if="items.mp3_list.length > 0">
  321. <span
  322. :class="['voice', mp3Play]"
  323. @click="playmicrophone(items.mp3_list[0].id, 'mp3')"
  324. ></span>
  325. </template>
  326. <Soundrecord
  327. @handleWav="handleWav"
  328. :answerRecordList="
  329. judgeAnswer != 'standardAnswer'
  330. ? curQue.Bookanswer[0].recordList
  331. : []
  332. "
  333. :TaskModel="TaskModel"
  334. :type="items.RecordControl ? items.RecordControl : 'normal'"
  335. class="luyin-box"
  336. :class="[items.RecordControl]"
  337. v-if="fn_list_obj.indexOf('image_record') > -1 || items.RecordControl"
  338. />
  339. <!-- <span :class="['luyin',microphoneStatus?'active':'']" @click="microphone"></span>
  340. <span :class="['play',hasMicro]" @click="playmicrophone(wavblob)"></span> -->
  341. </div>
  342. </li>
  343. <!-- </ul> -->
  344. </div>
  345. </template>
  346. <script>
  347. import Soundrecord from "../preview/Soundrecord.vue"; // 录音模板
  348. import Recorder from "js-audio-recorder"; //录音插件
  349. export default {
  350. components: { Soundrecord },
  351. props: ["curQue", "ChildType", "TaskModel", "judgeAnswer"],
  352. data() {
  353. return {
  354. fn_list_obj: "",
  355. answer: [],
  356. userAnswer: {
  357. input: { input: [] }, //输入
  358. judge: [], // 判断
  359. single: [],
  360. checkBox: [],
  361. recordList: [],
  362. }, // 记录用户答题内容
  363. recorder: new Recorder({
  364. sampleBits: 16, // 采样位数,支持 8 或 16,默认是16
  365. sampleRate: 16000, // 采样率,支持 11025、16000、22050、24000、44100、48000,根据浏览器默认值,我的chrome是48000
  366. numChannels: 1, // 声道,支持 1 或 2, 默认是1
  367. }),
  368. microphoneStatus: false,
  369. hasMicro: "", // 录音后的样式class
  370. wavblob: null,
  371. audio: new window.Audio(),
  372. oldUrl: null, // 存储上个播放音频地址
  373. mp3Play: "", // 音频播放
  374. userErrorNumberTotal: 0,
  375. };
  376. },
  377. computed: {
  378. isShowTemp() {
  379. let _this = this;
  380. let bool = false;
  381. if (_this.curQue && _this.curQue.Bookanswer) {
  382. if (_this.judgeAnswer == "standardAnswer") {
  383. if (_this.userErrorNumberTotal > 0) {
  384. bool = true;
  385. } else {
  386. bool = false;
  387. }
  388. } else {
  389. bool = true;
  390. }
  391. }
  392. return bool;
  393. },
  394. inputAnswerClass() {
  395. return function (key, index) {
  396. let _this = this;
  397. let classname = "";
  398. if (_this.judgeAnswer == "standardAnswer") {
  399. classname = "userRight";
  400. } else if (
  401. _this.judgeAnswer == "studentAnswer" ||
  402. _this.judgeAnswer == "userAnswer"
  403. ) {
  404. let answer = _this.curQue.Bookanswer[0].input.input[index].value;
  405. let correct = _this.curQue.correct[0][key][index];
  406. if (correct) {
  407. if (answer == correct) {
  408. classname = "userRight";
  409. } else {
  410. classname = "userError";
  411. }
  412. }
  413. }
  414. return classname;
  415. };
  416. },
  417. judgeAnswerClass() {
  418. return function (type) {
  419. let _this = this;
  420. let classname = "";
  421. let answer = _this.curQue.Bookanswer[0].judge[0].value;
  422. let correct = _this.curQue.correct[0].judge[0];
  423. if (_this.judgeAnswer == "standardAnswer") {
  424. if (correct == type) {
  425. classname = "userRight_" + type;
  426. }
  427. } else if (
  428. _this.judgeAnswer == "studentAnswer" ||
  429. _this.judgeAnswer == "userAnswer"
  430. ) {
  431. if (answer == type) {
  432. if (correct) {
  433. if (answer == correct) {
  434. classname = "userRight_" + type;
  435. } else {
  436. classname = "userError_" + type;
  437. }
  438. } else {
  439. classname = "active";
  440. }
  441. }
  442. } else {
  443. if (answer == type) {
  444. classname = "active";
  445. }
  446. }
  447. return classname;
  448. };
  449. },
  450. singleModel() {
  451. let _this = this;
  452. let result =
  453. _this.judgeAnswer == "standardAnswer"
  454. ? _this.curQue.correct[0].single[0]
  455. : _this.curQue.Bookanswer[0].single[0].value;
  456. return result;
  457. },
  458. singleAnswerClass() {
  459. return function (index) {
  460. let _this = this;
  461. let classname = "";
  462. if (_this.ChildType == "image_single") {
  463. let answer = _this.curQue.Bookanswer[0].single[0].value;
  464. let correct = _this.curQue.correct[0].single[0];
  465. if (_this.judgeAnswer == "standardAnswer") {
  466. if ((correct || correct === 0) && index === correct) {
  467. classname = "userRight";
  468. }
  469. } else if (
  470. _this.judgeAnswer == "studentAnswer" ||
  471. _this.judgeAnswer == "userAnswer"
  472. ) {
  473. if (correct || correct === 0) {
  474. if (answer === correct) {
  475. if (correct === index) {
  476. classname = "userRight";
  477. }
  478. } else {
  479. if (answer === index) {
  480. classname = "userError";
  481. }
  482. }
  483. }
  484. }
  485. }
  486. return classname;
  487. };
  488. },
  489. checkBoxAnswerClass() {
  490. return function (index) {
  491. let _this = this;
  492. let classname = "";
  493. if (_this.ChildType == "image_checkBox") {
  494. let answer = _this.curQue.Bookanswer[0].checkBox[0].value;
  495. let correct = _this.curQue.correct[0].checkBox;
  496. if (_this.judgeAnswer == "standardAnswer") {
  497. if (correct && correct.length > 0) {
  498. if (correct.indexOf(index) > -1) {
  499. classname = "userRight";
  500. }
  501. }
  502. } else if (
  503. _this.judgeAnswer == "studentAnswer" ||
  504. _this.judgeAnswer == "userAnswer"
  505. ) {
  506. if (correct && correct.length > 0) {
  507. if (correct.indexOf(index) > -1 && answer.indexOf(index) > -1) {
  508. classname = "userRight";
  509. } else if (
  510. answer.indexOf(index) > -1 &&
  511. correct.indexOf(index) < 0
  512. ) {
  513. classname = "userError";
  514. }
  515. }
  516. }
  517. }
  518. return classname;
  519. };
  520. },
  521. },
  522. watch: {},
  523. //方法集合
  524. methods: {
  525. handleFnList() {
  526. let _this = this;
  527. _this.userErrorNumberTotal = 0;
  528. if (!_this.curQue.Bookanswer) {
  529. _this.curQue.correct.forEach((item, index) => {
  530. //单输入/补全输入
  531. if (
  532. _this.ChildType == "image_input" ||
  533. _this.ChildType == "image_gdcy" ||
  534. _this.ChildType == "image_input_three" ||
  535. _this.ChildType == "image_wordInput"
  536. ) {
  537. let obj = {
  538. input: [
  539. {
  540. value: "",
  541. userAnswerJudge:
  542. item.input[0] || item.input[0] === 0
  543. ? "[JUDGE##F##JUDGE]"
  544. : "",
  545. },
  546. ],
  547. };
  548. _this.userAnswer.input = JSON.parse(JSON.stringify(obj));
  549. }
  550. //双输入
  551. if (_this.ChildType == "image_dobleinput") {
  552. let obj = {
  553. input: [
  554. {
  555. value: "",
  556. userAnswerJudge:
  557. item.input[0] || item.input[0] === 0
  558. ? "[JUDGE##F##JUDGE]"
  559. : "",
  560. },
  561. {
  562. value: "",
  563. userAnswerJudge:
  564. item.input[1] || item.input[1] === 0
  565. ? "[JUDGE##F##JUDGE]"
  566. : "",
  567. },
  568. ],
  569. };
  570. this.userAnswer.input = JSON.parse(JSON.stringify(obj));
  571. }
  572. //判断
  573. if (_this.ChildType == "image_judge") {
  574. let obj_judge = {
  575. value: "",
  576. userAnswerJudge: item.judge.length > 0 ? "[JUDGE##F##JUDGE]" : "",
  577. };
  578. _this.userAnswer.judge.push(JSON.parse(JSON.stringify(obj_judge)));
  579. }
  580. //单选
  581. if (_this.ChildType == "image_single") {
  582. let obj_single = {
  583. value: "",
  584. userAnswerJudge:
  585. item.single.length > 0 ? "[JUDGE##F##JUDGE]" : "",
  586. };
  587. _this.userAnswer.single.push(
  588. JSON.parse(JSON.stringify(obj_single))
  589. );
  590. }
  591. //单选
  592. if (_this.ChildType == "image_checkBox") {
  593. let obj_box = {
  594. value: [],
  595. userAnswerJudge:
  596. item.checkBox.length > 0 ? "[JUDGE##F##JUDGE]" : "",
  597. };
  598. _this.userAnswer.checkBox.push(JSON.parse(JSON.stringify(obj_box)));
  599. }
  600. });
  601. _this.$set(_this.curQue, "Bookanswer", []);
  602. this.curQue.Bookanswer.push(
  603. JSON.parse(JSON.stringify(this.userAnswer))
  604. );
  605. } else {
  606. let BookanswerStr = JSON.stringify(_this.curQue.Bookanswer);
  607. let errReg = /\[JUDGE##F##JUDGE\]/g;
  608. if (errReg.test(BookanswerStr)) {
  609. let errorArr = BookanswerStr.match(/\[JUDGE##F##JUDGE\]/g);
  610. _this.userErrorNumberTotal = errorArr.length;
  611. }
  612. }
  613. let obj = "";
  614. this.curQue.fn_list.forEach((node) => {
  615. if (node.isFn) {
  616. obj += node.type + ",";
  617. }
  618. });
  619. this.fn_list_obj = obj;
  620. },
  621. // 修改正确选项中得某一个为正确答案
  622. changAnswer(index, type) {
  623. if (type == "single") {
  624. } else if (type == "checkBox") {
  625. let correct = [];
  626. this.curQue.option.forEach((item, i) => {
  627. if (item.isChecked) {
  628. correct.push(i);
  629. }
  630. });
  631. this.answer[0].checkBox = correct;
  632. } else if (type == "judge") {
  633. //console.log(this.answer);
  634. }
  635. },
  636. // 去掉前后空格
  637. handleInput(key, indexs) {
  638. if (indexs || indexs === 0) {
  639. let res = this.curQue.Bookanswer[0][key].input[indexs].value.trim();
  640. this.$set(this.curQue.Bookanswer[0][key].input[indexs], "value", res);
  641. let hasError = false,
  642. hasRight = false;
  643. this.curQue.correct[0].input.forEach((item, index) => {
  644. let answer = this.curQue.Bookanswer[0][key].input[index].value;
  645. if (item) {
  646. if (item != answer) {
  647. this.$set(
  648. this.curQue.Bookanswer[0][key].input[index],
  649. "userAnswerJudge",
  650. "[JUDGE##F##JUDGE]"
  651. );
  652. } else {
  653. this.$set(
  654. this.curQue.Bookanswer[0][key].input[index],
  655. "userAnswerJudge",
  656. "[JUDGE##T##JUDGE]"
  657. );
  658. }
  659. }
  660. });
  661. // if (hasError) {
  662. // this.$set(
  663. // this.curQue.Bookanswer[0][key],
  664. // "userAnswerJudge",
  665. // "[JUDGE##F##JUDGE]"
  666. // );
  667. // }
  668. // if (!hasError && hasRight) {
  669. // this.$set(
  670. // this.curQue.Bookanswer[0][key],
  671. // "userAnswerJudge",
  672. // "[JUDGE##T##JUDGE]"
  673. // );
  674. // }
  675. } else {
  676. this.curQue.Bookanswer[0][key] = this.curQue.Bookanswer[0][key].trim();
  677. }
  678. this.$forceUpdate();
  679. },
  680. overallClick(value){
  681. this.curQue.Bookanswer[0].single[0].value = value===this.curQue.Bookanswer[0].single[0].value?'':value
  682. this.changeSingle(this.curQue.Bookanswer[0].single[0].value)
  683. },
  684. changeSingle(value) {
  685. let _this = this;
  686. let correct = _this.curQue.correct[0].single[0];
  687. if (correct || correct == 0) {
  688. if (value === correct) {
  689. _this.$set(
  690. _this.curQue.Bookanswer[0].single[0],
  691. "userAnswerJudge",
  692. "[JUDGE##T##JUDGE]"
  693. );
  694. } else {
  695. _this.$set(
  696. _this.curQue.Bookanswer[0].single[0],
  697. "userAnswerJudge",
  698. "[JUDGE##F##JUDGE]"
  699. );
  700. }
  701. }
  702. _this.$forceUpdate();
  703. },
  704. changeCheckBox() {
  705. let _this = this;
  706. let value = _this.curQue.Bookanswer[0].checkBox[0].value;
  707. let valueStr = value.sort().toString();
  708. let correct = _this.curQue.correct[0].checkBox;
  709. let correctStr = correct.sort().toString();
  710. if (correct && correct.length > 0) {
  711. if (valueStr == correctStr) {
  712. _this.$set(
  713. _this.curQue.Bookanswer[0].checkBox[0],
  714. "userAnswerJudge",
  715. "[JUDGE##T##JUDGE]"
  716. );
  717. } else {
  718. _this.$set(
  719. _this.curQue.Bookanswer[0].checkBox[0],
  720. "userAnswerJudge",
  721. "[JUDGE##F##JUDGE]"
  722. );
  723. }
  724. }
  725. _this.$forceUpdate();
  726. },
  727. playmicrophone(url, type) {
  728. if (url) {
  729. let _this = this;
  730. if (!this.audio.paused) {
  731. this.audio.pause();
  732. if (type == "mp3") {
  733. _this.mp3Play = "";
  734. }
  735. } else if (this.audio.paused && _this.oldUrl == url) {
  736. _this.audio.play();
  737. if (type == "mp3") {
  738. _this.mp3Play = "active";
  739. }
  740. } else {
  741. _this.audio.pause();
  742. _this.audio.load();
  743. if (type == "mp3") {
  744. _this.mp3Play = "active";
  745. _this.audio.src = url;
  746. }
  747. _this.oldUrl = url;
  748. _this.audio.play();
  749. }
  750. }
  751. },
  752. // 判断题选择
  753. handleSelectJudge(obj) {
  754. let _this = this;
  755. if (_this.TaskModel != "ANSWER" || !judgeAnswer) {
  756. _this.$set(_this.curQue.Bookanswer[0].judge[0], "value", obj);
  757. let correct = _this.curQue.correct[0].judge[0];
  758. if (correct) {
  759. if (correct == obj) {
  760. _this.$set(
  761. _this.curQue.Bookanswer[0].judge[0],
  762. "userAnswerJudge",
  763. "[JUDGE##T##JUDGE]"
  764. );
  765. } else {
  766. _this.$set(
  767. _this.curQue.Bookanswer[0].judge[0],
  768. "userAnswerJudge",
  769. "[JUDGE##F##JUDGE]"
  770. );
  771. }
  772. }
  773. }
  774. _this.$forceUpdate();
  775. },
  776. handleWav(list, tmIndex) {
  777. tmIndex = tmIndex ? tmIndex : 0;
  778. this.$set(this.curQue.Bookanswer[tmIndex], "recordList", list);
  779. },
  780. },
  781. //生命周期 - 创建完成(可以访问当前this实例)
  782. created() {},
  783. //生命周期 - 挂载完成(可以访问DOM元素)
  784. mounted() {
  785. if (this.curQue) {
  786. this.handleFnList();
  787. let obj = {
  788. single: [],
  789. checkBox: [],
  790. judge: [],
  791. input: [],
  792. spell: [],
  793. };
  794. this.answer.push(obj);
  795. }
  796. let _this = this;
  797. _this.audio.addEventListener("ended", function () {
  798. _this.mp3Play = "";
  799. _this.hasMicro = "normal";
  800. });
  801. },
  802. beforeCreate() {}, //生命周期 - 创建之前
  803. beforeMount() {}, //生命周期 - 挂载之前
  804. beforeUpdate() {}, //生命周期 - 更新之前
  805. updated() {}, //生命周期 - 更新之后
  806. beforeDestroy() {}, //生命周期 - 销毁之前
  807. destroyed() {}, //生命周期 - 销毁完成
  808. activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
  809. };
  810. </script>
  811. <style lang='scss' scoped>
  812. //@import url(); 引入公共css类
  813. .Big-Book-PictureBox {
  814. width: 100%;
  815. margin-bottom: 24px;
  816. // &.PictureBoxFlex{
  817. // display: flex;
  818. // justify-content: space-between;
  819. // .Big-Book-PictureBox-item{
  820. // width: 384px;
  821. // }
  822. // }
  823. // .Big-Book-PictureBox-item{
  824. // list-style: none;
  825. // background: #F3F3F3;
  826. // border-radius: 8px;
  827. // padding: 16px;
  828. // margin: 0;
  829. // display: flex;
  830. // flex-flow: wrap;
  831. h2{
  832. word-break: break-word;
  833. font-family: 'robot';
  834. font-weight: 700;
  835. font-size: 20px;
  836. line-height: 150%;
  837. margin: 0 0 16px;
  838. color: #000000;
  839. }
  840. li {
  841. list-style: none;
  842. padding: 8px;
  843. border-radius: 8px;
  844. border: 1px solid rgba(0, 0, 0, 0.1);
  845. background: #fff;
  846. position: relative;
  847. .xuhao{
  848. position: absolute;
  849. top: -4px;
  850. left: -4px;
  851. font-weight: 400;
  852. font-size: 12px;
  853. line-height: 14px;
  854. font-family: 'robot';
  855. color: #FFFFFF;
  856. padding: 1px 4px;
  857. background: #e35454;
  858. border-radius: 8px;
  859. display: block;
  860. min-width: 16px;
  861. text-align: center;
  862. }
  863. .option_main {
  864. display: flex;
  865. flex-wrap: wrap;
  866. .xxoption {
  867. display: flex;
  868. align-items: center;
  869. justify-content: center;
  870. margin-bottom: 8px;
  871. border: 1px transparent solid;
  872. border-radius: 4px;
  873. &.userRight {
  874. background: rgba(44, 167, 103, 0.1);
  875. border-color: #2ca767;
  876. }
  877. &.userError {
  878. background: rgba(237, 52, 45, 0.1);
  879. border-color: #ed342d;
  880. }
  881. }
  882. .option1 {
  883. width: 100%;
  884. }
  885. .option2 {
  886. width: 50%;
  887. }
  888. .option3 {
  889. width: 33.33%;
  890. }
  891. .option4 {
  892. width: 25%;
  893. }
  894. }
  895. .hanzi-box {
  896. margin-top: 8px;
  897. &.hanzi-box-top {
  898. margin-top: 0px;
  899. }
  900. > span.pinyin {
  901. display: block;
  902. text-align: center;
  903. font-family: "GB-PINYINOK-B";
  904. font-size: 14px;
  905. line-height: 1.3;
  906. color: #000000;
  907. }
  908. > p {
  909. color: #000000;
  910. font-size: 16px;
  911. line-height: 150%;
  912. text-align: center;
  913. margin: 0;
  914. width: 100%;
  915. font-family: "FZJCGFKTK";
  916. }
  917. }
  918. input {
  919. flex: 1;
  920. width: 100%;
  921. border: 1px solid rgba(0, 0, 0, 0.15);
  922. box-sizing: border-box;
  923. border-radius: 4px;
  924. outline: none;
  925. height: 32px;
  926. padding: 4px 8px;
  927. color: #000000;
  928. text-align: center;
  929. font-size: 16px;
  930. line-height: 150%;
  931. &.singleInput {
  932. margin-top: 8px;
  933. }
  934. &.userRight {
  935. color: #2ca767;
  936. }
  937. &.userError {
  938. color: #ed342d;
  939. }
  940. }
  941. .luyinVoice-box {
  942. width: 100%;
  943. margin-top: 8px;
  944. display: flex;
  945. -ms-flex-pack: justify;
  946. align-items: center;
  947. span {
  948. width: 24px;
  949. height: 24px;
  950. background-position: center;
  951. background-repeat: no-repeat;
  952. background-size: 24px;
  953. margin-right: 8px;
  954. cursor: pointer;
  955. &:first-child {
  956. margin-left: 0px;
  957. }
  958. &.voice {
  959. background-image: url("../../../assets/newImage/common/icon-voice-red.png");
  960. }
  961. &.active {
  962. background-image: url("../../../assets/newImage/common/icon-voice-play-red.png");
  963. }
  964. // &.luyin{
  965. // background-image: url('../../../assets/newImage/common/luyin.png');
  966. // &.active {
  967. // background-image: url('../../../assets/newImage/common/luyin-active.png');
  968. // }
  969. // }
  970. // &.play{
  971. // background-image: url('../../../assets/newImage/common/luyin-play.png');
  972. // &.normal {
  973. // background-image: url('../../../assets/newImage/common/luyin-play-active.png');
  974. // }
  975. // &.stop {
  976. // background-image: url('../../../assets/newImage/common/luyin-play-stop.png');
  977. // }
  978. // }
  979. }
  980. .luyin-box {
  981. flex: 1;
  982. justify-content: start;
  983. padding: 0 12px;
  984. border: 1px solid rgba(0, 0, 0, 0.1);
  985. border-radius: 8px;
  986. &.mini {
  987. width: 64px;
  988. }
  989. &.normal {
  990. width: 129px;
  991. }
  992. &.pro {
  993. width: 200px;
  994. }
  995. &.promax {
  996. width: 280px;
  997. }
  998. }
  999. }
  1000. .fill-box {
  1001. display: flex;
  1002. align-items: center;
  1003. margin-top: 8px;
  1004. b {
  1005. margin-right: 8px;
  1006. color: #000000;
  1007. font-weight: normal;
  1008. font-size: 16px;
  1009. }
  1010. }
  1011. .DoubleInput-box {
  1012. display: flex;
  1013. align-items: center;
  1014. margin-top: 8px;
  1015. > input:first-child {
  1016. margin-right: 8px;
  1017. }
  1018. }
  1019. .el-radio,
  1020. .el-checkbox {
  1021. // width: 100%;
  1022. // margin: 8px 0 0;
  1023. // text-align: center;
  1024. // height: 32px;
  1025. // line-height: 32px;
  1026. margin-right: 8px;
  1027. }
  1028. .judge-box {
  1029. margin-top: 8px;
  1030. display: flex;
  1031. justify-content: center;
  1032. a {
  1033. width: 70px;
  1034. height: 32px;
  1035. background: #f7f7f7 url("../../../assets/newImage/common/right-btn.png")
  1036. center no-repeat;
  1037. background-size: 24px;
  1038. border-radius: 4px;
  1039. border: 1px solid #f7f7f7;
  1040. &.right-btn-hover:hover,
  1041. &.active {
  1042. background-color: #e5fff0;
  1043. border-color: #00c850;
  1044. }
  1045. &.error-btn {
  1046. background: #f7f7f7
  1047. url("../../../assets/newImage/common/error-btn.png") center
  1048. no-repeat;
  1049. background-size: 24px;
  1050. margin-left: 4px;
  1051. &.error-btn-hover:hover,
  1052. &.active {
  1053. background-color: #ffe5e5;
  1054. border-color: #de4444;
  1055. }
  1056. }
  1057. &.userRight_true {
  1058. background-color: rgba(44, 167, 103, 0.1);
  1059. border: 1px solid #2ca767;
  1060. }
  1061. &.userError_true {
  1062. border: 1px solid #ed342d;
  1063. background: rgba(237, 52, 45, 0.1)
  1064. url("../../../assets/newImage/common/judge-dui.png") center
  1065. no-repeat;
  1066. background-size: 24px;
  1067. }
  1068. &.userRight_false {
  1069. border: 1px solid #2ca767;
  1070. background: rgba(44, 167, 103, 0.1)
  1071. url("../../../assets/newImage/common/judge-cuo.png") center
  1072. no-repeat;
  1073. background-size: 24px;
  1074. }
  1075. &.userError_false {
  1076. background-color: rgba(237, 52, 45, 0.1);
  1077. border: 1px solid #ed342d;
  1078. }
  1079. }
  1080. }
  1081. }
  1082. .img_url {
  1083. width: 100%;
  1084. height: 128px;
  1085. cursor: pointer;
  1086. }
  1087. // }
  1088. }
  1089. .NNPE-tableList-tr-last {
  1090. .Big-Book-PictureBox {
  1091. margin-bottom: 0;
  1092. }
  1093. }
  1094. .NPC-Big-Book-preview-green {
  1095. .Big-Book-PictureBox {
  1096. li{
  1097. .xuhao{
  1098. background: #24b99e;
  1099. }
  1100. }
  1101. }
  1102. }
  1103. .NPC-Big-Book-preview-brown {
  1104. .Big-Book-PictureBox {
  1105. li{
  1106. .xuhao{
  1107. background: #bd8865;
  1108. }
  1109. }
  1110. }
  1111. }
  1112. </style>
  1113. <style lang="scss">
  1114. ul,
  1115. li {
  1116. list-style: none;
  1117. padding: 0;
  1118. margin: 0;
  1119. }
  1120. .Big-Book-PictureBox {
  1121. .el-checkbox__label,
  1122. .el-radio__label {
  1123. padding: 0;
  1124. }
  1125. }
  1126. .xxoption {
  1127. label {
  1128. display: flex;
  1129. justify-content: center;
  1130. align-items: center;
  1131. > .el-radio__label {
  1132. margin-left: 8px;
  1133. }
  1134. }
  1135. }
  1136. </style>