Result.vue 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441
  1. <template>
  2. <div class="result" v-loading="loading">
  3. <Header
  4. :projectShow="true"
  5. :seekShow="true"
  6. :seekOption="false"
  7. :seekOptions="true"
  8. @changehzdata="getdata(true)"
  9. />
  10. <div class="main">
  11. <div class="hanzi_list">
  12. <div class="top_jf">
  13. <div class="j_f">
  14. <div :class="[JFIndex == 0 ? 'sele' : '']" @click="jfEvent(0)">
  15. 简
  16. </div>
  17. <div :class="[JFIndex == 1 ? 'sele' : '']" @click="jfEvent(1)">
  18. 繁
  19. </div>
  20. </div>
  21. </div>
  22. <div
  23. class="list_one_box"
  24. :style="{
  25. overflowY: unfold ? 'scroll' : 'hidden',
  26. }"
  27. v-if="ShowHzData"
  28. >
  29. <div
  30. class="list_one"
  31. v-for="(item, index) in ShowHzData"
  32. :key="'index' + index"
  33. >
  34. <Strockplayredline
  35. v-if="item.hzDetail.hz_json"
  36. :Book_text="JFIndex == 0 ? item.con : item.fanti"
  37. :playStorkes="true"
  38. :curItem="item.hzDetail"
  39. :targetDiv="'bwcHanziIntp' + index + item.con"
  40. :isHighlight="false"
  41. :judgeAnswer="2"
  42. />
  43. <div class="Highlight" v-if="item.hzDetail.hz_json">
  44. <div class="play_audio">
  45. <img src="../../assets/teacherdev/speaker-one.png" alt="" />
  46. <span>{{ item.pinyin }}</span>
  47. </div>
  48. <div
  49. v-for="(items, indexs) in item.hzDetail.hz_json.medians.length"
  50. :key="'row' + indexs"
  51. class="row"
  52. >
  53. <StrockplayredlineCorpus
  54. :Book_text="JFIndex == 0 ? item.con : item.fanti"
  55. :playStorkes="false"
  56. :curItem="item.hzDetail"
  57. :targetDiv="'bwcHanziIntp_height' + index + item.con + indexs"
  58. :targetDivGray="
  59. 'bwcHanziIntp_height_Grey' + index + item.con + indexs
  60. "
  61. :isHighlight="true"
  62. :judgeAnswer="indexs + 1"
  63. :BoxbgType="0"
  64. strokeColorgray="#ccc"
  65. strokeColor="#000000"
  66. />
  67. <div class="number">{{ indexs + 1 }}</div>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="shouqi" v-if="hzData.length > 2">
  73. <span @click="updownHz">
  74. <template v-if="unfold">
  75. <img src="../../assets/teacherdev/up.png" alt="" />
  76. 收起
  77. </template>
  78. <template v-else>
  79. <img src="../../assets/teacherdev/down.png" alt="" />
  80. 展开
  81. </template>
  82. </span>
  83. </div>
  84. </div>
  85. <div class="txt_imgtable">
  86. <div class="left">
  87. <div class="top">
  88. <div>
  89. <div class="pattern">
  90. <div
  91. :class="[patternIndex == 0 ? 'sele' : '']"
  92. @click="cutPattern(0)"
  93. >
  94. 引语模式
  95. </div>
  96. <div
  97. :class="[patternIndex == 1 ? 'sele' : '']"
  98. @click="cutPattern(1)"
  99. >
  100. KWIC模式
  101. </div>
  102. </div>
  103. <template v-if="patternIndex == 1">
  104. <div class="KWIC_sort">
  105. <span
  106. :class="['sort', KWIC_sortIndex == 0 ? 'sele' : '']"
  107. @click="KWICsortEvent(0, 'sentence_list_sort_left')"
  108. >
  109. <img
  110. src="../../assets/teacherdev/analys-right.png"
  111. alt=""
  112. />
  113. </span>
  114. <span
  115. :class="['sort', KWIC_sortIndex == 1 ? 'sele' : '']"
  116. @click="KWICsortEvent(1, 'sentence_list_sort_mid')"
  117. >
  118. <img
  119. src="../../assets/teacherdev/analys-center.png"
  120. alt=""
  121. />
  122. </span>
  123. <span
  124. :class="['sort', KWIC_sortIndex == 2 ? 'sele' : '']"
  125. @click="KWICsortEvent(2, 'sentence_list_sort_right')"
  126. >
  127. <img src="../../assets/teacherdev/analys-left.png" alt="" />
  128. </span>
  129. </div>
  130. </template>
  131. <template v-if="patternIndex == 0">
  132. <div class="lang_sort" @click="sortEvent">
  133. 长度
  134. <img
  135. v-if="sort == 'down'"
  136. src="../../assets/teacherdev/ylk-sort-down.png"
  137. alt=""
  138. />
  139. <img
  140. v-else-if="sort == 'up'"
  141. src="../../assets/teacherdev/ylk-sort-up.png"
  142. alt=""
  143. />
  144. <img
  145. v-else
  146. src="../../assets/teacherdev/ylk-sort-no.png"
  147. alt=""
  148. />
  149. </div>
  150. </template>
  151. <div class="refresh" @click="handleRefresh">
  152. <img src="../../assets/teacherdev/refresh.png" alt="" />
  153. </div>
  154. <template v-if="patternIndex == 0">
  155. <!-- <el-switch
  156. v-model="pinyinShow"
  157. active-text="拼音"
  158. active-color="#424242"
  159. style="margin-left: 24px"
  160. >
  161. </el-switch> -->
  162. <el-switch
  163. v-model="shiyiShow"
  164. active-text="释义"
  165. active-color="#424242"
  166. style="margin-left: 16px"
  167. >
  168. </el-switch>
  169. </template>
  170. </div>
  171. <div class="size">
  172. <span :class="[sizeIndex == 0 ? 'sele' : '']" @click="cutSize(0)"
  173. >大</span
  174. >
  175. <span :class="[sizeIndex == 1 ? 'sele' : '']" @click="cutSize(1)"
  176. >中</span
  177. >
  178. <span :class="[sizeIndex == 2 ? 'sele' : '']" @click="cutSize(2)"
  179. >小</span
  180. >
  181. </div>
  182. </div>
  183. <div class="main">
  184. <div class="list">
  185. <template v-if="patternIndex == 0">
  186. <div
  187. v-for="(item, i) in ShowList"
  188. :key="i + 'sentence'"
  189. class="one"
  190. >
  191. <div class="top">
  192. <!--
  193. :class="['number-' + sizeIndex + '-' + pinyinShow]"
  194. -->
  195. <div class="number">{{ item.number }}.</div>
  196. <!--
  197. :class="['speaker-' + sizeIndex + '-' + pinyinShow]"
  198. -->
  199. <img src="../../assets/teacherdev/speaker-one.png" alt="" />
  200. <div class="words" v-html="item.res"></div>
  201. <!--
  202. :class="['shiyi-' + sizeIndex]"
  203. -->
  204. <div
  205. class="shiyi"
  206. v-if="shiyiShow && item.word_definition_list.length > 0"
  207. >
  208. (
  209. <span
  210. v-for="(items, indexs) in item.word_definition_list"
  211. :key="indexs"
  212. v-html="items"
  213. >
  214. </span>
  215. )
  216. </div>
  217. </div>
  218. <div class="bottom">
  219. {{ item.source_courseware_name_path }}
  220. </div>
  221. </div>
  222. </template>
  223. <template v-else>
  224. <div
  225. v-for="(item, index) in ShowList"
  226. :key="'kwic' + index"
  227. class="kwic_one"
  228. >
  229. <div class="number">{{ item.number }}</div>
  230. <el-tooltip effect="dark" placement="bottom">
  231. <div slot="content">
  232. {{ item.source_courseware_name_path }}
  233. </div>
  234. <div class="laiyuan">
  235. {{ item.source_courseware_name_path }}
  236. </div>
  237. </el-tooltip>
  238. <div
  239. class="word"
  240. :style="{
  241. fontSize: conSize + 'px',
  242. }"
  243. >
  244. <div v-for="(txt, indexs) in item.resArr" :key="indexs">
  245. <span
  246. v-for="(txts, indexs) in txt"
  247. v-html="txts"
  248. :key="indexs"
  249. ></span>
  250. </div>
  251. </div>
  252. </div>
  253. </template>
  254. </div>
  255. <div class="page">
  256. <span class="text">
  257. 共 {{ CurrentList.length }} 条 命中 {{ scoreAHitNumber }} 次
  258. </span>
  259. <el-pagination
  260. background
  261. @current-change="handleCurrentChange"
  262. :current-page.sync="page"
  263. :page-size="pageSize"
  264. layout="prev, pager, next"
  265. :total="CurrentList.length"
  266. :pager-count="5"
  267. >
  268. </el-pagination>
  269. </div>
  270. </div>
  271. </div>
  272. <div class="right">
  273. <div class="top">
  274. <div>
  275. <div
  276. :class="[rightTopIndex == 0 ? 'sele' : '']"
  277. @click="cutsyly(0)"
  278. >
  279. 释义
  280. </div>
  281. <div
  282. :class="[rightTopIndex == 1 ? 'sele' : '']"
  283. @click="cutsyly(1)"
  284. >
  285. 来源
  286. </div>
  287. </div>
  288. </div>
  289. <div id="shanxing_main" style="height: 398px"></div>
  290. <div class="list">
  291. <div
  292. v-for="(item, i) in rightList"
  293. :key="i + 'right'"
  294. class="one"
  295. :style="{
  296. borderBottom:
  297. i == rightList.length - 1 ? 'none' : '1px solid #eeeeee',
  298. }"
  299. @mouseover="gaolangbzt(i, 'shanxing_main')"
  300. @mouseout="closegaolangbzt(i, 'shanxing_main')"
  301. >
  302. <div style="width: 60%">
  303. <span></span>
  304. <span v-html="item.book_name"></span>
  305. </div>
  306. <div style="width: 10%;">
  307. <span>{{ item.count }}</span>
  308. </div>
  309. <div style="width: 30%">
  310. <span>{{ item.percent }}%</span>
  311. </div>
  312. </div>
  313. <div class="one all">
  314. <div style="width: 60%">
  315. <span></span>
  316. <span>合计</span>
  317. </div>
  318. <div style="width: 10%;">
  319. <span>{{ allNumber }}</span>
  320. </div>
  321. <div style="width: 30%">
  322. <span>100%</span>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. </div>
  328. </div>
  329. </div>
  330. </template>
  331. <script>
  332. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  333. //例如:import 《组件名称》from ‘《组件路径》';
  334. import Header from "@/components/Header";
  335. import { getLogin, BookgetContent } from "@/api/api";
  336. import Strockplayredline from "@/components/corpus/Strockplayredline";
  337. import StrockplayredlineCorpus from "@/components/corpus/StrockplayredlineCorpus";
  338. import "@/utils/pinyin_dict_withtone";
  339. import "@/utils/pinyinUtil";
  340. const OpenCC = require("opencc-js");
  341. const converter = OpenCC.Converter({ from: "cn", to: "tw" });
  342. import * as echarts from "echarts";
  343. export default {
  344. //import引入的组件需要注入到对象中才能使用
  345. components: {
  346. Header,
  347. Strockplayredline,
  348. StrockplayredlineCorpus,
  349. },
  350. props: {},
  351. data() {
  352. //这里存放数据
  353. return {
  354. page: 1,
  355. pageSize: 8,
  356. shiyiShow: true,
  357. pinyinShow: true,
  358. JFIndex: 0,
  359. hzData: [],
  360. ShowHzData: [],
  361. loading: true,
  362. lang: null,
  363. unfold: true,
  364. patternIndex: 0,
  365. rightTopIndex: 0,
  366. sizeIndex: 1,
  367. sort: "",
  368. rightList: [],
  369. KWIC_sortIndex: 0,
  370. allNumber: 0,
  371. conSize: 20,
  372. pinyinSize: 12,
  373. allList: [],
  374. CurrentList: [],
  375. ShowList: [],
  376. chsFhList: [",", "。", "”", ":", "》", "《", "?", "!", ";"],
  377. scoreAHitNumber: 0,
  378. };
  379. },
  380. //计算属性 类似于data概念
  381. computed: {},
  382. //监控data中数据变化
  383. watch: {},
  384. //方法集合
  385. methods: {
  386. handleCurrentChange(val) {
  387. this.page = val;
  388. this.padingEvetn();
  389. },
  390. // KWIC排序
  391. KWICsortEvent(index, type) {
  392. if (this.KWIC_sortIndex == index) return;
  393. this.KWIC_sortIndex = index;
  394. this.CurrentList = this.allList[type];
  395. this.padingEvetn();
  396. },
  397. // 排序
  398. sortEvent() {
  399. if (this.sort == "up" || !this.sort) {
  400. this.sort = "down";
  401. } else {
  402. this.sort = "up";
  403. }
  404. this.getdata();
  405. this.page = 1;
  406. },
  407. // 修改大小
  408. cutSize(index) {
  409. this.sizeIndex = index;
  410. if (index == 0) {
  411. //大
  412. if (this.patternIndex == 0) {
  413. this.conSize = 24;
  414. this.pinyinSize = 12;
  415. } else {
  416. this.conSize = 20;
  417. }
  418. } else if (index == 1) {
  419. //中
  420. if (this.patternIndex == 0) {
  421. this.conSize = 20;
  422. this.pinyinSize = 12;
  423. } else {
  424. this.conSize = 17;
  425. }
  426. } else {
  427. //小
  428. if (this.patternIndex == 0) {
  429. this.conSize = 16;
  430. this.pinyinSize = 10;
  431. } else {
  432. this.conSize = 15;
  433. }
  434. }
  435. },
  436. // 切换模式
  437. cutPattern(index) {
  438. if (this.patternIndex == index) {
  439. return;
  440. }
  441. this.patternIndex = index;
  442. if (this.patternIndex == 0) {
  443. this.CurrentList = JSON.parse(
  444. JSON.stringify(this.allList.sentence_list)
  445. );
  446. } else {
  447. this.CurrentList = JSON.parse(
  448. JSON.stringify(this.allList.sentence_list_sort_left)
  449. );
  450. }
  451. this.padingEvetn();
  452. this.page = 1;
  453. },
  454. // 切换释义来源
  455. cutsyly(index) {
  456. if (this.rightTopIndex == index) {
  457. return;
  458. }
  459. this.rightTopIndex = index;
  460. if (this.rightTopIndex == 0) {
  461. this.rightList = this.allList.stat_list_sentence_source_book;
  462. } else {
  463. this.rightList = this.allList.stat_list_word_definition;
  464. }
  465. if (this.rightList.length > 0) {
  466. this.inityuan();
  467. }
  468. },
  469. updownHz() {
  470. this.unfold = !this.unfold;
  471. if (this.unfold) {
  472. this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
  473. } else {
  474. this.ShowHzData.splice(2);
  475. }
  476. },
  477. jfEvent(index) {
  478. this.JFIndex = index;
  479. if (index == 0) {
  480. //简体
  481. this.gethzJSON();
  482. } else {
  483. //繁体
  484. this.hzData.forEach((item) => {
  485. let a = converter(item.con);
  486. item.fanti = a;
  487. });
  488. this.gethzJSON();
  489. }
  490. },
  491. // 获取汉字josn
  492. gethzJSON() {
  493. this.ShowHzData = null;
  494. this.loading = true;
  495. let MethodName = "hz_resource_manager-GetHZStrokesContent";
  496. this.hzData.forEach((item, i) => {
  497. let data = {
  498. hz: this.JFIndex == 0 ? item.con : item.fanti,
  499. };
  500. item.hzDetail = {
  501. hz_json: null,
  502. };
  503. this.$forceUpdate();
  504. getLogin(MethodName, data)
  505. .then((res) => {
  506. this.$set(item.hzDetail, "hz_json", res);
  507. this.$forceUpdate();
  508. this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
  509. if (i == this.hzData.length - 1) {
  510. this.loading = false;
  511. }
  512. })
  513. .catch(() => {
  514. this.loading = false;
  515. });
  516. });
  517. },
  518. getrightListdata() {
  519. this.inityuan();
  520. },
  521. inityuan() {
  522. var chartDom = document.getElementById("shanxing_main");
  523. var myChart = echarts.init(chartDom);
  524. var option;
  525. this.allNumber = 0;
  526. let newdata = JSON.parse(JSON.stringify(this.rightList));
  527. newdata.forEach((item) => {
  528. this.allNumber += item.count;
  529. let percent = item.percent;
  530. item.value = item.count;
  531. if (percent % 1 == 0) {
  532. item.name = item.book_name + " " + percent + "%";
  533. } else {
  534. item.name = item.book_name + " " + percent.toFixed(2) + "%";
  535. }
  536. });
  537. option = {
  538. series: [
  539. {
  540. name: "Access From",
  541. type: "pie",
  542. // radius: ["50%", "50%"],
  543. data: newdata,
  544. itemStyle: {
  545. // borderColor: "#fff",
  546. // borderWidth: 2,
  547. },
  548. top: 50,
  549. emphasis: {
  550. itemStyle: {
  551. shadowBlur: 10,
  552. shadowOffsetX: 0,
  553. shadowColor: "rgba(0, 0, 0, 0.5)",
  554. },
  555. },
  556. },
  557. ],
  558. xAxis: {
  559. show: false, //不显示坐标轴线、坐标轴刻度线和坐标轴上的文字
  560. axisTick: {
  561. show: false, //不显示坐标轴刻度线
  562. },
  563. axisLine: {
  564. show: false, //不显示坐标轴线
  565. },
  566. axisLabel: {
  567. show: false, //不显示坐标轴上的文字
  568. },
  569. },
  570. };
  571. option && myChart.setOption(option);
  572. },
  573. // 鼠标进入
  574. gaolangbzt(index, id) {
  575. var compareChart = echarts.getInstanceByDom(document.getElementById(id));
  576. compareChart.dispatchAction({
  577. type: "highlight",
  578. seriesIndex: 0,
  579. dataIndex: index,
  580. });
  581. },
  582. // 鼠标移出
  583. closegaolangbzt(index, id) {
  584. var compareChart = echarts.getInstanceByDom(document.getElementById(id));
  585. compareChart.dispatchAction({
  586. type: "downplay",
  587. seriesIndex: 0,
  588. dataIndex: index,
  589. });
  590. },
  591. changehzdata() {
  592. this.hzData = [];
  593. this.jfEvent(0);
  594. let arr = this.$route.query.keyword.split("");
  595. arr.forEach((item) => {
  596. if (!/^[\u4e00-\u9fa5]/.test(item)) {
  597. return;
  598. }
  599. let result = pinyinUtil.getPinyin(item);
  600. let obj = {
  601. con: item,
  602. pinyin: result,
  603. hzDetail: {
  604. hz_json: null,
  605. },
  606. };
  607. this.hzData.push(obj);
  608. this.ShowHzData = JSON.parse(JSON.stringify(this.hzData));
  609. });
  610. this.gethzJSON();
  611. },
  612. handleRefresh() {
  613. this.pinyinShow = true;
  614. this.shiyiShow = true;
  615. this.sizeIndex = 1;
  616. this.sort = "down";
  617. this.KWIC_sortIndex = 0;
  618. this.cutSize(1);
  619. this.getdata();
  620. this.page = 1;
  621. },
  622. getdata(flag) {
  623. this.loading = true;
  624. let Mname =
  625. "book-courseware_manager-GetCoursewareWordExampleSentenceList";
  626. let data = {
  627. // courseware_id: "003-20211012-17-BDUZ1JVCAN",
  628. courseware_id: "",
  629. // word: this.$route.query.keyword, // 单词
  630. word: this.$route.query.keyword,
  631. search_scope: 3, // 检索范围 0 【本章】,1【本教材】,2【本套教材】,3【系统所有教材】
  632. // 本章:同一本教材下,归属同一个第一级章节下的所有课件为同一章。
  633. is_contain_word_variants: false, // 是否包含单词变体例句
  634. is_contain_stat_data: true, //
  635. sentence_length_sort_mode: this.sort
  636. ? this.sort == "down"
  637. ? "DESCENT"
  638. : "ASCENT"
  639. : "NO",
  640. };
  641. BookgetContent(Mname, data)
  642. .then((res) => {
  643. this.allList = {
  644. sentence_list: [],
  645. sentence_list_sort_left: [],
  646. sentence_list_sort_mid: [],
  647. sentence_list_sort_right: [],
  648. stat_list_sentence_source_book: res.stat_list_sentence_source_book,
  649. stat_list_word_definition: res.stat_list_word_definition,
  650. };
  651. if (res.sentence_list.length > 0) {
  652. res.stat_list_word_definition.forEach((item) => {
  653. item.book_name = item.definition;
  654. });
  655. // 清理脏数据
  656. this.removeRubbishData(res);
  657. this.rightList = res.stat_list_sentence_source_book;
  658. this.getrightListdata();
  659. this.allList.sentence_list = this.handleExample(res.sentence_list);
  660. this.allList.sentence_list_sort_left = this.handleExample(
  661. res.sentence_list_sort_left,
  662. "left"
  663. );
  664. this.allList.sentence_list_sort_mid = this.handleExample(
  665. res.sentence_list_sort_mid,
  666. "mid"
  667. );
  668. this.allList.sentence_list_sort_right = this.handleExample(
  669. res.sentence_list_sort_right,
  670. "right"
  671. );
  672. this.CurrentList = JSON.parse(
  673. JSON.stringify(this.allList.sentence_list)
  674. );
  675. this.padingEvetn();
  676. }
  677. if (this.$route.query.keyword && flag) {
  678. this.changehzdata();
  679. } else {
  680. this.loading = false;
  681. }
  682. })
  683. .catch((err) => {
  684. this.loading = false;
  685. });
  686. },
  687. handleExample(list, type) {
  688. if (list.length > 0) {
  689. list = list.map((item, index) => {
  690. item.number = index + 1;
  691. let str = item.source_courseware_name_path;
  692. item.show_source_courseware_name_path = str.slice(0, 8) + "...";
  693. if (type == "left") {
  694. let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
  695. arr.forEach((items, indexs) => {
  696. if (indexs == item.sentence_fc_list_word_index) {
  697. arr[
  698. indexs
  699. ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
  700. }
  701. });
  702. let data = this.changefiveword(
  703. arr,
  704. item.sentence_fc_list_word_index,
  705. type
  706. );
  707. item.resArr = data;
  708. } else if (type == "right") {
  709. let sentence = JSON.parse(JSON.stringify(item.sentence));
  710. let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
  711. arr.forEach((items, indexs) => {
  712. if (indexs == item.sentence_fc_list_word_index) {
  713. arr[
  714. indexs
  715. ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
  716. }
  717. });
  718. let data = this.changefiveword(
  719. arr,
  720. item.sentence_fc_list_word_index,
  721. type
  722. );
  723. item.resArr = data;
  724. } else if (type == "mid") {
  725. let sentence = JSON.parse(JSON.stringify(item.sentence));
  726. let arr = JSON.parse(JSON.stringify(item.sentence_fc_list));
  727. arr.forEach((items, indexs) => {
  728. if (indexs == item.sentence_fc_list_word_index) {
  729. arr[
  730. indexs
  731. ] = `<span style=color:#DE4444;font-weight:700;>${arr[indexs]}</span>`;
  732. }
  733. });
  734. let data = this.changefiveword(
  735. arr,
  736. item.sentence_fc_list_word_index,
  737. type
  738. );
  739. item.resArr = data;
  740. } else {
  741. this.scoreAHitNumber += item.position_list.length;
  742. let newsentence = JSON.parse(JSON.stringify(item.sentence));
  743. let res = "";
  744. for (let i = 0; i < item.position_list.length; i++) {
  745. let part1 = "";
  746. let part2 = "";
  747. let part3 = "";
  748. if (item.position_list.length > 1) {
  749. if (i == 0) {
  750. part1 = newsentence.substring(0, item.position_list[i].begin);
  751. part2 = newsentence.substring(
  752. item.position_list[i].begin,
  753. item.position_list[i].end
  754. );
  755. part3 = newsentence.substring(
  756. item.position_list[i].end,
  757. item.position_list[i + 1].begin
  758. );
  759. } else if (i == item.position_list.length - 1) {
  760. part2 = newsentence.substring(
  761. item.position_list[i].begin,
  762. item.position_list[i].end
  763. );
  764. part3 = newsentence.substring(item.position_list[i].end);
  765. } else {
  766. part2 = newsentence.substring(
  767. item.position_list[i].begin,
  768. item.position_list[i].end
  769. );
  770. part3 = newsentence.substring(
  771. item.position_list[i].end,
  772. item.position_list[i + 1].begin
  773. );
  774. }
  775. } else {
  776. part1 = newsentence.substring(0, item.position_list[i].begin);
  777. part2 = newsentence.substring(
  778. item.position_list[i].begin,
  779. item.position_list[i].end
  780. );
  781. part3 = newsentence.substring(item.position_list[i].end);
  782. }
  783. res +=
  784. part1 +
  785. '<span style="color:#DE4444;">' +
  786. part2 +
  787. "</span>" +
  788. part3;
  789. }
  790. item.res = res;
  791. }
  792. return item;
  793. });
  794. return list;
  795. } else {
  796. return [];
  797. }
  798. },
  799. changefiveword(arr, index, type) {
  800. let num = 6;
  801. let colorIndex = 0;
  802. let colorList = ["#4D7EFF", "#A4430F", "#9342C5", "#FF8718", "#1DAA91"];
  803. for (let i = 1; i < num; i++) {
  804. if (type == "left") {
  805. if (index - i >= 0) {
  806. if (this.chsFhList.indexOf(arr[index - i]) == -1) {
  807. arr[index - i] = `<span style=color:${colorList[colorIndex]};>${
  808. arr[index - i]
  809. }</span>`;
  810. colorIndex++;
  811. } else {
  812. num++;
  813. }
  814. }
  815. } else if (type == "right") {
  816. if (index + i <= arr.length - 1) {
  817. if (this.chsFhList.indexOf(arr[index + i]) == -1) {
  818. arr[index + i] = `<span style=color:${colorList[colorIndex]};>${
  819. arr[index + i]
  820. }</span>`;
  821. colorIndex++;
  822. } else {
  823. num++;
  824. }
  825. }
  826. }
  827. }
  828. let newarr = [];
  829. let arr1 = [];
  830. let arr2 = [];
  831. let arr3 = [];
  832. arr.forEach((item, i) => {
  833. if (i < index) {
  834. arr1.push(item);
  835. } else if (i == index) {
  836. arr2.push(item);
  837. } else {
  838. arr3.push(item);
  839. }
  840. });
  841. newarr.push(arr1);
  842. newarr.push(arr2);
  843. newarr.push(arr3);
  844. return newarr;
  845. },
  846. // 处理分页
  847. padingEvetn() {
  848. let arr = JSON.parse(JSON.stringify(this.CurrentList));
  849. let newarr = arr.splice((this.page - 1) * this.pageSize, this.pageSize);
  850. this.ShowList = JSON.parse(JSON.stringify(newarr));
  851. },
  852. // 删除脏数据
  853. removeRubbishData(data) {
  854. for (let i = data.sentence_list_sort_left.length - 1; i--; ) {
  855. if (data.sentence_list_sort_left[i].sentence_fc_list.length <= 1) {
  856. data.sentence_list_sort_left.splice(i, 1);
  857. }
  858. }
  859. for (let i = data.sentence_list_sort_mid.length - 1; i--; ) {
  860. if (data.sentence_list_sort_mid[i].sentence_fc_list.length <= 1) {
  861. data.sentence_list_sort_mid.splice(i, 1);
  862. }
  863. }
  864. for (let i = data.sentence_list_sort_right.length - 1; i--; ) {
  865. if (data.sentence_list_sort_right[i].sentence_fc_list.length <= 1) {
  866. data.sentence_list_sort_right.splice(i, 1);
  867. }
  868. }
  869. },
  870. },
  871. //生命周期 - 创建完成(可以访问当前this实例)
  872. created() {},
  873. //生命周期 - 挂载完成(可以访问DOM元素)
  874. mounted() {
  875. this.getdata(true);
  876. },
  877. //生命周期-创建之前
  878. beforeCreated() {},
  879. //生命周期-挂载之前
  880. beforeMount() {},
  881. //生命周期-更新之前
  882. beforUpdate() {},
  883. //生命周期-更新之后
  884. updated() {},
  885. //生命周期-销毁之前
  886. beforeDestory() {},
  887. //生命周期-销毁完成
  888. destoryed() {},
  889. //如果页面有keep-alive缓存功能,这个函数会触发
  890. activated() {},
  891. };
  892. </script>
  893. <style lang="scss" scoped>
  894. /* @import url(); 引入css类 */
  895. .result {
  896. min-height: 100%;
  897. > .main {
  898. min-height: 100%;
  899. background: #f2f2f2;
  900. padding-top: 33px;
  901. padding-bottom: 66px;
  902. }
  903. .hanzi_list {
  904. width: 1200px;
  905. margin: 0 auto;
  906. background: #ffffff;
  907. border-radius: 8px;
  908. padding: 40px 13px;
  909. position: relative;
  910. box-sizing: border-box;
  911. .top_jf {
  912. width: 128px;
  913. }
  914. .j_f {
  915. display: flex;
  916. width: 60px;
  917. height: 24px;
  918. margin-bottom: 16px;
  919. margin-left: 33px;
  920. > :nth-child(1) {
  921. border-top-left-radius: 2px;
  922. border-bottom-left-radius: 2px;
  923. border-right: none;
  924. }
  925. > :nth-child(2) {
  926. border-top-right-radius: 2px;
  927. border-bottom-right-radius: 2px;
  928. border-left: none;
  929. }
  930. div {
  931. width: 30px;
  932. height: 24px;
  933. font-weight: 400;
  934. font-size: 14px;
  935. line-height: 24px;
  936. text-align: center;
  937. color: #de4444;
  938. cursor: pointer;
  939. border: 2px solid #de4444;
  940. }
  941. .sele {
  942. color: #ffffff;
  943. background: #de4444;
  944. }
  945. }
  946. .list_one_box {
  947. max-height: 750px;
  948. padding: 0 27px;
  949. &::-webkit-scrollbar-track-piece {
  950. background: #fff;
  951. }
  952. &::-webkit-scrollbar {
  953. width: 4px;
  954. }
  955. &::-webkit-scrollbar-thumb {
  956. background: #d9d9d9;
  957. border-radius: 20px;
  958. }
  959. }
  960. .list_one {
  961. margin-bottom: 20px;
  962. display: flex;
  963. align-items: flex-start;
  964. .Highlight {
  965. flex: 1;
  966. margin-left: 22px;
  967. display: flex;
  968. flex-wrap: wrap;
  969. .play_audio {
  970. width: 100%;
  971. display: flex;
  972. align-items: center;
  973. margin-bottom: 13px;
  974. img {
  975. width: 16px;
  976. height: 16px;
  977. cursor: pointer;
  978. }
  979. span {
  980. font-family: "GB-PINYINOK-B";
  981. font-weight: 400;
  982. font-size: 12px;
  983. margin-left: 5px;
  984. color: #000000;
  985. }
  986. }
  987. }
  988. .row {
  989. margin-right: 8px;
  990. margin-bottom: 8px;
  991. .number {
  992. margin-top: 9px;
  993. width: 64px;
  994. height: 20px;
  995. background: #f0f0f0;
  996. border-radius: 22px;
  997. text-align: center;
  998. line-height: 20px;
  999. color: rgba(0, 0, 0, 0.5);
  1000. flex-shrink: 0;
  1001. }
  1002. }
  1003. }
  1004. .shouqi {
  1005. margin-top: 21;
  1006. display: flex;
  1007. justify-content: flex-end;
  1008. position: absolute;
  1009. right: 26px;
  1010. bottom: 13px;
  1011. span {
  1012. cursor: pointer;
  1013. display: flex;
  1014. align-items: center;
  1015. font-size: 16px;
  1016. line-height: 24px;
  1017. font-weight: 400;
  1018. color: rgba(0, 0, 0, 0.5);
  1019. }
  1020. img {
  1021. width: 24px;
  1022. height: 24px;
  1023. margin-right: 4px;
  1024. }
  1025. }
  1026. }
  1027. .txt_imgtable {
  1028. width: 1200px;
  1029. margin: 0 auto;
  1030. margin-top: 8px;
  1031. display: flex;
  1032. .left {
  1033. width: 562px;
  1034. background: #ffffff;
  1035. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  1036. border-radius: 8px;
  1037. margin-right: 8px;
  1038. padding-bottom: 58px;
  1039. position: relative;
  1040. > .top {
  1041. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  1042. height: 44px;
  1043. display: flex;
  1044. align-items: center;
  1045. justify-content: space-between;
  1046. font-weight: 400;
  1047. font-size: 12px;
  1048. color: #000000;
  1049. > div {
  1050. display: flex;
  1051. align-items: center;
  1052. }
  1053. .KWIC_sort {
  1054. margin-left: 24px;
  1055. display: flex;
  1056. span {
  1057. display: inline-block;
  1058. width: 28px;
  1059. height: 28px;
  1060. background: #ffffff;
  1061. border-radius: 4px;
  1062. display: flex;
  1063. justify-content: center;
  1064. align-items: center;
  1065. cursor: pointer;
  1066. }
  1067. .sele {
  1068. background: #f0f0f0;
  1069. }
  1070. .sort {
  1071. img {
  1072. width: 14px;
  1073. height: 12px;
  1074. }
  1075. }
  1076. .down {
  1077. img {
  1078. width: 16px;
  1079. height: 16px;
  1080. }
  1081. }
  1082. }
  1083. .pattern {
  1084. margin-left: 16px;
  1085. width: 144px;
  1086. height: 28px;
  1087. background: #eeeeee;
  1088. border-radius: 4px;
  1089. display: flex;
  1090. justify-content: center;
  1091. align-items: center;
  1092. > div {
  1093. width: 68px;
  1094. height: 24px;
  1095. text-align: center;
  1096. line-height: 24px;
  1097. color: #888888;
  1098. cursor: pointer;
  1099. font-weight: 400;
  1100. font-size: 12px;
  1101. border-radius: 2px;
  1102. }
  1103. .sele {
  1104. background: #ffffff;
  1105. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.08);
  1106. color: #000000;
  1107. }
  1108. }
  1109. .lang_sort {
  1110. width: 54px;
  1111. height: 28px;
  1112. background: #eeeeee;
  1113. border-radius: 4px;
  1114. margin-left: 24px;
  1115. display: flex;
  1116. justify-content: center;
  1117. align-items: center;
  1118. cursor: pointer;
  1119. img {
  1120. width: 16px;
  1121. height: 16px;
  1122. margin-left: 2px;
  1123. }
  1124. }
  1125. .refresh {
  1126. width: 28px;
  1127. height: 28px;
  1128. background: #eeeeee;
  1129. border-radius: 4px;
  1130. display: flex;
  1131. justify-content: center;
  1132. align-items: center;
  1133. margin-left: 8px;
  1134. cursor: pointer;
  1135. img {
  1136. width: 16px;
  1137. height: 16px;
  1138. }
  1139. }
  1140. .size {
  1141. margin-right: 12px;
  1142. span {
  1143. font-size: 14px;
  1144. padding: 4px;
  1145. cursor: pointer;
  1146. }
  1147. .sele {
  1148. background: #e6e6e6;
  1149. border-radius: 4px;
  1150. }
  1151. }
  1152. }
  1153. .main {
  1154. // height: 95%;
  1155. .list {
  1156. margin-top: 16px;
  1157. .one {
  1158. padding: 0 16px;
  1159. margin-bottom: 8px;
  1160. .top {
  1161. display: flex;
  1162. align-items: center;
  1163. // flex-flow: wrap;
  1164. width: 100%;
  1165. .number {
  1166. width: 22px;
  1167. font-weight: 400;
  1168. font-size: 14px;
  1169. line-height: 21px;
  1170. text-align: right;
  1171. color: rgba(0, 0, 0, 0.3);
  1172. margin-right: 8px;
  1173. flex-shrink: 0;
  1174. &-1-false {
  1175. margin-top: 3px;
  1176. }
  1177. &-0-true {
  1178. margin-top: 21px;
  1179. }
  1180. &-0-false {
  1181. margin-top: 5px;
  1182. }
  1183. &-2-true {
  1184. margin-top: 17px;
  1185. }
  1186. &-2-false {
  1187. margin-top: 1px;
  1188. }
  1189. }
  1190. img {
  1191. width: 16px;
  1192. height: 16px;
  1193. cursor: pointer;
  1194. margin-right: 8px;
  1195. &.speaker-1-false {
  1196. margin-top: 6px;
  1197. }
  1198. &.speaker-0-true {
  1199. margin-top: 24px;
  1200. }
  1201. &.speaker-0-false {
  1202. margin-top: 8px;
  1203. }
  1204. &.speaker-2-true {
  1205. margin-top: 20px;
  1206. }
  1207. &.speaker-2-false {
  1208. margin-top: 4px;
  1209. }
  1210. }
  1211. .words {
  1212. // display: flex;
  1213. // align-items: flex-end;
  1214. // flex-flow: wrap;
  1215. font-family: "FZJCGFKTK";
  1216. > div {
  1217. .pinyin {
  1218. font-family: "GB-PINYINOK-B";
  1219. font-weight: 500;
  1220. font-size: 12px;
  1221. color: rgba(0, 0, 0, 0.5);
  1222. text-align: center;
  1223. margin-bottom: 2px;
  1224. }
  1225. .con {
  1226. font-family: "FZJCGFKTK";
  1227. font-weight: 400;
  1228. font-size: 20px;
  1229. color: #000000;
  1230. text-align: center;
  1231. }
  1232. }
  1233. }
  1234. .shiyi {
  1235. font-weight: 400;
  1236. font-size: 12px;
  1237. color: #48a3e6;
  1238. line-height: 24px;
  1239. &-0 {
  1240. line-height: 32px;
  1241. }
  1242. &-1 {
  1243. line-height: 28px;
  1244. }
  1245. }
  1246. }
  1247. .bottom {
  1248. font-weight: 400;
  1249. font-size: 12px;
  1250. line-height: 150%;
  1251. color: rgba(0, 0, 0, 0.3);
  1252. text-align: right;
  1253. }
  1254. }
  1255. .kwic_one {
  1256. padding: 0 16px;
  1257. display: flex;
  1258. align-items: center;
  1259. > :nth-child(1) {
  1260. width: 16px;
  1261. margin-right: 16px;
  1262. justify-content: flex-end;
  1263. }
  1264. .laiyuan {
  1265. width: 117px;
  1266. white-space: nowrap;
  1267. overflow: hidden;
  1268. text-overflow: ellipsis;
  1269. font-weight: 400;
  1270. font-size: 14px;
  1271. line-height: 22px;
  1272. color: rgba(0, 0, 0, 0.65);
  1273. }
  1274. .word {
  1275. font-family: "FZJCGFKTK";
  1276. width: 361px;
  1277. height: 22px;
  1278. margin-left: 16px;
  1279. font-weight: 400;
  1280. font-size: 14px;
  1281. line-height: 22px;
  1282. color: #000000;
  1283. opacity: 1;
  1284. display: flex;
  1285. justify-content: center;
  1286. overflow: hidden;
  1287. white-space: nowrap;
  1288. > :nth-child(1) {
  1289. // direction: rtl;
  1290. // unicode-bidi: plaintext;
  1291. // text-align: right;
  1292. display: flex;
  1293. justify-content: end;
  1294. width: 172px;
  1295. white-space: nowrap;
  1296. overflow: hidden;
  1297. }
  1298. > :nth-child(3) {
  1299. direction: ltr;
  1300. unicode-bidi: plaintext;
  1301. text-align: left;
  1302. width: 172px;
  1303. white-space: nowrap;
  1304. overflow: hidden;
  1305. }
  1306. }
  1307. }
  1308. }
  1309. .page {
  1310. padding: 0 10px 0 12px;
  1311. width: 562px;
  1312. position: absolute;
  1313. bottom: 16px;
  1314. display: flex;
  1315. justify-content: space-between;
  1316. box-sizing: border-box;
  1317. .text {
  1318. font-weight: 400;
  1319. font-size: 14px;
  1320. line-height: 22px;
  1321. display: flex;
  1322. align-items: center;
  1323. text-align: center;
  1324. color: rgba(0, 0, 0, 0.6);
  1325. margin-right: 16px;
  1326. }
  1327. }
  1328. }
  1329. }
  1330. .right {
  1331. width: 630px;
  1332. background: #ffffff;
  1333. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  1334. border-radius: 8px;
  1335. padding-bottom: 39px;
  1336. .top {
  1337. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  1338. height: 44px;
  1339. display: flex;
  1340. align-items: center;
  1341. > div {
  1342. margin-left: 16px;
  1343. width: 84px;
  1344. height: 28px;
  1345. background: #eeeeee;
  1346. border-radius: 4px;
  1347. display: flex;
  1348. justify-content: center;
  1349. align-items: center;
  1350. > div {
  1351. border-radius: 2px;
  1352. width: 40px;
  1353. height: 24px;
  1354. text-align: center;
  1355. line-height: 24px;
  1356. color: #888888;
  1357. cursor: pointer;
  1358. font-weight: 400;
  1359. font-size: 12px;
  1360. }
  1361. .sele {
  1362. background: #ffffff;
  1363. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.08);
  1364. color: #000000;
  1365. }
  1366. }
  1367. }
  1368. .list {
  1369. width: 598px;
  1370. margin: 0 auto;
  1371. .one {
  1372. display: flex;
  1373. justify-content: space-between;
  1374. border-bottom: 1px solid #eeeeee;
  1375. padding: 12px;
  1376. font-weight: 400;
  1377. font-size: 14px;
  1378. line-height: 22px;
  1379. color: #333333;
  1380. cursor: pointer;
  1381. > :nth-child(1) {
  1382. text-align: left;
  1383. }
  1384. > div {
  1385. width: 186px;
  1386. text-align: right;
  1387. }
  1388. }
  1389. .all {
  1390. font-weight: 600;
  1391. font-size: 14px;
  1392. line-height: 22px;
  1393. color: #333333;
  1394. border-bottom: none;
  1395. }
  1396. }
  1397. }
  1398. }
  1399. }
  1400. </style>
  1401. <style lang="scss">
  1402. .result {
  1403. .el-switch__core {
  1404. width: 26px !important;
  1405. height: 16px;
  1406. }
  1407. .el-switch__core:after {
  1408. width: 8px;
  1409. height: 8px;
  1410. top: 3px;
  1411. }
  1412. .el-switch.is-checked .el-switch__core::after {
  1413. margin-left: -10px;
  1414. }
  1415. .el-switch__label.is-active {
  1416. color: #000000;
  1417. }
  1418. .page {
  1419. .el-pagination.is-background .el-pager li:not(.disabled).active {
  1420. background-color: #0052d9;
  1421. }
  1422. .el-pager li {
  1423. background: #ffffff;
  1424. border: 1px solid #dcdcdc;
  1425. border-radius: 3px;
  1426. }
  1427. }
  1428. }
  1429. .el-loading-mask {
  1430. z-index: 200000 !important;
  1431. }
  1432. </style>