WordPhrase.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  1. <template>
  2. <div class="NPC-zhedie NPC-zhedie-phone" v-if="curQue">
  3. <div :class="curQue.titleBg == 'white' ? 'topTitleWhite' : 'topTitle'">
  4. <div class="NPC-top-left">
  5. <template v-if="curQue.conDetail && curQue.conDetail.sentence">
  6. <div class="item-intro">
  7. <OneSentenceTemp
  8. :detail="curQue.conDetail"
  9. :TaskModel="TaskModel"
  10. :Bookanswer="[]"
  11. :correctAnswer="[]"
  12. :isInput="false"
  13. :fn_check_list="[]"
  14. :pyNumber="0"
  15. :record_check="[]"
  16. :maxFontsize="baseSizePhone"
  17. />
  18. </div>
  19. </template>
  20. <span
  21. class="NPC-topTitle-text"
  22. v-else
  23. :style="{
  24. fontSize: baseSizePhone + 2 + 'px'
  25. }"
  26. >{{ curQue.title }}</span
  27. >
  28. <!-- <span
  29. :class="['NPC-play-all', playClass]"
  30. @click.stop="playNewwords"
  31. ></span> -->
  32. </div>
  33. <div class="NPC-top-right" @click="handleChangeTab">
  34. <span
  35. class="NPC-top-right-text"
  36. :style="{
  37. fontSize: baseSizePhone + 'px'
  38. }"
  39. >{{ wordShow ? "收起" : "展开" }}</span
  40. >
  41. <template v-if="curQue.titleBg == 'white'">
  42. <img
  43. v-if="wordShow"
  44. src="../../../assets/NPC/down-black.png"
  45. alt=""
  46. />
  47. <img v-else src="../../../assets/NPC/up-black.png" alt="" />
  48. </template>
  49. <template v-else>
  50. <img v-if="wordShow" src="../../../assets/NPC/down.png" alt="" />
  51. <img v-else src="../../../assets/NPC/up.png" alt="" />
  52. </template>
  53. </div>
  54. </div>
  55. <el-collapse-transition>
  56. <div
  57. class="NPC-word-list"
  58. v-if="curQue.option && curQue.option.length > 0"
  59. v-show="wordShow"
  60. >
  61. <div
  62. class="aduioLine-box"
  63. v-if="
  64. curQue.mp3_list &&
  65. curQue.mp3_list.length > 0 &&
  66. curQue.mp3_list[0].id
  67. "
  68. >
  69. <AudioLine
  70. :audioId="'SelectYinjieAudio' + indexStr"
  71. :mp3="curQue.mp3_list[0].id"
  72. :getCurTime="getCurTime"
  73. :themeColor="themeColor"
  74. :ed="ed"
  75. type="audioLine"
  76. ref="audioLine"
  77. @handleListenRead="handleListenRead"
  78. />
  79. </div>
  80. <ul class="NPC-word-table" cellspacing="0" border="0" cellpadding="0">
  81. <li
  82. class="NPC-word-tr"
  83. v-for="(item, index) in curQue.option"
  84. :key="'curQue.option' + index"
  85. >
  86. <div
  87. :class="[
  88. 'NPC-word-row',
  89. playClass && mp3_index == sItem.sIndex ? 'active' : '',
  90. curTime >= sItem.bg && curTime < sItem.ed && stopAudioS
  91. ? 'active'
  92. : ''
  93. ]"
  94. v-for="(sItem, sIndex) in item"
  95. :key="'curQue.option.child' + sIndex"
  96. >
  97. <div class="content-box">
  98. <div
  99. style="display: flex;flex-flow: wrap; width: 100%; gap: 10px;"
  100. >
  101. <template v-if="sItem.bg || sItem.ed">
  102. <a
  103. :class="[
  104. 'play-btn',
  105. curTime >= sItem.bg && curTime < sItem.ed && stopAudioS
  106. ? 'active'
  107. : ''
  108. ]"
  109. @click="handleChangeTime(sItem.bg, sItem.ed)"
  110. ></a>
  111. </template>
  112. <template
  113. v-else-if="
  114. sItem.mp3_list &&
  115. sItem.mp3_list.length > 0 &&
  116. sItem.mp3_list[0].id
  117. "
  118. >
  119. <span
  120. :class="[
  121. themeColor == 'green'
  122. ? 'NPC-play-btn-green'
  123. : themeColor == 'red'
  124. ? 'NPC-play-btn-red'
  125. : 'NPC-play-btn-brown',
  126. playClass && mp3_index == sItem.sIndex ? 'active' : ''
  127. ]"
  128. @click="palyAudio(sItem.sIndex)"
  129. ></span>
  130. <audio
  131. :id="'word' + indexStr + sItem.sIndex"
  132. :src="sItem.mp3_list[0].id"
  133. ></audio>
  134. </template>
  135. <template v-else>
  136. <span style="width: 16px; height: 16px"></span>
  137. </template>
  138. <div class="tabNum-box">
  139. <template v-if="sItem.mIndex == 0 || sItem.number">
  140. <b
  141. class="tabNum"
  142. :style="{
  143. fontSize: baseSizePhone - 2 + 'px'
  144. }"
  145. >{{ sItem.number ? sItem.number : index + 1 }}</b
  146. >
  147. </template>
  148. <div
  149. v-else
  150. style="width: 16px; height: 16px; margin-left: 8px"
  151. ></div>
  152. <img
  153. v-if="sItem.starFlag"
  154. class="star-label"
  155. :src="
  156. require('../../../assets/NPC/asterisk-' +
  157. themeColor +
  158. '.png')
  159. "
  160. />
  161. </div>
  162. <template
  163. v-if="
  164. sItem.pinyin_site &&
  165. (sItem.pinyin_site == 'top' ||
  166. sItem.pinyin_site == 'bottom')
  167. "
  168. >
  169. <div class="NPC-word-tab-box">
  170. <span
  171. class="NPC-word-tab-common NPC-word-tab-pinyin"
  172. :class="[
  173. sItem.motif_color
  174. ? 'NPC-word-tab-pinyin-' + themeColor
  175. : ''
  176. ]"
  177. :style="{
  178. fontSize: baseSizePhone + 'px'
  179. }"
  180. v-if="sItem.pinyin_site == 'top'"
  181. >
  182. {{ sItem.pinyin }}
  183. </span>
  184. <span
  185. class="NPC-word-tab-common NPC-word-tab-word"
  186. :class="[
  187. sItem.motif_color
  188. ? 'NPC-word-tab-word-' + themeColor
  189. : '',
  190. curQue.whiteSpace ? 'NPC-word-tab-word-break' : ''
  191. ]"
  192. :style="{
  193. fontSize: baseSizePhone + 'px'
  194. }"
  195. >
  196. {{ sItem.new_word }}
  197. </span>
  198. <span
  199. class="NPC-word-tab-common NPC-word-tab-pinyin"
  200. :class="[
  201. sItem.motif_color
  202. ? 'NPC-word-tab-pinyin-' + themeColor
  203. : ''
  204. ]"
  205. :style="{
  206. fontSize: baseSizePhone + 'px'
  207. }"
  208. v-if="sItem.pinyin_site == 'bottom'"
  209. >
  210. {{ sItem.pinyin }}
  211. </span>
  212. </div>
  213. <span
  214. class="NPC-word-tab-common NPC-word-tab-cixing"
  215. :class="[
  216. /[\u4E00-\u9FA5\uF900-\uFA2D]/.test(sItem.cixing)
  217. ? 'hasCn'
  218. : '',
  219. sItem.motif_color
  220. ? 'NPC-word-tab-cixing-' + themeColor
  221. : ''
  222. ]"
  223. :style="{
  224. fontSize: baseSizePhone + 'px'
  225. }"
  226. v-html="sItem.cixing"
  227. ></span>
  228. </template>
  229. <template v-else>
  230. <span
  231. class="NPC-word-tab-common NPC-word-tab-pinyin"
  232. :class="[
  233. sItem.motif_color
  234. ? 'NPC-word-tab-pinyin-' + themeColor
  235. : ''
  236. ]"
  237. :style="{
  238. fontSize: baseSizePhone + 'px'
  239. }"
  240. v-if="!sItem.pinyin_site || sItem.pinyin_site == 'first'"
  241. >
  242. {{ sItem.pinyin }}
  243. </span>
  244. <span
  245. class="NPC-word-tab-common NPC-word-tab-word"
  246. :class="[
  247. sItem.motif_color
  248. ? 'NPC-word-tab-word-' + themeColor
  249. : '',
  250. curQue.whiteSpace ? 'NPC-word-tab-word-break' : ''
  251. ]"
  252. :style="{
  253. fontSize: baseSizePhone + 'px'
  254. }"
  255. >
  256. {{ sItem.new_word }}
  257. </span>
  258. <span
  259. class="NPC-word-tab-common NPC-word-tab-pinyin"
  260. :class="[
  261. sItem.motif_color
  262. ? 'NPC-word-tab-pinyin-' + themeColor
  263. : ''
  264. ]"
  265. :style="{
  266. fontSize: baseSizePhone + 'px'
  267. }"
  268. v-if="sItem.pinyin_site == 'last'"
  269. >
  270. {{ sItem.pinyin }}
  271. </span>
  272. <span
  273. class="NPC-word-tab-common NPC-word-tab-cixing"
  274. :class="[
  275. /[\u4E00-\u9FA5\uF900-\uFA2D]/.test(sItem.cixing)
  276. ? 'hasCn'
  277. : '',
  278. sItem.motif_color
  279. ? 'NPC-word-tab-cixing-' + themeColor
  280. : ''
  281. ]"
  282. :style="{
  283. fontSize: baseSizePhone + 'px'
  284. }"
  285. v-html="sItem.cixing"
  286. ></span>
  287. </template>
  288. </div>
  289. <span
  290. class="NPC-word-tab-common NPC-word-tab-def"
  291. :class="[
  292. sItem.motif_color ? 'NPC-word-tab-def-' + themeColor : ''
  293. ]"
  294. :style="{
  295. fontSize: baseSizePhone + 'px'
  296. }"
  297. v-html="sItem.def_str"
  298. ></span>
  299. <div v-if="sItem.collocation" class="collocation">
  300. <span
  301. :style="{
  302. fontSize: baseSizePhone + 'px'
  303. }"
  304. >搭配:</span
  305. ><b
  306. v-html="sItem.collocation"
  307. :style="{
  308. fontSize: baseSizePhone + 'px'
  309. }"
  310. ></b>
  311. </div>
  312. <div
  313. v-if="
  314. sItem.liju_list &&
  315. sItem.liju_list.length > 0 &&
  316. sItem.liju_list[0]
  317. "
  318. class="collocation"
  319. >
  320. <span
  321. :style="{
  322. fontSize: baseSizePhone + 'px'
  323. }"
  324. >例句:</span
  325. >
  326. <div>
  327. <b
  328. v-html="items"
  329. v-for="(items, indexs) in sItem.liju_list"
  330. :key="indexs"
  331. :style="{
  332. fontSize: baseSizePhone + 'px'
  333. }"
  334. ></b>
  335. </div>
  336. </div>
  337. </div>
  338. <div class="operate-box">
  339. <span v-if="curQue.type == 'NewWord_chs'">
  340. <Soundrecord
  341. :tmIndex="index"
  342. :tmsIndex="sIndex"
  343. :TaskModel="TaskModel"
  344. @handleWav="handleWav"
  345. :modelType="curQue.type"
  346. :answerRecordList="
  347. judgeAnswer != 'standardAnswer'
  348. ? curQue.Bookanswer[index][sIndex].recordList
  349. : []
  350. "
  351. type="mini"
  352. class="luyin-box-wordphrase"
  353. :style="{ marginLeft: '8px' }"
  354. />
  355. </span>
  356. <span v-if="curQue.isInfor">
  357. <img
  358. src="../../../assets/NPC/detail-icon.png"
  359. class="detail-icon"
  360. @click="showDetail(sItem)"
  361. />
  362. </span>
  363. </div>
  364. </div>
  365. </li>
  366. </ul>
  367. </div>
  368. </el-collapse-transition>
  369. <div class="practiceBox" v-if="detailShow">
  370. <WordPhraseDetail
  371. :data="data"
  372. :changeDetailIndex="changeDetailIndex"
  373. :closeWord="closeWordShow"
  374. :detailIndex="detailIndex"
  375. :optionRes="optionRes"
  376. :themeColor="themeColor"
  377. :currentTreeID="currentTreeID"
  378. :bg="data && data.bg ? data.bg : null"
  379. :ed="data && data.ed ? data.ed : null"
  380. type="newWordDetail"
  381. :isPhone="isPhone"
  382. />
  383. </div>
  384. <audio ref="newwordAudio" />
  385. </div>
  386. </template>
  387. <script>
  388. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  389. //例如:import 《组件名称》from ‘《组件路径》';
  390. import WordPhraseDetail from "./components/WordPhraseDetail.vue";
  391. import AudioLine from "../phonePreview/AudioLine.vue";
  392. import Soundrecord from "../phonePreview/Soundrecord.vue"; // 录音模板
  393. import OneSentenceTemp from "./components/OneSentenceTemp.vue";
  394. export default {
  395. //import引入的组件需要注入到对象中才能使用
  396. components: {
  397. WordPhraseDetail,
  398. AudioLine,
  399. Soundrecord,
  400. OneSentenceTemp
  401. },
  402. props: [
  403. "curQue",
  404. "themeColor",
  405. "currentTreeID",
  406. "indexs",
  407. "indexss",
  408. "indexStr",
  409. "TaskModel",
  410. "judgeAnswer",
  411. "baseSizePhone"
  412. ],
  413. data() {
  414. //这里存放数据
  415. return {
  416. wordShow: this.curQue.hasOwnProperty("isWordShow")
  417. ? this.curQue.isWordShow
  418. : true,
  419. data: null,
  420. detailShow: false,
  421. detailIndex: 0,
  422. audio: new Audio(),
  423. playClass: "",
  424. mp3_index: -1,
  425. playWord: null,
  426. optionRes: [],
  427. mp3List: [],
  428. isSuccess: false,
  429. loading: false,
  430. mp3: "",
  431. curTime: 0,
  432. stopAudioS: false,
  433. ed: null,
  434. chsFhList: [",", "。", "“", ":", "》", "?", "!", ";"],
  435. titleChsFhList: [",", "”", "。", ":", "》", "?", "!", ";"]
  436. };
  437. },
  438. //计算属性 类似于data概念
  439. computed: {},
  440. //监控data中数据变化
  441. watch: {
  442. currentTreeID: {
  443. handler: function() {
  444. this.mp3_index = -1; // 全文预览
  445. this.optionRes = []; // 显示单词和短语
  446. this.mp3List = []; // 语音练习
  447. this.initData();
  448. },
  449. deep: true
  450. }
  451. },
  452. //方法集合
  453. methods: {
  454. handleChange(val) {},
  455. palyAudio(sIndex) {
  456. let _this = this;
  457. _this.stopAudio();
  458. let node = document.getElementById("word" + _this.indexStr + sIndex);
  459. let mp3 = node.src;
  460. let audio = document.getElementsByTagName("audio");
  461. if (
  462. audio &&
  463. audio.length > 0 &&
  464. window.location.href.indexOf("GCLS-Learn") == -1
  465. ) {
  466. audio.forEach(item => {
  467. if (item.src != mp3) {
  468. item.pause();
  469. }
  470. });
  471. }
  472. _this.playWord = node;
  473. if (node) {
  474. this.mp3_index = sIndex;
  475. node.play();
  476. }
  477. this.handleListenPlay(sIndex);
  478. },
  479. handleListenPlay(sIndex) {
  480. let _this = this;
  481. if (_this.playWord) {
  482. let _this = this;
  483. _this.playWord.addEventListener("play", function() {
  484. _this.playClass = "nn";
  485. });
  486. _this.playWord.addEventListener("pause", function() {
  487. _this.mp3_index = -1;
  488. _this.playClass = "";
  489. });
  490. _this.playWord.addEventListener("ended", function() {
  491. _this.mp3_index = -1;
  492. _this.playClass = "";
  493. });
  494. }
  495. },
  496. // 打开单词详情
  497. showDetail(item) {
  498. this.data = null;
  499. this.data = item;
  500. this.detailShow = true;
  501. this.detailIndex = item.sIndex;
  502. },
  503. // 关闭单词详情
  504. closeWordShow(val) {
  505. this.detailShow = val;
  506. },
  507. changeDetailIndex(val) {
  508. let _this = this;
  509. if (val == "last") {
  510. _this.detailIndex--;
  511. } else {
  512. _this.detailIndex++;
  513. }
  514. _this.data = null;
  515. _this.data = _this.optionRes[_this.detailIndex];
  516. //_this.getWordLiju(_this.data.new_word);
  517. },
  518. playNewwords() {
  519. let _this = this;
  520. if (_this.playWord) {
  521. _this.playWord.pause();
  522. }
  523. if (_this.playClass) {
  524. _this.$refs.newwordAudio.pause();
  525. // _this.mp3_index = -1;
  526. _this.playClass = "";
  527. } else {
  528. let mp3_index = _this.mp3_index == -1 ? 0 : _this.mp3_index;
  529. let leg = _this.mp3List.length;
  530. let mp3 = _this.mp3List[mp3_index].mp3_list[0].id;
  531. _this.mp3_index = _this.mp3List[mp3_index].sIndex;
  532. _this.handlePlayVoice(mp3);
  533. _this.$refs.newwordAudio.addEventListener("ended", function() {
  534. setTimeout(() => {
  535. if (_this.playClass != "nn") {
  536. if (mp3_index < leg - 1) {
  537. if (_this.playClass) {
  538. mp3_index = mp3_index + 1;
  539. _this.mp3_index = _this.mp3List[mp3_index].sIndex;
  540. mp3 =
  541. _this.mp3List[mp3_index].mp3_list.length > 0 &&
  542. _this.mp3List[mp3_index].mp3_list[0].id;
  543. if (mp3) {
  544. _this.handlePlayVoice(mp3);
  545. }
  546. }
  547. } else {
  548. _this.mp3_index = -1;
  549. _this.playClass = "";
  550. }
  551. }
  552. }, 1000);
  553. });
  554. }
  555. },
  556. handlePlayVoice3(mp3) {
  557. let _this = this;
  558. let audio = document.getElementsByTagName("audio");
  559. if (
  560. audio &&
  561. audio.length > 0 &&
  562. window.location.href.indexOf("GCLS-Learn") == -1
  563. ) {
  564. audio.forEach(item => {
  565. if (item.src != mp3) {
  566. item.pause();
  567. }
  568. });
  569. }
  570. if (!mp3) {
  571. return;
  572. }
  573. if (!_this.audio.paused) {
  574. _this.audio.pause();
  575. } else {
  576. _this.audio.pause();
  577. _this.audio.load();
  578. _this.audio.src = mp3;
  579. _this.audio.loop = false;
  580. _this.audio.play();
  581. }
  582. },
  583. handlePlayVoice(mp3) {
  584. let _this = this;
  585. let audio = document.getElementsByTagName("audio");
  586. if (
  587. audio &&
  588. audio.length > 0 &&
  589. window.location.href.indexOf("GCLS-Learn") == -1
  590. ) {
  591. audio.forEach(item => {
  592. if (item.src != mp3) {
  593. item.pause();
  594. }
  595. });
  596. }
  597. if (!mp3) {
  598. return;
  599. }
  600. // setTimeout(() => {
  601. //_this.$refs.newwordAudio.pause();
  602. _this.$refs.newwordAudio.src = mp3;
  603. //_this.$refs.newwordAudio.load();
  604. _this.$refs.newwordAudio.play();
  605. // }, 1000);
  606. },
  607. stopAudio() {
  608. this.$refs.newwordAudio.pause();
  609. },
  610. initData() {
  611. let _this = this;
  612. if (this.curQue.type == "NewWord_chs") {
  613. let resIndex = 0;
  614. let optionRes = [];
  615. let mp3List = [];
  616. let itemNumber = 0;
  617. let Bookanswer = [];
  618. this.curQue.option.forEach((item, index) => {
  619. optionRes = optionRes.concat(item);
  620. Bookanswer.push([]);
  621. item.forEach((sItem, sIndex) => {
  622. sItem.mIndex = sIndex;
  623. sItem.sIndex = resIndex;
  624. resIndex++;
  625. sItem.def_str =
  626. sItem.definition_list.length > 0
  627. ? sItem.definition_list.join("; ")
  628. : "";
  629. if (sItem.mp3_list[0]) {
  630. mp3List.push(sItem);
  631. }
  632. if (_this.curQue.wordTime && _this.curQue.wordTime[itemNumber]) {
  633. sItem.bg = _this.curQue.wordTime[itemNumber].bg;
  634. sItem.ed = _this.curQue.wordTime[itemNumber].ed;
  635. }
  636. itemNumber++;
  637. Bookanswer[index].push({
  638. recordList: []
  639. });
  640. });
  641. });
  642. this.optionRes = JSON.parse(JSON.stringify(optionRes));
  643. this.mp3List = mp3List;
  644. if (!this.curQue.Bookanswer) {
  645. this.$set(this.curQue, "Bookanswer", Bookanswer);
  646. }
  647. }
  648. if (this.curQue.hasOwnProperty("conDetail")) {
  649. if (this.curQue.conDetail.wordsList.length > 0) {
  650. this.curQue.conDetail.wordsList.forEach((sItem, sIndex) => {
  651. this.mergeWordSymbol(sItem);
  652. sItem.fontColor = "rgba(255, 255, 255, 1)";
  653. sItem.fontSize = "16px";
  654. sItem.fontWeight = "bold";
  655. });
  656. }
  657. this.$set(this.curQue.conDetail, "config", {
  658. fontColor: "#fff",
  659. fontFamily:
  660. "Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif, alabo",
  661. fontSize: "16px",
  662. fontWeight: "bold"
  663. });
  664. }
  665. },
  666. //词和标点合一起
  667. mergeWordSymbol(sItem) {
  668. if (this.titleChsFhList.indexOf(sItem.chs) > -1) {
  669. sItem.isShow = false;
  670. } else {
  671. sItem.isShow = true;
  672. }
  673. },
  674. handleChangeTab() {
  675. this.wordShow = !this.wordShow;
  676. },
  677. getCurTime(curTime) {
  678. this.curTime = curTime * 1000;
  679. },
  680. //点击播放某个句子
  681. handleChangeTime(time, edTime) {
  682. let _this = this;
  683. _this.curTime = time;
  684. _this.stopAudioS = true;
  685. _this.$refs.audioLine.onTimeupdateTime(time / 1000, true);
  686. _this.ed = edTime;
  687. },
  688. handleListenRead(playFlag) {
  689. this.stopAudioS = playFlag;
  690. },
  691. emptyEd() {
  692. this.ed = null;
  693. },
  694. handleWav(list, tmIndex, tmsIndex) {
  695. tmIndex = tmIndex ? tmIndex : 0;
  696. tmsIndex = tmsIndex ? tmsIndex : 0;
  697. this.$set(this.curQue.Bookanswer[tmIndex][tmsIndex], "recordList", list);
  698. }
  699. },
  700. //生命周期 - 创建完成(可以访问当前this实例)
  701. created() {
  702. this.initData();
  703. },
  704. //生命周期 - 挂载完成(可以访问DOM元素)
  705. mounted() {
  706. let _this = this;
  707. _this.$refs.newwordAudio.addEventListener("play", function() {
  708. _this.playClass = "active";
  709. });
  710. _this.$refs.newwordAudio.addEventListener("pause", function() {
  711. //_this.playClass = "";
  712. });
  713. },
  714. //生命周期-创建之前
  715. beforeCreated() {},
  716. //生命周期-挂载之前
  717. beforeMount() {},
  718. //生命周期-更新之前
  719. beforUpdate() {},
  720. //生命周期-更新之后
  721. updated() {},
  722. //生命周期-销毁之前
  723. beforeDestory() {},
  724. //生命周期-销毁完成
  725. destoryed() {},
  726. //如果页面有keep-alive缓存功能,这个函数会触发
  727. activated() {}
  728. };
  729. </script>
  730. <style lang="scss" scoped>
  731. /* @import url(); 引入css类 */
  732. .NPC-zhedie {
  733. width: 100%;
  734. // margin-bottom: 24px;
  735. .aduioLine-box {
  736. margin-bottom: 8px;
  737. }
  738. .practiceBox {
  739. position: fixed;
  740. left: 0;
  741. top: 0;
  742. z-index: 999;
  743. width: 100%;
  744. height: 100vh;
  745. background: rgba(0, 0, 0, 0.19);
  746. box-sizing: border-box;
  747. overflow: hidden;
  748. overflow-y: auto;
  749. }
  750. .NPC-word-list {
  751. // background: #f7f7f7;
  752. }
  753. .NPC-word-table {
  754. width: 100%;
  755. > .NPC-word-tr {
  756. background: rgba(250, 249, 249, 1);
  757. border-radius: 8px;
  758. margin-bottom: 8px;
  759. .NPC-word-row {
  760. cursor: pointer;
  761. display: flex;
  762. flex-flow: wrap;
  763. justify-content: flex-start;
  764. padding: 10px 4px 10px 10px;
  765. border-radius: 8px;
  766. &.active {
  767. background: linear-gradient(
  768. 0deg,
  769. rgba(0, 0, 0, 0.08),
  770. rgba(0, 0, 0, 0.08)
  771. ),
  772. #ffffff;
  773. }
  774. span {
  775. font-size: 16px;
  776. line-height: 150%;
  777. color: #000000;
  778. }
  779. }
  780. .content-box {
  781. flex: 1;
  782. }
  783. .operate-box {
  784. display: flex;
  785. }
  786. .tabNum-box {
  787. position: relative;
  788. .star-label {
  789. position: absolute;
  790. right: -6px;
  791. top: 1px;
  792. width: 6px;
  793. height: 6px;
  794. }
  795. }
  796. .tabNum {
  797. background: #de4444;
  798. text-align: center;
  799. width: 16px;
  800. height: 16px;
  801. color: #ffffff;
  802. border-radius: 50%;
  803. font-size: 12px;
  804. font-family: "robot", "alabo";
  805. line-height: 16px;
  806. margin-top: 4px;
  807. margin-left: 8px;
  808. display: block;
  809. }
  810. .NPC-word-tab-box {
  811. width: 240px;
  812. span {
  813. display: block;
  814. width: 100%;
  815. color: #000000;
  816. margin: 2px 0;
  817. }
  818. }
  819. .NPC-word-tab-common {
  820. // padding-left: 8px;
  821. // width: 125px;
  822. box-sizing: border-box;
  823. }
  824. .NPC-word-tab-pinyin {
  825. font-family: "GB-PINYINOK-B";
  826. // white-space: nowrap;
  827. font-size: 12px;
  828. word-break: break-word;
  829. &.NPC-word-tab-pinyin-red {
  830. color: #e35454;
  831. }
  832. &.NPC-word-tab-pinyin-green {
  833. color: #24b99e;
  834. }
  835. &.NPC-word-tab-pinyin-brown {
  836. color: #bd8865;
  837. }
  838. }
  839. .NPC-word-tab-word {
  840. font-family: "FZJCGFKTK";
  841. white-space: nowrap;
  842. font-size: 16px;
  843. &.NPC-word-tab-word-red {
  844. color: #e35454;
  845. }
  846. &.NPC-word-tab-word-green {
  847. color: #24b99e;
  848. }
  849. &.NPC-word-tab-word-brown {
  850. color: #bd8865;
  851. }
  852. &-break {
  853. white-space: normal;
  854. word-break: break-word;
  855. }
  856. }
  857. .NPC-word-tab-cixing {
  858. font-family: "robot", "alabo";
  859. // width: 48px;
  860. // width: 60px;
  861. word-break: break-word;
  862. box-sizing: border-box;
  863. text-align: left;
  864. // font-style: italic; // 要求改为正体
  865. &.NPC-word-tab-cixing-red {
  866. color: #e35454;
  867. }
  868. &.NPC-word-tab-cixing-green {
  869. color: #24b99e;
  870. }
  871. &.NPC-word-tab-cixing-brown {
  872. color: #bd8865;
  873. }
  874. &.hasCn {
  875. font-size: 13px;
  876. }
  877. }
  878. .NPC-word-tab-def {
  879. flex: 1;
  880. font-family: "robot", "alabo";
  881. word-break: break-word;
  882. box-sizing: border-box;
  883. white-space: pre-wrap;
  884. &.NPC-word-tab-def-red {
  885. color: #e35454;
  886. }
  887. &.NPC-word-tab-def-green {
  888. color: #24b99e;
  889. }
  890. &.NPC-word-tab-def-brown {
  891. color: #bd8865;
  892. }
  893. }
  894. .collocation {
  895. width: 100%;
  896. display: flex;
  897. padding-top: 8px;
  898. > span {
  899. color: #000;
  900. font-size: 16px;
  901. font-weight: 400;
  902. line-height: 24px;
  903. flex-shrink: 0;
  904. }
  905. > div b {
  906. display: block;
  907. }
  908. > b,
  909. > div b {
  910. flex: 1;
  911. color: rgba(0, 0, 0, 0.65);
  912. font-size: 16px;
  913. font-weight: 400;
  914. line-height: 24px;
  915. font-family: "robot", "FZJCGFKTK", "alabo";
  916. }
  917. }
  918. }
  919. }
  920. .NPC-play-btn-brown {
  921. margin-top: 4px;
  922. width: 16px;
  923. height: 16px;
  924. display: block;
  925. background: url("../../../assets/NPC/play-brown.png") no-repeat left top;
  926. background-size: 100% 100%;
  927. &.active {
  928. background: url("../../../assets/NPC/icon-voice-play-brown.png") no-repeat
  929. left top;
  930. background-size: 100% 100%;
  931. }
  932. }
  933. .NPC-play-btn-green {
  934. margin-top: 4px;
  935. width: 16px;
  936. height: 16px;
  937. display: block;
  938. background: url("../../../assets/NPC/play-green.png") no-repeat left top;
  939. background-size: 100% 100%;
  940. &.active {
  941. background: url("../../../assets/NPC/icon-voice-play-green.png") no-repeat
  942. left top;
  943. background-size: 100% 100%;
  944. }
  945. }
  946. .NPC-play-btn-red {
  947. margin-top: 4px;
  948. width: 16px;
  949. height: 16px;
  950. display: block;
  951. background: url("../../../assets/NPC/play-red.png") no-repeat left top;
  952. background-size: 100% 100%;
  953. &.active {
  954. background: url("../../../assets/NPC/icon-voice-play-red.png") no-repeat
  955. left top;
  956. background-size: 100% 100%;
  957. }
  958. }
  959. .NPC-word-list {
  960. padding: 10px;
  961. border: 1px solid rgba(0, 0, 0, 0.1);
  962. border-top: none;
  963. border-radius: 0 0 8px 8px;
  964. }
  965. .detail-icon {
  966. width: 24px;
  967. height: 24px;
  968. display: block;
  969. cursor: pointer;
  970. opacity: 0.5;
  971. }
  972. .play-btn {
  973. margin-top: 4px;
  974. width: 16px;
  975. height: 16px;
  976. background: url("../../../assets/NPC/play-red.png") center no-repeat;
  977. background-size: cover;
  978. display: block;
  979. &.active {
  980. background-image: url("../../../assets/NPC/icon-voice-play-red.png");
  981. background-size: cover;
  982. }
  983. }
  984. &-phone {
  985. width: 100%;
  986. }
  987. }
  988. .NPC-Big-Book-preview-green {
  989. .NPC-zhedie {
  990. .play-btn {
  991. background: url("../../../assets/NPC/play-green.png") center no-repeat;
  992. background-size: cover;
  993. &.active {
  994. background-image: url("../../../assets/NPC/icon-voice-play-green.png");
  995. background-size: cover;
  996. }
  997. }
  998. }
  999. }
  1000. .NPC-Big-Book-preview-brown {
  1001. .NPC-zhedie {
  1002. .play-btn {
  1003. background: url("../../../assets/NPC/play-brown.png") center no-repeat;
  1004. background-size: cover;
  1005. &.active {
  1006. background-image: url("../../../assets/NPC/icon-voice-play-brown.png");
  1007. background-size: cover;
  1008. }
  1009. }
  1010. }
  1011. }
  1012. @keyframes firstrotate {
  1013. 0% {
  1014. transform: rotateZ(0deg);
  1015. }
  1016. 100% {
  1017. transform: rotateZ(180deg);
  1018. }
  1019. }
  1020. @keyframes huifuRotate {
  1021. 0% {
  1022. transform: rotateZ(180deg);
  1023. }
  1024. 100% {
  1025. transform: rotateZ(0deg);
  1026. }
  1027. }
  1028. .luyin-box-wordphrase {
  1029. height: 24px;
  1030. }
  1031. </style>
  1032. <style lang="scss">
  1033. .NPC-zhedie {
  1034. .topTitle {
  1035. width: 100%;
  1036. display: flex;
  1037. justify-content: space-between;
  1038. padding-left: 24px;
  1039. padding-right: 16px;
  1040. height: 48px;
  1041. background: #e35454;
  1042. border: 1px solid rgba(0, 0, 0, 0.1);
  1043. overflow: hidden;
  1044. border-radius: 8px 8px 0 0;
  1045. .NPC-top-left {
  1046. display: flex;
  1047. justify-content: flex-start;
  1048. align-items: center;
  1049. .NPC-topTitle-text {
  1050. font-family: "sourceR";
  1051. font-size: 16px;
  1052. color: #fff;
  1053. font-weight: bold;
  1054. margin-right: 8px;
  1055. white-space: pre;
  1056. }
  1057. .NPC-play-all {
  1058. width: 16px;
  1059. height: 16px;
  1060. background: url("../../../assets/NPC/play-white.png") no-repeat left top;
  1061. background-size: 100% 100%;
  1062. cursor: pointer;
  1063. &.active {
  1064. width: 16px;
  1065. height: 16px;
  1066. background: url("../../../assets/NPC/icon-voice-play-white.png")
  1067. no-repeat left top;
  1068. background-size: 100% 100%;
  1069. }
  1070. }
  1071. }
  1072. .NPC-top-right {
  1073. display: flex;
  1074. justify-content: flex-start;
  1075. align-items: center;
  1076. cursor: pointer;
  1077. &-text {
  1078. font-weight: normal;
  1079. font-size: 14px;
  1080. line-height: 16px;
  1081. color: #ffffff;
  1082. }
  1083. img {
  1084. width: 16px;
  1085. height: 16px;
  1086. margin-left: 4px;
  1087. }
  1088. }
  1089. img {
  1090. width: 24px;
  1091. height: 24px;
  1092. }
  1093. .rotate {
  1094. animation-name: firstrotate;
  1095. animation-direction: 2s;
  1096. animation-fill-mode: both;
  1097. animation-timing-function: linear;
  1098. }
  1099. }
  1100. .topTitleWhite {
  1101. width: 100%;
  1102. display: flex;
  1103. justify-content: space-between;
  1104. padding-left: 24px;
  1105. padding-right: 16px;
  1106. height: 48px;
  1107. background: #fff;
  1108. border: 1px solid rgba(0, 0, 0, 0.1);
  1109. overflow: hidden;
  1110. border-radius: 8px 8px 0 0;
  1111. .NPC-top-left {
  1112. display: flex;
  1113. justify-content: flex-start;
  1114. align-items: center;
  1115. .NPC-topTitle-text {
  1116. font-family: "sourceR";
  1117. font-size: 16px;
  1118. color: #000;
  1119. font-weight: bold;
  1120. margin-right: 8px;
  1121. }
  1122. .NPC-play-all {
  1123. width: 16px;
  1124. height: 16px;
  1125. background: url("../../../assets/NPC/play-red.png") no-repeat left top;
  1126. background-size: 100% 100%;
  1127. cursor: pointer;
  1128. &.active {
  1129. width: 16px;
  1130. height: 16px;
  1131. background: url("../../../assets/NPC/icon-voice-play-red.png")
  1132. no-repeat left top;
  1133. background-size: 100% 100%;
  1134. }
  1135. }
  1136. }
  1137. .NPC-top-right {
  1138. display: flex;
  1139. justify-content: flex-start;
  1140. align-items: center;
  1141. cursor: pointer;
  1142. &-text {
  1143. font-weight: normal;
  1144. font-size: 14px;
  1145. line-height: 16px;
  1146. color: #000;
  1147. }
  1148. img {
  1149. width: 16px;
  1150. height: 16px;
  1151. margin-left: 4px;
  1152. }
  1153. }
  1154. img {
  1155. width: 24px;
  1156. height: 24px;
  1157. }
  1158. .rotate {
  1159. animation-name: firstrotate;
  1160. animation-direction: 2s;
  1161. animation-fill-mode: both;
  1162. animation-timing-function: linear;
  1163. }
  1164. }
  1165. .el-collapse-item__content {
  1166. padding-bottom: 0;
  1167. }
  1168. .el-slider__button {
  1169. width: 8px;
  1170. height: 8px;
  1171. }
  1172. .el-slider__runway {
  1173. margin: 0;
  1174. padding: 0;
  1175. }
  1176. .el-slider {
  1177. position: relative;
  1178. // top: -3px;
  1179. }
  1180. .el-collapse {
  1181. background: #f7f7f7;
  1182. box-sizing: border-box;
  1183. border-radius: 8px;
  1184. }
  1185. .el-collapse-item__wrap {
  1186. border: 1px solid rgba(0, 0, 0, 0.1);
  1187. border-top: 0;
  1188. background: #f7f7f7;
  1189. border-radius: 0px 0px 8px 8px;
  1190. }
  1191. .el-collapse-item__arrow {
  1192. display: none;
  1193. }
  1194. .el-table__row {
  1195. padding: 4px 0;
  1196. }
  1197. .operate-box {
  1198. .playBack {
  1199. margin-left: 3px;
  1200. }
  1201. }
  1202. }
  1203. .NPC-Big-Book-preview-green {
  1204. .NPC-zhedie {
  1205. .topTitle {
  1206. background: #24b99e !important;
  1207. }
  1208. .tabNum {
  1209. background: #24b99e !important;
  1210. }
  1211. .topTitleWhite {
  1212. .NPC-top-left {
  1213. .NPC-play-all {
  1214. background: url("../../../assets/NPC/play-green.png") no-repeat left
  1215. top;
  1216. background-size: 100% 100%;
  1217. &.active {
  1218. background: url("../../../assets/NPC/play-green.png") no-repeat left
  1219. top;
  1220. background-size: 100% 100%;
  1221. }
  1222. }
  1223. }
  1224. }
  1225. }
  1226. }
  1227. .NPC-Big-Book-preview-brown {
  1228. .NPC-zhedie {
  1229. .topTitle {
  1230. background: #bd8865 !important;
  1231. }
  1232. .tabNum {
  1233. background: #bd8865 !important;
  1234. }
  1235. .topTitleWhite {
  1236. .NPC-top-left {
  1237. .NPC-play-all {
  1238. background: url("../../../assets/NPC/play-brown.png") no-repeat left
  1239. top;
  1240. background-size: 100% 100%;
  1241. &.active {
  1242. background: url("../../../assets/NPC/play-brown.png") no-repeat left
  1243. top;
  1244. background-size: 100% 100%;
  1245. }
  1246. }
  1247. }
  1248. }
  1249. }
  1250. }
  1251. </style>