Result.vue 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440
  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. >
  210. {{ items }}
  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="4"
  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>
  299. <span></span>
  300. <span>{{ item.book_name }}</span>
  301. </div>
  302. <div>
  303. <span>{{ item.count }}</span>
  304. </div>
  305. <div>
  306. <span>{{ item.percent }}%</span>
  307. </div>
  308. </div>
  309. <div class="one all">
  310. <div>
  311. <span></span>
  312. <span>合计</span>
  313. </div>
  314. <div>
  315. <span>{{ allNumber }}</span>
  316. </div>
  317. <div>
  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. > div {
  1212. .pinyin {
  1213. font-family: "GB-PINYINOK-B";
  1214. font-weight: 500;
  1215. font-size: 12px;
  1216. color: rgba(0, 0, 0, 0.5);
  1217. text-align: center;
  1218. margin-bottom: 2px;
  1219. }
  1220. .con {
  1221. font-family: "FZJCGFKTK";
  1222. font-weight: 400;
  1223. font-size: 20px;
  1224. color: #000000;
  1225. text-align: center;
  1226. }
  1227. }
  1228. }
  1229. .shiyi {
  1230. font-weight: 400;
  1231. font-size: 12px;
  1232. color: #48a3e6;
  1233. line-height: 24px;
  1234. &-0 {
  1235. line-height: 32px;
  1236. }
  1237. &-1 {
  1238. line-height: 28px;
  1239. }
  1240. }
  1241. }
  1242. .bottom {
  1243. font-weight: 400;
  1244. font-size: 12px;
  1245. line-height: 150%;
  1246. color: rgba(0, 0, 0, 0.3);
  1247. text-align: right;
  1248. }
  1249. }
  1250. .kwic_one {
  1251. padding: 0 16px;
  1252. display: flex;
  1253. align-items: center;
  1254. > :nth-child(1) {
  1255. width: 16px;
  1256. margin-right: 16px;
  1257. justify-content: flex-end;
  1258. }
  1259. .laiyuan {
  1260. width: 117px;
  1261. white-space: nowrap;
  1262. overflow: hidden;
  1263. text-overflow: ellipsis;
  1264. font-weight: 400;
  1265. font-size: 14px;
  1266. line-height: 22px;
  1267. color: rgba(0, 0, 0, 0.65);
  1268. }
  1269. .word {
  1270. font-family: "FZJCGFKTK";
  1271. width: 361px;
  1272. height: 22px;
  1273. margin-left: 16px;
  1274. font-weight: 400;
  1275. font-size: 14px;
  1276. line-height: 22px;
  1277. color: #000000;
  1278. opacity: 1;
  1279. display: flex;
  1280. justify-content: center;
  1281. overflow: hidden;
  1282. white-space: nowrap;
  1283. > :nth-child(1) {
  1284. // direction: rtl;
  1285. // unicode-bidi: plaintext;
  1286. // text-align: right;
  1287. display: flex;
  1288. justify-content: end;
  1289. width: 172px;
  1290. white-space: nowrap;
  1291. overflow: hidden;
  1292. }
  1293. > :nth-child(3) {
  1294. direction: ltr;
  1295. unicode-bidi: plaintext;
  1296. text-align: left;
  1297. width: 172px;
  1298. white-space: nowrap;
  1299. overflow: hidden;
  1300. }
  1301. }
  1302. }
  1303. }
  1304. .page {
  1305. padding: 0 10px 0 12px;
  1306. width: 562px;
  1307. position: absolute;
  1308. bottom: 16px;
  1309. display: flex;
  1310. justify-content: space-between;
  1311. box-sizing: border-box;
  1312. .text {
  1313. font-weight: 400;
  1314. font-size: 14px;
  1315. line-height: 22px;
  1316. display: flex;
  1317. align-items: center;
  1318. text-align: center;
  1319. color: rgba(0, 0, 0, 0.6);
  1320. margin-right: 16px;
  1321. }
  1322. }
  1323. }
  1324. }
  1325. .right {
  1326. width: 630px;
  1327. background: #ffffff;
  1328. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  1329. border-radius: 8px;
  1330. padding-bottom: 39px;
  1331. .top {
  1332. border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  1333. height: 44px;
  1334. display: flex;
  1335. align-items: center;
  1336. > div {
  1337. margin-left: 16px;
  1338. width: 84px;
  1339. height: 28px;
  1340. background: #eeeeee;
  1341. border-radius: 4px;
  1342. display: flex;
  1343. justify-content: center;
  1344. align-items: center;
  1345. > div {
  1346. border-radius: 2px;
  1347. width: 40px;
  1348. height: 24px;
  1349. text-align: center;
  1350. line-height: 24px;
  1351. color: #888888;
  1352. cursor: pointer;
  1353. font-weight: 400;
  1354. font-size: 12px;
  1355. }
  1356. .sele {
  1357. background: #ffffff;
  1358. box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.08);
  1359. color: #000000;
  1360. }
  1361. }
  1362. }
  1363. .list {
  1364. width: 598px;
  1365. margin: 0 auto;
  1366. .one {
  1367. display: flex;
  1368. justify-content: space-between;
  1369. border-bottom: 1px solid #eeeeee;
  1370. padding: 12px;
  1371. font-weight: 400;
  1372. font-size: 14px;
  1373. line-height: 22px;
  1374. color: #333333;
  1375. cursor: pointer;
  1376. > :nth-child(1) {
  1377. text-align: left;
  1378. }
  1379. > div {
  1380. width: 186px;
  1381. text-align: right;
  1382. }
  1383. }
  1384. .all {
  1385. font-weight: 600;
  1386. font-size: 14px;
  1387. line-height: 22px;
  1388. color: #333333;
  1389. border-bottom: none;
  1390. }
  1391. }
  1392. }
  1393. }
  1394. }
  1395. </style>
  1396. <style lang="scss">
  1397. .result {
  1398. .el-switch__core {
  1399. width: 26px !important;
  1400. height: 16px;
  1401. }
  1402. .el-switch__core:after {
  1403. width: 8px;
  1404. height: 8px;
  1405. top: 3px;
  1406. }
  1407. .el-switch.is-checked .el-switch__core::after {
  1408. margin-left: -10px;
  1409. }
  1410. .el-switch__label.is-active {
  1411. color: #000000;
  1412. }
  1413. .page {
  1414. .el-pagination.is-background .el-pager li:not(.disabled).active {
  1415. background-color: #0052d9;
  1416. }
  1417. .el-pager li {
  1418. background: #ffffff;
  1419. border: 1px solid #dcdcdc;
  1420. border-radius: 3px;
  1421. }
  1422. }
  1423. }
  1424. .el-loading-mask {
  1425. z-index: 200000 !important;
  1426. }
  1427. </style>