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