Result.vue 40 KB

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